From 39fd6383a98b9bd05e31bd3cb95d23ab3130514b Mon Sep 17 00:00:00 2001 From: OkaykOrhmn Date: Thu, 20 Feb 2025 12:19:21 +0330 Subject: [PATCH] fix product page. --- lib/core/routes/app_router.dart | 5 +- .../ui/screens/home/home_page.dart | 5 - .../navigations/categories_mega_menu.dart | 3 - .../widgets/navigations/drop_down_demo2.dart | 264 ------------------ .../ui/widgets/navigations/mega_menu.dart | 44 --- 5 files changed, 2 insertions(+), 319 deletions(-) delete mode 100644 lib/presentation/ui/widgets/navigations/drop_down_demo2.dart delete mode 100644 lib/presentation/ui/widgets/navigations/mega_menu.dart diff --git a/lib/core/routes/app_router.dart b/lib/core/routes/app_router.dart index abc08ac..77c4ef6 100644 --- a/lib/core/routes/app_router.dart +++ b/lib/core/routes/app_router.dart @@ -5,7 +5,6 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:go_router/go_router.dart'; import 'package:proxibuy/presentation/providers/category/cubit/categories_children_cubit.dart'; import 'package:proxibuy/presentation/providers/category/cubit/categories_cubit.dart'; -import 'package:proxibuy/presentation/providers/category/cubit/category_cubit.dart'; import 'package:proxibuy/presentation/providers/user_info_cubit.dart'; import 'package:proxibuy/presentation/ui/screens/auth/auth_page.dart'; import 'package:proxibuy/presentation/ui/screens/home/screens/categories_screen.dart'; @@ -13,8 +12,8 @@ import 'package:proxibuy/presentation/ui/screens/home/screens/explore_screen.dar import 'package:proxibuy/presentation/ui/screens/home/home_page.dart'; import 'package:proxibuy/presentation/ui/screens/home/screens/home_screen.dart'; import 'package:proxibuy/presentation/ui/screens/home/screens/setting_screen.dart'; +import 'package:proxibuy/presentation/ui/screens/product/product_page.dart'; import 'package:proxibuy/presentation/ui/theme/responsive.dart'; -import 'package:proxibuy/presentation/ui/widgets/navigations/drop_down_demo2.dart'; class AppRouter { static final initial = '/'; @@ -87,7 +86,7 @@ class AppRouter { GoRoute( path: product, builder: (BuildContext context, GoRouterState state) { - return DropDownDemo3(); + return ProductPage(); }, ), ]), diff --git a/lib/presentation/ui/screens/home/home_page.dart b/lib/presentation/ui/screens/home/home_page.dart index 53804bd..4b5d2e7 100644 --- a/lib/presentation/ui/screens/home/home_page.dart +++ b/lib/presentation/ui/screens/home/home_page.dart @@ -1,16 +1,11 @@ import 'package:bottom_navy_bar/bottom_navy_bar.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:go_router/go_router.dart'; import 'package:proxibuy/core/gen/assets.gen.dart'; import 'package:proxibuy/core/routes/app_router.dart'; -import 'package:proxibuy/core/utils/empty_space.dart'; import 'package:proxibuy/data/models/screen_model.dart'; -import 'package:proxibuy/presentation/providers/them_mode_cubit.dart'; import 'package:proxibuy/presentation/ui/screens/home/home_desk_page.dart'; import 'package:proxibuy/presentation/ui/theme/responsive.dart'; -import 'package:proxibuy/presentation/ui/theme/theme.dart'; -import 'package:proxibuy/presentation/ui/widgets/navigations/categories_mega_menu.dart'; class HomePage extends StatefulWidget { final Widget child; diff --git a/lib/presentation/ui/widgets/navigations/categories_mega_menu.dart b/lib/presentation/ui/widgets/navigations/categories_mega_menu.dart index a399496..30e238f 100644 --- a/lib/presentation/ui/widgets/navigations/categories_mega_menu.dart +++ b/lib/presentation/ui/widgets/navigations/categories_mega_menu.dart @@ -1,13 +1,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:flutter_svg/svg.dart'; import 'package:proxibuy/core/utils/empty_space.dart'; import 'package:proxibuy/presentation/providers/category/cubit/categories_children_cubit.dart'; import 'package:proxibuy/presentation/providers/category/cubit/categories_cubit.dart'; import 'package:proxibuy/presentation/ui/screens/home/screens/categories_screen.dart'; -import 'package:proxibuy/presentation/ui/theme/colors.dart'; import 'package:proxibuy/presentation/ui/theme/theme.dart'; -import 'package:proxibuy/presentation/ui/widgets/default_placeholder.dart'; class CategoriesMegaMenu extends StatefulWidget { const CategoriesMegaMenu({super.key}); diff --git a/lib/presentation/ui/widgets/navigations/drop_down_demo2.dart b/lib/presentation/ui/widgets/navigations/drop_down_demo2.dart deleted file mode 100644 index f2aaac3..0000000 --- a/lib/presentation/ui/widgets/navigations/drop_down_demo2.dart +++ /dev/null @@ -1,264 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:ll_dropdown_menu/ll_dropdown_menu.dart'; - -import 'package:flutter/services.dart'; - -/// Wrapper AppBar for customizing default values -class WrapperAppBar extends AppBar { - static Widget? _defaultLeading; - static Widget? _defaultTitle; - static TextStyle? _defaultToolbarTextStyle; - static TextStyle? _defaultTitleTextStyle; - static double? _defaultToolbarHeight; - static SystemUiOverlayStyle? _defaultSystemOverlayStyle; - - static void initConfig({ - Widget? defaultLeading, - Widget? defaultTitle, - TextStyle? defaultToolbarTextStyle, - TextStyle? defaultTitleTextStyle, - double? defaultToolbarHeight, - SystemUiOverlayStyle? defaultSystemOverlayStyle, - }) { - _defaultLeading = defaultLeading; - _defaultTitle = defaultTitle; - _defaultToolbarTextStyle = defaultToolbarTextStyle; - _defaultTitleTextStyle = defaultTitleTextStyle; - _defaultToolbarHeight = defaultToolbarHeight; - _defaultSystemOverlayStyle = defaultSystemOverlayStyle; - } - - WrapperAppBar({ - super.key, - Widget? leading, - super.automaticallyImplyLeading, - Widget? title, - super.actions, - super.flexibleSpace, - super.bottom, - double super.elevation = 0, - super.scrolledUnderElevation, - super.notificationPredicate, - super.shadowColor, - super.surfaceTintColor, - super.shape, - Color super.backgroundColor = Colors.white, - super.foregroundColor, - super.iconTheme, - super.actionsIconTheme, - super.primary, - bool super.centerTitle = true, - super.excludeHeaderSemantics, - super.titleSpacing, - super.toolbarOpacity, - super.bottomOpacity, - double? toolbarHeight, - super.leadingWidth, - TextStyle? toolbarTextStyle, - TextStyle? titleTextStyle, - SystemUiOverlayStyle? systemOverlayStyle, - super.forceMaterialTransparency, - super.clipBehavior, - String? titleText, - }) : super( - leading: - leading ?? (automaticallyImplyLeading ? _defaultLeading : null), - title: title ?? - _defaultTitle ?? - Text(titleText ?? '', style: titleTextStyle), - toolbarHeight: toolbarHeight ?? _defaultToolbarHeight, - toolbarTextStyle: toolbarTextStyle ?? _defaultToolbarTextStyle, - titleTextStyle: titleTextStyle ?? - _defaultTitleTextStyle ?? - const TextStyle(color: Colors.black, fontSize: 18), - systemOverlayStyle: systemOverlayStyle ?? _defaultSystemOverlayStyle, - ); -} - -class DropDownDemo3 extends StatefulWidget { - const DropDownDemo3({super.key}); - - @override - State createState() => _DropDownDemoState(); -} - -class _DropDownDemoState extends State - with SingleTickerProviderStateMixin { - final DropDownController dropDownController = DropDownController(); - final DropDownCascadeListDataController dataController1 = - DropDownCascadeListDataController(); - final DropDownCascadeListDataController dataController2 = - DropDownCascadeListDataController(); - final GlobalKey scaffoldKey = GlobalKey(); - - List>> data1 = List.generate( - 6, - (index) => DropDownItem>( - text: "Tab $index", - data: List.generate( - index + 2, - (index) => DropDownItem( - text: "Tab Second $index", - activeIcon: const Icon(Icons.check), - ), - ), - ), - ); - List>> data2 = List.generate( - 6, - (index) => DropDownItem>( - text: "Tab $index", - data: List.generate( - index + 2, - (index) => DropDownItem( - text: "Tab Second $index", - activeIcon: const Icon(Icons.check), - ), - ), - ), - ); - - @override - Widget build(BuildContext context) { - return Scaffold( - key: scaffoldKey, - appBar: WrapperAppBar( - titleText: "DropDownDemo Custom", - backgroundColor: Colors.white, - actions: const [ - SizedBox(), - ], - ), - body: Column(children: [ - DropDownHeader( - controller: dropDownController, - boxStyle: const DropDownBoxStyle( - height: 50, - backgroundColor: Colors.white, - margin: EdgeInsets.symmetric(horizontal: 10), - padding: EdgeInsets.symmetric(horizontal: 10), - ), - itemStyle: DropDownItemStyle( - activeIconColor: Colors.blue, - activeTextStyle: const TextStyle(color: Colors.blue), - decoration: BoxDecoration( - color: Colors.grey.shade100, - borderRadius: BorderRadius.circular(20), - ), - activeDecoration: BoxDecoration( - color: Colors.grey.shade100, - borderRadius: BorderRadius.circular(20), - ), - margin: const EdgeInsets.symmetric(vertical: 6, horizontal: 10), - alignment: Alignment.center, - highlightTextStyle: const TextStyle(color: Colors.white), - highlightDecoration: BoxDecoration( - color: Colors.black, - borderRadius: BorderRadius.circular(20), - ), - highlightIcon: const Icon( - Icons.arrow_drop_down, - color: Colors.white, - ), - ), - items: List.generate( - 3, - (index) => DropDownItem( - text: index == 2 ? "Filter" : "Tab $index", - icon: index == 2 - ? const Icon(Icons.filter_alt) - : const Icon(Icons.arrow_drop_down), - activeIcon: index == 2 - ? const Icon(Icons.filter_alt) - : const Icon(Icons.arrow_drop_up), - ), - ), - onItemTap: (index, item) { - if (index == 2) { - dropDownController.hide(); - scaffoldKey.currentState?.openEndDrawer(); - } else { - dropDownController.toggle(index); - } - }, - ), - Expanded( - child: Stack( - children: [ - Container( - color: Colors.blue[200], - child: Center( - child: TextButton( - onPressed: () { - dataController1.resetAllItemsStatus(); - dataController2.resetAllItemsStatus(); - for (int i = 0; i < 2; i++) { - dropDownController.hide( - index: i, - status: DropDownHeaderStatus(text: "Tab$i"), - ); - } - }, - child: const Text("Reset"), - ), - ), - ), - DropDownView( - controller: dropDownController, - builders: [ - DropDownCascadeList( - controller: dropDownController, - dataController: dataController1, - headerIndex: 0, - secondFloorItemStyle: const DropDownItemStyle( - backgroundColor: Colors.white, - activeBackgroundColor: Color(0xFFF5F5F5), - activeTextStyle: - TextStyle(fontSize: 14, color: Colors.blue), - activeIconColor: Colors.blue, - padding: EdgeInsets.symmetric(horizontal: 20), - alignment: Alignment.centerLeft, - textExpand: true, - ), - items: data1, - ), - DropDownCascadeList( - controller: dropDownController, - dataController: dataController2, - headerIndex: 1, - secondFloorItemStyle: const DropDownItemStyle( - backgroundColor: Colors.white, - activeBackgroundColor: Color(0xFFF5F5F5), - activeTextStyle: - TextStyle(fontSize: 14, color: Colors.blue), - activeIconColor: Colors.blue, - padding: EdgeInsets.symmetric(horizontal: 20), - alignment: Alignment.centerLeft, - textExpand: true, - ), - items: data2, - maxMultiChoiceSize: 3, - ), - DropDownViewWrapper( - width: MediaQuery.of(context).size.width, - height: 300, - child: Container( - color: Colors.yellow, - height: 300, - ), - ), - ], - ), - ], - ), - ), - ]), - ); - } - - @override - void dispose() { - dropDownController.dispose(); - super.dispose(); - } -} diff --git a/lib/presentation/ui/widgets/navigations/mega_menu.dart b/lib/presentation/ui/widgets/navigations/mega_menu.dart deleted file mode 100644 index 55cec4e..0000000 --- a/lib/presentation/ui/widgets/navigations/mega_menu.dart +++ /dev/null @@ -1,44 +0,0 @@ -import 'package:flutter/material.dart'; - -class MyMegaMenu extends StatelessWidget { - const MyMegaMenu({super.key}); - - @override - Widget build(BuildContext context) { - return SizedBox( - width: 300, - height: 120, - child: DropdownButton( - value: 'Menu', - icon: Icon(Icons.av_timer), - iconSize: 24, - elevation: 16, - style: TextStyle(color: Colors.deepPurple), - underline: Container( - height: 2, - color: Colors.deepPurpleAccent, - ), - onChanged: (newValue) {}, - items: ['Menu', 'Home', 'Profile', 'Settings'] - .map>((String value) { - return DropdownMenuItem( - value: value, - child: Text(value), - ); - }).toList() - ..add(DropdownMenuItem( - child: ExpansionTile( - title: Text('Menu'), - children: [ - ListTile( - title: Text('Submenu 1'), - ), - ListTile( - title: Text('Submenu 2'), - ), - ], - ), - ))), - ); - } -}