* 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
63 lines
2.3 KiB
Dart
63 lines
2.3 KiB
Dart
import 'package:flutter/material.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 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"),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|