Animated Container
https://pub.dev/packages/animate_do
Use this package as a library
animate_do: ^1.7.2
........................................................................................................................................................................................................................
Example : #1
import 'package:flutter/material.dart';
import 'package:animate_do/animate_do.dart';
void main()=>runApp(MaterialApp(home: MyApp(), debugShowCheckedModeBanner: false,));
class MyApp extends StatefulWidget{
@override
MyAppState createState()=>MyAppState();
}
class MyAppState extends State<MyApp>{
@override
Widget build(BuildContext context){
return Scaffold(
body: Center(
child: Bounce(
infinite: true,
//duration: Duration(seconds: 5),
child: RectangularIO(),
),
),
);
}
}
class RectangularIO extends StatelessWidget{
@override
Widget build(BuildContext context){
return Container(
width: 50,
height: 50,
decoration: BoxDecoration(
color: Colors.deepPurpleAccent
),
);
}
}
........................................................................................................................................................................................................................
Example : #2[ Bounce]
import 'package:flutter/material.dart';
import 'package:animate_do/animate_do.dart';
void main()=>runApp(MaterialApp(home: MyApp(), debugShowCheckedModeBanner: false,));
class MyApp extends StatefulWidget{
@override
MyAppState createState()=>MyAppState();
}
class MyAppState extends State<MyApp>{
@override
Widget build(BuildContext context){
return Scaffold(
body: Center(
child: Bounce(
infinite: true,
child: Container(
child:Text(" Hello World!")
),
),
),
);
}
}
........................................................................................................................................................................................................................
Example : #3[AnimatedContainer]
import 'package:flutter/material.dart';
import 'package:animate_do/animate_do.dart';
void main()=>runApp(MaterialApp(home: MyApp(), debugShowCheckedModeBanner: false,));
class MyApp extends StatefulWidget{
@override
MyAppState createState()=>MyAppState();
}
class MyAppState extends State<MyApp>{
@override
Widget build(BuildContext context){
return Scaffold(
floatingActionButton: FloatingActionButton(
onPressed: (){
setState((){
});
},
child: Icon(Icons.accessibility_new),
backgroundColor: Colors.purple,
),
body: Center(
//child: Container(
child: AnimatedContainer(
duration: Duration(milliseconds: 1000),
// curve: Curves.linear,
curve: Curves.elasticOut,
width: 70,
height: 70,
decoration: BoxDecoration(
color: Colors.deepPurpleAccent,
),
),
),
);
}
}
........................................................................................................................................................................................................................
Example : #4[]
........................................................................................................................................................................................................................
Example : #5
........................................................................................................................................................................................................................
Example : #6
No comments:
Post a Comment