Feature/BugFix-01 Future Time Progresses (#4)

- Fixed Bug with Future Time Progresses
  Now no longer shows future time progresses in dashboard or in app drawer
- Dashboard Now Shows started and future times.
  These cards are divided based on their count
- Fixed Bug Future Progress In Detail Screen
- Progress Detail Screen Now Shows in how many Days a progress starts
- BugFix App Version

Signed-off-by: Andreas Fahrecker <AndreasFahrecker@gmail.com>
This commit is contained in:
Andreas Fahrecker
2020-12-04 05:15:04 +01:00
committed by GitHub
parent 988e8f3c72
commit 319f539b48
9 changed files with 245 additions and 60 deletions

View File

@ -9,8 +9,16 @@ import 'package:time_progress_tracker/models/app_state.dart';
import 'package:time_progress_tracker/models/time_progress.dart';
import 'package:time_progress_tracker/screens/progress_dashboard_screen.dart';
import 'package:time_progress_tracker/screens/progress_detail_screen.dart';
import 'package:time_progress_tracker/selectors/time_progress_selectors.dart';
class AppDrawer extends StatelessWidget {
final String appVersion;
AppDrawer({
Key key,
@required this.appVersion,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Drawer(
@ -18,6 +26,11 @@ class AppDrawer extends StatelessWidget {
converter: _ViewModel.fromStore,
onInit: loadTimeProgressListIfUnloaded,
builder: (context, _ViewModel vm) {
if (!vm.hasLoaded) {
return Center(
child: CircularProgressIndicator(),
);
}
List<Widget> drawerTileList = List<Widget>();
drawerTileList.add(DrawerHeader(
child: Text(TimeProgressTrackerApp.name),
@ -36,8 +49,8 @@ class AppDrawer extends StatelessWidget {
},
),
));
if (vm.timeProgressList.length > 0) {
for (TimeProgress tp in vm.timeProgressList) {
if (vm.startedTimeProgresses.length > 0) {
for (TimeProgress tp in vm.startedTimeProgresses) {
drawerTileList.add(ListTile(
title: Text(tp.name),
trailing: CircularPercentIndicator(
@ -60,7 +73,7 @@ class AppDrawer extends StatelessWidget {
);
},
));
if (vm.timeProgressList.last != tp) {
if (vm.startedTimeProgresses.last != tp) {
drawerTileList.add(Divider(
color: Colors.black12,
));
@ -80,11 +93,10 @@ class AppDrawer extends StatelessWidget {
title: Text("About"),
onTap: () {
showAboutDialog(
context: context,
applicationName: TimeProgressTrackerApp.name,
applicationVersion: ' Version 0.0.1',
applicationLegalese: '\u00a9Andreas Fahrecker 2020'
);
context: context,
applicationName: TimeProgressTrackerApp.name,
applicationVersion: " Version $appVersion",
applicationLegalese: '\u00a9Andreas Fahrecker 2020');
},
),
));
@ -98,13 +110,18 @@ class AppDrawer extends StatelessWidget {
}
class _ViewModel {
final List<TimeProgress> timeProgressList;
final List<TimeProgress> startedTimeProgresses;
final bool hasLoaded;
_ViewModel({@required this.timeProgressList});
_ViewModel({
@required this.startedTimeProgresses,
@required this.hasLoaded,
});
static _ViewModel fromStore(Store<AppState> store) {
return _ViewModel(
timeProgressList: store.state.timeProgressList,
startedTimeProgresses: startedTimeProgressesSelector(store.state),
hasLoaded: store.state.hasLoaded,
);
}
}