flying_animation 0.0.1
flying_animation: ^0.0.1 copied to clipboard
Animation package for fly effect
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:fly_animation/flying_animation.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage>
with SingleTickerProviderStateMixin {
late final AnimationController animationController;
@override
void initState() {
animationController = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 1000),
);
super.initState();
}
@override
void dispose() {
animationController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: FlyingAnimationWidget(
animationController: animationController,
icon: Icon(
color: Colors.blue,
size: 42,
Icons.accessibility,
),
flyIcon: Icon(
color: Colors.red,
size: 52,
Icons.accessibility,
),
),
),
floatingActionButton: FloatingActionButton(
onPressed: () {
if (!context.mounted) return;
animationController.reset();
animationController.forward();
},
child: const Icon(Icons.add),
),
);
}
}