A framework for building convergent cross-platform Nextcloud clients using Flutter.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.6 KiB

part of '../neon_files.dart';
2 years ago
class FilesCreateFolderDialog extends StatefulWidget {
const FilesCreateFolderDialog({
super.key,
});
@override
State<FilesCreateFolderDialog> createState() => _FilesCreateFolderDialogState();
}
class _FilesCreateFolderDialogState extends State<FilesCreateFolderDialog> {
final formKey = GlobalKey<FormState>();
final controller = TextEditingController();
@override
void dispose() {
controller.dispose();
super.dispose();
}
2 years ago
void submit() {
if (formKey.currentState!.validate()) {
Navigator.of(context).pop(controller.text);
2 years ago
}
}
@override
Widget build(final BuildContext context) => NeonDialog(
title: Text(FilesLocalizations.of(context).folderCreate),
2 years ago
children: [
Form(
key: formKey,
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
TextFormField(
controller: controller,
decoration: InputDecoration(
hintText: FilesLocalizations.of(context).folderName,
2 years ago
),
autofocus: true,
validator: (final input) => validateNotEmpty(context, input),
onFieldSubmitted: (final _) {
submit();
},
),
ElevatedButton(
onPressed: submit,
child: Text(FilesLocalizations.of(context).folderCreate),
2 years ago
),
],
),
),
],
);
}