From f3da99fd00f32afa35ead098460ca93d8d7b4781 Mon Sep 17 00:00:00 2001 From: julian Date: Tue, 9 May 2023 09:26:19 -0600 Subject: [PATCH] use id given by server --- lib/models/isar/sw_theme.dart | 16 ++++++++-------- lib/themes/defaults/dark.dart | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/models/isar/sw_theme.dart b/lib/models/isar/sw_theme.dart index 26e1188cb..c2ae6f440 100644 --- a/lib/models/isar/sw_theme.dart +++ b/lib/models/isar/sw_theme.dart @@ -7,18 +7,19 @@ import 'package:stackwallet/utilities/extensions/impl/box_shadow.dart'; import 'package:stackwallet/utilities/extensions/impl/gradient.dart'; import 'package:stackwallet/utilities/extensions/impl/string.dart'; import 'package:stackwallet/utilities/theme/color_theme.dart'; -import 'package:uuid/uuid.dart'; @Collection(inheritance: false) class StackTheme { + Id id = Isar.autoIncrement; + + /// id of theme on themes server + @Index(unique: true, replace: true) + final String idOnServer; + final String assetBundleUrl; final ThemeType themeType = ThemeType.dark; - /// should be a uuid - @Index(unique: true, replace: true) - final String internalId; - /// the theme name that will be displayed in app final String name; @@ -1475,7 +1476,7 @@ class StackTheme { // =========================================================================== StackTheme({ - required this.internalId, + required this.idOnServer, required this.assetBundleUrl, required this.name, required this.assets, @@ -1640,9 +1641,8 @@ class StackTheme { required Map json, required String applicationThemesDirectoryPath, }) { - final _id = const Uuid().v1(); return StackTheme( - internalId: _id, + idOnServer: json["id"] as String, name: json["name"] as String, assetBundleUrl: json["asset_bundle_url"] as String, brightnessString: json["brightness"] as String, diff --git a/lib/themes/defaults/dark.dart b/lib/themes/defaults/dark.dart index 3fea9c86e..6100455bd 100644 --- a/lib/themes/defaults/dark.dart +++ b/lib/themes/defaults/dark.dart @@ -1,5 +1,6 @@ final Map darkJson = { "name": "Dark", + "id": "dark", "asset_bundle_url": "", "brightness": "dark", "colors": {