You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.5 KiB
Dart
65 lines
1.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:workinghours/widgets/monthly/monthlyScreen.dart';
|
|
import 'package:workinghours/widgets/yearly/yearlyScreen.dart';
|
|
|
|
class TabsScreen extends StatefulWidget {
|
|
const TabsScreen({super.key});
|
|
|
|
@override
|
|
State<TabsScreen> createState() {
|
|
return _TabsScreenState();
|
|
}
|
|
}
|
|
|
|
class _TabsScreenState extends State<TabsScreen> {
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
}
|
|
|
|
int _selectedPageIndex = 0;
|
|
|
|
void _selectPage(int index) {
|
|
setState(() {
|
|
_selectedPageIndex = index;
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Widget activePage = const MonthlyScreen();
|
|
var activePageTitle = 'Monthly';
|
|
|
|
if (_selectedPageIndex == 1) {
|
|
activePage = const YearlyScreen();
|
|
activePageTitle = 'Yearly';
|
|
}
|
|
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Text(activePageTitle),
|
|
),
|
|
body: activePage,
|
|
bottomNavigationBar: BottomNavigationBar(
|
|
onTap: _selectPage,
|
|
currentIndex: _selectedPageIndex,
|
|
items: const [
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.home),
|
|
// icon: Icon(Icons.tv_outlined),
|
|
label: 'Monthly',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.business),
|
|
// icon: Icon(Icons.movie),
|
|
label: 'Yearly',
|
|
),
|
|
],
|
|
selectedIconTheme: const IconThemeData(opacity: 0.0, size: 0),
|
|
unselectedIconTheme: const IconThemeData(opacity: 0.0, size: 0),
|
|
),
|
|
);
|
|
}
|
|
}
|