jaumard / flare_splash_screen

Facilitator for having a Splash Screen with a Flare animation
MIT License
95 stars 20 forks source link

Default transition is not working #20

Open ghost opened 4 years ago

ghost commented 4 years ago

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 { bool _isLoading = true; Widget _initialPage = HomeScreen();

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

@override Widget build(BuildContext context) { return SplashScreen.navigate( name: 'assets/animations/splashanimation.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!

jaumard commented 4 years ago

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 ?

ghost commented 4 years ago

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

YohanWadia commented 4 years ago

It doesnt work

brendabullorini commented 4 years ago

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

ghost commented 4 years ago

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',
      ),
PembaTamang commented 4 years ago

I just get a dark screen and the app is stuck

draskosaric commented 4 years ago

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