From ec7c6e4f7ebd4e096722c7cfd1e651867207ec07 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Fri, 19 Aug 2022 13:07:39 +0200 Subject: v0.3 --- lib/widgets/agenda_week_item.dart | 62 +++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 22 deletions(-) (limited to 'lib/widgets/agenda_week_item.dart') diff --git a/lib/widgets/agenda_week_item.dart b/lib/widgets/agenda_week_item.dart index 7847030..fd61506 100644 --- a/lib/widgets/agenda_week_item.dart +++ b/lib/widgets/agenda_week_item.dart @@ -120,20 +120,28 @@ class _ExerciseEntryState extends State { Widget createStopShiftButton() { return TextButton( onPressed: () { - auth - .authenticate( - localizedReason: 'Weet je zeker dat je wilt eindigen?') - .then((value) => { - if (value) - { - setState(() { - widget.shift.setIsActive(false); - shiftProvider.updateShift(widget.shift); - stopNotificationForActiveSession(); - }) - } - }) - .catchError((f) => {}); + if (canUseLocalAuth) { + auth + .authenticate( + localizedReason: 'Weet je zeker dat je wilt eindigen?') + .then((value) => { + if (value && mounted) + { + setState(() { + widget.shift.setIsActive(false); + shiftProvider.updateShift(widget.shift); + stopNotificationForActiveSession(); + }) + } + }) + .catchError((f) => {}); + } else { + setState(() { + widget.shift.setIsActive(false); + shiftProvider.updateShift(widget.shift); + stopNotificationForActiveSession(); + }); + } }, child: Text('Einde')); } @@ -253,10 +261,10 @@ class _ExerciseEntryState extends State { @override Widget build(BuildContext context) { Widget startShiftWidget = createShiftModifyButton(); - TextStyle endDateTextStyle = TextStyle(color: Colors.black); + TextStyle endDateTextStyle = TextStyle(color: Style.listEntryStandardColor); if (!widget.shift.isDone()) { - endDateTextStyle = TextStyle(color: Color.fromARGB(80, 0, 0, 0)); + endDateTextStyle = TextStyle(color: Style.listEntryTransparentColor); } setStartAndEndTime(); @@ -323,22 +331,32 @@ class _ExerciseEntryState extends State { ), Container( padding: const EdgeInsets.only(left: 10), - child: Text( - DateHelper.getWeekdayName(widget.shift.start.weekday), - style: Style.listItemTitletextBold, - textAlign: TextAlign.center, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + DateHelper.getWeekdayName( + widget.shift.start.weekday), + style: Style.listItemTitletextBold, + ), + Text( + "${widget.shift.start.day.toString().padLeft(2, '0')}e", + ), + ], ), width: widthOfWeekday, ), GestureDetector( onLongPress: () { requestStartAndEndTimeForShift() - .then((e) => {setState(() {})}); + .then((e) => {if (mounted) setState(() {})}); }, child: Container( child: RichText( text: TextSpan( - style: TextStyle(color: Colors.black), + style: TextStyle( + color: Style.listEntryStandardColor), children: [ TextSpan(text: ' | ' + shiftTime), TextSpan( -- cgit v1.2.3-70-g09d2