98 lines
2.4 KiB
Dart
98 lines
2.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:happy_camper_proto/checklist.dart';
|
|
import 'package:happy_camper_proto/preplist.dart';
|
|
|
|
void main() {
|
|
runApp(const MyApp());
|
|
}
|
|
|
|
class MyApp extends StatelessWidget {
|
|
const MyApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
title: 'Flutter Demo',
|
|
theme: ThemeData(
|
|
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
|
useMaterial3: true,
|
|
),
|
|
home: const MyHomePage(title: 'Flutter Demo Home Page'),
|
|
);
|
|
}
|
|
}
|
|
|
|
class MyHomePage extends StatefulWidget {
|
|
const MyHomePage({super.key, required this.title});
|
|
|
|
final String title;
|
|
|
|
@override
|
|
State<MyHomePage> createState() => _MyHomePageState();
|
|
}
|
|
|
|
class _MyHomePageState extends State<MyHomePage> {
|
|
late Widget page;
|
|
int _selectedPage = 0;
|
|
|
|
List<Preplist> prepLists = Preplist.exampleData();
|
|
|
|
void _showPage(int i) {
|
|
_selectedPage = i;
|
|
switch (_selectedPage) {
|
|
case 0:
|
|
page = PrepPage(prepLists: prepLists);
|
|
break;
|
|
default:
|
|
page = const Center(
|
|
child: Text("Hello World"),
|
|
);
|
|
}
|
|
setState(() {});
|
|
}
|
|
|
|
@override
|
|
void initState() {
|
|
page = PrepPage(prepLists: prepLists);
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
|
title: Text(widget.title),
|
|
),
|
|
body: page,
|
|
bottomNavigationBar: BottomNavigationBar(
|
|
currentIndex: _selectedPage,
|
|
selectedItemColor: Theme.of(context).colorScheme.inversePrimary,
|
|
selectedFontSize:
|
|
(Theme.of(context).textTheme.labelLarge?.fontSize ?? 10) + 1,
|
|
onTap: _showPage,
|
|
items: const [
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.check),
|
|
label: "Prep",
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.checklist),
|
|
label: "Templates",
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.route),
|
|
label: "Route",
|
|
),
|
|
],
|
|
),
|
|
floatingActionButton: FloatingActionButton(
|
|
child: const Icon(Icons.add),
|
|
onPressed: () {},
|
|
),
|
|
floatingActionButtonLocation:
|
|
FloatingActionButtonLocation.miniCenterFloat,
|
|
);
|
|
}
|
|
}
|