Skip to main content

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

This class is a StatefulWidget that displays a card with a hover animation effect.

example/lib/main.dart

import 'package:card_animation_hover/card_animation_hover.dart';
import 'package:flutter/material.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(
      title: 'Flutter Demo',
      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> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
      ),
      body: Center(
        child: Padding(
          padding: const EdgeInsets.all(40.0),
          child: Wrap(
            spacing: 20.0,
            runSpacing: 22.0,
            children: cards
                .map(
                  (card) => CardAnimationHover(
                    card: card,
                    showAnimation: true,
                    onTap: () {
                      Navigator.push(
                        context,
                        MaterialPageRoute(
                          builder: (context) => const MyHomePage(),
                        ),
                      );
                    },
                  ),
                )
                .toList(),
          ),
        ),
      ),
      // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

final List<Map<String, String>> cards = [
  {
    'image': 'assets/apple_watch_series_7_1.png',
    'header': 'Apple Watch Series 7',
    'content': 'The latest Apple Watch with advanced features.',
  },
  {
    'image': 'assets/galaxy_watch_4_3.png',
    'header': 'Galaxy Watch 4',
    'content': 'Samsung smartwatch with Wear OS.',
  },
  {
    'image': 'assets/samsung_q_60_a_1.png',
    'header': 'Samsung Q60A',
    'content': 'Samsung QLED TV with stunning display.',
  },
];
14
likes
150
points
190
downloads

Documentation

API reference

Publisher

verified publisherswanflutterdev.com

Weekly Downloads

This class is a StatefulWidget that displays a card with a hover animation effect.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter

More

Packages that depend on card_animation_hover