1
0
mirror of https://github.com/h7x4/Jisho-Study-Tool.git synced 2024-12-21 13:37:29 +01:00

Make titlebar modular

This commit is contained in:
Oystein Kristoffer Tveit 2020-07-14 12:52:48 +02:00
parent d126f54500
commit 9204ce4cfd
2 changed files with 15 additions and 8 deletions

View File

@ -31,7 +31,7 @@ class _HomeState extends State<Home> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(pages[_selectedPage].title),
title: pages[_selectedPage].titleBar,
centerTitle: true,
),
body: pages[_selectedPage].content,
@ -79,31 +79,31 @@ final List<BottomNavigationBarItem> navBar = [
];
class Page {
String title;
Widget content;
Widget titleBar;
Page({this.title, this.content});
Page({ this.content,this.titleBar,});
}
final List<Page> pages = [
Page(
title: "Search",
content: SearchView(),
titleBar: Text('Search')
),
Page(
title: "Kanji",
content: KanjiView(),
titleBar: KanjiViewBar(),
),
Page(
title: "History",
content: HistoryView(),
titleBar: Text("History"),
),
Page(
title: "Memorization",
content: Container(),
titleBar: Text("Memorization"),
),
Page(
title: "Settings",
content: Container(),
titleBar: Text("Settings"),
),
];

View File

@ -30,6 +30,13 @@ class _KanjiSearchPage extends StatelessWidget {
}
}
class KanjiViewBar extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Text('Kanji');
}
}
class KanjiSearchBar extends StatelessWidget {
@override
Widget build(BuildContext context) {