after_enter_anim 1.0.4
after_enter_anim: ^1.0.4

Flutter Android iOS web

Brings functionality to execute code after the enter animation finish.

Flutter After Enter Anim #

pub package

Brings functionality to execute code after the enter animation finish.

Quick Usage #

Add with AfterEnterAnimMixin<MyWidget> mixin to your State<MyWidget> class and then implement the void afterEnterAnim(BuildContext context) abstract method. Code in this method will be called the enter animation finish.

Usage #

This demo showcases how this package resolves the shortcomings shown above:

import 'package:after_enter_anim/after_enter_anim.dart';
import 'package:flutter/material.dart';

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'After Enter Anim Example',
      home: new FirstScreen(),
    );
  }
}

class FirstScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      floatingActionButton: FloatingActionButton(
        onPressed: () => Navigator.push(
            context, MaterialPageRoute(builder: (context) => SecondScreen())),
      ),
    );
  }
}

class SecondScreen extends StatefulWidget {
  @override
  SecondScreenState createState() => new SecondScreenState();
}

class SecondScreenState extends State<SecondScreen>
    with AfterEnterAnimMixin<SecondScreen> {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(body: new Container(color: Colors.red));
  }

  @override
  void afterEnterAnim(BuildContext context) {
    showHelloWorld();
  }

  void showHelloWorld() {
    showDialog(
      context: context,
      builder: (context) => new AlertDialog(
        content: new Text('Hello World'),
        actions: <Widget>[
          new FlatButton(
            child: new Text('DISMISS'),
            onPressed: () => Navigator.of(context).pop(),
          )
        ],
      ),
    );
  }
}

1
likes
100
pub points
25%
popularity

Brings functionality to execute code after the enter animation finish.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

luodilong@gmail.com

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on after_enter_anim