Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 31 additions & 25 deletions lib/app/modules/timer/views/timer_animation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ class _TimerAnimatedCardState extends State<TimerAnimatedCard>
widget.timer.startedOn, widget.timer.timerValue) <
widget.timer.timerValue &&
widget.timer.isPaused == 0) {
widget.timer.timeElapsed = widget.timer.timerValue - Utils.getDifferenceMillisFromNow(
widget.timer.startedOn, widget.timer.timerValue);
widget.timer.timeElapsed = widget.timer.timerValue -
Utils.getDifferenceMillisFromNow(
widget.timer.startedOn, widget.timer.timerValue);
IsarDb.updateTimerPauseStatus(widget.timer);
}
if (widget.timer.isPaused == 0) {
Expand All @@ -84,8 +85,7 @@ class _TimerAnimatedCardState extends State<TimerAnimatedCard>
padding: const EdgeInsets.symmetric(
horizontal: 10.0,
),
child: Container(
height: context.height / 3.0,
child: SizedBox(
width: context.width,
child: Obx(
() => Card(
Expand All @@ -104,10 +104,10 @@ class _TimerAnimatedCardState extends State<TimerAnimatedCard>
children: [
AnimatedContainer(
decoration: BoxDecoration(
color: kprimaryDisabledTextColor.withOpacity(0.1),
borderRadius: BorderRadius.circular(18)),
duration: Duration(milliseconds: 1000),
height: context.height / 3.3,
color: kprimaryDisabledTextColor.withOpacity(0.1),
borderRadius: BorderRadius.circular(18),
),
duration: const Duration(milliseconds: 1000),
width: context.width *
((widget.timer.timeElapsed) /
(widget.timer.timerValue)),
Expand All @@ -129,9 +129,10 @@ class _TimerAnimatedCardState extends State<TimerAnimatedCard>
style: Theme.of(
context,
).textTheme.bodySmall!.copyWith(
fontWeight: FontWeight.w500,
color: kprimaryColor,
fontSize: 18),
fontWeight: FontWeight.w500,
color: kprimaryColor,
fontSize: 18,
),
),
),
Row(
Expand All @@ -154,20 +155,20 @@ class _TimerAnimatedCardState extends State<TimerAnimatedCard>
}
});
},
icon: Icon(
icon: const Icon(
Icons.refresh,
size: 18,
color: Colors.white,
),
),
IconButton(
onPressed: () {
controller.stopRinger(
widget.timer.timerId);
controller.deleteTimer(
widget.timer.timerId);
controller
.stopRinger(widget.timer.timerId);
controller
.deleteTimer(widget.timer.timerId);
},
icon: Icon(
icon: const Icon(
Icons.close,
size: 18,
color: Colors.white,
Expand All @@ -177,7 +178,6 @@ class _TimerAnimatedCardState extends State<TimerAnimatedCard>
),
],
),
Spacer(),
Padding(
padding: const EdgeInsets.symmetric(vertical: 10),
child: Row(
Expand All @@ -192,7 +192,8 @@ class _TimerAnimatedCardState extends State<TimerAnimatedCard>
.textTheme
.displayLarge!
.copyWith(
color: themeController.primaryTextColor.value,
color: themeController
.primaryTextColor.value,
fontSize: 44,
),
),
Expand All @@ -209,17 +210,21 @@ class _TimerAnimatedCardState extends State<TimerAnimatedCard>
startTimer();
}
widget.timer.isPaused =
widget.timer.isPaused == 0 ? 1 : 0;
IsarDb.updateTimerPauseStatus(widget.timer);
widget.timer.isPaused == 0
? 1
: 0;
IsarDb.updateTimerPauseStatus(
widget.timer);
});
if (widget.timer.timeElapsed >=
widget.timer.timerValue) {
controller.stopRinger(widget.timer.timerId);
controller
.stopRinger(widget.timer.timerId);
setState(() {
widget.timer.timeElapsed = 0;
IsarDb.updateTimerTick(widget.timer)
.then((value) =>
IsarDb.updateTimerPauseStatus(
.then((value) => IsarDb
.updateTimerPauseStatus(
widget.timer));
widget.timer.isPaused = 1;
});
Expand All @@ -228,7 +233,8 @@ class _TimerAnimatedCardState extends State<TimerAnimatedCard>
child: Container(
decoration: BoxDecoration(
color: kprimaryColor,
borderRadius: BorderRadius.circular(80)),
borderRadius:
BorderRadius.circular(80)),
width: 80,
height: 80,
child: Icon(
Expand Down