63 lines
2.1 KiB
Dart
63 lines
2.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'services/database_service.dart';
|
|
import 'services/auth_service.dart';
|
|
import 'services/gps_service.dart';
|
|
import 'services/sync_service.dart';
|
|
import 'services/analytics_service.dart';
|
|
import 'services/training_plan_service.dart';
|
|
import 'controllers/workout_controller.dart';
|
|
import 'screens/home_screen.dart';
|
|
import 'screens/phone_login_screen.dart';
|
|
|
|
void main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
|
|
// 1. تهيئة الخدمات (Services Initialization)
|
|
// بالترتيب: قاعدة البيانات -> الهوية -> GPS -> المزامنة -> التحليل
|
|
await Get.putAsync<DatabaseService>(() => DatabaseService().init());
|
|
await Get.putAsync<AuthService>(() => AuthService().init());
|
|
Get.put(TrainingPlanService(auth: Get.find<AuthService>()));
|
|
Get.put(GpsService());
|
|
await Get.putAsync<SyncService>(() => SyncService().init());
|
|
Get.put(AnalyticsService());
|
|
|
|
// 2. تهيئة المتحكمات (Controllers)
|
|
Get.put(WorkoutController());
|
|
|
|
runApp(const SportPathApp());
|
|
}
|
|
|
|
class SportPathApp extends StatelessWidget {
|
|
const SportPathApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GetMaterialApp(
|
|
title: 'SportPath',
|
|
debugShowCheckedModeBanner: false,
|
|
locale: const Locale('ar', 'JO'), // دعم اللغة العربية افتراضياً
|
|
theme: ThemeData(
|
|
useMaterial3: true,
|
|
fontFamily: null,
|
|
colorScheme: ColorScheme.fromSeed(
|
|
seedColor: const Color(0xFF456C52),
|
|
primary: const Color(0xFF456C52),
|
|
secondary: const Color(0xFF26382D),
|
|
brightness: Brightness.light,
|
|
),
|
|
scaffoldBackgroundColor: const Color(0xFFF5F7F2),
|
|
cardTheme: CardThemeData(
|
|
color: Colors.white,
|
|
elevation: 0,
|
|
shape:
|
|
RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
|
),
|
|
),
|
|
home: Get.find<AuthService>().isSignedIn
|
|
? const HomeScreen()
|
|
: const PhoneLoginScreen(),
|
|
);
|
|
}
|
|
}
|