42 lines
1.2 KiB
Dart
42 lines
1.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
|
|
class CreateBookmarkCollectionDialog extends StatelessWidget {
|
|
const CreateBookmarkCollectionDialog({
|
|
super.key,
|
|
required this.onSavePressed,
|
|
});
|
|
final void Function(String name) onSavePressed;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final nameController = TextEditingController();
|
|
return AlertDialog(
|
|
title: Text('Create Collection'),
|
|
content: TextField(
|
|
controller: nameController,
|
|
autofocus: true,
|
|
maxLines: 1,
|
|
maxLength: 50,
|
|
inputFormatters: [
|
|
FilteringTextInputFormatter.allow(RegExp(r'[a-zA-Z0-9äöüÄÖÜß\s]')),
|
|
FilteringTextInputFormatter.deny(RegExp(r'\s\s+')),
|
|
],
|
|
decoration: InputDecoration(
|
|
labelText: 'Collection Name',
|
|
border: OutlineInputBorder(borderRadius: BorderRadius.circular(10)),
|
|
),
|
|
),
|
|
actions: [
|
|
FloatingActionButton(
|
|
onPressed: () {
|
|
onSavePressed(nameController.text);
|
|
Navigator.of(context).pop();
|
|
},
|
|
child: Icon(Icons.save),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|