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

Animation package for fly effect

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:flying_animation/flying_image.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: FlyingImageWidget(
          animationController: animationController,
          flyImage: SvgPicture.asset('assets/ic_heart.svg'),
          image: SvgPicture.asset('assets/ic_heart.svg'),
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          if (!context.mounted) return;
          animationController.reset();
          animationController.forward();
        },
        child: const Icon(Icons.add),
      ),
    );
  }
}
9
likes
0
points
67
downloads

Publisher

verified publisherganghee.dev

Weekly Downloads

Animation package for fly effect

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

collection, flutter

More

Packages that depend on flying_animation