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.
65 lines
1.9 KiB
65 lines
1.9 KiB
2 years ago
|
part of '../neon_news.dart';
|
||
2 years ago
|
|
||
|
class NewsFolderView extends StatefulWidget {
|
||
|
const NewsFolderView({
|
||
|
required this.bloc,
|
||
|
required this.folder,
|
||
|
super.key,
|
||
|
});
|
||
|
|
||
|
final NewsBloc bloc;
|
||
2 years ago
|
final NextcloudNewsFolder folder;
|
||
2 years ago
|
|
||
|
@override
|
||
|
State<NewsFolderView> createState() => _NewsFolderViewState();
|
||
|
}
|
||
|
|
||
|
class _NewsFolderViewState extends State<NewsFolderView> {
|
||
|
late final option = widget.bloc.options.defaultFolderViewTypeOption;
|
||
|
late DefaultFolderViewType _viewType = option.value;
|
||
|
|
||
|
@override
|
||
|
Widget build(final BuildContext context) => Column(
|
||
|
children: [
|
||
|
Container(
|
||
2 years ago
|
margin: const EdgeInsets.symmetric(horizontal: 15),
|
||
2 years ago
|
child: DropdownButton<DefaultFolderViewType>(
|
||
|
isExpanded: true,
|
||
|
value: _viewType,
|
||
|
items: option.values.value.keys
|
||
|
.map(
|
||
|
(final key) => DropdownMenuItem<DefaultFolderViewType>(
|
||
|
value: key,
|
||
|
child: Text(option.values.value[key]!(context)),
|
||
|
),
|
||
|
)
|
||
|
.toList(),
|
||
|
onChanged: (final value) {
|
||
|
setState(() {
|
||
|
_viewType = value!;
|
||
|
});
|
||
|
},
|
||
|
),
|
||
|
),
|
||
|
Expanded(
|
||
|
child: _viewType == DefaultFolderViewType.articles
|
||
|
? NewsArticlesView(
|
||
|
bloc: NewsArticlesBloc(
|
||
|
widget.bloc,
|
||
2 years ago
|
widget.bloc.options,
|
||
|
widget.bloc.requestManager,
|
||
|
widget.bloc.client,
|
||
2 years ago
|
id: widget.folder.id,
|
||
|
listType: ListType.folder,
|
||
|
),
|
||
2 years ago
|
newsBloc: widget.bloc,
|
||
2 years ago
|
)
|
||
|
: NewsFeedsView(
|
||
|
bloc: widget.bloc,
|
||
|
folderID: widget.folder.id,
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
);
|
||
|
}
|