flying_animation 0.0.4 copy "flying_animation: ^0.0.4" to clipboard
flying_animation: ^0.0.4 copied to clipboard

Animation package for fly effect

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flying_animation/flying_widget.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: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            FlyingWidget(
              coverWidget: Icon(Icons.favorite, color: Colors.red),
              animationController: animationController,
              child: Icon(Icons.favorite, color: Colors.red),
            ),
            const SizedBox(height: 20),
            ElevatedButton(
              onPressed: () {
                if (!context.mounted) return;
                animationController.reset();
                animationController.forward();
              },
              child: const Text('Click me'),
            ),
          ],
        ),
      ),
    );
  }
}
9
likes
150
points
67
downloads

Publisher

verified publisherganghee.dev

Weekly Downloads

Animation package for fly effect

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flying_animation