Add log page

JST-11
Oystein Kristoffer Tveit 2020-07-09 20:59:00 +02:00
parent b8130cb6b9
commit 8dab9e5cb9
2 changed files with 41 additions and 40 deletions

View File

@ -20,59 +20,59 @@ class MyApp extends StatelessWidget {
class Home extends StatefulWidget { class Home extends StatefulWidget {
@override @override
_HomeState createState() => _HomeState(); _HomeState createState() => _HomeState();
} }
class _HomeState extends State<Home> { class _HomeState extends State<Home> {
int _selectedPage = 0; int _selectedPage = 0;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(pages[_selectedPage].title), title: Text(pages[_selectedPage].title),
centerTitle: true, centerTitle: true,
), ),
body: pages[_selectedPage].content, body: pages[_selectedPage].content,
bottomNavigationBar: BottomNavigationBar( bottomNavigationBar: BottomNavigationBar(
currentIndex: _selectedPage, currentIndex: _selectedPage,
onTap: (int index) { onTap: (int index) {
setState(() { setState(() {
_selectedPage = index; _selectedPage = index;
}); });
}, },
items: navBar, items: navBar,
showSelectedLabels: false, showSelectedLabels: false,
showUnselectedLabels: false, showUnselectedLabels: false,
unselectedItemColor: Colors.blue, unselectedItemColor: Colors.blue,
selectedItemColor: Colors.green, selectedItemColor: Colors.green,
), ),
); );
} }
} }
List<BottomNavigationBarItem> navBar = [ List<BottomNavigationBarItem> navBar = [
BottomNavigationBarItem( BottomNavigationBarItem(
title: Text('Search'), title: Text('Search'),
icon: Icon(Icons.search) icon: Icon(Icons.search),
), ),
BottomNavigationBarItem( BottomNavigationBarItem(
title: Text('Kanji'), title: Text('Kanji'),
icon: Text( icon: Text(
'', '',
style: TextStyle( style: TextStyle(fontSize: 18),
fontSize: 18 ),
), ),
) BottomNavigationBarItem(
title: Text('Log'),
icon: Icon(Icons.bookmark),
), ),
BottomNavigationBarItem( BottomNavigationBarItem(
title: Text('Memorize'), title: Text('Memorize'),
icon: Icon(Icons.local_offer) icon: Icon(Icons.local_offer),
), ),
BottomNavigationBarItem( BottomNavigationBarItem(
title: Text('Settings'), title: Text('Settings'),
icon: Icon(Icons.settings) icon: Icon(Icons.settings),
), ),
]; ];
@ -80,27 +80,28 @@ class Page {
String title; String title;
Widget content; Widget content;
Page({ Page({this.title, this.content});
this.title,
this.content
});
} }
List<Page> pages = [ List<Page> pages = [
Page( Page(
title: "Search", title: "Search",
content: Container() content: Container(),
), ),
Page( Page(
title: "Kanji", title: "Kanji",
content: KanjiSearch() content: KanjiSearch(),
),
Page(
title: "Log",
content: Container(),
), ),
Page( Page(
title: "Memorization", title: "Memorization",
content: Container() content: Container(),
), ),
Page( Page(
title: "Settings", title: "Settings",
content: Container() content: Container(),
), ),
]; ];

0
lib/screens/log.dart Normal file
View File