first commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hidalyx_drluiscastro/core/router/app_router.dart';
|
||||
import 'package:hidalyx_drluiscastro/core/theme/app_theme.dart';
|
||||
|
||||
import '../../features/auth/data/services/auth_service.dart';
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
final authService = AuthService();
|
||||
final session = await authService.loadSavedSession();
|
||||
final initialRoute = (session != null && session.accessToken.isNotEmpty) ? '/' : '/login';
|
||||
|
||||
runApp(HidalyxApp(initialRoute: initialRoute));
|
||||
}
|
||||
|
||||
class HidalyxApp extends StatelessWidget {
|
||||
final String initialRoute;
|
||||
|
||||
const HidalyxApp({super.key, this.initialRoute = '/login'});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp.router(
|
||||
title: 'Dr. Luis Castro - Hidalyx Med',
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: AppTheme.lightTheme,
|
||||
routerConfig: AppRouter.getRouter(initialRoute),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user