Untitled
unknown
plain_text
3 years ago
3.4 kB
6
Indexable
Feel free to use the code in your projects but do not forget to give me the credits adding my app (Flutter Animation Gallery) where you are gonna use it.
------------------------------------------
import 'package:animator/animator.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class MyCustomWidget extends StatefulWidget {
@override
_MyCustomWidgetState createState() => _MyCustomWidgetState();
}
class _MyCustomWidgetState extends State<MyCustomWidget> {
@override
Widget build(BuildContext context) {
double _width = MediaQuery.of(context).size.width;
return Scaffold(
body: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Container(
height: _width / 2.7,
width: _width / 2.7,
child: Animator<double>(
duration: Duration(milliseconds: 1000),
cycles: 0,
curve: Curves.elasticIn,
tween: Tween<double>(begin: 20.0, end: 25.0),
builder: (context, animatorState, child) => Icon(
Icons.favorite,
size: animatorState.value * 5,
color: Color(0xFFFF5757),
),
),
),
Container(
height: _width / 2.7,
width: _width / 2.7,
child: Animator<double>(
duration: Duration(milliseconds: 1000),
cycles: 0,
curve: Curves.elasticInOut,
tween: Tween<double>(begin: 20.0, end: 25.0),
builder: (context, animatorState, child) => Icon(
Icons.favorite,
size: animatorState.value * 5,
color: Color(0xFFFF5757),
),
),
),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Container(
height: _width / 2.7,
width: _width / 2.7,
child: Animator<double>(
duration: Duration(milliseconds: 1000),
cycles: 0,
curve: Curves.bounceOut,
tween: Tween<double>(begin: 20.0, end: 25.0),
builder: (context, animatorState, child) => Icon(
Icons.favorite,
size: animatorState.value * 5,
color: Color(0xFFFF5757),
),
),
),
Container(
height: _width / 2.7,
width: _width / 2.7,
child: Animator<double>(
duration: Duration(milliseconds: 1000),
cycles: 0,
curve: Curves.elasticOut,
tween: Tween<double>(begin: 20.0, end: 25.0),
builder: (context, animatorState, child) => Icon(
Icons.favorite,
size: animatorState.value * 5,
color: Color(0xFFFF5757),
),
),
),
],
),
],
),
);
}
}
Editor is loading...