mirror of
https://github.com/immich-app/immich.git
synced 2025-12-16 09:13:13 +03:00
* feat(mobile): create new album from add to modal * refactor: use statefulwidget instead of hook * chore: rename createalbumbutton
54 lines
1.5 KiB
Dart
54 lines
1.5 KiB
Dart
import 'package:easy_localization/easy_localization.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
|
|
|
class NewAlbumNameModal extends StatefulWidget {
|
|
const NewAlbumNameModal({super.key});
|
|
|
|
@override
|
|
State<NewAlbumNameModal> createState() => _NewAlbumNameModalState();
|
|
}
|
|
|
|
class _NewAlbumNameModalState extends State<NewAlbumNameModal> {
|
|
TextEditingController nameController = TextEditingController();
|
|
|
|
@override
|
|
void dispose() {
|
|
nameController.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AlertDialog(
|
|
title: const Text("album_name", style: TextStyle(fontWeight: FontWeight.bold)).tr(),
|
|
content: SingleChildScrollView(
|
|
child: TextFormField(
|
|
controller: nameController,
|
|
textCapitalization: TextCapitalization.words,
|
|
autofocus: true,
|
|
decoration: InputDecoration(hintText: 'name'.tr(), border: const OutlineInputBorder()),
|
|
),
|
|
),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => context.pop(null),
|
|
child: Text(
|
|
"cancel",
|
|
style: TextStyle(color: Colors.red[300], fontWeight: FontWeight.bold),
|
|
).tr(),
|
|
),
|
|
TextButton(
|
|
onPressed: () {
|
|
context.pop(nameController.text.trim());
|
|
},
|
|
child: Text(
|
|
"create_album",
|
|
style: TextStyle(color: context.primaryColor, fontWeight: FontWeight.bold),
|
|
).tr(),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|