63 lines
1.8 KiB
Dart
63 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
|
|
import 'package:timetracker/screens/home_screen.dart';
|
|
import 'package:timetracker/screens/tags_screen.dart';
|
|
import 'package:timetracker/screens/report_screen.dart';
|
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
|
|
class MainScreen extends StatefulWidget {
|
|
const MainScreen({super.key});
|
|
|
|
@override
|
|
State<MainScreen> createState() => _MainScreenState();
|
|
}
|
|
|
|
class _MainScreenState extends State<MainScreen> {
|
|
int _selectedIndex = 0;
|
|
|
|
static const List<Widget> _widgetOptions = <Widget>[
|
|
HomeScreen(),
|
|
TagsScreen(),
|
|
ReportScreen(),
|
|
];
|
|
|
|
void _onTabTapped(int index) {
|
|
setState(() {
|
|
_selectedIndex = index;
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return PlatformScaffold(
|
|
body: IndexedStack(index: _selectedIndex, children: _widgetOptions),
|
|
|
|
bottomNavBar: PlatformNavBar(
|
|
currentIndex: _selectedIndex,
|
|
itemChanged: _onTabTapped,
|
|
|
|
items: [
|
|
BottomNavigationBarItem(
|
|
icon: FaIcon(FontAwesomeIcons.clock),
|
|
activeIcon: FaIcon(FontAwesomeIcons.solidClock),
|
|
label: 'Tracking',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(context.platformIcons.tagOutline),
|
|
activeIcon: Icon(context.platformIcons.tagSolid),
|
|
label: 'Tags',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: FaIcon(
|
|
FontAwesomeIcons.chartBar,
|
|
), //Icon(context.platformIcons.bookmarkOutline),
|
|
activeIcon: FaIcon(
|
|
FontAwesomeIcons.solidChartBar,
|
|
), //Icon(context.platformIcons.bookmarkSolid),
|
|
label: 'Reports',
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|