* 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
33 lines
1.3 KiB
Dart
33 lines
1.3 KiB
Dart
import 'package:redux/redux.dart';
|
|
import 'package:time_progress_tracker/actions/actions.dart';
|
|
import 'package:time_progress_tracker/models/app_settings.dart';
|
|
import 'package:time_progress_tracker/models/app_state.dart';
|
|
import 'package:time_progress_tracker/reducers/has_loaded_reducer.dart';
|
|
import 'package:time_progress_tracker/reducers/time_progress_list_reducer.dart';
|
|
|
|
AppState appStateReducer(AppState state, dynamic action) {
|
|
return AppState(
|
|
hasProgressesLoaded: hasLoadedReducer(state.hasProgressesLoaded, action),
|
|
timeProgressList: timeProgressListReducer(state.timeProgressList, action),
|
|
appSettings: appSettingsReducers(state.appSettings, action),
|
|
);
|
|
}
|
|
|
|
final appSettingsReducers = combineReducers<AppSettings>([
|
|
TypedReducer<AppSettings, AppSettingsLoadedActions>(_loadAppSettings),
|
|
TypedReducer<AppSettings, UpdateAppSettingsActions>(_updateAppSettings),
|
|
TypedReducer<AppSettings, AppSettingsNotLoadedAction>(_setDefaultSettings)
|
|
]);
|
|
|
|
AppSettings _loadAppSettings(
|
|
AppSettings appSettings, AppSettingsLoadedActions nS) =>
|
|
nS.appSettings;
|
|
|
|
AppSettings _setDefaultSettings(
|
|
AppSettings appSettings, AppSettingsNotLoadedAction action) =>
|
|
AppSettings.defaults();
|
|
|
|
AppSettings _updateAppSettings(
|
|
AppSettings appSettings, UpdateAppSettingsActions nS) =>
|
|
nS.appSettings;
|