1
0
forked from firka/firka
Files
firka/firka_common/lib/data/models/user_theme_model.dart
zypherift 25f303e1e9 feat(themes): keep themes per account and keep shared ones live
A theme now follows the account rather than the install: it is pulled
on login and when the theme list opens, and every edit is pushed back,
so signing in elsewhere brings the theme along.

Sharing no longer hands over a dead snapshot. The link carries the
whole theme so it still imports with no network, plus a share id the
copy refetches by, which is how an edit by the owner reaches everyone
who scanned the code. Imported themes catch up on app open.

The editor's per-slot settings lookup moved to theme_palette, where
the share format already needed the same mapping.
2026-11-29 01:10:12 +01:00

30 lines
765 B
Dart

import "package:isar_community/isar.dart";
part "user_theme_model.g.dart";
@collection
class UserThemeModel {
Id id = Isar.autoIncrement;
@Index(unique: true, replace: true)
late String themeId;
late String name;
/// `own` or `downloaded`. Built-in is not persisted.
late String origin;
late List<int> swatchArgb;
/// the whole theme as a share code: the slots, the grade colors and the
/// gradients. empty for themes made before codes were stored.
String code = "";
/// the server handle this theme is tied to, empty until it is shared or
/// imported. the owner keeps editing a shared theme and everyone holding
/// the link follows along, so this is also what a copy refetches by.
String shareId = "";
UserThemeModel();
}