Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: app #4

Merged
merged 2 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
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';

void main() async {
final userApi = UserApi();
final userRepository = UserRepository(userApi: userApi);

await bootstrap(() => MyApp(userRepository: userRepository));
await bootstrap(() => App(userRepository: userRepository));
}
1 change: 1 addition & 0 deletions lib/src/app/app.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export 'view/view.dart';
13 changes: 4 additions & 9 deletions lib/my_app.dart → lib/src/app/view/app.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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;

Expand All @@ -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(),
);
}
}
16 changes: 16 additions & 0 deletions lib/src/app/view/app_view.dart
Original file line number Diff line number Diff line change
@@ -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,
);
}
}
2 changes: 2 additions & 0 deletions lib/src/app/view/view.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export 'app.dart';
export 'app_view.dart';
3 changes: 1 addition & 2 deletions lib/src/models/menu_tab_category.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/models/models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/models/order_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class OrderDetails {
/// Associated order details order menu items
final List<OrderMenuItem> orderMenuItems;

/// Assosisated order details total order sum
/// Associated order details total order sum
final double totalOrderSum;

/// Associated order details order delivery fee
Expand Down
2 changes: 1 addition & 1 deletion lib/src/models/order_menu_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ class ProfileView extends StatelessWidget {
),
PopupMenuItem<dynamic>(
onTap: () {
// NotificationService.showBigTextNotification(
// title: 'Hello world',
// body: 'How are you',
// );
NotificationService.showOngoingNotification(
title: 'Hello ',
body: 'This is an ongoing notification!',
Expand All @@ -79,7 +75,7 @@ class ProfileView extends StatelessWidget {
child: GestureDetector(
onTap: NotificationService.cancelAllNotifications,
child: const KText(
text: 'Show notifiction',
text: 'Show notification',
),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class _FilterButtonState extends State<FilterButton>
);
}

void _onTapUp(TapUpDetails detailsm, List<Tag> chosenTags) {
void _onTapUp(TapUpDetails details, List<Tag> chosenTags) {
_playAnimation();
Future.delayed(const Duration(milliseconds: 200), () {
context.showCustomModalBottomSheet(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class _HeaderViewState extends State<HeaderView>
});
_animationController.forward();
},
onTapUp: (TapUpDetails detalis) {
onTapUp: (_) {
setState(() {
isTapped = false;
});
Expand Down
Loading