new plus button
This commit is contained in:
@@ -9,6 +9,7 @@ Future<String?> showNameDialog(
|
||||
String? initial,
|
||||
String label = 'Name',
|
||||
String confirmLabel = 'Save',
|
||||
bool allowEmpty = false,
|
||||
}) {
|
||||
return showDialog<String>(
|
||||
context: context,
|
||||
@@ -17,6 +18,7 @@ Future<String?> showNameDialog(
|
||||
initial: initial ?? '',
|
||||
label: label,
|
||||
confirmLabel: confirmLabel,
|
||||
allowEmpty: allowEmpty,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -27,12 +29,14 @@ class _NameDialog extends StatefulWidget {
|
||||
required this.initial,
|
||||
required this.label,
|
||||
required this.confirmLabel,
|
||||
required this.allowEmpty,
|
||||
});
|
||||
|
||||
final String title;
|
||||
final String initial;
|
||||
final String label;
|
||||
final String confirmLabel;
|
||||
final bool allowEmpty;
|
||||
|
||||
@override
|
||||
State<_NameDialog> createState() => _NameDialogState();
|
||||
@@ -56,7 +60,7 @@ class _NameDialogState extends State<_NameDialog> {
|
||||
|
||||
void _save() {
|
||||
final name = _controller.text.trim();
|
||||
if (name.isEmpty) {
|
||||
if (name.isEmpty && !widget.allowEmpty) {
|
||||
setState(() => _error = 'Enter a name.');
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user