64 lines
2.2 KiB
Dart
64 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:flutter_native_splash/flutter_native_splash.dart';
|
|
import 'package:proxibuy/core/routes/app_router.dart';
|
|
import 'package:proxibuy/core/utils/my_custom_scroll_behavior.dart';
|
|
import 'package:proxibuy/data/storage/shared_preferences_helper.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/them_mode_cubit.dart';
|
|
import 'package:proxibuy/presentation/providers/user_info_cubit.dart';
|
|
import 'package:proxibuy/presentation/ui/theme/theme.dart';
|
|
import 'package:url_strategy/url_strategy.dart';
|
|
|
|
void main() async {
|
|
setPathUrlStrategy(); // 👈 Removes the # from URLs
|
|
WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
|
|
FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
|
|
await SharedPreferencesHelper.initial();
|
|
|
|
runApp(MultiBlocProvider(
|
|
providers: [
|
|
BlocProvider<ThemModeCubit>(create: (context) => ThemModeCubit()),
|
|
BlocProvider<CategoriesChildrenCubit>(
|
|
create: (context) => CategoriesChildrenCubit()),
|
|
BlocProvider<CategoriesCubit>(create: (context) => CategoriesCubit()),
|
|
BlocProvider<UserInfoCubit>(create: (context) => UserInfoCubit()),
|
|
],
|
|
child: const MyApp(),
|
|
));
|
|
}
|
|
|
|
class MyApp extends StatefulWidget {
|
|
const MyApp({super.key});
|
|
|
|
@override
|
|
State<MyApp> createState() => _MyAppState();
|
|
}
|
|
|
|
class _MyAppState extends State<MyApp> {
|
|
@override
|
|
void initState() {
|
|
FlutterNativeSplash.remove();
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocBuilder<ThemModeCubit, ThemeMode>(
|
|
builder: (context, themeState) {
|
|
return MaterialApp.router(
|
|
routerConfig: AppRouter.createRouter,
|
|
restorationScopeId: 'app',
|
|
title: 'Proxibuy',
|
|
theme: appTheme,
|
|
darkTheme: darkTheme,
|
|
themeMode: themeState,
|
|
scrollBehavior: MyCustomScrollBehavior(),
|
|
debugShowCheckedModeBanner: false,
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|