Added 'go back' functionality and fileinfos to Fileviewer

This commit is contained in:
2023-02-26 22:24:37 +01:00
parent 0ab44e3046
commit f31f667fd9
6 changed files with 101 additions and 95 deletions

View File

@ -19,6 +19,25 @@ class App extends StatefulWidget {
class _AppState extends State<App> {
int currentPage = 0;
late AppBar _appBar;
void setAppBar(BuildContext context, AppBar? appBar) {
setState(() {
_appBar = appBar ?? AppBar(
title: const Text("Marianum Fulda"),
actions: <Widget>[
IconButton(
padding: const EdgeInsets.only(right: 15),
icon: const Icon(Icons.settings),
onPressed: () {
Navigator.push(context, MaterialPageRoute(builder: (context) => const Settings()));
},
)
],
);
});
setState(() {});
}
@override
void initState() {
@ -33,6 +52,8 @@ class _AppState extends State<App> {
Provider.of<ChatListProps>(context, listen: false).run();
});
setAppBar(context, null);
super.initState();
}
@ -41,18 +62,7 @@ class _AppState extends State<App> {
final PageController pageController = PageController();
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
title: const Text("Marianum Fulda"),
actions: <Widget>[
IconButton(
padding: const EdgeInsets.only(right: 15),
icon: const Icon(Icons.settings),
onPressed: () {
Navigator.push(context, MaterialPageRoute(builder: (context) => const Settings()));
},
)
],
),
appBar: _appBar,
body: Column(
children: [
Visibility(
@ -66,11 +76,11 @@ class _AppState extends State<App> {
Flexible(
child: PageView(
controller: pageController,
children: const [
Timetable(),
ChatList(),
Files(),
Overhang(),
children: [
const Timetable(),
const ChatList(),
Files(setAppBar),
const Overhang(),
],
onPageChanged: (page) {
setState(() {
@ -132,6 +142,7 @@ class _AppState extends State<App> {
currentIndex: currentPage,
onTap: (item) {
setAppBar(context, null);
setState(() {
currentPage = item;
pageController.jumpToPage(item);