+13
-24
@@ -86,7 +86,7 @@ class MyApp extends StatelessWidget {
|
|||||||
theme: ThemeData(fontFamily: 'Poppins'),
|
theme: ThemeData(fontFamily: 'Poppins'),
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
title: 'ProsApp',
|
title: 'ProsApp',
|
||||||
initialRoute: '/splash',
|
initialRoute: '/',
|
||||||
routes: {
|
routes: {
|
||||||
'/splash': (context) => const SplashScreen(),
|
'/splash': (context) => const SplashScreen(),
|
||||||
'/': (context) => const LoginScreen(),
|
'/': (context) => const LoginScreen(),
|
||||||
@@ -122,36 +122,25 @@ class SplashScreen extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _SplashScreenState extends State<SplashScreen> {
|
class _SplashScreenState extends State<SplashScreen> {
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
if (kIsWeb) {
|
|
||||||
// Espera 3 segundos y luego redirige a LoginScreen
|
|
||||||
Future.delayed(const Duration(seconds: 3), () {
|
|
||||||
Navigator.pushReplacement(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(builder: (context) => const LoginScreen()),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
if (kIsWeb) { // Verifica si se está ejecutando en web
|
||||||
backgroundColor: Colors.blue,
|
return AnimatedSplashScreen.withScreenFunction(
|
||||||
body: Center(
|
splash: 'images/splash.png',
|
||||||
child: kIsWeb
|
screenFunction: () async {
|
||||||
? Image.asset(
|
return const LoginScreen();
|
||||||
'/images/splash.png') // Asegúrate de que la ruta sea correcta
|
},
|
||||||
: const LoginScreen(), // En otras plataformas, muestra LoginScreen
|
splashTransition: SplashTransition.rotationTransition,
|
||||||
),
|
duration: 80000,
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
return const LoginScreen(); // En otras plataformas, solo muestra LoginScreen
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// splash: 'images/splashgif.gif',
|
// splash: 'images/splashgif.gif',
|
||||||
// backgroundColor: Colors.black,
|
// backgroundColor: Colors.black,
|
||||||
// nextScreen: const LoginScreen(),
|
// nextScreen: const LoginScreen(),
|
||||||
|
|||||||
Reference in New Issue
Block a user