Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 27 additions & 12 deletions lib/app/modules/home/views/add_task_bottom_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ class AddTaskBottomSheet extends StatelessWidget {
onFieldSubmitted: (tag) {
addTag(tag.trim());
},
onChanged: (value) {
String trimmedString = value.trim();
if (value.endsWith(" ") &&
trimmedString.split(' ').length == 1) {
addTag(trimmedString);
}
},
),
),
IconButton(
Expand Down Expand Up @@ -158,9 +165,9 @@ class AddTaskBottomSheet extends StatelessWidget {
),
validator: (name) => name != null && name.isEmpty
? SentenceManager(
currentLanguage: homeController.selectedLanguage.value)
.sentences
.addTaskFieldCannotBeEmpty
currentLanguage: homeController.selectedLanguage.value)
.sentences
.addTaskFieldCannotBeEmpty
: null,
);

Expand Down Expand Up @@ -400,9 +407,9 @@ class AddTaskBottomSheet extends StatelessWidget {
TextButton(
child: Text(
SentenceManager(
currentLanguage: homeController.selectedLanguage.value)
.sentences
.addTaskCancel,
currentLanguage: homeController.selectedLanguage.value)
.sentences
.addTaskCancel,
style: TextStyle(
color: AppSettings.isDarkMode
? TaskWarriorColors.white
Expand All @@ -425,8 +432,8 @@ class AddTaskBottomSheet extends StatelessWidget {
child: Text(
SentenceManager(
currentLanguage: homeController.selectedLanguage.value)
.sentences
.addTaskAdd,
.sentences
.addTaskAdd,
style: TextStyle(
color: AppSettings.isDarkMode
? TaskWarriorColors.white
Expand Down Expand Up @@ -472,8 +479,8 @@ class AddTaskBottomSheet extends StatelessWidget {
content: Text(
SentenceManager(
currentLanguage: homeController.selectedLanguage.value)
.sentences
.addTaskTaskAddedSuccessfully,
.sentences
.addTaskTaskAddedSuccessfully,
style: TextStyle(
color: AppSettings.isDarkMode
? TaskWarriorColors.kprimaryTextColor
Expand Down Expand Up @@ -519,11 +526,19 @@ class AddTaskBottomSheet extends StatelessWidget {
void addTag(String tag) {
if (tag.isNotEmpty) {
String trimmedString = tag.trim();
homeController.tags.add(trimmedString);
List<String> tags = trimmedString.split(" ");
for(tag in tags){
if(checkTagIfExists(tag)) {
removeTag(tag);
}
homeController.tags.add(tag);
}
homeController.tagcontroller.text = '';
}
}

bool checkTagIfExists(String tag){
return homeController.tags.contains(tag);
}
void removeTag(String tag) {
homeController.tags.remove(tag);
}
Expand Down
Loading