import
'package:circular_reveal_animation/circular_reveal_animation.dart'
;
import
'package:flutter/material.dart'
;
void
main() => runApp(MyApp());
class
MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return
MaterialApp(
title:
'GeeksForGeeks'
,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(),
);
}
}
class
MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class
_MyHomePageState extends State<MyHomePage>
with SingleTickerProviderStateMixin {
AnimationController animationController;
Animation<
double
> animation;
@override
void
initState() {
super.initState();
animationController = AnimationController(
vsync:
this
,
duration: Duration(milliseconds: 1000),
);
animation = CurvedAnimation(
parent: animationController,
curve: Curves.easeIn,
);
}
@override
Widget build(BuildContext context) {
return
Scaffold(
appBar: AppBar(
title: Text(
"GeeksForGeeks"
),
backgroundColor: Colors.green,
),
body: Padding(
padding:
const
EdgeInsets.all(16.0),
child: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
SizedBox(height: 16),
CircularRevealAnimation(
child: Image.asset(
'assets/wonderwomen.jpg'
),
animation: animation,
centerAlignment: Alignment.centerRight,
centerOffset: Offset(130, 100),
minRadius: 12,
maxRadius: 200,
),
],
),
),
),
floatingActionButton: FloatingActionButton(
backgroundColor: Colors.green,
onPressed: () {
if
(animationController.status == AnimationStatus.forward ||
animationController.status == AnimationStatus.completed) {
animationController.reverse();
}
else
{
animationController.forward();
}
}),
);
}
}