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.
58 lines
1.5 KiB
58 lines
1.5 KiB
2 years ago
|
part of '../neon_news.dart';
|
||
2 years ago
|
|
||
|
class NewsMoveFeedDialog extends StatefulWidget {
|
||
|
const NewsMoveFeedDialog({
|
||
|
required this.folders,
|
||
|
required this.feed,
|
||
|
super.key,
|
||
|
});
|
||
|
|
||
2 years ago
|
final List<NextcloudNewsFolder> folders;
|
||
|
final NextcloudNewsFeed feed;
|
||
2 years ago
|
|
||
|
@override
|
||
|
State<NewsMoveFeedDialog> createState() => _NewsMoveFeedDialogState();
|
||
|
}
|
||
|
|
||
|
class _NewsMoveFeedDialogState extends State<NewsMoveFeedDialog> {
|
||
|
final formKey = GlobalKey<FormState>();
|
||
|
|
||
2 years ago
|
NextcloudNewsFolder? folder;
|
||
2 years ago
|
|
||
|
void submit() {
|
||
|
if (formKey.currentState!.validate()) {
|
||
|
Navigator.of(context).pop([folder?.id]);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
Widget build(final BuildContext context) => CustomDialog(
|
||
|
title: Text(AppLocalizations.of(context).newsMoveFeed),
|
||
|
children: [
|
||
|
Form(
|
||
|
key: formKey,
|
||
|
child: Column(
|
||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||
|
children: [
|
||
|
NewsFolderSelect(
|
||
|
folders: widget.folders,
|
||
|
value: widget.feed.folderId != null
|
||
|
? widget.folders.singleWhere((final folder) => folder.id == widget.feed.folderId)
|
||
|
: null,
|
||
|
onChanged: (final f) {
|
||
|
setState(() {
|
||
|
folder = f;
|
||
|
});
|
||
|
},
|
||
|
),
|
||
|
ElevatedButton(
|
||
|
onPressed: submit,
|
||
|
child: Text(AppLocalizations.of(context).newsMoveFeed),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
);
|
||
|
}
|