forked from eatvio/eatvio_app
167 lines
4.4 KiB
Dart
167 lines
4.4 KiB
Dart
import 'package:eatvio_app/core/app_export.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class CustomBottomBar extends StatefulWidget {
|
|
CustomBottomBar({this.onChanged});
|
|
|
|
Function(BottomBarEnum)? onChanged;
|
|
|
|
@override
|
|
CustomBottomBarState createState() => CustomBottomBarState();
|
|
}
|
|
|
|
class CustomBottomBarState extends State<CustomBottomBar> {
|
|
int selectedIndex = 0;
|
|
|
|
List<BottomMenuModel> bottomMenuList = [
|
|
BottomMenuModel(
|
|
icon: ImageConstant.imgNav,
|
|
activeIcon: ImageConstant.imgNav,
|
|
title: "lbl17".tr,
|
|
type: BottomBarEnum.tf,
|
|
),
|
|
BottomMenuModel(
|
|
icon: ImageConstant.imgNavBlueGray400,
|
|
activeIcon: ImageConstant.imgNavBlueGray400,
|
|
title: "lbl18".tr,
|
|
type: BottomBarEnum.tf,
|
|
),
|
|
BottomMenuModel(
|
|
icon: ImageConstant.imgNavBlueGray40024x23,
|
|
activeIcon: ImageConstant.imgNavBlueGray40024x23,
|
|
title: "lbl19".tr,
|
|
type: BottomBarEnum.tf,
|
|
),
|
|
BottomMenuModel(
|
|
icon: ImageConstant.imgNavPrimary,
|
|
activeIcon: ImageConstant.imgNavPrimary,
|
|
title: "lbl20".tr,
|
|
type: BottomBarEnum.tf,
|
|
),
|
|
BottomMenuModel(
|
|
icon: ImageConstant.imgNavBlueGray40024x25,
|
|
activeIcon: ImageConstant.imgNavBlueGray40024x25,
|
|
title: "lbl21".tr,
|
|
type: BottomBarEnum.tf,
|
|
)
|
|
];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
height: 80.v,
|
|
decoration: BoxDecoration(
|
|
border: Border.all(
|
|
color: appTheme.whiteA700,
|
|
width: 1.h,
|
|
),
|
|
),
|
|
child: BottomNavigationBar(
|
|
backgroundColor: Colors.transparent,
|
|
showSelectedLabels: false,
|
|
showUnselectedLabels: false,
|
|
selectedFontSize: 0,
|
|
elevation: 0,
|
|
currentIndex: selectedIndex,
|
|
type: BottomNavigationBarType.fixed,
|
|
items: List.generate(bottomMenuList.length, (index) {
|
|
return BottomNavigationBarItem(
|
|
icon: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
CustomImageView(
|
|
imagePath: bottomMenuList[index].icon,
|
|
height: 24.v,
|
|
width: 19.h,
|
|
color: appTheme.blueGray400,
|
|
),
|
|
Padding(
|
|
padding: EdgeInsets.only(top: 8.v),
|
|
child: Text(
|
|
bottomMenuList[index].title ?? "",
|
|
style:
|
|
CustomTextStyles.bodySmallMulishBluegray80012.copyWith(
|
|
color: appTheme.blueGray800,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
activeIcon: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
CustomImageView(
|
|
imagePath: bottomMenuList[index].activeIcon,
|
|
height: 24.adaptSize,
|
|
width: 24.adaptSize,
|
|
color: theme.colorScheme.primary,
|
|
),
|
|
Padding(
|
|
padding: EdgeInsets.only(top: 9.v),
|
|
child: Text(
|
|
bottomMenuList[index].title ?? "",
|
|
style: CustomTextStyles.bodySmallMulishPrimary.copyWith(
|
|
color: theme.colorScheme.primary,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
label: '',
|
|
);
|
|
}),
|
|
onTap: (index) {
|
|
selectedIndex = index;
|
|
widget.onChanged?.call(bottomMenuList[index].type);
|
|
setState(() {});
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
enum BottomBarEnum {
|
|
tf,
|
|
}
|
|
|
|
class BottomMenuModel {
|
|
BottomMenuModel({
|
|
required this.icon,
|
|
required this.activeIcon,
|
|
this.title,
|
|
required this.type,
|
|
});
|
|
|
|
String icon;
|
|
|
|
String activeIcon;
|
|
|
|
String? title;
|
|
|
|
BottomBarEnum type;
|
|
}
|
|
|
|
class DefaultWidget extends StatelessWidget {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
color: Colors.white,
|
|
padding: EdgeInsets.all(10),
|
|
child: Center(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Text(
|
|
'Please replace the respective Widget here',
|
|
style: TextStyle(
|
|
fontSize: 18,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|