Coder Social home page Coder Social logo

wuweijian1997 / flutter_animated_flex Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 287 KB

Flutter animation flex | animation column | animation row

License: BSD 3-Clause "New" or "Revised" License

Dart 95.66% Kotlin 0.95% Swift 3.09% Objective-C 0.29%

flutter_animated_flex's Introduction

Animated flex

Flutter animation flex.

example

demo.gif

demo1

AnimatedFlex(
  children: [
    Container(
      color: Colors.red,
      height: 200,
      margin: EdgeInsets.only(top: 20),
    ),
    Container(
      color: Colors.green,
      height: 200,
      margin: EdgeInsets.only(top: 20),
    ),
    Container(
      color: Colors.blue,
      height: 200,
      margin: EdgeInsets.only(top: 20),
    ),
  ],
)

demo2

AnimatedFlex(
  animationWidgetBuilder: (Animation animation, Widget child) {
    return Opacity(
      opacity: animation.value,
      child: Transform(
        transform: Matrix4.translationValues(
            20 * (1.0 - animation.value),
            20 * (1.0 - animation.value),
            0.0),
        child: child,
      ),
    );
  },
  children: [
    Container(
      color: Colors.red,
      height: 200,
      margin: EdgeInsets.only(top: 20),
    ),
    Container(
      color: Colors.green,
      height: 200,
      margin: EdgeInsets.only(top: 20),
    ),
    Container(
      color: Colors.blue,
      height: 200,
      margin: EdgeInsets.only(top: 20),
    ),
  ],
)

demo3

Column(
  children: [
    SizedBox(
      height: 100,
      child: AnimatedFlex(
        animationWidgetBuilder: (Animation animation, Widget child) {
          return Opacity(
            opacity: animation.value,
            child: Transform(
              transform: Matrix4.translationValues(
                  20 * (1.0 - animation.value), 0, 0.0),
              child: child,
            ),
          );
        },
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        direction: Axis.horizontal,
        children: [
          Container(
            color: Colors.red,
            height: 100,
            width: 100,
          ),
          Container(
            color: Colors.green,
            height: 100,
            width: 100,
          ),
          Container(
            color: Colors.blue,
            height: 100,
            width: 100,
          ),
        ],
      ),
    ),
    SizedBox(
      height: 400,
      child: AnimatedFlex(
        delayed: Duration(milliseconds: 1000),
        animationWidgetBuilder: (Animation animation, Widget child) {
          return Opacity(
            opacity: animation.value,
            child: Transform(
              transform: Matrix4.translationValues(
                  20 * (1.0 - animation.value),
                  20 * (1.0 - animation.value),
                  0.0),
              child: child,
            ),
          );
        },
        children: [
          Container(
            color: Colors.red,
            height: 100,
            margin: EdgeInsets.only(top: 20),
          ),
          Container(
            color: Colors.green,
            height: 100,
            margin: EdgeInsets.only(top: 20),
          ),
          Expanded(
            child: Container(
              color: Colors.blue,
              // height: 100,
              margin: EdgeInsets.only(top: 20),
            ),
          ),
        ],
      ),
    ),
  ],
)

demo4

AnimatedFlex(
  animationWidgetBuilder: (Animation animation, Widget child) {
    return Opacity(
      opacity: animation.value,
      child: Transform.scale(
          scale: 0.8 + animation.value * .2,
          child: child),
    );
  },
  children: [
    Container(
      color: Colors.red,
      height: 150,
      margin: EdgeInsets.only(top: 20),
    ),
    Container(
      color: Colors.green,
      height: 150,
      margin: EdgeInsets.only(top: 20),
    ),
    Container(
      color: Colors.blue,
      height: 150,
      margin: EdgeInsets.only(top: 20),
    ),
  ],
)

flutter_animated_flex's People

Contributors

wuweijian1997 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

followthemoney1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.