own paints and public paints thingie

This commit is contained in:
Kima
2024-02-02 22:53:59 +01:00
parent 8b91e0e1d3
commit 18892c6156
8 changed files with 492 additions and 192 deletions

View File

@@ -71,6 +71,32 @@ class ShareProvider extends ChangeNotifier {
return null;
}
Future<List<SharedTheme>> getAllPublicThemes(BuildContext context,
{int count = 0}) async {
List? themesJson = await FilcAPI.getAllSharedThemes(count);
List<SharedTheme> themes = [];
if (themesJson != null) {
for (var t in themesJson) {
if (t['public_id'].toString().replaceAll(' ', '') == '') continue;
if (t['grade_colors_id'].toString().replaceAll(' ', '') == '') continue;
Map? gradeColorsJson =
await FilcAPI.getSharedGradeColors(t['grade_colors_id']);
if (gradeColorsJson != null) {
SharedTheme theme = SharedTheme.fromJson(
t, SharedGradeColors.fromJson(gradeColorsJson));
themes.add(theme);
}
}
}
return themes;
}
// grade colors
Future<SharedGradeColors> shareCurrentGradeColors(
BuildContext context, {