feat: initial Cutdex application
Add the Flutter video editing application with project management, media import, timeline editing, preview, AI assistance, diagnostics and settings. Include shared UI and native host packages, platform runners, application tests and release tooling. Provide usage and contribution guides, the MIT license and third-party notices. Exclude local credentials, build outputs and validation data.
This commit is contained in:
commit
27e77fff39
718 files changed
+183958
No files matched your search
@@ -0,0 +1,45 @@
|
||||
import '../../settings/appearance.dart';
|
||||
|
||||
import 'package:drift/drift.dart' hide JsonKey;
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
import '../app_database.dart';
|
||||
|
||||
part 'appearance_settings_repository.g.dart';
|
||||
|
||||
abstract interface class AppearanceSettingsRepository {
|
||||
Future<AppAppearance> load();
|
||||
Future<void> save(AppAppearance mode);
|
||||
}
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
AppearanceSettingsRepository appearanceSettingsRepository(Ref ref) =>
|
||||
DriftAppearanceSettingsRepository(ref.watch(appDatabaseProvider));
|
||||
|
||||
class DriftAppearanceSettingsRepository
|
||||
implements AppearanceSettingsRepository {
|
||||
DriftAppearanceSettingsRepository(this._database);
|
||||
|
||||
final AppDatabase _database;
|
||||
|
||||
@override
|
||||
Future<AppAppearance> load() async {
|
||||
final row = await (_database.select(
|
||||
_database.appearanceConfigurations,
|
||||
)..where((table) => table.id.equals(0))).getSingleOrNull();
|
||||
return AppAppearance.values.firstWhere(
|
||||
(mode) => mode.name == row?.themeMode,
|
||||
orElse: () => AppAppearance.system,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> save(AppAppearance mode) => _database
|
||||
.into(_database.appearanceConfigurations)
|
||||
.insertOnConflictUpdate(
|
||||
AppearanceConfigurationsCompanion.insert(
|
||||
id: const Value(0),
|
||||
themeMode: mode.name,
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user