From 898f870b549cdc17577a375520276a8e6e1da3ef Mon Sep 17 00:00:00 2001 From: "mr.mojtaba" Date: Mon, 30 Jun 2025 08:51:11 +0330 Subject: [PATCH] fix : new bottom sheet --- .../lib/presentation/pages/root/view.dart | 208 ++++++------------ .../lib/presentation/common/app_fonts.dart | 22 +- .../bottom_navigation_1.dart | 82 ------- .../r_bottom_navigation.dart | 69 ++++++ .../core/lib/presentation/widget/widget.dart | 2 +- .../lib/presentation/page/root/view.dart | 8 +- 6 files changed, 157 insertions(+), 234 deletions(-) delete mode 100644 packages/core/lib/presentation/widget/bottom_navigation/bottom_navigation_1.dart create mode 100644 packages/core/lib/presentation/widget/bottom_navigation/r_bottom_navigation.dart diff --git a/packages/chicken/lib/presentation/pages/root/view.dart b/packages/chicken/lib/presentation/pages/root/view.dart index 3faa439..a461e6b 100644 --- a/packages/chicken/lib/presentation/pages/root/view.dart +++ b/packages/chicken/lib/presentation/pages/root/view.dart @@ -14,89 +14,69 @@ class RootPage extends GetView { body: IndexedStack( children: [ Navigator( - key: Get.nestedKey(0), - onGenerateRoute: (settings) => - GetPageRoute(page: () => controller.pages[0]), + key: Get.nestedKey(0), + onGenerateRoute: (settings) => GetPageRoute(page: () => controller.pages[0]), ), Navigator( key: Get.nestedKey(1), onGenerateRoute: (settings) { final page = ChickenPages.pages.firstWhere( - (e) => e.name == settings.name, - orElse: () => ChickenPages.pages.firstWhere( - (e) => e.name == ChickenRoutes.outOfProvince, - ), + (e) => e.name == settings.name, + orElse: () => ChickenPages.pages.firstWhere((e) => e.name == ChickenRoutes.outOfProvince), ); return buildRouteFromGetPage(page); - }, ), Navigator( key: Get.nestedKey(2), - onGenerateRoute: (settings) => - GetPageRoute(page: () => controller.pages[2]), + onGenerateRoute: (settings) => GetPageRoute(page: () => controller.pages[2]), ), Navigator( key: Get.nestedKey(3), - onGenerateRoute: (settings) => - GetPageRoute(page: () => controller.pages[3]), + onGenerateRoute: (settings) => GetPageRoute(page: () => controller.pages[3]), ), Navigator( key: Get.nestedKey(4), - onGenerateRoute: (settings) => - GetPageRoute(page: () => controller.pages[4]), + onGenerateRoute: (settings) => GetPageRoute(page: () => controller.pages[4]), ), ], index: data.value, ), - bottomNavigationBar: WaveBottomNavigation( - initPage: controller.currentPage.value, + + bottomNavigationBar: RBottomNavigation( items: [ - WaveBottomNavigationItem( - title: 'خرید', - icon: Assets.vec.buySvg.svg( - width: 32, - height: 32, - colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn), - ), + RBottomNavigationItem( + label: 'خرید', + icon: Assets.vec.buySvg.path, + isSelected: controller.currentPage.value == 0, + onTap: () => controller.changePage(0), ), - WaveBottomNavigationItem( - title: 'فروش', - icon: Assets.vec.saleSvg.svg( - width: 32, - height: 32, - colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn), - ), + RBottomNavigationItem( + label: 'فروش', + icon: Assets.vec.saleSvg.path, + isSelected: controller.currentPage.value == 1, + onTap: () => controller.changePage(1), ), - WaveBottomNavigationItem( - title: 'خانه', - icon: Assets.vec.homeSvg.svg( - width: 32, - height: 32, - colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn), - ), + RBottomNavigationItem( + label: 'خانه', + icon: Assets.vec.homeSvg.path, + isSelected: controller.currentPage.value == 2, + onTap: () => controller.changePage(2), ), - WaveBottomNavigationItem( - title: 'قطعه بندی', - icon: Assets.vec.convertCubeSvg.svg( - width: 32, - height: 32, - colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn), - ), + RBottomNavigationItem( + label: 'قطعه بندی', + icon: Assets.vec.convertCubeSvg.path, + isSelected: controller.currentPage.value == 3, + onTap: () => controller.changePage(3), ), - WaveBottomNavigationItem( - title: 'پروفایل', - icon: Assets.vec.userSvg.svg( - width: 32, - height: 32, - colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn), - ), + RBottomNavigationItem( + label: 'پروفایل', + icon: Assets.vec.profileCircleSvg.path, + isSelected: controller.currentPage.value == 4, + onTap: () => controller.changePage(4), ), ], - onPageChanged: (index) { - controller.changePage(index); - }, ), ); }, controller.currentPage); @@ -106,10 +86,7 @@ class RootPage extends GetView { return Container( height: 70, width: Get.width / 2, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(8), - ), + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(8)), clipBehavior: Clip.hardEdge, child: Row( children: [ @@ -130,9 +107,7 @@ class RootPage extends GetView { Text( 'بارهای امروز', textAlign: TextAlign.right, - style: AppFonts.yekan14.copyWith( - color: AppColor.blueNormal, - ), + style: AppFonts.yekan14.copyWith(color: AppColor.blueNormal), ), ], ), @@ -182,26 +157,19 @@ class RootPage extends GetView { height: 82, decoration: BoxDecoration( color: bgLabelColor, - borderRadius: BorderRadius.only( - topRight: Radius.circular(8), - bottomRight: Radius.circular(8), - ), + borderRadius: BorderRadius.only(topRight: Radius.circular(8), bottomRight: Radius.circular(8)), ), child: Column( mainAxisAlignment: MainAxisAlignment.center, spacing: 4, children: [ - SvgGenImage.vec(iconPath).svg( - width: 24, - height: 24, - colorFilter: ColorFilter.mode(iconColor, BlendMode.srcIn), - ), + SvgGenImage.vec( + iconPath, + ).svg(width: 24, height: 24, colorFilter: ColorFilter.mode(iconColor, BlendMode.srcIn)), Text( title, textAlign: TextAlign.right, - style: AppFonts.yekan14.copyWith( - color: AppColor.mediumGreyDarkActive, - ), + style: AppFonts.yekan14.copyWith(color: AppColor.mediumGreyDarkActive), ), ], ), @@ -212,10 +180,7 @@ class RootPage extends GetView { child: Container( decoration: BoxDecoration( color: bgDescriptionColor, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(8), - bottomLeft: Radius.circular(8), - ), + borderRadius: BorderRadius.only(topLeft: Radius.circular(8), bottomLeft: Radius.circular(8)), ), child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -224,16 +189,12 @@ class RootPage extends GetView { Text( description, textAlign: TextAlign.right, - style: AppFonts.yekan16.copyWith( - color: AppColor.mediumGreyDarkActive, - ), + style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkActive), ), Text( unit, textAlign: TextAlign.center, - style: AppFonts.yekan12.copyWith( - color: AppColor.mediumGreyDarkActive, - ), + style: AppFonts.yekan12.copyWith(color: AppColor.mediumGreyDarkActive), ), ], ), @@ -278,23 +239,17 @@ class RootPage extends GetView { Text( title, textAlign: TextAlign.right, - style: AppFonts.yekan14.copyWith( - color: AppColor.mediumGreyDarkActive, - ), + style: AppFonts.yekan14.copyWith(color: AppColor.mediumGreyDarkActive), ), Text( description, textAlign: TextAlign.right, - style: AppFonts.yekan16.copyWith( - color: AppColor.mediumGreyDarkActive, - ), + style: AppFonts.yekan16.copyWith(color: AppColor.mediumGreyDarkActive), ), Text( unit, textAlign: TextAlign.center, - style: AppFonts.yekan12.copyWith( - color: AppColor.mediumGreyDarkActive, - ), + style: AppFonts.yekan12.copyWith(color: AppColor.mediumGreyDarkActive), ), ], ), @@ -313,11 +268,9 @@ class RootPage extends GetView { ), ), child: Center( - child: SvgGenImage.vec(iconPath).svg( - width: 24, - height: 24, - colorFilter: ColorFilter.mode(iconColor, BlendMode.srcIn), - ), + child: SvgGenImage.vec( + iconPath, + ).svg(width: 24, height: 24, colorFilter: ColorFilter.mode(iconColor, BlendMode.srcIn)), ), ), ), @@ -326,11 +279,7 @@ class RootPage extends GetView { ); } - Widget widelyUsed({ - required String title, - required String iconPath, - required VoidCallback onTap, - }) { + Widget widelyUsed({required String title, required String iconPath, required VoidCallback onTap}) { return Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.start, @@ -342,18 +291,14 @@ class RootPage extends GetView { padding: EdgeInsets.all(4), decoration: ShapeDecoration( color: const Color(0xFFBECDFF), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - ), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), ), child: Container( width: 40, height: 40, decoration: ShapeDecoration( color: AppColor.blueNormal, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - ), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), ), child: SvgGenImage.vec(iconPath).svg( width: 24, @@ -363,10 +308,7 @@ class RootPage extends GetView { ), ), ), - Text( - title, - style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal), - ), + Text(title, style: AppFonts.yekan10.copyWith(color: AppColor.blueNormal)), ], ); } @@ -383,24 +325,16 @@ class RootPage extends GetView { padding: EdgeInsets.all(4), decoration: ShapeDecoration( color: const Color(0xFFD9F7F0), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(8), - ), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), ), child: Assets.vec.messageAddSvg.svg( width: 40, height: 40, - colorFilter: ColorFilter.mode( - AppColor.greenNormal, - BlendMode.srcIn, - ), + colorFilter: ColorFilter.mode(AppColor.greenNormal, BlendMode.srcIn), fit: BoxFit.cover, ), ), - Text( - 'افزودن', - style: AppFonts.yekan10.copyWith(color: AppColor.greenDarkHover), - ), + Text('افزودن', style: AppFonts.yekan10.copyWith(color: AppColor.greenDarkHover)), ], ); } @@ -547,9 +481,7 @@ class RootPage extends GetView { child: Text( title, textAlign: TextAlign.right, - style: AppFonts.yekan14.copyWith( - color: AppColor.darkGreyDarkHover, - ), + style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover), ), ), Flexible( @@ -557,9 +489,7 @@ class RootPage extends GetView { child: Text( value, textAlign: TextAlign.center, - style: AppFonts.yekan14.copyWith( - color: AppColor.darkGreyDarkHover, - ), + style: AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover), ), ), ], @@ -585,30 +515,18 @@ class RootPage extends GetView { Text( 'اطلاعات ارسالی', textAlign: TextAlign.right, - style: AppFonts.yekan16Bold.copyWith( - color: AppColor.blueNormal, - ), + style: AppFonts.yekan16Bold.copyWith(color: AppColor.blueNormal), ), const SizedBox(height: 12), - buildRow( - 'فروش و توزیع داخل استان (کیلوگرم)', - model.stewardAllocationsWeight!.toInt().toString(), - ), - buildRow( - 'فروش و توزیع خارج استان (کیلوگرم)', - model.freeSalesWeight!.toInt().toString(), - ), + buildRow('فروش و توزیع داخل استان (کیلوگرم)', model.stewardAllocationsWeight!.toInt().toString()), + buildRow('فروش و توزیع خارج استان (کیلوگرم)', model.freeSalesWeight!.toInt().toString()), ], ) : const Center(child: CircularProgressIndicator()), ); } - Widget cardWidget({ - required String title, - required String iconPath, - required VoidCallback onTap, - }) { + Widget cardWidget({required String title, required String iconPath, required VoidCallback onTap}) { return Container( width: Get.width / 4, height: 130, diff --git a/packages/core/lib/presentation/common/app_fonts.dart b/packages/core/lib/presentation/common/app_fonts.dart index c850c32..a4d3f7c 100644 --- a/packages/core/lib/presentation/common/app_fonts.dart +++ b/packages/core/lib/presentation/common/app_fonts.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; class AppFonts { AppFonts._(); // Private constructor to prevent instantiation @@ -173,6 +174,15 @@ class AppFonts { height: _height, ); + + static const TextStyle yekan14Bold = TextStyle( + fontFamily: yekan, + fontWeight: bold, // Use bold weight + fontSize: 13, + height: _height, + ); + + static const TextStyle yekan13Bold = TextStyle( fontFamily: yekan, fontWeight: bold, // Use bold weight @@ -180,10 +190,18 @@ class AppFonts { height: _height, ); - static const TextStyle yekan10Bold = TextStyle( + static TextStyle yekan12Bold = TextStyle( fontFamily: yekan, fontWeight: bold, // Use bold weight - fontSize: 10, + fontSize: 12.sp, + height: _height, + ); + + + static TextStyle yekan10Bold = TextStyle( + fontFamily: yekan, + fontWeight: bold, // Use bold weight + fontSize: 10.sp, height: _height, ); } diff --git a/packages/core/lib/presentation/widget/bottom_navigation/bottom_navigation_1.dart b/packages/core/lib/presentation/widget/bottom_navigation/bottom_navigation_1.dart deleted file mode 100644 index b5c569e..0000000 --- a/packages/core/lib/presentation/widget/bottom_navigation/bottom_navigation_1.dart +++ /dev/null @@ -1,82 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:rasadyar_core/core.dart'; - -class BottomNavigation1 extends StatefulWidget { - const BottomNavigation1({super.key, required this.items}); - - final List items; - - @override - State createState() => _BottomNavigation1State(); -} - -class _BottomNavigation1State extends State { - @override - Widget build(BuildContext context) { - return Container( - height: 90, - padding: EdgeInsets.fromLTRB(50, 10, 50, 10), - decoration: BoxDecoration( - color: AppColor.blueNormal, - borderRadius: const BorderRadius.only( - topLeft: Radius.circular(50), - topRight: Radius.circular(50), - ), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: widget.items, - ), - ); - } -} - -class BottomNavigation1Item extends StatelessWidget { - final String icon; - final String label; - final bool isSelected; - final Function() onTap; - - const BottomNavigation1Item({ - super.key, - required this.icon, - required this.label, - required this.isSelected, - required this.onTap, - }); - - @override - Widget build(BuildContext context) { - return Container( - width: 80, - height: 80, - padding: const EdgeInsets.symmetric(horizontal: 10), - decoration: BoxDecoration( - color: isSelected ? Colors.white.withAlpha(208) : Colors.transparent, - borderRadius: BorderRadius.circular(10), - ), - child: InkWell( - onTap: onTap, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - SvgGenImage.vec(icon).svg( - width: 32, - height: 32, - colorFilter: ColorFilter.mode( - isSelected ? AppColor.blueNormal : Colors.white, - BlendMode.srcIn) - ), - const SizedBox(height: 5), - Text( - label, - style: AppFonts.yekan10.copyWith( - color: isSelected ? AppColor.blueNormal : Colors.white, - ), - ), - ], - ), - ), - ); - } -} diff --git a/packages/core/lib/presentation/widget/bottom_navigation/r_bottom_navigation.dart b/packages/core/lib/presentation/widget/bottom_navigation/r_bottom_navigation.dart new file mode 100644 index 0000000..0d91e27 --- /dev/null +++ b/packages/core/lib/presentation/widget/bottom_navigation/r_bottom_navigation.dart @@ -0,0 +1,69 @@ +import 'package:flutter/material.dart'; +import 'package:rasadyar_core/core.dart'; + +class RBottomNavigation extends StatefulWidget { + const RBottomNavigation({super.key, required this.items}); + + final List items; + + @override + State createState() => _RBottomNavigationState(); +} + +class _RBottomNavigationState extends State { + @override + Widget build(BuildContext context) { + return Container( + height: 100.h, + padding: EdgeInsets.symmetric(horizontal: 11.w, vertical: 18.h), + decoration: BoxDecoration( + color: AppColor.blueNormal, + borderRadius: const BorderRadius.only(topLeft: Radius.circular(32), topRight: Radius.circular(32)), + ), + child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: widget.items), + ); + } +} + +class RBottomNavigationItem extends StatelessWidget { + final String icon; + final String label; + final bool isSelected; + final Function() onTap; + + const RBottomNavigationItem({ + super.key, + required this.icon, + required this.label, + required this.isSelected, + required this.onTap, + }); + + @override + Widget build(BuildContext context) { + return Container( + width: 70.w, + height: 70.h, + padding: const EdgeInsets.symmetric(horizontal: 10), + decoration: BoxDecoration( + color: isSelected ? Colors.white.withAlpha(208) : Colors.transparent, + borderRadius: BorderRadius.circular(10), + ), + child: InkWell( + onTap: onTap, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SvgGenImage.vec(icon).svg( + width: 40.w, + height: 40.h, + colorFilter: ColorFilter.mode(isSelected ? AppColor.blueNormal : Colors.white, BlendMode.srcIn), + ), + SizedBox(height: 5.h), + Text(label, style: AppFonts.yekan10.copyWith(color: isSelected ? AppColor.blueNormal : Colors.white)), + ], + ), + ), + ); + } +} diff --git a/packages/core/lib/presentation/widget/widget.dart b/packages/core/lib/presentation/widget/widget.dart index 20d3bdd..5b5cc6c 100644 --- a/packages/core/lib/presentation/widget/widget.dart +++ b/packages/core/lib/presentation/widget/widget.dart @@ -1,5 +1,5 @@ export 'app_bar/r_app_bar.dart'; -export 'bottom_navigation/bottom_navigation_1.dart'; +export 'bottom_navigation/r_bottom_navigation.dart'; export 'bottom_navigation/wave_bottom_navigation.dart'; export 'buttons/elevated.dart'; export 'buttons/outline_elevated.dart'; diff --git a/packages/livestock/lib/presentation/page/root/view.dart b/packages/livestock/lib/presentation/page/root/view.dart index f506375..1951ca1 100644 --- a/packages/livestock/lib/presentation/page/root/view.dart +++ b/packages/livestock/lib/presentation/page/root/view.dart @@ -44,23 +44,23 @@ class RootPage extends GetView { sizing: StackFit.expand, ), extendBody: true, - bottomNavigationBar: BottomNavigation1( + bottomNavigationBar: RBottomNavigation( items: [ - BottomNavigation1Item( + RBottomNavigationItem( icon: Assets.vec.filterSvg.path, label: 'درخواست‌ها', isSelected: currentIndex.value == 0, onTap: () => controller.changePage(0), ), - BottomNavigation1Item( + RBottomNavigationItem( icon: Assets.vec.mapSvg.path, label: 'نقشه', isSelected: currentIndex.value == 1, onTap: () => controller.changePage(1), ), - BottomNavigation1Item( + RBottomNavigationItem( icon: Assets.vec.profileUserSvg.path, label: 'پروفایل', isSelected: currentIndex.value == 2,