Settingsfields nullable

main
Kai Mannweiler 2023-02-27 11:19:56 +01:00
parent b1c6288b2b
commit 28e46d1806
2 changed files with 12 additions and 12 deletions

View File

@ -1,10 +1,10 @@
import 'package:smoke_cess_app/services/json_service.dart';
class Settings {
final int group;
final int? group;
final List<String>? relapseCategories;
final QueryConfig moodQuery;
final QueryConfig sleepQuery;
final QueryConfig? moodQuery;
final QueryConfig? sleepQuery;
final TimeConfig? chessTime;
Settings(this.group, this.relapseCategories, this.moodQuery, this.sleepQuery,
@ -21,8 +21,8 @@ class Settings {
}
class QueryConfig {
final int hours;
final int minutes;
final int? hours;
final int? minutes;
final List<String>? days;
QueryConfig(this.hours, this.minutes, this.days);
@ -34,8 +34,8 @@ class QueryConfig {
}
class TimeConfig {
final int hours;
final int minutes;
final int? hours;
final int? minutes;
TimeConfig(this.hours, this.minutes);

View File

@ -27,12 +27,12 @@ class SettingsProvider extends ChangeNotifier {
int? chessMinutes = await getChessMinutes();
_settings = Settings(
group ?? 0,
group,
relapseCategories,
QueryConfig(moodHours ?? 0, moodMinutes ?? 0, moodDays),
QueryConfig(sleepHours ?? 0, sleepMinutes ?? 0, sleepDays),
TimeConfig(chessHours ?? 0, chessMinutes ?? 0));
_initialized = group != 0 ? true : false;
QueryConfig(moodHours, moodMinutes, moodDays),
QueryConfig(sleepHours, sleepMinutes, sleepDays),
TimeConfig(chessHours, chessMinutes));
_initialized = group != null ? true : false;
notifyListeners();
}
}