@@ -112,6 +112,13 @@ class AddTaskBottomSheet extends StatelessWidget {
112112 onFieldSubmitted: (tag) {
113113 addTag (tag.trim ());
114114 },
115+ onChanged: (value) {
116+ String trimmedString = value.trim ();
117+ if (value.endsWith (" " ) &&
118+ trimmedString.split (' ' ).length == 1 ) {
119+ addTag (trimmedString);
120+ }
121+ },
115122 ),
116123 ),
117124 IconButton (
@@ -158,9 +165,9 @@ class AddTaskBottomSheet extends StatelessWidget {
158165 ),
159166 validator: (name) => name != null && name.isEmpty
160167 ? SentenceManager (
161- currentLanguage: homeController.selectedLanguage.value)
162- .sentences
163- .addTaskFieldCannotBeEmpty
168+ currentLanguage: homeController.selectedLanguage.value)
169+ .sentences
170+ .addTaskFieldCannotBeEmpty
164171 : null ,
165172 );
166173
@@ -400,9 +407,9 @@ class AddTaskBottomSheet extends StatelessWidget {
400407 TextButton (
401408 child: Text (
402409 SentenceManager (
403- currentLanguage: homeController.selectedLanguage.value)
404- .sentences
405- .addTaskCancel,
410+ currentLanguage: homeController.selectedLanguage.value)
411+ .sentences
412+ .addTaskCancel,
406413 style: TextStyle (
407414 color: AppSettings .isDarkMode
408415 ? TaskWarriorColors .white
@@ -425,8 +432,8 @@ class AddTaskBottomSheet extends StatelessWidget {
425432 child: Text (
426433 SentenceManager (
427434 currentLanguage: homeController.selectedLanguage.value)
428- .sentences
429- .addTaskAdd,
435+ .sentences
436+ .addTaskAdd,
430437 style: TextStyle (
431438 color: AppSettings .isDarkMode
432439 ? TaskWarriorColors .white
@@ -472,8 +479,8 @@ class AddTaskBottomSheet extends StatelessWidget {
472479 content: Text (
473480 SentenceManager (
474481 currentLanguage: homeController.selectedLanguage.value)
475- .sentences
476- .addTaskTaskAddedSuccessfully,
482+ .sentences
483+ .addTaskTaskAddedSuccessfully,
477484 style: TextStyle (
478485 color: AppSettings .isDarkMode
479486 ? TaskWarriorColors .kprimaryTextColor
@@ -519,11 +526,19 @@ class AddTaskBottomSheet extends StatelessWidget {
519526 void addTag (String tag) {
520527 if (tag.isNotEmpty) {
521528 String trimmedString = tag.trim ();
522- homeController.tags.add (trimmedString);
529+ List <String > tags = trimmedString.split (" " );
530+ for (tag in tags){
531+ if (checkTagIfExists (tag)) {
532+ removeTag (tag);
533+ }
534+ homeController.tags.add (tag);
535+ }
523536 homeController.tagcontroller.text = '' ;
524537 }
525538 }
526-
539+ bool checkTagIfExists (String tag){
540+ return homeController.tags.contains (tag);
541+ }
527542 void removeTag (String tag) {
528543 homeController.tags.remove (tag);
529544 }
0 commit comments