Auto slide image with indicator in flutter

carousel_slider #

A carousel slider widget, support infinite scroll and custom widget, with auto play feature.

Example App:-
Add carousel_pro: ^1.0.0 in your pubspec.yaml dependencies. And import it:

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

void main() => runApp(MaterialApp(
  debugShowCheckedModeBanner: false,
  title: 'Auto_Image_slider_with_Indicator',
  home: HomePage(),
));


class HomePage extends StatefulWidget {
  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {

    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.brown,
        title: Text("Auto_Image_slider_with_Indicator"),
      ),

      body: ListView(children: <Widget>[
        autoImagesliderwithIndicator,
      ]),
    );
  }

  Widget autoImagesliderwithIndicator = Container(
    height: 200,
    child: Carousel(
      boxFit: BoxFit.fill,
     
      images:[
      FlutterLogo(size:250),
      FlutterLogo(size:200),
      FlutterLogo(size:150),
      ],

      autoplay: true,
      autoplayDuration: Duration(seconds:2),
      dotSize: 4.0,
      dotColor: Colors.lightGreenAccent,
    ),
  );
}

Parameters and Values #

images #

All the images on this Carousel. Type: List

animationCurve #

The transition animation timing curve Default value: Curves.ease Type: Curve
Values #
  • Curves.linear;
  • Curves.fastOutSlowIn;
  • Curves.ease;
  • Curves.bounceOut;
  • Curves.bounceIn;
  • Curves.bounceInOut;
  • Curves.decelerate;
  • Curves.ease;
  • Curves.easeIn;
  • Curves.easeInOut;
  • Curves.easeOut;
  • Curves.elasticIn;
  • Curves.elasticInOut;
  • Curves.elasticOut;

animationDuration #

The transition animation duration Type: Duration Default value: 300ms.

dotSize #

The base size of the dots Type: double Default value: 8.0

dotIncreaseSize #

The increase in the size of the selected dot Type: double Default value: 2.0

dotSpacing #

The distance between the center of each dot Type: double Default value: 25.0

dotColor #

The Color of each dot Type: Color Default value: Colors.white

dotBgColor #

The background Color of the dots Type: Color Default value: Colors.grey[800].withOpacity(0.5)

showIndicator #

Enable or Disable the indicator (dots) Type: bool Default value: true

indicatorBgPadding #

Padding Size of the background Indicator Type: double Default value: 20.0

boxFit #

How to show the images in the box Type: BoxFit Default value: cover
Values #
  • BoxFit.cover;
  • BoxFit.fitWidth;
  • BoxFit.fitHeight;
  • BoxFit.scaleDown;
  • BoxFit.fill;
  • BoxFit.contain;
  • BoxFit.none;

borderRadius #

Enable/Disable radius Border for the images Type: bool Default value: false

radius #

Border Radius of the images Type: Radius Default value: Radius.circular(8.0)

moveIndicatorFromBottom #

Move the Indicator From the Bottom Type: double Default value: 0.0

noRadiusForIndicator #

Remove the radius bottom from the indicator background Type: bool Default value: false

overlayShadow #

Enable/Disable Image Overlay Shadow Type: bool Default value: false

overlayShadowColors #

Choose the color of the overlay Shadow color Type: Color Default value: Colors.grey[800]

overlayShadowSize #

Choose the size of the Overlay Shadow, from 0.0 to 1.0 Type: double Default value: 0.5

autoplay #

Enable/Disable autoplay carousel Type: bool Default value: true

autoplayDuration #


The autoplay transition duration Type: Duration Default value: 3s

Comments

Popular posts from this blog

Flutter Architecture | Flutter - Architecture Application

Automatic Scrolling Image in flutter