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

Effortlessly animate views or list items with AnimationView by selecting an animation type. Options include: none, fadeIn, scale, slideRTL, slideLTR, slideUp, flip, bounce, scaleLTR, scaleCenterZoomOu [...]

example/lib/example.dart

import 'package:flutter/material.dart';
import 'package:flutter_awesome_animations_kit/flutter_awesome_animations_kit.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const HomeScreen(),
    );
  }
}

class HomeScreen extends StatelessWidget {
  const HomeScreen({super.key});
  static const List<String> animationTypeList = [
    'fadeIn',
    'slideRTL',
    'slideLTR',
    'slideUp',
    'scaleLTR',
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Flutter Animation')),
      body: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          ListView.builder(
            shrinkWrap: true,
            itemCount: animationTypeList.length,
            itemBuilder: (context, index) {
              return GestureDetector(
                onTap: () => Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) => ListViewScreen(
                      animationName: animationTypeList[index],
                    ),
                  ),
                ),
                child: Card(
                  child: ListTile(
                    title: Text(animationTypeList[index]),
                    trailing: const Icon(Icons.arrow_forward_ios),
                  ),
                ),
              );
            },
          ),
          const Text('\n Animated Text \n'),
          const Row(
            children: [
              Expanded(
                child: Column(
                  children: [
                    Text('CountUp'),
                    FlutterAnimatedText(
                      startValue: 0.0,
                      endValue: 100,
                      animationType: TextAnimationType.countUp,
                    ),
                  ],
                ),
              ),
              Expanded(
                child: Column(
                  children: [
                    Text('CountDown'),
                    FlutterAnimatedText(
                      startValue: 0,
                      endValue: 100.0,
                      animationType: TextAnimationType.countDown,
                    ),
                  ],
                ),
              ),
              Expanded(
                child: Column(
                  children: [
                    Text('Typing'),
                    FlutterAnimatedText(
                      normalText: "Hello...",
                      animationType: TextAnimationType.typing,
                    ),
                  ],
                ),
              )
            ],
          ),
        ],
      ),
    );
  }
}

class ListViewScreen extends StatefulWidget {
  final String animationName;

  const ListViewScreen({super.key, required this.animationName});

  @override
  State<ListViewScreen> createState() => _ListViewScreenState();
}

class _ListViewScreenState extends State<ListViewScreen> {
  late AnimationType animationType;
  @override
  void initState() {
    super.initState();
    animationType = getAnimationType(animationName: widget.animationName);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.animationName),
      ),
      body: Container(
        color: Colors.amber,
        child: ListView.builder(
          itemCount: 20,
          itemBuilder: (context, index) {
            return FlutterAnimatedView(
              animationType: animationType,
              index: index,
              child: Card(
                child: Padding(
                  padding:
                      const EdgeInsets.symmetric(horizontal: 16, vertical: 20),
                  child: Column(
                    children: [
                      Row(
                        children: [
                          Visibility(
                              visible: animationType == AnimationType.slideRTL,
                              child: const Icon(
                                Icons.arrow_back_ios,
                              )),
                          Text('Item $index'),
                          const Spacer(),
                          Visibility(
                            visible: animationType == AnimationType.slideLTR,
                            child: const Icon(
                              Icons.arrow_forward_ios,
                            ),
                          ),
                          const Divider()
                        ],
                      ),
                    ],
                  ),
                ),
              ),
            );
          },
        ),
      ),
    );
  }

  AnimationType getAnimationType({required String animationName}) {
    switch (animationName) {
      case 'fadeIn':
        return AnimationType.fadeIn;

      case 'slideRTL':
        return AnimationType.slideRTL;

      case 'slideLTR':
        return AnimationType.slideLTR;

      case 'slideUp':
        return AnimationType.slideUp;

      case 'flip':
        return AnimationType.flip;

      case 'scaleLTR':
        return AnimationType.scaleLTR;
      case 'none':
      default:
        return AnimationType.none;
    }
  }
}
4
likes
150
points
53
downloads

Publisher

unverified uploader

Weekly Downloads

Effortlessly animate views or list items with AnimationView by selecting an animation type. Options include: none, fadeIn, scale, slideRTL, slideLTR, slideUp, flip, bounce, scaleLTR, scaleCenterZoomOut. Enhance your UI seamlessly!

Repository (GitHub)
View/report issues

Documentation

API reference

Funding

Consider supporting this project:

buymeacoffee.com

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_awesome_animations_kit