infinite_carousel 1.1.1 copy "infinite_carousel: ^1.1.1" to clipboard
infinite_carousel: ^1.1.1 copied to clipboard

Carousel in flutter. Supports features like infinite looping, friction effect, multiple scroll physics and control over item anchor and velocity.

example/lib/main.dart

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

import 'screens/complex.dart';
import 'screens/horizontal.dart';
import 'screens/vertical.dart';

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

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

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

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  late InfiniteScrollController controller;
  int selectedIndex = 0;

  @override
  void initState() {
    super.initState();
    controller = InfiniteScrollController();
  }

  @override
  void dispose() {
    super.dispose();
    controller.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text(widget.title)),
      body: Container(
        alignment: Alignment.topCenter,
        child: Column(
          children: [
            const SizedBox(height: 20),
            ElevatedButton(
              child: const Text('Horizontal example'),
              onPressed: () {
                Navigator.of(context).push(MaterialPageRoute(
                    builder: (context) => const Horizontal()));
              },
            ),
            const SizedBox(height: 30),
            ElevatedButton(
              child: const Text('Vertical example'),
              onPressed: () {
                Navigator.of(context).push(
                    MaterialPageRoute(builder: (context) => const Vertical()));
              },
            ),
            const SizedBox(height: 30),
            ElevatedButton(
              child: const Text('Complex example'),
              onPressed: () {
                Navigator.of(context).push(
                    MaterialPageRoute(builder: (context) => const Complex()));
              },
            ),
          ],
        ),
      ),
    );
  }
}
258
likes
160
points
11.5k
downloads

Publisher

verified publishergeekyants.com

Weekly Downloads

Carousel in flutter. Supports features like infinite looping, friction effect, multiple scroll physics and control over item anchor and velocity.

Repository (GitHub)
View/report issues
Contributing

Topics

#ui #carousel #widget #infinite

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on infinite_carousel