overlapped_carousel 1.0.1 icon indicating copy to clipboard operation
overlapped_carousel: ^1.0.1 copied to clipboard

A Flutter package project that is a simple horizontal overlapped_carousel widget.

Overlapped Carousel #

A horizontal overlapped carousel widget. The center widget will be at the top of the stack.

Demo #

Installation #

Add overlapped_carousel: ^1.0.1 to your pubspec.yaml dependecies. And import it:

import 'package:overlapped_carousel/overlapped_carousel.dart';

How to use #

Simply add a OverlappedCarousel widget with required params.

  @override
  Widget build(BuildContext context) {
    var screenWidth = MediaQuery.of(context).size.width;
    var screenHeight = MediaQuery.of(context).size.height;
    return Scaffold(
      backgroundColor: Colors.blue,
      //Wrap with Center to place the carousel center of the screen
      body: Center(
        //Wrap the OverlappedCarousel widget with SizedBox to fix a height. No need to specify width.
        child: SizedBox(
          height: min(screenWidth / 3.3 * (16 / 9),screenHeight*.9),
          child: OverlappedCarousel(
            widgets: widgets, //List of widgets
            currentIndex: 2,
            onClicked: (index) {
              ScaffoldMessenger.of(context).showSnackBar(
                SnackBar(
                  content: Text("You clicked at $index"),
                ),
              );
            },
          ),
        ),
      ),
    );
  }

22
likes
130
pub points
68%
popularity

Publisher

unverified uploader

A Flutter package project that is a simple horizontal overlapped_carousel widget.

Repository (GitHub)

Documentation

API reference

License

Icon for licenses.MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on overlapped_carousel