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

@ -24,6 +24,13 @@ class ProgressDetailScreenArguments {
class ProgressDetailScreen extends StatefulWidget {
static const routeName = "/progress-detail";
final String appVersion;
ProgressDetailScreen({
Key key,
@required this.appVersion,
}) : super(key: key);
@override
State<StatefulWidget> createState() {
return _ProgressDetailScreenState();
@ -147,7 +154,9 @@ class _ProgressDetailScreenState extends State<ProgressDetailScreen> {
appBar: AppBar(
title: Text("Progress"),
),
drawer: AppDrawer(),
drawer: AppDrawer(
appVersion: widget.appVersion,
),
body: Container(
margin: EdgeInsets.all(8),
child: StoreConnector(
@ -170,32 +179,58 @@ class _ProgressDetailScreenState extends State<ProgressDetailScreen> {
: "The Name of the Time Progress has to be set.",
),
)
: FittedBox(
fit: BoxFit.fitWidth,
child: Text(
vm.timeProgress.name,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black87,
: vm.hasProgressStarted
? FittedBox(
fit: BoxFit.fitWidth,
child: Text(
vm.timeProgress.name,
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black87,
),
),
)
: Center(
child: FittedBox(
fit: BoxFit.fitWidth,
child: Text(
vm.timeProgress.name,
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black87,
),
),
),
),
),
),
vm.hasProgressStarted
? Expanded(
flex: 2,
child: ProgressDetailCircularPercent(
percentDone: _isBeingEdited
? _editedProgress.percentDone()
: vm.timeProgress.percentDone(),
),
),
Expanded(
flex: 2,
child: ProgressDetailCircularPercent(
percentDone: _isBeingEdited
? _editedProgress.percentDone()
: vm.timeProgress.percentDone(),
),
),
Expanded(
flex: 1,
child: ProgressDetailLinearPercent(
timeProgress:
_isBeingEdited ? _editedProgress : vm.timeProgress,
),
),
)
: Expanded(
flex: 2,
child: Text(
"Starts in ${vm.timeProgress.startTime.difference(DateTime.now()).inDays} Days."),
),
vm.hasProgressStarted
? Expanded(
flex: 1,
child: ProgressDetailLinearPercent(
timeProgress: _isBeingEdited
? _editedProgress
: vm.timeProgress,
),
)
: Spacer(
flex: 1,
),
Expanded(
flex: 1,
child: Text(
@ -242,15 +277,19 @@ class _ProgressDetailScreenState extends State<ProgressDetailScreen> {
class _ViewModel {
final TimeProgress timeProgress;
final bool hasProgressStarted;
_ViewModel({
@required this.timeProgress,
@required this.hasProgressStarted,
});
static _ViewModel fromStoreAndArg(
Store<AppState> store, ProgressDetailScreenArguments args) {
TimeProgress tp = timeProgressByIdSelector(store.state, args.id);
return _ViewModel(
timeProgress: timeProgressByIdSelector(store.state, args.id),
);
timeProgress: tp,
hasProgressStarted: DateTime.now().millisecondsSinceEpoch >
tp.startTime.millisecondsSinceEpoch);
}
}