@@ -61,7 +61,7 @@ class _TimerAnimatedCardState extends State<TimerAnimatedCard>
61
61
widget.timer.startedOn, widget.timer.timerValue) <
62
62
widget.timer.timerValue &&
63
63
widget.timer.isPaused == 0 ) {
64
- widget.timer.timeElapsed = widget.timer.timerValue- Utils .getDifferenceMillisFromNow (
64
+ widget.timer.timeElapsed = widget.timer.timerValue - Utils .getDifferenceMillisFromNow (
65
65
widget.timer.startedOn, widget.timer.timerValue);
66
66
IsarDb .updateTimerPauseStatus (widget.timer);
67
67
}
@@ -72,7 +72,7 @@ class _TimerAnimatedCardState extends State<TimerAnimatedCard>
72
72
73
73
@override
74
74
void dispose () {
75
- _timerCounter! .cancel ();
75
+ _timerCounter? .cancel ();
76
76
super .dispose ();
77
77
}
78
78
@@ -83,7 +83,7 @@ class _TimerAnimatedCardState extends State<TimerAnimatedCard>
83
83
horizontal: 10.0 ,
84
84
),
85
85
child: Container (
86
- height: context.height / 3.0 , // changed from 3.3 to 3.0
86
+ height: context.height / 3.0 ,
87
87
width: context.width,
88
88
child: Obx (
89
89
() => Card (
@@ -112,168 +112,140 @@ class _TimerAnimatedCardState extends State<TimerAnimatedCard>
112
112
),
113
113
Center (
114
114
child: Padding (
115
- padding: const EdgeInsets .only (
116
- left: 25.0 ,
117
- right: 20.0 ,
118
- top: 20.0 ,
119
- bottom: 30.0 ,
120
- ),
121
- child: Row (
122
- mainAxisAlignment: MainAxisAlignment .start,
115
+ padding: const EdgeInsets .all (10.0 ),
116
+ child: Column (
117
+ mainAxisAlignment: MainAxisAlignment .center,
118
+ crossAxisAlignment: CrossAxisAlignment .start,
123
119
children: [
124
- Expanded (
125
- flex: 3 ,
126
- child: Column (
127
- mainAxisAlignment: MainAxisAlignment .center,
128
- crossAxisAlignment: CrossAxisAlignment .start,
120
+ Row (
121
+ mainAxisAlignment: MainAxisAlignment .spaceBetween,
122
+ children: [
123
+ Expanded (
124
+ child: Text (
125
+ widget.timer.timerName,
126
+ overflow: TextOverflow .ellipsis,
127
+ style: Theme .of (
128
+ context,
129
+ ).textTheme.bodySmall! .copyWith (
130
+ fontWeight: FontWeight .w500,
131
+ color: kprimaryColor,
132
+ fontSize: 18 ),
133
+ ),
134
+ ),
135
+ Row (
136
+ children: [
137
+ IconButton (
138
+ onPressed: () {
139
+ setState (() {
140
+ if (_timerCounter != null &&
141
+ widget.timer.isPaused == 0 ) {
142
+ stopTimer ();
143
+ }
144
+ widget.timer.timeElapsed = 0 ;
145
+ IsarDb .updateTimerTick (widget.timer);
146
+ if (_timerCounter != null &&
147
+ widget.timer.isPaused == 0 ) {
148
+ widget.timer.startedOn =
149
+ DateTime .now ().toString ();
150
+ IsarDb .updateTimerTick (widget.timer)
151
+ .then ((value) => startTimer ());
152
+ }
153
+ });
154
+ },
155
+ icon: Icon (
156
+ Icons .refresh,
157
+ size: 18 ,
158
+ color: Colors .white,
159
+ ),
160
+ ),
161
+ IconButton (
162
+ onPressed: () {
163
+ controller.stopRinger (
164
+ widget.timer.timerId);
165
+ controller.deleteTimer (
166
+ widget.timer.timerId);
167
+ },
168
+ icon: Icon (
169
+ Icons .close,
170
+ size: 18 ,
171
+ color: Colors .white,
172
+ ),
173
+ ),
174
+ ],
175
+ ),
176
+ ],
177
+ ),
178
+ Spacer (),
179
+ Padding (
180
+ padding:
181
+ const EdgeInsets .symmetric (vertical: 10 ),
182
+ child: Row (
183
+ mainAxisAlignment:
184
+ MainAxisAlignment .spaceBetween,
129
185
children: [
130
- Row (
131
- mainAxisAlignment:
132
- MainAxisAlignment .spaceBetween,
133
- children: [
134
- Text (
135
- widget.timer.timerName,
136
- overflow: TextOverflow .ellipsis,
137
- // Set overflow property here
186
+ Obx (
187
+ () => AnimatedContainer (
188
+ duration: Duration (seconds: 1 ),
189
+ child: Text (
190
+ '${Utils .formatMilliseconds (widget .timer .timerValue - widget .timer .timeElapsed )}' ,
138
191
style: Theme .of (
139
192
context,
140
- ).textTheme.bodySmall! .copyWith (
141
- fontWeight: FontWeight .w500,
142
- color: kprimaryColor,
143
- fontSize: 18 ),
144
- ),
145
- Spacer (),
146
- Padding (
147
- padding: const EdgeInsets .only (right: 16.0 ),
148
- child: InkWell (
149
- onTap: () {
150
- setState (() {
151
- if (_timerCounter != null &&
152
- widget.timer.isPaused == 0 ) {
153
- stopTimer ();
154
- }
155
- widget.timer.timeElapsed = 0 ;
156
- IsarDb .updateTimerTick (widget.timer);
157
- if (_timerCounter != null &&
158
- widget.timer.isPaused == 0 ) {
159
- widget.timer.startedOn =
160
- DateTime .now ().toString ();
161
- IsarDb .updateTimerTick (widget.timer)
162
- .then ((value) => startTimer ());
163
- }
164
- });
165
- },
166
- child: Container (
167
- decoration: BoxDecoration (
168
- color: themeController.primaryBackgroundColor.value,
169
- borderRadius:
170
- BorderRadius .circular (20 )),
171
- child: const Padding (
172
- padding: EdgeInsets .all (4.0 ),
173
- child: Icon (
174
- Icons .refresh,
175
- size: 18 ,
176
- ),
193
+ ).textTheme.displayLarge! .copyWith (
194
+ color: themeController.primaryTextColor.value,
195
+ fontSize: 44 ,
177
196
),
178
- ),
179
- ),
180
197
),
181
- InkWell (
182
- onTap: () {
183
- controller
184
- .stopRinger (widget.timer.timerId);
185
- controller
186
- .deleteTimer (widget.timer.timerId);
187
- },
188
- child: Container (
189
- decoration: BoxDecoration (
190
- color: themeController.primaryBackgroundColor.value,
191
- borderRadius:
192
- BorderRadius .circular (20 )),
193
- child: const Padding (
194
- padding: EdgeInsets .all (4.0 ),
195
- child: Icon (
196
- Icons .close,
197
- size: 18 ,
198
- ),
199
- ),
200
- ),
201
- )
202
- ],
203
- ),
204
- Padding (
205
- padding:
206
- const EdgeInsets .symmetric (vertical: 20 ),
207
- child: Row (
208
- mainAxisAlignment:
209
- MainAxisAlignment .spaceBetween,
210
- children: [
211
- Obx (
212
- () => AnimatedContainer (
213
- duration: Duration (seconds: 1 ),
214
- child: Text (
215
- '${Utils .formatMilliseconds (widget .timer .timerValue - widget .timer .timeElapsed )}' ,
216
- style: Theme .of (
217
- context,
218
- ).textTheme.displayLarge! .copyWith (
219
- color: themeController.primaryTextColor.value,
220
- fontSize: 44 ,
221
- ),
222
- ),
223
- ),
224
- ),
225
- Padding (
226
- padding: EdgeInsets .all (20 ),
227
- child: GestureDetector (
228
- onTap: () {
229
- setState (() {
230
- widget.timer.isPaused == 0
231
- ? stopTimer ()
232
- : startTimer ();
233
- widget.timer.isPaused =
234
- widget.timer.isPaused == 0
235
- ? 1
236
- : 0 ;
237
- IsarDb .updateTimerPauseStatus (
238
- widget.timer);
239
- });
240
- if (widget.timer.timeElapsed >=
241
- widget.timer.timerValue) {
242
- controller.stopRinger (
243
- widget.timer.timerId);
244
- setState (() {
245
- widget.timer.timeElapsed = 0 ;
246
- IsarDb .updateTimerTick (
247
- widget.timer)
248
- .then ((value) => IsarDb
249
- .updateTimerPauseStatus (
250
- widget.timer));
251
- widget.timer.isPaused = 1 ;
252
- });
253
- }
254
- },
255
- child: Container (
256
- decoration: BoxDecoration (
257
- color: kprimaryColor,
258
- borderRadius:
259
- BorderRadius .circular (80 )),
260
- width: 80 ,
261
- height: 80 ,
262
- child: Icon (
263
- widget.timer.isPaused == 0
264
- ? Icons .pause
265
- : Icons .play_arrow,
266
- size: 30 ,
267
- color: ksecondaryBackgroundColor,
268
- ),
269
- ),
270
- ))
271
- ],
272
198
),
273
199
),
200
+ GestureDetector (
201
+ onTap: () {
202
+ setState (() {
203
+ widget.timer.isPaused == 0
204
+ ? stopTimer ()
205
+ : startTimer ();
206
+ widget.timer.isPaused =
207
+ widget.timer.isPaused == 0
208
+ ? 1
209
+ : 0 ;
210
+ IsarDb .updateTimerPauseStatus (
211
+ widget.timer);
212
+ });
213
+ if (widget.timer.timeElapsed >=
214
+ widget.timer.timerValue) {
215
+ controller.stopRinger (
216
+ widget.timer.timerId);
217
+ setState (() {
218
+ widget.timer.timeElapsed = 0 ;
219
+ IsarDb .updateTimerTick (
220
+ widget.timer)
221
+ .then ((value) => IsarDb
222
+ .updateTimerPauseStatus (
223
+ widget.timer));
224
+ widget.timer.isPaused = 1 ;
225
+ });
226
+ }
227
+ },
228
+ child: Container (
229
+ decoration: BoxDecoration (
230
+ color: kprimaryColor,
231
+ borderRadius:
232
+ BorderRadius .circular (80 )),
233
+ width: 80 ,
234
+ height: 80 ,
235
+ child: Icon (
236
+ widget.timer.isPaused == 0
237
+ ? Icons .pause
238
+ : Icons .play_arrow,
239
+ size: 30 ,
240
+ color:
241
+ Colors .white,
242
+ ),
243
+ ),
244
+ )
274
245
],
275
246
),
276
247
),
248
+ Spacer (),
277
249
],
278
250
),
279
251
),
0 commit comments