animated_infinite_slider 0.0.1 copy "animated_infinite_slider: ^0.0.1" to clipboard
animated_infinite_slider: ^0.0.1 copied to clipboard

An advanced Flutter animation package to create an infinite, draggable slider for showcasing any widget list (e.g., images, cards, or custom widgets). The slider supports seamless animations, draggabl [...]

πŸš€ Infinite Draggable Slider 🌟 #

An advanced Flutter animation package to create an infinite, draggable slider for showcasing any widget list (e.g., images, cards, or custom widgets). The slider supports seamless animations, draggable interactions, and customization options to suit your app's design.


✨ Features #

  • Infinite Sliding: Navigate through widgets in an infinite loop.
  • Draggable Interaction: Drag left or right to navigate, with threshold-based sensitivity.
  • Smooth Animations: Fine-tuned transitions for a polished look and feel.
  • Snapback Behavior: Widgets snap back to their original position when dragged vertically.
  • Highly Customizable: Control dimensions, animations, and padding as per your requirements.

πŸ“¦ Installation #

Add the package to your pubspec.yaml file:

dependencies:
  animated_slider: latest_version

Run the command:

flutter pub get

πŸ› οΈ Usage #

Here’s how you can integrate the slider into your project:

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const HomeScreen(),
    );
  }
}

class HomeScreen extends StatefulWidget {
  const HomeScreen({super.key});

  @override
  State<HomeScreen> createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
  final List<String> imageList = List.generate(10, (index) {
    return "assets/images/image${index + 1}.jpg";
  });

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            const SizedBox(height: 100),
            const Text("🌟 Animated Slider Widget 🌟"),
            Expanded(
              child: AnimatedSlider(
                itemCount: imageList.length,
                itemBuielder: (context, index) =>
                    SliderImages(image: imageList[index]),
              ),
            ),
            const SizedBox(height: 100),
          ],
        ),
      ),
    );
  }
}

class SliderImages extends StatelessWidget {
  const SliderImages({super.key, required this.image});
  final String image;

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 400,
      width: 250,
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(18),
        image: DecorationImage(image: AssetImage(image), fit: BoxFit.contain),
      ),
    );
  }
}

🧰 Properties #

Property Type Description
itemCount int Total number of items in the slider.
itemBuielder Function(BuildContext context, int index) Function to build each widget.
height double? (Optional) Height of the slider.
width double? (Optional) Width of the slider.
padding EdgeInsets? (Optional) Padding inside the slider. Default: 8.0.
onTap Function? (Optional) Callback for tap events.
index int (Optional) Initial index of the slider. Default: 0.

πŸ“‚ Asset Setup #

Make sure your image assets are properly defined in the pubspec.yaml file:

flutter:
  assets:
    - assets/images/image1.jpg
    - assets/images/image2.jpg
    - assets/images/image3.jpg

For a folder:

flutter:
  assets:
    - assets/images/

πŸ“œ License #

This project is licensed under the MIT License.


πŸ™Œ Contributing #

Contributions are welcome! Feel free to open issues or submit pull requests.


πŸŽ₯ Demo #

Include a demo GIF or image to showcase your slider in action! #

Infinite Draggable Slider


Happy Sliding! πŸŽ‰  

Key Changes: #

  1. Updated the properties to reflect the improved code (height spelling fixed).
  2. Added drag sensitivity and animation refinements in the highlights section.
  3. Simplified and aligned the code examples with the latest functionality.
  4. Suggested adding a demo GIF to make the project more visually appealing.
4
likes
120
points
31
downloads

Publisher

unverified uploader

Weekly Downloads

An advanced Flutter animation package to create an infinite, draggable slider for showcasing any widget list (e.g., images, cards, or custom widgets). The slider supports seamless animations, draggable interactions, and customization options to suit your app's design.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on animated_infinite_slider