Skip to content
Open
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions lib/app/modules/home/views/add_task_bottom_sheet_new.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class AddTaskBottomSheet extends StatelessWidget {
padding: const EdgeInsets.all(padding),
child: TextFormField(
controller: homeController.namecontroller,
validator: (value) => value!.isEmpty
validator: (value) => value!.trim().isEmpty
? SentenceManager(
currentLanguage:
homeController.selectedLanguage.value)
Expand Down Expand Up @@ -317,7 +317,7 @@ class AddTaskBottomSheet extends StatelessWidget {
if (homeController.formKey.currentState!.validate()) {
debugPrint("tags ${homeController.tags}");
var task = TaskForC(
description: homeController.namecontroller.text,
description: homeController.namecontroller.text.trim(),
status: 'pending',
priority: homeController.priority.value,
entry: DateTime.now().toIso8601String(),
Expand Down Expand Up @@ -365,7 +365,7 @@ class AddTaskBottomSheet extends StatelessWidget {
void onSaveButtonClicked(BuildContext context) async {
if (homeController.formKey.currentState!.validate()) {
try {
var task = taskParser(homeController.namecontroller.text)
var task = taskParser(homeController.namecontroller.text.trim())
.rebuild((b) =>
b..due = getDueDate(homeController.selectedDates)?.toUtc())
.rebuild((p) => p..priority = homeController.priority.value)
Expand Down Expand Up @@ -451,7 +451,7 @@ class AddTaskBottomSheet extends StatelessWidget {
if (homeController.formKey.currentState!.validate()) {
try {
await Replica.addTaskToReplica(HashMap<String, dynamic>.from({
"description": homeController.namecontroller.text,
"description": homeController.namecontroller.text.trim(),
"due": getDueDate(homeController.selectedDates)?.toUtc(),
"priority": homeController.priority.value,
"project": homeController.projectcontroller.text != ""
Expand Down
4 changes: 2 additions & 2 deletions lib/app/utils/taskfunctions/validate.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
void validateTaskDescription(String description) {
if (description.isEmpty) {
if (description.trim().isEmpty) {
throw FormatException(
'Empty description will provoke a server error.',
'Description cannot be empty or contain only spaces.',
description,
0,
);
Expand Down