animated_cross 1.0.0 animated_cross: ^1.0.0 copied to clipboard
An animated cross icon widget for Flutter.
import 'package:animated_cross/animated_cross.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Animated Cross Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Animated Cross Demo'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({this.title = ''});
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage>
with SingleTickerProviderStateMixin {
late AnimationController _animationController;
late Animation<double> _animation;
@override
void initState() {
super.initState();
_animationController =
AnimationController(vsync: this, duration: Duration(seconds: 1));
_animation = new Tween<double>(begin: 0, end: 1).animate(
new CurvedAnimation(
parent: _animationController, curve: Curves.easeInOutCirc));
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Animated Cross Example"),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
child: AnimatedCross(
progress: _animation,
size: 200,
)),
TextButton(
child: Text("Go"),
onPressed: _animationController.forward),
TextButton(
child: Text("Reset"), onPressed: _animationController.reset)
],
),
));
}
}