125 lines
4.3 KiB
Dart
125 lines
4.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:nearle/views/Dashboard/deliveries/deliveries.dart';
|
|
import 'package:nearle/views/Dashboard/home/homepage.dart';
|
|
import 'package:nearle/views/Dashboard/summary/summary.dart';
|
|
import 'package:nearle/views/Dashboard/profile/Profilepage.dart';
|
|
import 'package:nearle/views/helpers/constants/Colorconstants.dart';
|
|
import 'package:nearle/views/helpers/constants/Font_constant.dart';
|
|
class BottomPage extends StatefulWidget {
|
|
final int initialIndex;
|
|
final Widget? overridePage;
|
|
final List<String> acceptedOrders;
|
|
const BottomPage({
|
|
super.key,
|
|
this.initialIndex = 0,
|
|
this.overridePage,
|
|
this.acceptedOrders = const [],
|
|
});
|
|
@override
|
|
State<BottomPage> createState() => _BottomPageState();
|
|
}
|
|
class _BottomPageState extends State<BottomPage> {
|
|
late int selected;
|
|
late final List<Widget> _pages;
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
selected = widget.initialIndex;
|
|
_pages = [
|
|
widget.overridePage ?? const Homepage(),
|
|
const MyDeliveries(),
|
|
const Summary(), // Removed Cartpage - active deliveries now shown in deliveries page banner
|
|
const ProfilePage(),
|
|
];
|
|
}
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Theme(
|
|
data: Theme.of(context).copyWith(
|
|
textTheme: Theme.of(
|
|
context,
|
|
).textTheme.apply(fontFamily: FontConstants.fontFamily),
|
|
),
|
|
child: Scaffold(
|
|
body: IndexedStack(index: selected, children: _pages),
|
|
bottomNavigationBar: Container(
|
|
decoration: const BoxDecoration(
|
|
color: Colors.white,
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.black12,
|
|
blurRadius: 6,
|
|
offset: Offset(0, -2),
|
|
),
|
|
],
|
|
),
|
|
child: BottomNavigationBar(
|
|
backgroundColor: Colors.white,
|
|
currentIndex: selected,
|
|
onTap: (index) => setState(() => selected = index),
|
|
type: BottomNavigationBarType.fixed,
|
|
selectedItemColor: ColorConstants.primaryColor,
|
|
unselectedItemColor: Colors.grey,
|
|
selectedFontSize: 14,
|
|
unselectedFontSize: 12,
|
|
showUnselectedLabels: true,
|
|
items: const [
|
|
BottomNavigationBarItem(
|
|
icon: ImageIcon(
|
|
AssetImage("assets/images/homeicon.png"),
|
|
size: 30,
|
|
color: Colors.grey,
|
|
),
|
|
activeIcon: ImageIcon(
|
|
AssetImage("assets/images/selecthome.png"),
|
|
size: 30,
|
|
color: ColorConstants.primaryColor,
|
|
),
|
|
label: 'HOME',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: ImageIcon(
|
|
AssetImage("assets/images/deliveryicon.png"),
|
|
size: 30,
|
|
color: Colors.grey,
|
|
),
|
|
activeIcon: ImageIcon(
|
|
AssetImage("assets/images/selecteddelivery.png"),
|
|
size: 30,
|
|
color: ColorConstants.primaryColor,
|
|
),
|
|
label: 'DELIVERIES',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: ImageIcon(
|
|
AssetImage("assets/images/summary.png"),
|
|
size: 30,
|
|
color: Colors.grey,
|
|
),
|
|
activeIcon: ImageIcon(
|
|
AssetImage("assets/images/selectedsummary.png"),
|
|
size: 30,
|
|
color: ColorConstants.primaryColor,
|
|
),
|
|
label: 'SUMMARY',
|
|
),
|
|
BottomNavigationBarItem(
|
|
icon: ImageIcon(
|
|
AssetImage("assets/images/profileicon.png"),
|
|
size: 30,
|
|
color: Colors.grey,
|
|
),
|
|
activeIcon: ImageIcon(
|
|
AssetImage("assets/images/selectedprofile.png"),
|
|
size: 30,
|
|
color: ColorConstants.primaryColor,
|
|
),
|
|
label: 'PROFILE',
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} |