@@ -250,7 +250,7 @@ class AddTaskBottomSheet extends StatelessWidget {
250
250
},
251
251
fieldHintText: "Month/Date/Year" ,
252
252
context: context,
253
- initialDate: homeController.due.value?? DateTime .now (),
253
+ initialDate: homeController.due.value ?? DateTime .now (),
254
254
firstDate: DateTime .now (),
255
255
lastDate: DateTime (2037 , 12 , 31 ),
256
256
);
@@ -287,7 +287,7 @@ class AddTaskBottomSheet extends StatelessWidget {
287
287
child: Obx (() => MediaQuery (
288
288
data: MediaQuery .of (context).copyWith (
289
289
alwaysUse24HourFormat:
290
- homeController.change24hr .value,
290
+ AppSettings .use24HourFormatRx .value,
291
291
),
292
292
child: child! )),
293
293
);
@@ -308,8 +308,11 @@ class AddTaskBottomSheet extends StatelessWidget {
308
308
homeController.due.value = dateTime;
309
309
310
310
// print("due value ${homeController.due}");
311
+ String timeFormat = AppSettings .use24HourFormatRx.value
312
+ ? 'dd-MM-yyyy HH:mm'
313
+ : 'dd-MM-yyyy hh:mm a' ;
311
314
homeController.dueString.value =
312
- DateFormat ("dd-MM-yyyy HH:mm" ).format (dateTime);
315
+ DateFormat (timeFormat ).format (dateTime);
313
316
// print(homeController.dueString.value);
314
317
if (dateTime.isBefore (DateTime .now ())) {
315
318
//Try changing the color. in the settings and Due display.
@@ -355,10 +358,7 @@ class AddTaskBottomSheet extends StatelessWidget {
355
358
crossAxisAlignment: CrossAxisAlignment .center,
356
359
children: [
357
360
Text (
358
- "${SentenceManager (
359
- currentLanguage : homeController .selectedLanguage .value )
360
- .sentences
361
- .addTaskPriority } :" ,
361
+ "${SentenceManager (currentLanguage : homeController .selectedLanguage .value ).sentences .addTaskPriority } :" ,
362
362
style: GoogleFonts .poppins (
363
363
fontWeight: TaskWarriorFonts .bold,
364
364
color: AppSettings .isDarkMode
@@ -367,51 +367,54 @@ class AddTaskBottomSheet extends StatelessWidget {
367
367
),
368
368
textAlign: TextAlign .left,
369
369
),
370
- const SizedBox (width: 2 ,),
370
+ const SizedBox (
371
+ width: 2 ,
372
+ ),
371
373
Obx (
372
374
() => Row (
373
375
children: [
374
- for (int i= 0 ;i < homeController.priorityList.length;i++ )
376
+ for (int i = 0 ; i < homeController.priorityList.length; i++ )
375
377
Padding (
376
378
padding: const EdgeInsets .symmetric (horizontal: 2.5 ),
377
379
child: GestureDetector (
378
380
onTap: () {
379
- homeController.priority.value = homeController.priorityList[i];
381
+ homeController.priority.value =
382
+ homeController.priorityList[i];
380
383
debugPrint (homeController.priority.value);
381
384
},
382
385
child: AnimatedContainer (
383
386
duration: const Duration (milliseconds: 100 ),
384
387
height: 30 ,
385
388
width: 37 ,
386
389
decoration: BoxDecoration (
387
-
388
- borderRadius: BorderRadius .circular (8 ),
389
- border: Border .all (
390
- color: homeController.priority.value == homeController.priorityList[i]
391
- ? AppSettings .isDarkMode
392
- ? TaskWarriorColors .kLightPrimaryBackgroundColor
393
- : TaskWarriorColors .kprimaryBackgroundColor
394
- : AppSettings .isDarkMode
395
- ? TaskWarriorColors .kprimaryBackgroundColor
396
- : TaskWarriorColors .kLightPrimaryBackgroundColor,
397
- )
398
- ),
390
+ borderRadius: BorderRadius .circular (8 ),
391
+ border: Border .all (
392
+ color: homeController.priority.value ==
393
+ homeController.priorityList[i]
394
+ ? AppSettings .isDarkMode
395
+ ? TaskWarriorColors
396
+ .kLightPrimaryBackgroundColor
397
+ : TaskWarriorColors
398
+ .kprimaryBackgroundColor
399
+ : AppSettings .isDarkMode
400
+ ? TaskWarriorColors
401
+ .kprimaryBackgroundColor
402
+ : TaskWarriorColors
403
+ .kLightPrimaryBackgroundColor,
404
+ )),
399
405
child: Center (
400
406
child: Text (
401
407
homeController.priorityList[i],
402
408
textAlign: TextAlign .center,
403
409
style: GoogleFonts .poppins (
404
- fontWeight: FontWeight .bold,
405
- fontSize: 17 ,
406
- color: homeController.priorityColors[i]
407
- ),
410
+ fontWeight: FontWeight .bold,
411
+ fontSize: 17 ,
412
+ color: homeController.priorityColors[i]),
408
413
),
409
414
),
410
415
),
411
-
412
416
),
413
417
)
414
-
415
418
],
416
419
),
417
420
)
@@ -448,8 +451,7 @@ class AddTaskBottomSheet extends StatelessWidget {
448
451
Widget buildAddButton (BuildContext context) {
449
452
return TextButton (
450
453
child: Text (
451
- SentenceManager (
452
- currentLanguage: homeController.selectedLanguage.value)
454
+ SentenceManager (currentLanguage: homeController.selectedLanguage.value)
453
455
.sentences
454
456
.addTaskAdd,
455
457
style: TextStyle (
@@ -460,12 +462,12 @@ class AddTaskBottomSheet extends StatelessWidget {
460
462
),
461
463
onPressed: () async {
462
464
// print(homeController.formKey.currentState);
463
- if (homeController.due.value!= null && DateTime .now ().isAfter (homeController.due.value! )){
465
+ if (homeController.due.value != null &&
466
+ DateTime .now ().isAfter (homeController.due.value! )) {
464
467
ScaffoldMessenger .of (context).showSnackBar (SnackBar (
465
468
content: Text (
466
469
SentenceManager (
467
- currentLanguage:
468
- homeController.selectedLanguage.value)
470
+ currentLanguage: homeController.selectedLanguage.value)
469
471
.sentences
470
472
.addTaskTimeInPast,
471
473
style: TextStyle (
@@ -476,8 +478,7 @@ class AddTaskBottomSheet extends StatelessWidget {
476
478
),
477
479
backgroundColor: AppSettings .isDarkMode
478
480
? TaskWarriorColors .ksecondaryBackgroundColor
479
- : TaskWarriorColors
480
- .kLightSecondaryBackgroundColor,
481
+ : TaskWarriorColors .kLightSecondaryBackgroundColor,
481
482
duration: const Duration (seconds: 2 )));
482
483
return ;
483
484
}
@@ -501,13 +502,12 @@ class AddTaskBottomSheet extends StatelessWidget {
501
502
homeController.priority.value = 'M' ;
502
503
homeController.tagcontroller.text = '' ;
503
504
homeController.tags.value = [];
504
- homeController.due.value= null ;
505
+ homeController.due.value = null ;
505
506
homeController.update ();
506
507
// Navigator.of(context).pop();
507
508
Get .back ();
508
509
if (Platform .isAndroid) {
509
- WidgetController widgetController =
510
- Get .put (WidgetController ());
510
+ WidgetController widgetController = Get .put (WidgetController ());
511
511
widgetController.fetchAllData ();
512
512
513
513
widgetController.update ();
@@ -518,7 +518,8 @@ class AddTaskBottomSheet extends StatelessWidget {
518
518
ScaffoldMessenger .of (context).showSnackBar (SnackBar (
519
519
content: Text (
520
520
SentenceManager (
521
- currentLanguage: homeController.selectedLanguage.value)
521
+ currentLanguage:
522
+ homeController.selectedLanguage.value)
522
523
.sentences
523
524
.addTaskTaskAddedSuccessfully,
524
525
style: TextStyle (
@@ -567,18 +568,20 @@ class AddTaskBottomSheet extends StatelessWidget {
567
568
if (tag.isNotEmpty) {
568
569
String trimmedString = tag.trim ();
569
570
List <String > tags = trimmedString.split (" " );
570
- for (tag in tags){
571
- if (checkTagIfExists (tag)) {
571
+ for (tag in tags) {
572
+ if (checkTagIfExists (tag)) {
572
573
removeTag (tag);
573
574
}
574
575
homeController.tags.add (tag);
575
576
}
576
577
homeController.tagcontroller.text = '' ;
577
578
}
578
579
}
579
- bool checkTagIfExists (String tag){
580
+
581
+ bool checkTagIfExists (String tag) {
580
582
return homeController.tags.contains (tag);
581
583
}
584
+
582
585
void removeTag (String tag) {
583
586
homeController.tags.remove (tag);
584
587
}
0 commit comments