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.

68 lines
1.5 KiB

part of '../neon_notes.dart';
3 years ago
class NotesMainPage extends StatefulWidget {
const NotesMainPage({
super.key,
});
@override
State<NotesMainPage> createState() => _NotesMainPageState();
}
class _NotesMainPageState extends State<NotesMainPage> {
late NotesBloc bloc;
late int _index = bloc.options.defaultCategoryOption.value.index;
3 years ago
@override
void initState() {
super.initState();
bloc = NeonProvider.of<NotesBloc>(context);
bloc.errors.listen((final error) {
3 years ago
handleNotesException(context, error);
});
}
@override
Widget build(final BuildContext context) {
final views = [
NotesView(
bloc: bloc,
),
NotesCategoriesView(
bloc: bloc,
),
];
final floatingActionButtons = [
NotesFloatingActionButton(bloc: bloc),
null,
];
return Scaffold(
resizeToAvoidBottomInset: false,
bottomNavigationBar: BottomNavigationBar(
currentIndex: _index,
onTap: (final index) {
setState(() {
_index = index;
});
},
items: [
BottomNavigationBarItem(
icon: const Icon(Icons.note),
label: NotesLocalizations.of(context).notes,
),
BottomNavigationBarItem(
icon: const Icon(MdiIcons.tag),
label: NotesLocalizations.of(context).categories,
),
],
),
body: views[_index],
floatingActionButton: floatingActionButtons[_index],
);
}
3 years ago
}