feat:mai page done

This commit is contained in:
jahongireshonqulov
2025-11-01 14:30:56 +05:00
parent 4acc409de0
commit 44878e79b3
81 changed files with 4976 additions and 244 deletions

View File

@@ -0,0 +1,68 @@
import 'package:food_delivery_client/feature/main/presentation/pages/main_page/widgtes/w_bottom_navbar_item.dart';
import '../../../../../food_delivery_client.dart';
class MainPage extends StatelessWidget with MainPageMixins {
MainPage({super.key});
@override
Widget build(BuildContext context) {
final List<String> inActiveIcons = [
context.appThemeIcons.icHome,
context.appThemeIcons.icDiscover,
context.appThemeIcons.icCart1,
context.appThemeIcons.icTransactions,
context.appThemeIcons.icProfile,
];
final List<String> titles = [
context.loc.home,
context.loc.discover,
context.loc.cart,
context.loc.transactions,
context.loc.profile,
];
return BlocProvider(
create: (context) => sl<MainBloc>(),
child: BlocBuilder<MainBloc, MainState>(
builder: (context, state) {
return Scaffold(
body: IndexedStack(index: state.currentIndex, children: pages),
bottomNavigationBar: DecoratedBox(
decoration: BoxDecoration(
color: context.appThemeColors.iconColor,
boxShadow: [
BoxShadow(
blurStyle: BlurStyle.inner,
spreadRadius: 0,
color: AppColors.cA7AEC1.newWithOpacity(.15),
blurRadius: 80,
offset: const Offset(0, 4),
),
],
),
child: BottomNavigationBar(
onTap: (value) {
context.read<MainBloc>().add(MainEvent.loaded(value));
},
currentIndex: state.currentIndex,
items: List.generate(titles.length, (index) {
return BottomNavigationBarItem(
label: titles[index],
tooltip: "",
icon: WBottomNavbarItem(
iconPath: inActiveIcons[index],
activeIconPath: activeIcons[index],
title: titles[index],
isActive: index == state.currentIndex,
),
);
}),
),
),
);
},
),
);
}
}

View File

@@ -0,0 +1,56 @@
import '../../../../../../food_delivery_client.dart';
class WBottomNavbarItem extends StatelessWidget {
const WBottomNavbarItem({
super.key,
required this.iconPath,
required this.activeIconPath,
required this.title,
required this.isActive,
});
final String iconPath;
final String activeIconPath;
final String title;
final bool isActive;
@override
Widget build(BuildContext context) {
return Column(
children: [
SizedBox(
height: 24,
width: 24,
child: SvgPicture.asset(
isActive ? activeIconPath : iconPath,
fit: BoxFit.cover,
),
),
8.verticalSpace,
if (!isActive)
Text(
title,
style: AppTextStyles.size12Medium.copyWith(
height: 1.3,
color: context.appThemeColors.inActiveColor1,
),
),
if (isActive)
ShaderMask(
shaderCallback: (bounds) => AppUtils.kGradient.createShader(
Rect.fromLTWH(0, 0, bounds.width, bounds.height),
),
child: Text(
title,
style: AppTextStyles.size12Medium.copyWith(
height: 1.3,
color: isActive
? AppColors.cFFFFFF
: context.appThemeColors.inActiveColor1,
),
),
),
],
);
}
}