2025-03-12 14:09:03 +03:30
|
|
|
import 'package:flutter/material.dart';
|
2025-07-12 17:06:29 +03:30
|
|
|
import 'package:rasadyar_app/infrastructure/service/app_navigation_observer.dart';
|
2025-09-06 14:50:02 +03:30
|
|
|
import 'package:rasadyar_app/infrastructure/utils/local_storage_utils.dart';
|
2025-04-07 16:49:15 +03:30
|
|
|
import 'package:rasadyar_app/presentation/routes/app_pages.dart';
|
2025-04-26 09:25:49 +03:30
|
|
|
import 'package:rasadyar_core/core.dart';
|
2025-09-06 14:50:02 +03:30
|
|
|
|
2025-05-14 11:44:46 +03:30
|
|
|
import 'infrastructure/di/di.dart';
|
2025-07-27 15:36:28 +03:30
|
|
|
import 'presentation/routes/auth_route_resolver_impl.dart';
|
2025-07-27 15:13:37 +03:30
|
|
|
|
2025-05-14 11:44:46 +03:30
|
|
|
Future<void> main() async {
|
2025-04-07 16:49:15 +03:30
|
|
|
WidgetsFlutterBinding.ensureInitialized();
|
2025-08-11 12:56:26 +03:30
|
|
|
await Hive.initFlutter();
|
2025-07-27 15:13:37 +03:30
|
|
|
await setupPreInjection();
|
2025-09-06 14:50:02 +03:30
|
|
|
Get.put(GService());
|
|
|
|
|
var gService = Get.find<GService>();
|
|
|
|
|
await gService.init();
|
|
|
|
|
if (gService.isFirstTime()) {
|
|
|
|
|
await seedTargetPage();
|
|
|
|
|
await gService.setIsNotFirstTime();
|
|
|
|
|
}
|
2025-05-18 09:32:43 +03:30
|
|
|
Get.put(TokenStorageService());
|
2025-07-16 18:31:47 +03:30
|
|
|
await Get.find<TokenStorageService>().init();
|
2025-07-27 15:36:28 +03:30
|
|
|
Get.put<AuthRouteResolver>(AppAuthRouteResolver());
|
2025-05-18 09:32:43 +03:30
|
|
|
Get.put(AuthMiddleware());
|
2025-07-28 15:57:30 +03:30
|
|
|
|
2025-09-21 14:32:58 +03:30
|
|
|
runApp(MyApp());
|
2025-07-12 17:06:29 +03:30
|
|
|
|
2025-09-21 14:32:58 +03:30
|
|
|
//runApp(DevicePreview(builder: (context) => ForDevicePreview(),));
|
2025-04-21 15:45:15 +03:30
|
|
|
}
|
|
|
|
|
|
2025-09-20 17:03:11 +03:30
|
|
|
class ForDevicePreview extends StatelessWidget {
|
2025-04-21 15:45:15 +03:30
|
|
|
const ForDevicePreview({super.key});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
2025-09-20 17:03:11 +03:30
|
|
|
return ScreenUtilInit(
|
|
|
|
|
designSize: const Size(412, 917),
|
|
|
|
|
minTextAdapt: true,
|
|
|
|
|
splitScreenMode: true,
|
|
|
|
|
child: GetMaterialApp(
|
|
|
|
|
title: 'رصدیار',
|
|
|
|
|
theme: ThemeData(
|
|
|
|
|
fontFamily: 'yekan',
|
|
|
|
|
colorScheme: ColorScheme.fromSeed(seedColor: AppColor.blueNormal),
|
|
|
|
|
),
|
|
|
|
|
initialRoute: AppPages.initRoutes,
|
|
|
|
|
getPages: AppPages.pages,
|
|
|
|
|
locale: const Locale("fa", "IR"),
|
|
|
|
|
supportedLocales: const [Locale("fa", "IR")],
|
|
|
|
|
navigatorObservers: [CustomNavigationObserver()],
|
|
|
|
|
localizationsDelegates: [
|
|
|
|
|
PersianMaterialLocalizations.delegate,
|
|
|
|
|
PersianCupertinoLocalizations.delegate,
|
|
|
|
|
GlobalMaterialLocalizations.delegate,
|
|
|
|
|
GlobalWidgetsLocalizations.delegate,
|
|
|
|
|
GlobalCupertinoLocalizations.delegate,
|
|
|
|
|
],
|
2025-04-21 15:45:15 +03:30
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
2025-09-20 17:03:11 +03:30
|
|
|
}
|
2025-03-12 14:09:03 +03:30
|
|
|
|
2025-09-21 14:32:58 +03:30
|
|
|
class MyApp extends StatelessWidget {
|
2025-03-12 14:09:03 +03:30
|
|
|
const MyApp({super.key});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
2025-06-29 11:56:22 +03:30
|
|
|
return ScreenUtilInit(
|
|
|
|
|
designSize: const Size(412, 917),
|
|
|
|
|
minTextAdapt: true,
|
|
|
|
|
splitScreenMode: true,
|
|
|
|
|
child: GetMaterialApp(
|
|
|
|
|
title: 'رصدیار',
|
|
|
|
|
theme: ThemeData(
|
|
|
|
|
fontFamily: 'yekan',
|
|
|
|
|
colorScheme: ColorScheme.fromSeed(seedColor: AppColor.blueNormal),
|
|
|
|
|
),
|
|
|
|
|
initialRoute: AppPages.initRoutes,
|
|
|
|
|
getPages: AppPages.pages,
|
|
|
|
|
locale: const Locale("fa", "IR"),
|
|
|
|
|
supportedLocales: const [Locale("fa", "IR")],
|
2025-07-12 17:06:29 +03:30
|
|
|
navigatorObservers: [CustomNavigationObserver()],
|
2025-06-29 11:56:22 +03:30
|
|
|
localizationsDelegates: [
|
|
|
|
|
PersianMaterialLocalizations.delegate,
|
|
|
|
|
PersianCupertinoLocalizations.delegate,
|
|
|
|
|
GlobalMaterialLocalizations.delegate,
|
|
|
|
|
GlobalWidgetsLocalizations.delegate,
|
|
|
|
|
GlobalCupertinoLocalizations.delegate,
|
|
|
|
|
],
|
2025-04-06 15:39:00 +03:30
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
2025-09-21 14:32:58 +03:30
|
|
|
}
|