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.

64 lines
1.9 KiB

part of '../neon_news.dart';
3 years ago
class NewsFolderView extends StatefulWidget {
const NewsFolderView({
required this.bloc,
required this.folder,
super.key,
});
final NewsBloc bloc;
final NewsFolder folder;
3 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(
margin: const EdgeInsets.symmetric(horizontal: 15),
3 years ago
child: DropdownButton<DefaultFolderViewType>(
isExpanded: true,
value: _viewType,
items: option.values.keys
3 years ago
.map(
(final key) => DropdownMenuItem<DefaultFolderViewType>(
value: key,
child: Text(option.values[key]!(context)),
3 years ago
),
)
.toList(),
onChanged: (final value) {
setState(() {
_viewType = value!;
});
},
),
),
Expanded(
child: _viewType == DefaultFolderViewType.articles
? NewsArticlesView(
bloc: NewsArticlesBloc(
widget.bloc,
widget.bloc.options,
widget.bloc.account,
3 years ago
id: widget.folder.id,
listType: ListType.folder,
),
newsBloc: widget.bloc,
3 years ago
)
: NewsFeedsView(
bloc: widget.bloc,
folderID: widget.folder.id,
),
),
],
);
}