fade 1.0.0 copy "fade: ^1.0.0" to clipboard
fade: ^1.0.0 copied to clipboard

A Widget that animates its visible property with fade and size transitions

fade #

pub package A Widget that animates its visible property with fade and size (height) transitions made on child widget. It allows declarative UI without code smell like animation controller for each widget that should fade away. The Widget works on bounded and unbounded constraints, so height doesn't need to be explicitly provided to the child widget.

The library provides one widget Fade and depends only on Flutter framework.

Example #

Usage #

Let's see a basic demo:

class MyPage extends StatefulWidget {
  @override
  _MyPageState createState() => _MyPageState();
}

class _MyPageState_ extends State<MyPage> {
  bool visible = false;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SingleChildScrollView(
        child: GestureDetector(
          onTap: () => setState(() => visible = !visible),
          child: Column(
            children: <Widget>[
              Container(
                height: 200,
                color: Colors.blue,
              ),
              Fade(
                visible: visible,
                // duration is optional
                duration: Duration(milliseconds: 400),
                child: Container(
                  height: 200,
                  color: Colors.green,
                ),
              ),
              Container(
                height: 200,
                color: Colors.red,
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Contributors #

3
likes
40
pub points
51%
popularity

Publisher

unverified uploader

A Widget that animates its visible property with fade and size transitions

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on fade