flare_splash_screen icon indicating copy to clipboard operation
flare_splash_screen copied to clipboard

Default transition is not working

Open ghost opened this issue 4 years ago • 7 comments

Hi! I have read in the documentation that the SplashScreen.navigate method has a default fade transition but for me it's not working. I have tried replacing it by transitionsBuilder but this transition it's not working either. Here is my code:

`class SplashAnimationScreen extends StatefulWidget { @override _SplashAnimationScreenState createState() => _SplashAnimationScreenState(); }

class _SplashAnimationScreenState extends State<SplashAnimationScreen> { bool _isLoading = true; Widget _initialPage = HomeScreen();

@override void initState() { _setInitialRoute(); super.initState(); }

@override Widget build(BuildContext context) { return SplashScreen.navigate( name: 'assets/animations/splash_animation.flr', next: (_) => _initialPage, isLoading: _isLoading, startAnimation: 'StartAnimation', backgroundColor: Styles.primaryColorDark, transitionsBuilder: (context, animation, secondaryAnimation, child) { var begin = Offset(0.0, 1.0); var end = Offset.zero; var curve = Curves.ease;

    var tween = Tween(begin: begin, end: end).chain(CurveTween(curve: curve));

    return SlideTransition(
      position: animation.drive(tween),
      child: child,
    );
  },
);

}

_setInitialRoute() async { SharedPreferences prefs = await SharedPreferences.getInstance(); String initialRoute = (prefs.getString('initialRoute') ?? onboardingRoute);

if (initialRoute == onboardingRoute) _initialPage = OnboardingScreen();

_isLoading = false;

} }`

¿I am doing something wrong?

Thank you in advance!

ghost avatar Apr 05 '20 13:04 ghost

Hello :)

Did you check the example project ? https://github.com/jaumard/flare_splash_screen/blob/master/example/lib/main.dart#L15

What do you mean by it's not working exactly ?

jaumard avatar Apr 05 '20 13:04 jaumard

Yes checked it. This is not working: by default it does a fade animation but you can customize it by using transitionsBuilder

ghost avatar Apr 05 '20 13:04 ghost

It doesnt work

YohanWadia avatar May 27 '20 19:05 YohanWadia

I've tried using transitionBuilder but it didn't work either.

brendabullorini avatar Jun 07 '20 20:06 brendabullorini

I'm having the same issue as well. There is no animation (fade or my implementation of slide) that occurs when the "loading" (in this case an simulation of 10 seconds.

Here's my implementation:

SplashScreen.navigate(
        name: 'lib/graphics/splash-screen.flr',
        next: (context) => LibraryNavigator(),
        transitionsBuilder: (_, animation, __, child) {
          return SlideTransition(
            position: Tween<Offset>(
              begin: const Offset(0, -1),
              end: Offset.zero,
            ).animate(animation),
            child: child,
          );
        },
        until: () => Future.delayed(Duration(seconds: 10)),
        backgroundColor: const Color(0xFF32407b),
        alignment: Alignment.center,
        height: 300,
        width: 300,
        loopAnimation: 'loading',
        endAnimation: 'done',
      ),

ghost avatar Jul 06 '20 11:07 ghost

I just get a dark screen and the app is stuck

PembaTamang avatar Sep 03 '20 12:09 PembaTamang

Check pubspec.yaml, path to your flr file or names for animations. I had problem with those.

draskosaric avatar Sep 06 '20 09:09 draskosaric