* Added Settings Actions * Created App Settings and Repo + Entity * Code cleanup Time Progress * Created App Settings Middleware * Has Progresses ad has Settings loaded * Created Load and Update Settings reducers * Added Settings store middleware to renamed store middleware * Load Default Settings if not Saved. Use Redux AppState to showprogress colors. Colors are not yet changeable. * Added ColorPicker for Done and Left Color Fixed Loading App Settings Bug * Fixed Version Number * Fixed Android App Logo * Extracted Color Settings into Widget * Fixed Home Settings Tab Layout and Color Settings Button now show Text in complementary color
45 lines
1.2 KiB
Dart
45 lines
1.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:time_progress_tracker/persistence/app_settings.dart';
|
|
|
|
@immutable
|
|
class AppSettings {
|
|
final Color doneColor;
|
|
final Color leftColor;
|
|
final Duration duration;
|
|
|
|
AppSettings({
|
|
this.doneColor,
|
|
this.leftColor,
|
|
this.duration,
|
|
});
|
|
|
|
factory AppSettings.defaults() =>
|
|
AppSettings(doneColor: Colors.green, leftColor: Colors.red);
|
|
|
|
AppSettings copyWith({
|
|
Color doneColor,
|
|
Color leftColor,
|
|
}) =>
|
|
AppSettings(
|
|
doneColor: doneColor ?? this.doneColor,
|
|
leftColor: leftColor ?? this.leftColor);
|
|
|
|
@override
|
|
int get hashCode => doneColor.hashCode ^ leftColor.hashCode;
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
other is AppSettings &&
|
|
runtimeType == other.runtimeType &&
|
|
doneColor == other.doneColor &&
|
|
leftColor == other.leftColor;
|
|
|
|
AppSettingsEntity toEntity() =>
|
|
AppSettingsEntity(doneColor.value, leftColor.value);
|
|
|
|
static AppSettings fromEntity(AppSettingsEntity entity) => AppSettings(
|
|
doneColor: Color(entity.doneColorValue),
|
|
leftColor: Color(entity.leftColorValue));
|
|
}
|