Skip to content

Commit

Permalink
feat(neon_framework): skip renaming if it was not changed
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolas Rimikis <[email protected]>
  • Loading branch information
Leptopoda committed Dec 27, 2023
1 parent f54822e commit 60cdf4a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/neon_framework/lib/src/widgets/dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ class NeonConfirmationDialog extends StatelessWidget {
/// Use `showRenameDialog` to display this dialog.
///
/// When submitted the new value will be popped as a `String`.
/// If the new value is equal to the provided one `null` will be popped.
class NeonRenameDialog extends StatefulWidget {
/// Creates a new Neon rename dialog.
const NeonRenameDialog({
Expand Down Expand Up @@ -328,8 +329,14 @@ class _NeonRenameDialogState extends State<NeonRenameDialog> {
}

void submit() {
if (formKey.currentState!.validate()) {
if (!formKey.currentState!.validate()) {
return;
}

if (controller.text != widget.value) {
Navigator.of(context).pop(controller.text);
} else {
Navigator.of(context).pop();
}
}

Expand Down

0 comments on commit 60cdf4a

Please sign in to comment.