infinity_slider 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 63

infinity_slider #

A infinity slider widget, support infinite scroll and slider nesting .

Installation #

Add infinity_slider: ^1.0.0 in your pubspec.yaml dependencies. And import it:

import 'package:infinity_slider/infinity_slider.dart';

How to use #

Simply create a InifitySlider widget, and pass the required params:

  items: [1,2,3,4,5].map((i) {
    return new Builder(
      builder: (BuildContext context) {
        return new Container(
          width: MediaQuery.of(context).size.width,
          margin: new EdgeInsets.symmetric(horizontal: 5.0),
          decoration: new BoxDecoration(
            color: Colors.amber
          child: new Text('text $i', style: new TextStyle(fontSize: 16.0),)
  height: 400.0,
  autoPlay: true

You can pass the above params to the class. If you pass the height params, the aspectRatio param will be ignore.

Instance methods #

You can use the instance methods to programmatically take control of the pageView's position.

.nextPage({Duration duration, Curve curve}) #

Animate to the next page

.previousPage({Duration duration, Curve curve}) #

Animate to the previous page

.animateToPage(int page, {Duration duration, Curve curve}) #

Animate to the other page

.jumpToPage(int page) #

jump to the other page

Faq #

Can I nest both sliders? #

Yes, you can.

    items: [1,2,3].map((int outIndex) {
      return Builder(
        builder: (BuildContext context) {
          return InfinitySlider(
            items: [4,5].map((int innerIndex) {
              return Builder(
                builder: (BuildContext context) {
                  return Container(
                    color: Colors.amber,
                    child: Text("$outIndex-$innerIndex"),
            loop: false,
    loop: false,

Can I display a dotted indicator for the slider? #

Yes, you can.

class InfinityWithIndicator extends StatefulWidget {
  _InfinityWithIndicatorState createState() => _InfinityWithIndicatorState();

class _InfinityWithIndicatorState extends State<InfinityWithIndicator> {
  int _current = 0;

  Widget build(BuildContext context) {
    return Stack(
      children: [
          items: child,
          autoPlay: true,
          updateCallback: (index) {
            setState(() {
              _current = index;
          top: 0.0,
          left: 0.0,
          right: 0.0,
          child: Row(
            children: map<Widget>(imgList, (index, url) {
              return Container(
                width: 8.0,
                height: 8.0,
                margin: EdgeInsets.symmetric(vertical: 10.0, horizontal: 2.0),
                decoration: BoxDecoration(
                  color: _current == index ? Color.fromRGBO(0, 0, 0, 0.9) : Color.fromRGBO(0, 0, 0, 0.4)


  • Initial version.


  • Support for slider nesting


example #

A new Flutter application.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  infinity_slider: ^1.0.0

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:infinity_slider/infinity_slider.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Nov 15, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.0
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.6


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/infinity_slider.dart. (-0.50 points)

Analysis of lib/infinity_slider.dart reported 1 hint:

line 178 col 3: This function has a return type of 'bool', but doesn't end with a return statement.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies