How can i add lottie loading screen on my app?

Buğra Aykan

I want to when i am click special button and show firstly lottie animation screen then navigate another page, how can i do this ? Thank you so much

InkWell(
                        onTap: () {
                          showDialog(
                              context: context,
                              builder: (context) => Lottie.asset(
                                  'assets/lotties/rocket.json',
                                  repeat: true,
                                  animate: true)).then((value) =>
                              Navigator.of(context).push(MaterialPageRoute(
                                  builder: (context) => SecondScreen())));
                        },
Md. Kamrul Amin

To navigate after Lottie Animation has ended you have to do the following:

class Home extends StatefulWidget {
  const Home({Key? key}) : super(key: key);

  @override
  State<Home> createState() => _HomeState();
}

class _HomeState extends State<Home> with TickerProviderStateMixin{

  late final AnimationController _controller;
  
  @override
  void initState() {
    _controller = AnimationController(vsync: this, duration: Duration(milliseconds: 600));

    super.initState();
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.all(8.0),
      child: Lottie.network(
        'https://raw.githubusercontent.com/xvrh/lottie-flutter/master/example/assets/Mobilo/A.json',
        controller: _controller,
        onLoaded: (composition) {
          // Configure the AnimationController with the duration of the
          // Lottie file and start the animation.
          _controller
            ..duration = composition.duration
            ..forward().then((value) => Navigator.of(context).push(MaterialPageRoute(
                builder: (context) => Page2())));


        },
      ),
    );
  }

}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How can I add my app shortcut to notification panel

How do I keep the screen on in my App?

How can I add a custom chrome extension to my Electron app?

How Can I Add Map view to my Android app fragmentactivity

How can I resolve loading of xml2json in my electron app

How can I add advanced animations to my mobile app?

How can i center these images on my screen

Project tab stucked on loading screen How can I see my project folder on left?

How can i add UIActivityIndicator to Splash screen of my app?

How can I increase my screen resolution?

How can I record my screen?

Can I make a loading screen

How can I make tableview the default view screen for my iOS app?

How can I add the session name to my screen status display?

How can I add loading effect on top of my slider using jQuery

What is this notification bar called and how can I add it into my app?

How can I add the Bootstrap package to my meteor app?

How can I delay the loading of my controller?

How can I add App Indexing concept in my Application?

My app shows a splash screen. How can I make my test wait for the main screen?

How can I show a logo when my android app first loading?

How can I add support for android 4.4 in my android app

How can i redirect my app to a lock screen when reenter app

How can I open my Android app through share screen?

How can I add animations to my images in my Django app?

How can I get my app screen time on a hourly basis?

how can I add collision to my object and around the screen in my program?

How can I add a dynamic date time picker to my app?

How do I add a website loading screen in ReactJS?