78 lines
2.0 KiB
Dart
78 lines
2.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../widgets/app_background.dart';
|
|
import '../widgets/floatingnavbar.dart';
|
|
import '../screens/attendence_screen.dart';
|
|
import '../screens/finance_screen.dart';
|
|
import '../screens/holiday_screen.dart';
|
|
|
|
class MainPage extends StatefulWidget {
|
|
const MainPage({super.key});
|
|
|
|
@override
|
|
State<MainPage> createState() => _MainPageState();
|
|
}
|
|
|
|
class _MainPageState extends State<MainPage> {
|
|
int _currentIndex = 0;
|
|
|
|
Widget _buildScreen() {
|
|
switch (_currentIndex) {
|
|
case 0:
|
|
return const AttendanceScreen();
|
|
case 1:
|
|
return const FinanceScreen(); // no need for scroll callback anymore
|
|
case 2:
|
|
return const HolidayScreen(); // SettingsBar is inside the screen now
|
|
default:
|
|
return const AttendanceScreen();
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: Stack(
|
|
children: [
|
|
/// BACKGROUND
|
|
const AppBackground(child: SizedBox()),
|
|
|
|
/// ACTIVE SCREEN (fills everything except navbar area)
|
|
Positioned.fill(
|
|
bottom: 100, // space for floating navbar
|
|
child: _buildScreen(),
|
|
),
|
|
|
|
/// FLOATING NAVBAR
|
|
Positioned(
|
|
left: 0,
|
|
right: 0,
|
|
bottom: 20,
|
|
child: Floatingnavbar(
|
|
items: [
|
|
NavBarItem(
|
|
iconPath: 'assets/images/attendance.svg',
|
|
label: 'الحضور',
|
|
),
|
|
NavBarItem(
|
|
iconPath: 'assets/images/finance.svg',
|
|
label: 'المالية',
|
|
),
|
|
NavBarItem(
|
|
iconPath: 'assets/images/holiday.svg',
|
|
label: 'الإجازة',
|
|
),
|
|
],
|
|
selectedIndex: _currentIndex,
|
|
onTap: (index) {
|
|
setState(() {
|
|
_currentIndex = index;
|
|
});
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|