finished theme sharing

This commit is contained in:
Kima
2023-09-08 23:15:56 +02:00
parent 070e3cf18c
commit 67721112cc
10 changed files with 257 additions and 67 deletions

View File

@@ -19,7 +19,8 @@ class ShareProvider extends ChangeNotifier {
// }
Future<SharedTheme> shareCurrentTheme(BuildContext context,
{bool isPublic = false, bool shareNick = true}) async {
final SettingsProvider settings = Provider.of<SettingsProvider>(context);
final SettingsProvider settings =
Provider.of<SettingsProvider>(context, listen: false);
Map themeJson = {
'public_id': const Uuid().v4(),
@@ -41,4 +42,16 @@ class ShareProvider extends ChangeNotifier {
return theme;
}
Future<SharedTheme?> getThemeById(BuildContext context,
{required String id}) async {
Map? themeJson = await FilcAPI.getSharedTheme(id);
if (themeJson != null) {
SharedTheme theme = SharedTheme.fromJson(themeJson);
return theme;
}
return null;
}
}