Revert "Revert "update""

This reverts commit 1361f0bbf7.
This commit is contained in:
Felipe
2023-08-22 11:34:03 -05:00
parent 1361f0bbf7
commit 0a84306afa
+24 -13
View File
@@ -86,7 +86,7 @@ class MyApp extends StatelessWidget {
theme: ThemeData(fontFamily: 'Poppins'),
debugShowCheckedModeBanner: false,
title: 'ProsApp',
initialRoute: '/',
initialRoute: '/splash',
routes: {
'/splash': (context) => const SplashScreen(),
'/': (context) => const LoginScreen(),
@@ -122,25 +122,36 @@ class SplashScreen extends StatefulWidget {
}
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
Widget build(BuildContext context) {
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
}
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
),
);
}
}
// splash: 'images/splashgif.gif',
// backgroundColor: Colors.black,
// nextScreen: const LoginScreen(),