Improved json auto save & budget mobile UI
This commit is contained in:
@@ -2,16 +2,19 @@ import 'package:tunas/repositories/metadata/models/budget.dart';
|
||||
import 'package:tunas/repositories/metadata/models/category.dart';
|
||||
import 'package:tunas/repositories/json/models/json.dart';
|
||||
import 'package:tunas/repositories/metadata/models/account.dart';
|
||||
import 'package:tunas/repositories/metadata/models/settings.dart';
|
||||
|
||||
class Metadata implements Json {
|
||||
List<Budget> budgets;
|
||||
List<Category> categories;
|
||||
List<Account> accounts;
|
||||
Settings settings;
|
||||
|
||||
Metadata({
|
||||
this.budgets = const [],
|
||||
this.categories = const [],
|
||||
this.accounts = const [],
|
||||
this.settings = const Settings(),
|
||||
});
|
||||
|
||||
@override
|
||||
|
||||
19
lib/repositories/metadata/models/settings.dart
Normal file
19
lib/repositories/metadata/models/settings.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class Settings {
|
||||
final ThemeMode themeMode;
|
||||
|
||||
const Settings({
|
||||
this.themeMode = ThemeMode.system,
|
||||
});
|
||||
|
||||
factory Settings.fromJson(Map<String, dynamic> json) {
|
||||
return Settings(
|
||||
themeMode: ThemeMode.values.byName(json['themeMode']),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, String> toJson() => {
|
||||
'themeMode': themeMode.name,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user