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

outdated

Carousel in flutter. Supports infinite looping and gives control over 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(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Infinite Carousel Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Infinite Carousel Demo'),
    );
  }
}

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

  final String title;

  @override
  _MyHomePageState 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: Column(
        children: [
          ElevatedButton(
            child: Text('Horizontal example'),
            onPressed: () {
              Navigator.of(context)
                  .push(MaterialPageRoute(builder: (context) => Horizontal()));
            },
          ),
          ElevatedButton(
            child: Text('Vertical example'),
            onPressed: () {
              Navigator.of(context)
                  .push(MaterialPageRoute(builder: (context) => Vertical()));
            },
          ),
          ElevatedButton(
            child: Text('Complex example'),
            onPressed: () {
              Navigator.of(context)
                  .push(MaterialPageRoute(builder: (context) => Complex()));
            },
          ),
        ],
      ),
    );
  }
}
233
likes
0
pub points
97%
popularity

Publisher

verified publishergeekyants.com

Carousel in flutter. Supports infinite looping and gives control over anchor and velocity.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on infinite_carousel