Feature/change progress colors (#6)
* 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
This commit is contained in:
committed by
GitHub
parent
c580e45361
commit
b520d56d1a
44
lib/models/app_settings.dart
Normal file
44
lib/models/app_settings.dart
Normal file
@ -0,0 +1,44 @@
|
||||
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));
|
||||
}
|
Reference in New Issue
Block a user