60 lines
1.6 KiB
Dart
Raw Normal View History

2022-07-22 09:42:10 +08:00
import 'package:flutter/material.dart';
2022-08-03 10:24:14 +08:00
import 'single_board_list_example.dart';
import 'multi_board_list_example.dart';
2022-07-22 09:42:10 +08:00
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
2022-08-03 10:24:14 +08:00
int _currentIndex = 0;
final _bottomNavigationColor = Colors.blue;
final List<Widget> _examples = [
const MultiBoardListExample(),
const SingleBoardListExample(),
];
2022-07-22 09:42:10 +08:00
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
2022-08-03 10:24:14 +08:00
appBar: AppBar(
2022-08-08 17:12:34 +08:00
title: const Text('AppFlowy Board'),
2022-08-03 10:24:14 +08:00
),
2022-09-30 20:44:41 +08:00
body: Container(color: Colors.white, child: _examples[_currentIndex]),
2022-08-03 10:24:14 +08:00
bottomNavigationBar: BottomNavigationBar(
fixedColor: _bottomNavigationColor,
showSelectedLabels: true,
showUnselectedLabels: false,
currentIndex: _currentIndex,
items: [
BottomNavigationBarItem(
icon: Icon(Icons.grid_on, color: _bottomNavigationColor),
2022-08-08 17:12:34 +08:00
label: "MultiColumn"),
2022-08-03 10:24:14 +08:00
BottomNavigationBarItem(
icon: Icon(Icons.grid_on, color: _bottomNavigationColor),
2022-08-08 17:12:34 +08:00
label: "SingleColumn"),
2022-08-03 10:24:14 +08:00
],
onTap: (int index) {
setState(() {
_currentIndex = index;
});
},
)),
2022-07-22 09:42:10 +08:00
);
}
}