Skip to content

Commit 7d78d0d

Browse files
committed
If anyone of title or description is available then its valid
1 parent 2fdc862 commit 7d78d0d

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

lib/page/edit_safe_note_page.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class _AddEditNotePageState extends State<AddEditNotePage>
168168
});
169169
});
170170
bool isFormValid() {
171-
return description.isNotEmpty;
171+
return description.isNotEmpty || title.isNotEmpty;
172172
}
173173

174174
void startFixTitle() {
@@ -193,17 +193,13 @@ class _AddEditNotePageState extends State<AddEditNotePage>
193193
}
194194

195195
void addOrUpdateNote() async {
196-
final isValid = _formKey.currentState!.validate();
197-
198-
if (isValid) {
199196
final isUpdating = widget.note != null || savedOnce;
200197

201198
if (isUpdating) {
202199
await updateNote();
203200
} else {
204201
await addNote();
205202
}
206-
}
207203
}
208204

209205
Future updateNote() async {

lib/widget/safe_note_form_widget.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ class NoteFormWidget extends StatelessWidget {
8383
hintText: 'Type something...',
8484
//hintStyle: TextStyle(color: Colors.white60),
8585
),
86-
validator: (title) => title != null && title.isEmpty
87-
? 'The description cannot be empty'
88-
: null,
86+
// validator: (title) => title != null && title.isEmpty
87+
// ? 'The description cannot be empty'
88+
// : null,
8989
onChanged: onChangedDescription,
9090
);
9191
}

0 commit comments

Comments
 (0)