Skip to content

Commit e691078

Browse files
authored
fix: overflow of timer button (#738)
1 parent 44d1eaf commit e691078

File tree

1 file changed

+95
-0
lines changed

1 file changed

+95
-0
lines changed

lib/app/modules/timer/views/timer_animation.dart

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ class _TimerAnimatedCardState extends State<TimerAnimatedCard>
2626
with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
2727
TimerController controller = Get.find<TimerController>();
2828
ThemeController themeController = Get.find<ThemeController>();
29+
var width = Get.width;
30+
var height = Get.height;
2931

3032
Timer? _timerCounter;
3133
void startTimer() {
@@ -195,6 +197,99 @@ class _TimerAnimatedCardState extends State<TimerAnimatedCard>
195197
fontSize: 44,
196198
),
197199
),
200+
201+
InkWell(
202+
onTap: () {
203+
controller
204+
.stopRinger(widget.timer.timerId);
205+
controller
206+
.deleteTimer(widget.timer.timerId);
207+
},
208+
child: Container(
209+
decoration: BoxDecoration(
210+
color: themeController.primaryBackgroundColor.value,
211+
borderRadius:
212+
BorderRadius.circular(20)),
213+
child: const Padding(
214+
padding: EdgeInsets.all(4.0),
215+
child: Icon(
216+
Icons.close,
217+
size: 18,
218+
),
219+
),
220+
),
221+
)
222+
],
223+
),
224+
Padding(
225+
padding:
226+
const EdgeInsets.symmetric(vertical: 20),
227+
child: Row(
228+
mainAxisAlignment:
229+
MainAxisAlignment.spaceBetween,
230+
children: [
231+
Obx(
232+
() => AnimatedContainer(
233+
duration: Duration(seconds: 1),
234+
child: Text(
235+
'${Utils.formatMilliseconds(widget.timer.timerValue - widget.timer.timeElapsed)}',
236+
style: Theme.of(
237+
context,
238+
).textTheme.displayLarge!.copyWith(
239+
color: themeController.primaryTextColor.value,
240+
fontSize: 44,
241+
),
242+
),
243+
),
244+
),
245+
Padding(
246+
padding: EdgeInsets.all(20),
247+
child: GestureDetector(
248+
onTap: () {
249+
setState(() {
250+
widget.timer.isPaused == 0
251+
? stopTimer()
252+
: startTimer();
253+
widget.timer.isPaused =
254+
widget.timer.isPaused == 0
255+
? 1
256+
: 0;
257+
IsarDb.updateTimerPauseStatus(
258+
widget.timer);
259+
});
260+
if (widget.timer.timeElapsed >=
261+
widget.timer.timerValue) {
262+
controller.stopRinger(
263+
widget.timer.timerId);
264+
setState(() {
265+
widget.timer.timeElapsed = 0;
266+
IsarDb.updateTimerTick(
267+
widget.timer)
268+
.then((value) => IsarDb
269+
.updateTimerPauseStatus(
270+
widget.timer));
271+
widget.timer.isPaused = 1;
272+
});
273+
}
274+
},
275+
child: Container(
276+
decoration: BoxDecoration(
277+
color: kprimaryColor,
278+
borderRadius:
279+
BorderRadius.circular(80)),
280+
width: width * 0.14,
281+
height: width * 0.14,
282+
child: Icon(
283+
widget.timer.isPaused == 0
284+
? Icons.pause
285+
: Icons.play_arrow,
286+
size: 30,
287+
color: ksecondaryBackgroundColor,
288+
),
289+
),
290+
))
291+
],
292+
198293
),
199294
),
200295
GestureDetector(

0 commit comments

Comments
 (0)