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

Add log page

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

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