Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default transition is not working #20

Open
ghost opened this issue Apr 5, 2020 · 7 comments
Open

Default transition is not working #20

ghost opened this issue Apr 5, 2020 · 7 comments

Comments

@ghost
Copy link

ghost commented Apr 5, 2020

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/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!

@jaumard
Copy link
Owner

jaumard commented Apr 5, 2020

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
Copy link
Author

ghost commented Apr 5, 2020

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

@YohanWadia
Copy link

It doesnt work

@brendabullorini
Copy link

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

@ghost
Copy link

ghost commented Jul 6, 2020

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
Copy link

I just get a dark screen and the app is stuck

@draskosaric
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants