From bce3a0486bba5b33c1643f529bbf9eb61a1e95bd Mon Sep 17 00:00:00 2001 From: Emil Date: Tue, 21 May 2024 20:51:24 +0500 Subject: [PATCH 1/2] refactor: app --- lib/main.dart | 4 ++-- lib/src/app/app.dart | 1 + lib/{my_app.dart => src/app/view/app.dart} | 13 ++++--------- lib/src/app/view/app_view.dart | 16 ++++++++++++++++ lib/src/app/view/view.dart | 2 ++ 5 files changed, 25 insertions(+), 11 deletions(-) create mode 100644 lib/src/app/app.dart rename lib/{my_app.dart => src/app/view/app.dart} (82%) create mode 100644 lib/src/app/view/app_view.dart create mode 100644 lib/src/app/view/view.dart diff --git a/lib/main.dart b/lib/main.dart index 847e3c6..b9660da 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,5 +1,5 @@ import 'package:papa_burger/bootstrap.dart'; -import 'package:papa_burger/my_app.dart'; +import 'package:papa_burger/src/app/app.dart'; import 'package:papa_burger/src/services/network/api/api.dart'; import 'package:papa_burger/src/services/repositories/user/user.dart'; @@ -7,5 +7,5 @@ void main() async { final userApi = UserApi(); final userRepository = UserRepository(userApi: userApi); - await bootstrap(() => MyApp(userRepository: userRepository)); + await bootstrap(() => App(userRepository: userRepository)); } diff --git a/lib/src/app/app.dart b/lib/src/app/app.dart new file mode 100644 index 0000000..00ffcf9 --- /dev/null +++ b/lib/src/app/app.dart @@ -0,0 +1 @@ +export 'view/view.dart'; diff --git a/lib/my_app.dart b/lib/src/app/view/app.dart similarity index 82% rename from lib/my_app.dart rename to lib/src/app/view/app.dart index cf84b1c..c118123 100644 --- a/lib/my_app.dart +++ b/lib/src/app/view/app.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart' show BlocProvider, MultiBlocProvider; -import 'package:papa_burger/src/config/config.dart'; +import 'package:papa_burger/src/app/app.dart'; import 'package:papa_burger/src/services/repositories/user/user.dart'; import 'package:papa_burger/src/views/pages/login/components/show_password_controller/show_password_cubit.dart'; import 'package:papa_burger/src/views/pages/login/state/login_cubit.dart'; @@ -10,8 +10,8 @@ import 'package:papa_burger/src/views/pages/main/state/bloc/main_test_bloc.dart' import 'package:papa_burger/src/views/pages/notification/state/notification_bloc.dart'; import 'package:papa_burger/src/views/pages/register/state/register_cubit.dart'; -class MyApp extends StatelessWidget { - const MyApp({required this.userRepository, super.key}); +class App extends StatelessWidget { + const App({required this.userRepository, super.key}); final UserRepository userRepository; @@ -38,12 +38,7 @@ class MyApp extends StatelessWidget { create: (context) => OrdersBloc()..add(const OrdersStarted()), ), ], - child: MaterialApp( - title: 'Papa Burger', - debugShowCheckedModeBanner: false, - theme: AppTheme.lightTheme, - routes: Routes.routes, - ), + child: const AppView(), ); } } diff --git a/lib/src/app/view/app_view.dart b/lib/src/app/view/app_view.dart new file mode 100644 index 0000000..89af7fb --- /dev/null +++ b/lib/src/app/view/app_view.dart @@ -0,0 +1,16 @@ +import 'package:flutter/material.dart'; +import 'package:papa_burger/src/config/config.dart'; + +class AppView extends StatelessWidget { + const AppView({super.key}); + + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Papa Burger', + debugShowCheckedModeBanner: false, + theme: AppTheme.lightTheme, + routes: Routes.routes, + ); + } +} diff --git a/lib/src/app/view/view.dart b/lib/src/app/view/view.dart new file mode 100644 index 0000000..c8cc714 --- /dev/null +++ b/lib/src/app/view/view.dart @@ -0,0 +1,2 @@ +export 'app.dart'; +export 'app_view.dart'; From 6685095be14517a24591f1b96d687ed331ac5914 Mon Sep 17 00:00:00 2001 From: Emil Date: Tue, 21 May 2024 20:54:25 +0500 Subject: [PATCH 2/2] fix: spell checker issues --- .../form_fields/{form_fileds.dart => form_fields.dart} | 0 lib/src/models/menu_tab_category.dart | 3 +-- lib/src/models/models.dart | 2 +- lib/src/models/order_details.dart | 2 +- lib/src/models/order_menu_item.dart | 2 +- .../cart/components/add_credit_card_modal_bottom_sheet.dart | 2 +- .../main/components/drawer/views/profile/profile_view.dart | 6 +----- .../main/components/filter/components/filter_button.dart | 2 +- lib/src/views/pages/main/components/header/header_view.dart | 2 +- 9 files changed, 8 insertions(+), 13 deletions(-) rename lib/src/models/form_fields/{form_fileds.dart => form_fields.dart} (100%) diff --git a/lib/src/models/form_fields/form_fileds.dart b/lib/src/models/form_fields/form_fields.dart similarity index 100% rename from lib/src/models/form_fields/form_fileds.dart rename to lib/src/models/form_fields/form_fields.dart diff --git a/lib/src/models/menu_tab_category.dart b/lib/src/models/menu_tab_category.dart index 45898bf..0d1b527 100644 --- a/lib/src/models/menu_tab_category.dart +++ b/lib/src/models/menu_tab_category.dart @@ -55,8 +55,7 @@ class MenuBloc with ChangeNotifier { void init() async { final apiClient = server.ApiClient(); - final dbmenus = await apiClient.getRestaurantMenu(_restaurant.placeId); - menus = dbmenus + menus = (await apiClient.getRestaurantMenu(_restaurant.placeId)) .map( (e) => Menu( category: e.category, diff --git a/lib/src/models/models.dart b/lib/src/models/models.dart index a14442d..bdb3a4b 100644 --- a/lib/src/models/models.dart +++ b/lib/src/models/models.dart @@ -3,7 +3,7 @@ export 'cart.dart'; export 'category.dart'; export 'credit_card.dart'; export 'exceptions.dart'; -export 'form_fields/form_fileds.dart'; +export 'form_fields/form_fields.dart'; export 'menu.dart'; export 'menu_model.dart'; export 'menu_tab_category.dart'; diff --git a/lib/src/models/order_details.dart b/lib/src/models/order_details.dart index 024e99a..b92d9d5 100644 --- a/lib/src/models/order_details.dart +++ b/lib/src/models/order_details.dart @@ -40,7 +40,7 @@ class OrderDetails { /// Associated order details order menu items final List orderMenuItems; - /// Assosisated order details total order sum + /// Associated order details total order sum final double totalOrderSum; /// Associated order details order delivery fee diff --git a/lib/src/models/order_menu_item.dart b/lib/src/models/order_menu_item.dart index 732053b..70dd60c 100644 --- a/lib/src/models/order_menu_item.dart +++ b/lib/src/models/order_menu_item.dart @@ -20,7 +20,7 @@ class OrderMenuItem { /// Associated order menu items item's name final String name; - /// Assosisated order menu items item's quantity + /// Associated order menu items item's quantity final int quantity; /// Associated order menu items item's price diff --git a/lib/src/views/pages/cart/components/add_credit_card_modal_bottom_sheet.dart b/lib/src/views/pages/cart/components/add_credit_card_modal_bottom_sheet.dart index 27fab21..9a39a70 100644 --- a/lib/src/views/pages/cart/components/add_credit_card_modal_bottom_sheet.dart +++ b/lib/src/views/pages/cart/components/add_credit_card_modal_bottom_sheet.dart @@ -87,7 +87,7 @@ class _AddCreditCardModalBottomSheetState PaymentBloc().addCard(context, _creditCard!); ScaffoldMessenger.of(context).showSnackBar( const SnackBar( - content: Text('Succesfully saved Credit card!'), + content: Text('Successfully saved Credit card!'), ), ); logI('Credit card saved'); diff --git a/lib/src/views/pages/main/components/drawer/views/profile/profile_view.dart b/lib/src/views/pages/main/components/drawer/views/profile/profile_view.dart index a90ee0d..be70cbc 100644 --- a/lib/src/views/pages/main/components/drawer/views/profile/profile_view.dart +++ b/lib/src/views/pages/main/components/drawer/views/profile/profile_view.dart @@ -67,10 +67,6 @@ class ProfileView extends StatelessWidget { ), PopupMenuItem( onTap: () { - // NotificationService.showBigTextNotification( - // title: 'Hello world', - // body: 'How are you', - // ); NotificationService.showOngoingNotification( title: 'Hello ', body: 'This is an ongoing notification!', @@ -79,7 +75,7 @@ class ProfileView extends StatelessWidget { child: GestureDetector( onTap: NotificationService.cancelAllNotifications, child: const KText( - text: 'Show notifiction', + text: 'Show notification', ), ), ), diff --git a/lib/src/views/pages/main/components/filter/components/filter_button.dart b/lib/src/views/pages/main/components/filter/components/filter_button.dart index 95b182d..d2a33d4 100644 --- a/lib/src/views/pages/main/components/filter/components/filter_button.dart +++ b/lib/src/views/pages/main/components/filter/components/filter_button.dart @@ -50,7 +50,7 @@ class _FilterButtonState extends State ); } - void _onTapUp(TapUpDetails detailsm, List chosenTags) { + void _onTapUp(TapUpDetails details, List chosenTags) { _playAnimation(); Future.delayed(const Duration(milliseconds: 200), () { context.showCustomModalBottomSheet( diff --git a/lib/src/views/pages/main/components/header/header_view.dart b/lib/src/views/pages/main/components/header/header_view.dart index bb748cf..56e61f6 100644 --- a/lib/src/views/pages/main/components/header/header_view.dart +++ b/lib/src/views/pages/main/components/header/header_view.dart @@ -96,7 +96,7 @@ class _HeaderViewState extends State }); _animationController.forward(); }, - onTapUp: (TapUpDetails detalis) { + onTapUp: (_) { setState(() { isTapped = false; });