Skip to content

Commit

Permalink
refactor: app
Browse files Browse the repository at this point in the history
  • Loading branch information
Gambley1 committed May 21, 2024
1 parent f403951 commit bce3a04
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 11 deletions.
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';

0 comments on commit bce3a04

Please sign in to comment.