@@ -250,7 +250,7 @@ class AddTaskBottomSheet extends StatelessWidget {
250250 },
251251 fieldHintText: "Month/Date/Year" ,
252252 context: context,
253- initialDate: homeController.due.value?? DateTime .now (),
253+ initialDate: homeController.due.value ?? DateTime .now (),
254254 firstDate: DateTime .now (),
255255 lastDate: DateTime (2037 , 12 , 31 ),
256256 );
@@ -287,7 +287,7 @@ class AddTaskBottomSheet extends StatelessWidget {
287287 child: Obx (() => MediaQuery (
288288 data: MediaQuery .of (context).copyWith (
289289 alwaysUse24HourFormat:
290- homeController.change24hr .value,
290+ AppSettings .use24HourFormatRx .value,
291291 ),
292292 child: child! )),
293293 );
@@ -308,8 +308,11 @@ class AddTaskBottomSheet extends StatelessWidget {
308308 homeController.due.value = dateTime;
309309
310310 // print("due value ${homeController.due}");
311+ String timeFormat = AppSettings .use24HourFormatRx.value
312+ ? 'dd-MM-yyyy HH:mm'
313+ : 'dd-MM-yyyy hh:mm a' ;
311314 homeController.dueString.value =
312- DateFormat ("dd-MM-yyyy HH:mm" ).format (dateTime);
315+ DateFormat (timeFormat ).format (dateTime);
313316 // print(homeController.dueString.value);
314317 if (dateTime.isBefore (DateTime .now ())) {
315318 //Try changing the color. in the settings and Due display.
@@ -355,10 +358,7 @@ class AddTaskBottomSheet extends StatelessWidget {
355358 crossAxisAlignment: CrossAxisAlignment .center,
356359 children: [
357360 Text (
358- "${SentenceManager (
359- currentLanguage : homeController .selectedLanguage .value )
360- .sentences
361- .addTaskPriority } :" ,
361+ "${SentenceManager (currentLanguage : homeController .selectedLanguage .value ).sentences .addTaskPriority } :" ,
362362 style: GoogleFonts .poppins (
363363 fontWeight: TaskWarriorFonts .bold,
364364 color: AppSettings .isDarkMode
@@ -367,51 +367,54 @@ class AddTaskBottomSheet extends StatelessWidget {
367367 ),
368368 textAlign: TextAlign .left,
369369 ),
370- const SizedBox (width: 2 ,),
370+ const SizedBox (
371+ width: 2 ,
372+ ),
371373 Obx (
372374 () => Row (
373375 children: [
374- for (int i= 0 ;i < homeController.priorityList.length;i++ )
376+ for (int i = 0 ; i < homeController.priorityList.length; i++ )
375377 Padding (
376378 padding: const EdgeInsets .symmetric (horizontal: 2.5 ),
377379 child: GestureDetector (
378380 onTap: () {
379- homeController.priority.value = homeController.priorityList[i];
381+ homeController.priority.value =
382+ homeController.priorityList[i];
380383 debugPrint (homeController.priority.value);
381384 },
382385 child: AnimatedContainer (
383386 duration: const Duration (milliseconds: 100 ),
384387 height: 30 ,
385388 width: 37 ,
386389 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+ )),
399405 child: Center (
400406 child: Text (
401407 homeController.priorityList[i],
402408 textAlign: TextAlign .center,
403409 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]),
408413 ),
409414 ),
410415 ),
411-
412416 ),
413417 )
414-
415418 ],
416419 ),
417420 )
@@ -448,8 +451,7 @@ class AddTaskBottomSheet extends StatelessWidget {
448451 Widget buildAddButton (BuildContext context) {
449452 return TextButton (
450453 child: Text (
451- SentenceManager (
452- currentLanguage: homeController.selectedLanguage.value)
454+ SentenceManager (currentLanguage: homeController.selectedLanguage.value)
453455 .sentences
454456 .addTaskAdd,
455457 style: TextStyle (
@@ -460,12 +462,12 @@ class AddTaskBottomSheet extends StatelessWidget {
460462 ),
461463 onPressed: () async {
462464 // 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! )) {
464467 ScaffoldMessenger .of (context).showSnackBar (SnackBar (
465468 content: Text (
466469 SentenceManager (
467- currentLanguage:
468- homeController.selectedLanguage.value)
470+ currentLanguage: homeController.selectedLanguage.value)
469471 .sentences
470472 .addTaskTimeInPast,
471473 style: TextStyle (
@@ -476,8 +478,7 @@ class AddTaskBottomSheet extends StatelessWidget {
476478 ),
477479 backgroundColor: AppSettings .isDarkMode
478480 ? TaskWarriorColors .ksecondaryBackgroundColor
479- : TaskWarriorColors
480- .kLightSecondaryBackgroundColor,
481+ : TaskWarriorColors .kLightSecondaryBackgroundColor,
481482 duration: const Duration (seconds: 2 )));
482483 return ;
483484 }
@@ -501,13 +502,12 @@ class AddTaskBottomSheet extends StatelessWidget {
501502 homeController.priority.value = 'M' ;
502503 homeController.tagcontroller.text = '' ;
503504 homeController.tags.value = [];
504- homeController.due.value= null ;
505+ homeController.due.value = null ;
505506 homeController.update ();
506507 // Navigator.of(context).pop();
507508 Get .back ();
508509 if (Platform .isAndroid) {
509- WidgetController widgetController =
510- Get .put (WidgetController ());
510+ WidgetController widgetController = Get .put (WidgetController ());
511511 widgetController.fetchAllData ();
512512
513513 widgetController.update ();
@@ -518,7 +518,8 @@ class AddTaskBottomSheet extends StatelessWidget {
518518 ScaffoldMessenger .of (context).showSnackBar (SnackBar (
519519 content: Text (
520520 SentenceManager (
521- currentLanguage: homeController.selectedLanguage.value)
521+ currentLanguage:
522+ homeController.selectedLanguage.value)
522523 .sentences
523524 .addTaskTaskAddedSuccessfully,
524525 style: TextStyle (
@@ -567,18 +568,20 @@ class AddTaskBottomSheet extends StatelessWidget {
567568 if (tag.isNotEmpty) {
568569 String trimmedString = tag.trim ();
569570 List <String > tags = trimmedString.split (" " );
570- for (tag in tags){
571- if (checkTagIfExists (tag)) {
571+ for (tag in tags) {
572+ if (checkTagIfExists (tag)) {
572573 removeTag (tag);
573574 }
574575 homeController.tags.add (tag);
575576 }
576577 homeController.tagcontroller.text = '' ;
577578 }
578579 }
579- bool checkTagIfExists (String tag){
580+
581+ bool checkTagIfExists (String tag) {
580582 return homeController.tags.contains (tag);
581583 }
584+
582585 void removeTag (String tag) {
583586 homeController.tags.remove (tag);
584587 }
0 commit comments