Skip to content

Commit

Permalink
🐛 Fix the display of timers on the Timers page
Browse files Browse the repository at this point in the history
  • Loading branch information
Khaoz-Topsy committed Feb 16, 2023
1 parent 191f489 commit 3b162b2
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 7 deletions.
23 changes: 21 additions & 2 deletions lib/components/tilePresenters/timer_tile_presenter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,25 @@ Widget timerTilePresenter(
void Function(TimerItem) onEdit,
void Function(String) onDelete,
) {
DateTime tweakedStart = (DateTime(
timer.startDate.year,
timer.startDate.month,
timer.startDate.day,
timer.startDate.hour,
timer.startDate.minute,
timer.startDate.second,
timer.startDate.millisecond,
));
DateTime tweakedEnd = (DateTime(
timer.completionDate.year,
timer.completionDate.month,
timer.completionDate.day,
timer.completionDate.hour,
timer.completionDate.minute,
timer.completionDate.second,
timer.completionDate.millisecond,
));

return genericListTileWithSubtitle(
context,
leadingImage: timer.icon,
Expand All @@ -18,8 +37,8 @@ Widget timerTilePresenter(
padding: const EdgeInsets.only(top: 4.0, bottom: 4.0),
child: getProgressbarFromDates(
context,
timer.startDate,
timer.completionDate,
tweakedStart,
tweakedEnd,
animation: false,
),
),
Expand Down
4 changes: 2 additions & 2 deletions lib/contracts/timer/timer_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class TimerItem {
'uuid': uuid,
'name': name,
'icon': icon,
'startDate': startDate.toString(),
'completionDate': completionDate.toString(),
'startDate': startDate.toIso8601String(),
'completionDate': completionDate.toIso8601String(),
};
}
5 changes: 3 additions & 2 deletions lib/pages/timer/add_edit_timer_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ class _AddEditTimerState extends State<AddEditTimerPage> {
DateTime now = DateTime.now();

_AddEditTimerState(this.timer, this.isEdit) {
int selectedIndex = UserSelectionIcons.timer.indexOf(timer.icon!);
int selectedIndex = UserSelectionIcons.timer.indexOf(timer.icon ?? '');
selectedImageIndex = selectedIndex >= 0 ? selectedIndex : 0;
timer.icon = UserSelectionIcons.timer[selectedImageIndex];

var diff =
int diff =
now.millisecondsSinceEpoch - timer.startDate.millisecondsSinceEpoch;
if (diff.abs() < millisecondsDrift) {
// If startDate is set to now-ish
Expand Down Expand Up @@ -131,6 +131,7 @@ class _AddEditTimerState extends State<AddEditTimerPage> {
));

widgets.add(Wrap(
spacing: 4,
alignment: WrapAlignment.center,
children: getQuickAccessButtons(context),
));
Expand Down
6 changes: 5 additions & 1 deletion lib/pages/timer/timer_page_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ class _TimersPageViewState extends State<TimersPageView> {
void Function()? onTap,
}) =>
timerTilePresenter(
presenterContext, timer, onEdit, (String id) => deleteTimer(id));
presenterContext,
timer,
onEdit,
(String id) => deleteTimer(id),
);

return SearchableList<TimerItem>(
getSearchListFutureFromList(
Expand Down
1 change: 1 addition & 0 deletions release_notes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- 💫 Improve the transition after selecting/deselecting platforms | Closes #175
- ⚡️ Improve itemDetails page loading performance
- 🐛 Remove focus on navigating away from searchList (commit is in AA common library) | Closes #183
- 🐛 Fix the display of timers on the Timers page


Expand Down

0 comments on commit 3b162b2

Please sign in to comment.