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
@ -1,28 +1,62 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:package_info/package_info.dart';
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
import 'package:time_progress_tracker/actions/actions.dart';
|
||||
import 'package:time_progress_tracker/app.dart';
|
||||
import 'package:time_progress_tracker/models/app_settings.dart';
|
||||
import 'package:time_progress_tracker/models/app_state.dart';
|
||||
import 'package:time_progress_tracker/selectors/time_progress_selectors.dart';
|
||||
import 'package:time_progress_tracker/widgets/home/tabs/settings/color_settings_widget.dart';
|
||||
|
||||
class HomeSettingsTab extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
Text("The Settings of this App are not yet implemented."),
|
||||
FlatButton(
|
||||
onPressed: () {
|
||||
showAboutDialog(
|
||||
context: context,
|
||||
applicationName: TimeProgressTrackerApp.name,
|
||||
applicationVersion: "Beta",
|
||||
applicationLegalese: '\u00a9Andreas Fahrecker 2020-2021');
|
||||
},
|
||||
child: Text("About"))
|
||||
],
|
||||
),
|
||||
),
|
||||
return StoreConnector<AppState, AppSettings>(
|
||||
onInit: loadSettingsIfUnloaded,
|
||||
converter: (store) => appSettingsSelector(store.state),
|
||||
builder: (context, AppSettings settings) {
|
||||
Store<AppState> store = StoreProvider.of<AppState>(context);
|
||||
void updateDoneColor(Color newDoneColor) => store.dispatch(
|
||||
UpdateAppSettingsActions(
|
||||
settings.copyWith(doneColor: newDoneColor)),
|
||||
);
|
||||
void updateLeftColor(Color newLeftColor) => store.dispatch(
|
||||
UpdateAppSettingsActions(
|
||||
settings.copyWith(leftColor: newLeftColor)),
|
||||
);
|
||||
|
||||
return Container(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ColorSettingsWidget(
|
||||
doneColor: settings.doneColor,
|
||||
leftColor: settings.leftColor,
|
||||
updateDoneColor: updateDoneColor,
|
||||
updateLeftColor: updateLeftColor,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Expanded(
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
showAboutDialog(
|
||||
context: context,
|
||||
applicationName: TimeProgressTrackerApp.name,
|
||||
applicationVersion: "Beta",
|
||||
applicationLegalese:
|
||||
'\u00a9Andreas Fahrecker 2020-2021');
|
||||
},
|
||||
child: Text("About"),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user