2020-06-28 00:39:45 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2020-06-30 22:51:32 +02:00
|
|
|
import 'package:jisho_study_tool/screens/kanji_search.dart';
|
2020-07-09 22:17:10 +02:00
|
|
|
import 'package:jisho_study_tool/screens/log.dart';
|
|
|
|
import 'package:jisho_study_tool/screens/search.dart';
|
2020-06-28 00:39:45 +02:00
|
|
|
|
|
|
|
void main() => runApp(MyApp());
|
|
|
|
|
|
|
|
class MyApp extends StatelessWidget {
|
|
|
|
// This widget is the root of your application.
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return MaterialApp(
|
2020-07-09 20:06:48 +02:00
|
|
|
title: 'Jisho Study Tool',
|
2020-06-28 00:39:45 +02:00
|
|
|
theme: ThemeData(
|
|
|
|
primarySwatch: Colors.blue,
|
|
|
|
),
|
|
|
|
home: Home(),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class Home extends StatefulWidget {
|
|
|
|
@override
|
|
|
|
_HomeState createState() => _HomeState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _HomeState extends State<Home> {
|
|
|
|
int _selectedPage = 0;
|
|
|
|
|
|
|
|
@override
|
2020-07-09 20:59:00 +02:00
|
|
|
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,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
2020-06-30 22:51:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
List<BottomNavigationBarItem> navBar = [
|
|
|
|
BottomNavigationBarItem(
|
|
|
|
title: Text('Search'),
|
2020-07-09 20:59:00 +02:00
|
|
|
icon: Icon(Icons.search),
|
2020-06-30 22:51:32 +02:00
|
|
|
),
|
|
|
|
BottomNavigationBarItem(
|
|
|
|
title: Text('Kanji'),
|
|
|
|
icon: Text(
|
|
|
|
'漢',
|
2020-07-09 20:59:00 +02:00
|
|
|
style: TextStyle(fontSize: 18),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
BottomNavigationBarItem(
|
|
|
|
title: Text('Log'),
|
|
|
|
icon: Icon(Icons.bookmark),
|
2020-06-30 22:51:32 +02:00
|
|
|
),
|
|
|
|
BottomNavigationBarItem(
|
|
|
|
title: Text('Memorize'),
|
2020-07-09 20:59:00 +02:00
|
|
|
icon: Icon(Icons.local_offer),
|
2020-06-30 22:51:32 +02:00
|
|
|
),
|
|
|
|
BottomNavigationBarItem(
|
|
|
|
title: Text('Settings'),
|
2020-07-09 20:59:00 +02:00
|
|
|
icon: Icon(Icons.settings),
|
2020-06-30 22:51:32 +02:00
|
|
|
),
|
|
|
|
];
|
|
|
|
|
|
|
|
class Page {
|
|
|
|
String title;
|
|
|
|
Widget content;
|
|
|
|
|
2020-07-09 20:59:00 +02:00
|
|
|
Page({this.title, this.content});
|
2020-06-30 22:51:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
List<Page> pages = [
|
|
|
|
Page(
|
|
|
|
title: "Search",
|
2020-07-09 22:17:10 +02:00
|
|
|
content: SearchView(),
|
2020-06-30 22:51:32 +02:00
|
|
|
),
|
|
|
|
Page(
|
|
|
|
title: "Kanji",
|
2020-07-09 22:17:10 +02:00
|
|
|
content: KanjiView(),
|
2020-07-09 20:59:00 +02:00
|
|
|
),
|
|
|
|
Page(
|
|
|
|
title: "Log",
|
2020-07-09 22:17:10 +02:00
|
|
|
content: LogView(),
|
2020-06-30 22:51:32 +02:00
|
|
|
),
|
|
|
|
Page(
|
|
|
|
title: "Memorization",
|
2020-07-09 20:59:00 +02:00
|
|
|
content: Container(),
|
2020-06-30 22:51:32 +02:00
|
|
|
),
|
|
|
|
Page(
|
|
|
|
title: "Settings",
|
2020-07-09 20:59:00 +02:00
|
|
|
content: Container(),
|
2020-06-30 22:51:32 +02:00
|
|
|
),
|
2020-07-09 20:59:00 +02:00
|
|
|
];
|