Skip to content

Commit

Permalink
fix: prevent the user from creating empty notes
Browse files Browse the repository at this point in the history
  • Loading branch information
mrunix00 committed Nov 25, 2023
1 parent 39318a1 commit 3c192ee
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/ui/screens/new_note_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ class SaveButton extends StatelessWidget {
return SquareIconButton(
icon: const Icon(Icons.save_outlined),
onPressed: () {
if (titleController.text.trim().isEmpty) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('The title cannot be empty')),
);
return;
}
final Note note = Note(
title: titleController.text,
content: noteController.text,
Expand Down

0 comments on commit 3c192ee

Please sign in to comment.