From 459f590638191c5d7d6811c418e68d641c99c5cd Mon Sep 17 00:00:00 2001 From: lizandrogd <77708265+lizandrogd@users.noreply.github.com> Date: Tue, 22 Aug 2023 16:00:47 -0500 Subject: [PATCH] Revert "Revert "Revert "update""" This reverts commit 0a84306afa80b70550549b1ca9d7994aadcafea3. --- lib/main.dart | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 97d4cba..b12f649 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -86,7 +86,7 @@ class MyApp extends StatelessWidget { theme: ThemeData(fontFamily: 'Poppins'), debugShowCheckedModeBanner: false, title: 'ProsApp', - initialRoute: '/splash', + initialRoute: '/', routes: { '/splash': (context) => const SplashScreen(), '/': (context) => const LoginScreen(), @@ -122,36 +122,25 @@ class SplashScreen extends StatefulWidget { } class _SplashScreenState extends State { - @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 Widget build(BuildContext context) { - return Scaffold( - backgroundColor: Colors.blue, - body: Center( - child: kIsWeb - ? Image.asset( - '/images/splash.png') // Asegúrate de que la ruta sea correcta - : const LoginScreen(), // En otras plataformas, muestra LoginScreen - ), - ); + if (kIsWeb) { // Verifica si se está ejecutando en web + return AnimatedSplashScreen.withScreenFunction( + splash: 'images/splash.png', + screenFunction: () async { + return const LoginScreen(); + }, + splashTransition: SplashTransition.rotationTransition, + duration: 80000, + ); + } else { + return const LoginScreen(); // En otras plataformas, solo muestra LoginScreen + } } } - // splash: 'images/splashgif.gif', // backgroundColor: Colors.black, // nextScreen: const LoginScreen(),