Files
prosappweb/lib/main.dart
T
Lizandro GuarnizoandClaude Sonnet 4.6 eb01e96e5d fix: remove get package, upgrade Flutter 3.44 compat deps
- Remove `get` package (incompatible with Flutter 3.44/Dart 3.12 due to
  removed ThemeData.backgroundColor and final IconData class)
- Replace GetMaterialApp → MaterialApp with GlobalKey navigatorKey
- Convert AuthenticationRepository and all 7 controllers from
  GetxController to plain singletons
- Replace Get.snackbar/offAll/to/back/defaultDialog with app_navigator
  helpers and native Flutter APIs
- Add ApiService.baseUrl static + parseJson method
- Add UserModel.getUser static method
- Add UserProvider.score via ScoresModel API
- Fix user?.photo → user?.picture in drawer_menu, service_after
- Fix logout(uid!) → logout() in drawer_menu
- Fix photo_view_web.dart missing dart:typed_data import
- Remove getCoordsOfCity call from ubicacion.dart
- Fix UserModel.getUser?.name null-safety in map/service.dart
- Upgrade: google_maps_flutter ^2.9.0, url_launcher ^6.3.0,
  font_awesome_flutter ^10.8.0, image_picker ^1.1.2

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-18 14:33:22 -05:00

128 lines
5.0 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:intl/date_symbol_data_local.dart';
import 'package:prosappco/src/authentication/authentication_repository.dart';
import 'package:prosappco/src/presentation/screens/service_web.dart';
import 'package:prosappco/src/providers/user_provider.dart';
import 'package:prosappco/src/presentation/screens/calendar.dart';
import 'package:prosappco/src/presentation/screens/city.dart';
import 'package:prosappco/src/presentation/screens/login/login.dart';
import 'package:prosappco/src/presentation/screens/login/login_email.dart';
import 'package:prosappco/src/presentation/screens/my_services.dart';
import 'package:prosappco/src/presentation/screens/my_services_pro.dart';
import 'package:prosappco/src/presentation/screens/new_number.dart';
import 'package:prosappco/src/presentation/screens/new_password.dart';
import 'package:prosappco/src/presentation/screens/profession.dart';
import 'package:prosappco/src/presentation/screens/professional_profile.dart';
import 'package:prosappco/src/presentation/screens/professional_revision.dart';
import 'package:prosappco/src/presentation/screens/profile/profile.dart';
import 'package:prosappco/src/presentation/screens/profile/profile_pro.dart';
import 'package:prosappco/src/presentation/screens/register/register.dart';
import 'package:prosappco/src/presentation/screens/request_sent.dart';
import 'package:prosappco/src/presentation/screens/reset_password/reset_password.dart';
import 'package:prosappco/src/presentation/screens/map/service.dart';
import 'package:prosappco/src/presentation/screens/solicitudes.dart';
import 'package:flutter/foundation.dart' show kIsWeb;
import 'package:provider/provider.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:prosappco/src/utils/app_navigator.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
// Trigger singleton init which schedules _checkSession after first frame
AuthenticationRepository.instance;
await initializeDateFormatting('es_MX', null);
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MultiProvider(
providers: [
ChangeNotifierProvider(create: (_) => UserProvider()),
],
child: MaterialApp(
navigatorKey: appNavigatorKey,
theme: ThemeData(fontFamily: 'Poppins'),
debugShowCheckedModeBanner: false,
localizationsDelegates: const [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: const [Locale('es', 'US')],
title: 'ProsApp',
initialRoute: '/',
routes: {
'/': (context) => const LoginScreen(),
'/splash': (context) => const SplashScreen(),
'/login': (context) => const LoginEmailScreen(),
'/profile': (context) => const ProfileScreen(),
'/register': (context) => const RegisterScreen(),
'/city': (context) => const CityScreen(),
'/profession': (context) => const ProfessionScreen(),
'/newNumber': (context) => const NewNumberScreen(),
'/profesionalRevision': (context) => const ProfessionalRevisionScreen(),
'/profesionalProfile': (context) => const ProfessionalProfileScreen(),
'/solicitudEnviada': (context) => const RequestSentScreen(),
'/nuevaPassword': (context) => NewPasswordScreen(),
'/servicio': (context) => const ServiceScreen(),
'/servicioWeb': (context) => const ServiceWebScreen(),
'/profilePro': (context) => const ProfileProScreen(),
'/calendar': (context) => const CalendarScreen(),
'/solicitud': (context) => SolicitudScreen(),
'/misserviciospro': (context) => MyServicesProScreen(),
'/misservicios': (context) => MyServicesScreen(),
'/resetpassword': (context) => const ResetPasswordScreen(),
},
onGenerateRoute: (settings) {
throw Exception('Ruta desconocida: ${settings.name}');
},
),
);
}
}
class SplashScreen extends StatefulWidget {
const SplashScreen({super.key});
@override
State<SplashScreen> createState() => _SplashScreenState();
}
class _SplashScreenState extends State<SplashScreen> {
@override
void initState() {
super.initState();
if (kIsWeb) {
Future.delayed(const Duration(seconds: 3), () {
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => const LoginScreen()),
);
});
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.blue,
body: Center(
child: kIsWeb ? Image.asset('/images/splash.png') : const LoginScreen(),
),
);
}
}