I'm trying to make the logo fade in, and then fade out, in a Splash Screen. After this, it would be redirected to another page. I could not find a way to make it do both in and out fades. I'd like not to use any dependency to accomplish this as well. I've tried to change the future to accept a parameter, but it didn't work. Any
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:shopperbr1/t.dart';
class SplashScreen extends StatefulWidget {
const SplashScreen({Key? key}) : super(key: key);
@override
State<SplashScreen> createState() => _SplashScreenState();
}
class _SplashScreenState extends State<SplashScreen> {
bool animate = false;
@override
void initState() {
super.initState();
fadeInAnimation();
}
Future fadeInAnimation() async {
await Future.delayed(const Duration(seconds: 2));
setState(() {
animate = true;
});
await Future.delayed(const Duration(seconds: 2));
Get.offAll(() => const t());
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AnimatedOpacity(
duration: const Duration(seconds: 1),
opacity: animate ? 1 : 0,
child: const Image(
image: AssetImage('assets/images/transparent_logo.png'),
),
),
],
),
),
);
}
}
Any help would be really appreciated.