intro_slider 3.0.9 icon indicating copy to clipboard operation
intro_slider: ^3.0.9 copied to clipboard

Flutter Intro Slider is a flutter plugin that helps you make a cool intro for your app

FLUTTER INTRO SLIDER

Flutter Intro Slider is a flutter plugin that helps you make a cool intro for your app. Create intro has never been easier and faster

Table of Contents #

Installing #

Add to pubspec.yaml file

dependencies:
  intro_slider: ^3.0.9

Import

import 'package:intro_slider/intro_slider.dart';

Demo #

default custom 1 custom 2

Code example #

Default config #

default config image

Code example (click to expand)
class IntroScreenDefaultState extends State<IntroScreenDefault> {
  List<Slide> slides = [];

  @override
  void initState() {
    super.initState();

    slides.add(
      Slide(
        title: "ERASER",
        description:
            "Allow miles wound place the leave had. To sitting subject no improve studied limited",
        pathImage: "images/photo_eraser.png",
        backgroundColor: const Color(0xfff5a623),
      ),
    );
    slides.add(
      Slide(
        title: "PENCIL",
        description:
            "Ye indulgence unreserved connection alteration appearance",
        pathImage: "images/photo_pencil.png",
        backgroundColor: const Color(0xff203152),
      ),
    );
    slides.add(
      Slide(
        title: "RULER",
        description:
            "Much evil soon high in hope do view. Out may few northward believing attempted. Yet timed being songs marry one defer men our. Although finished blessing do of",
        pathImage: "images/photo_ruler.png",
        backgroundColor: const Color(0xff9932CC),
      ),
    );
  }

  void onDonePress() {
    // Do what you want
    print("End of slides");
  }

  @override
  Widget build(BuildContext context) {
    return IntroSlider(
      slides: slides,
      onDonePress: onDonePress,
    );
  }
}

Custom config #

custom config image

Code example (click to expand)
class IntroScreenCustomConfigState extends State<IntroScreenCustomConfig> {
  List<Slide> slides = [];

  @override
  void initState() {
    super.initState();

    slides.add(
      Slide(
        title:
            "A VERY LONG TITLE A VERY LONG TITLE A VERY LONG TITLE A VERY LONG TITLE A VERY LONG TITLE A VERY LONG TITLE A VERY LONG TITLE A VERY LONG TITLE A VERY LONG TITLE",
        maxLineTitle: 2,
        styleTitle: const TextStyle(
          color: Colors.white,
          fontSize: 30.0,
          fontWeight: FontWeight.bold,
          fontFamily: 'RobotoMono',
        ),
        description:
            "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem. Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo. Sed fringilla mauris sit amet nibh. Donec sodales sagittis magna. Sed consequat, leo eget bibendum sodales, augue velit cursus nunc,",
        styleDescription: const TextStyle(
          color: Colors.white,
          fontSize: 20.0,
          fontStyle: FontStyle.italic,
          fontFamily: 'Raleway',
        ),
        marginDescription: const EdgeInsets.only(
          left: 20.0,
          right: 20.0,
          top: 20.0,
          bottom: 70.0,
        ),
        centerWidget: const Text(
          "Replace this with a custom widget",
          style: TextStyle(color: Colors.white),
        ),
        backgroundNetworkImage: "https://picsum.photos/200/300",
        onCenterItemPress: () {},
      ),
    );
    slides.add(
      Slide(
        title: "CITY",
        styleTitle: const TextStyle(
          color: Color(0xff7FFFD4),
          fontSize: 30.0,
          fontWeight: FontWeight.bold,
          fontFamily: 'RobotoMono',
        ),
        description:
            "Ye indulgence unreserved connection alteration appearance",
        styleDescription: const TextStyle(
          color: Color(0xff7FFFD4),
          fontSize: 20.0,
          fontStyle: FontStyle.italic,
          fontFamily: 'Raleway',
        ),
        colorBegin: Colors.lightBlue,
        colorEnd: Colors.amber,
        directionColorBegin: Alignment.topRight,
        directionColorEnd: Alignment.bottomLeft,
      ),
    );
    slides.add(
      Slide(
        title: "BEACH",
        styleTitle: const TextStyle(
          color: Color(0xffFFDAB9),
          fontSize: 30.0,
          fontWeight: FontWeight.bold,
          fontFamily: 'RobotoMono',
        ),
        description:
            "Much evil soon high in hope do view. Out may few northward believing attempted. Yet timed being songs marry one defer men our. Although finished blessing do of",
        styleDescription: const TextStyle(
          color: Color(0xffFFDAB9),
          fontSize: 20.0,
          fontStyle: FontStyle.italic,
          fontFamily: 'Raleway',
        ),
        backgroundImage: "images/beach.jpeg",
        maxLineTextDescription: 3,
      ),
    );
  }

  void onDonePress() {
    // Do what you want
    // Navigator.push(
    //   context,
    //   MaterialPageRoute(builder: (context) => HomeScreen()),
    // );
  }

  void onNextPress() {
    log("onNextPress caught");
  }

  Widget renderNextBtn() {
    return const Icon(
      Icons.navigate_next,
      color: Color(0xffF3B4BA),
      size: 35.0,
    );
  }

  Widget renderDoneBtn() {
    return const Icon(
      Icons.done,
      color: Color(0xffF3B4BA),
    );
  }

  Widget renderSkipBtn() {
    return const Icon(
      Icons.skip_next,
      color: Color(0xffF3B4BA),
    );
  }

  ButtonStyle myButtonStyle() {
    return ButtonStyle(
      shape: MaterialStateProperty.all<OutlinedBorder>(const StadiumBorder()),
      backgroundColor:
          MaterialStateProperty.all<Color>(const Color(0x33F3B4BA)),
      overlayColor: MaterialStateProperty.all<Color>(const Color(0x33FFA8B0)),
    );
  }

  @override
  Widget build(BuildContext context) {
    return IntroSlider(
      // List slides
      slides: slides,

      // Skip button
      renderSkipBtn: renderSkipBtn(),
      skipButtonStyle: myButtonStyle(),

      // Next button
      renderNextBtn: renderNextBtn(),
      onNextPress: onNextPress,
      nextButtonStyle: myButtonStyle(),

      // Done button
      renderDoneBtn: renderDoneBtn(),
      onDonePress: onDonePress,
      doneButtonStyle: myButtonStyle(),

      // Dot indicator
      colorDot: const Color(0x33FFA8B0),
      colorActiveDot: const Color(0xffFFA8B0),
      sizeDot: 13.0,

      // Behavior
      hideStatusBar: true,
      backgroundColorAllSlides: Colors.grey,
      verticalScrollbarBehavior: ScrollbarBehavior.SHOW_ALWAYS,
      autoScroll: true,
      loopAutoScroll: true,
      curveScroll: Curves.bounceIn,
    );
  }
}

Custom tab #

custom config image

Code example (click to expand)
class IntroScreenCustomTabState extends State<IntroScreenCustomTab> {
  List<Slide> slides = [];

  late Function goToTab;

  @override
  void initState() {
    super.initState();

    slides.add(
      Slide(
        title: "SCHOOL",
        styleTitle: const TextStyle(
          color: Color(0xff3da4ab),
          fontSize: 30.0,
          fontWeight: FontWeight.bold,
          fontFamily: 'RobotoMono',
        ),
        description:
            "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa.",
        styleDescription: const TextStyle(
          color: Color(0xfffe9c8f),
          fontSize: 20.0,
          fontStyle: FontStyle.italic,
          fontFamily: 'Raleway',
        ),
        pathImage: "images/photo_school.png",
      ),
    );
    slides.add(
      Slide(
        title: "MUSEUM",
        styleTitle: const TextStyle(
          color: Color(0xff3da4ab),
          fontSize: 30.0,
          fontWeight: FontWeight.bold,
          fontFamily: 'RobotoMono',
        ),
        description: "Ye indulgence unreserved connection alteration appearance",
        styleDescription: const TextStyle(
          color: Color(0xfffe9c8f),
          fontSize: 20.0,
          fontStyle: FontStyle.italic,
          fontFamily: 'Raleway',
        ),
        pathImage: "images/photo_museum.png",
      ),
    );
    slides.add(
      Slide(
        title: "COFFEE SHOP",
        styleTitle: const TextStyle(
          color: Color(0xff3da4ab),
          fontSize: 30.0,
          fontWeight: FontWeight.bold,
          fontFamily: 'RobotoMono',
        ),
        description:
            "Much evil soon high in hope do view. Out may few northward believing attempted. Yet timed being songs marry one defer men our. Although finished blessing do of",
        styleDescription: const TextStyle(
          color: Color(0xfffe9c8f),
          fontSize: 20.0,
          fontStyle: FontStyle.italic,
          fontFamily: 'Raleway',
        ),
        pathImage: "images/photo_coffee_shop.png",
      ),
    );
  }

  void onDonePress() {
    // Back to the first tab
    goToTab(0);
  }

  void onTabChangeCompleted(index) {
    // Index of current tab is focused
    log("onTabChangeCompleted, index: $index");
  }

  Widget renderNextBtn() {
    return const Icon(
      Icons.navigate_next,
      color: Color(0xffffcc5c),
      size: 35.0,
    );
  }

  Widget renderDoneBtn() {
    return const Icon(
      Icons.done,
      color: Color(0xffffcc5c),
    );
  }

  Widget renderSkipBtn() {
    return const Icon(
      Icons.skip_next,
      color: Color(0xffffcc5c),
    );
  }

  ButtonStyle myButtonStyle() {
    return ButtonStyle(
      shape: MaterialStateProperty.all<OutlinedBorder>(const StadiumBorder()),
      backgroundColor: MaterialStateProperty.all<Color>(const Color(0x33ffcc5c)),
      overlayColor: MaterialStateProperty.all<Color>(const Color(0x33ffcc5c)),
    );
  }

  List<Widget> renderListCustomTabs() {
    return List.generate(
      slides.length,
      (index) => SizedBox(
        width: double.infinity,
        height: double.infinity,
        child: Container(
          margin: const EdgeInsets.only(bottom: 60.0, top: 60.0),
          child: ListView(
            children: <Widget>[
              GestureDetector(
                child: Image.asset(
                  slides[index].pathImage!,
                  width: 200.0,
                  height: 200.0,
                  fit: BoxFit.contain,
                ),
              ),
              Container(
                margin: const EdgeInsets.only(top: 20.0),
                child: Text(
                  slides[index].title!,
                  style: slides[index].styleTitle,
                  textAlign: TextAlign.center,
                ),
              ),
              Container(
                margin: const EdgeInsets.only(top: 20.0),
                child: Text(
                  slides[index].description ?? '',
                  style: slides[index].styleDescription,
                  textAlign: TextAlign.center,
                  maxLines: 5,
                  overflow: TextOverflow.ellipsis,
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return IntroSlider(
      // Skip button
      renderSkipBtn: renderSkipBtn(),
      skipButtonStyle: myButtonStyle(),

      // Next button
      renderNextBtn: renderNextBtn(),
      nextButtonStyle: myButtonStyle(),

      // Done button
      renderDoneBtn: renderDoneBtn(),
      onDonePress: onDonePress,
      doneButtonStyle: myButtonStyle(),

      // Dot indicator
      colorDot: const Color(0xffffcc5c),
      sizeDot: 13.0,
      typeDotAnimation: DotSliderAnimation.SIZE_TRANSITION,

      // Tabs
      listCustomTabs: renderListCustomTabs(),
      backgroundColorAllSlides: Colors.white,
      refFuncGoToTab: (refFunc) {
        goToTab = refFunc;
      },

      // Behavior
      scrollPhysics: const BouncingScrollPhysics(),

      // Show or hide status bar
      hideStatusBar: true,

      // On tab change completed
      onTabChangeCompleted: onTabChangeCompleted,
    );
  }
}

Slide object properties #

NameTypeDefaultDescription
Title
titleString?""Change text title at top
widgetTitleWidget?nullSet a custom widget as the title (ignore title if define both)
maxLineTitleint?1Change max number of lines title at top
styleTitleTextStyle?White color, bold and font size is 30.0Style for text title
textAlignTitleTextAlign?TextAlign.centerTextAlign for text title
textOverFlowTitleTextOverflow?TextOverflow.ellipsisTextOverflow for text title
marginTitleEdgeInsets?top: 70.0, bottom: 50.0Margin for text title
Image
pathImageString?""Path to your local image
widthImagedouble?250.0Width of image
heightImagedouble?250.0Height of image
foregroundImageFitBoxFit?BoxFit.containForeground image fit
Center widget
centerWidgetWidget?nullYour custom's widget
onCenterItemPressFunction()?Do nothingFire when press center image/widget
Description
descriptionString?""Change text description at bottom
widgetDescriptionWidget?nullSet a custom widget as the description (ignore description if define both)
maxLineTextDescriptionint?100Maximum line of text description
styleDescriptionTextStyle?White and font size is 18.0Style for text description
textAlignDescriptionTextAlign?TextAlign.centerTextAlign for text description
textOverFlowDescriptionTextOverflow?TextOverflow.ellipsisTextOverflow for text description
marginDescriptionEdgeInsets?left, right = 20.0, top, bottom = 50.0Margin for text description
Background Color
backgroundColorColor?Colors.amberAccentBackground tab color (if set, will ignore gradient properties below)
colorBeginColor?Colors.amberAccentGradient tab color begin
colorEndColor?Colors.amberAccentGradient tab color end
directionColorBeginAlignmentGeometry?Alignment.topLeftDirection color begin
directionColorEndAlignmentGeometry?Alignment.bottomRightDirection color end
Background Image
backgroundImageString?nullBackground tab image
backgroundNetworkImageString?nullBackground tab image (from network)
backgroundImageFitBoxFit?BoxFit.coverBackground tab image fit
backgroundOpacitydouble?0.5Background tab image filter opacity
backgroundOpacityColorColor?Colors.blackBackground tab image filter color
backgroundBlendModeBlendMode?BlendMode.darkenBackground tab image filter blend mode

IntroSlider widget properties #

NameTypeDefaultDescription
Slide
slidesSlideNo default, require if listCustomTabs not definedAn array of Slide object
Skip Button
renderSkipBtnWidget?Button with white text SKIPRender your own widget SKIP button
skipButtonStyleButtonStyle?ButtonStyle()Style for SKIP button
onSkipPressvoid Function()?Go to last pageFire when press SKIP button
skipButtonStyleButtonStyle?ButtonStyle()Style for SKIP button
showSkipBtnbool?trueShow or hide SKIP button
Previous Button
renderPrevBtnWidget?Button with white text PREVRender your own PREV button
prevButtonStyleButtonStyle?ButtonStyle()Style for PREV button
showPrevBtnbool?falseShow or hide PREV, have to set showSkipBtn to false at first if you want to show this button
Done Button
renderDoneBtnWidget?Button with white text DONERender your own DONE button
doneButtonStyleButtonStyle?ButtonStyle()Style for DONE button
onDonePressvoid Function()?Do nothingFire when press DONE button
showDoneBtnbool?trueShow or hide DONE button
Next Button
renderNextBtnWidget?Button with white text NEXTRender your own NEXT button
nextButtonStyleButtonStyle?ButtonStyle()Style for NEXT button
onNextPressvoid Function()?Do nothingFire when press NEXT button
showNextBtnbool?trueShow or hide NEXT button
Nav position
navPositionIntroSliderNavPositionIntroSliderNavPosition.bottomCustomize the position of dots and skip/next/done buttons to the top of the screen or the bottom
Dot Indicator
showDotIndicatorbool?trueShow or hide dot indicator
colorDotColor?Color(0x80000000)Color for dot when passive
colorActiveDotColor?Color(0xffffffff)Color for dot when active
sizeDotdouble?8.0Size of each dot
typeDotAnimation (inactive dots auto have opacity 50%,<br/>dot active has size bigger than 1.5 times )enum DotSliderAnimation?DotSliderAnimation.DOT_MOVEMENTType dots animation
Tabs
listCustomTabsList<Widget>?nullRender your own list tabs (use default tab UI if not defined)
refFuncGoToTabvoid Function(Function function)?Do nothingSend the reference of change tab's function,<br/>then we can move to any tab index programmatically
onTabChangeCompletedvoid Function(int index)?Do nothingCallback when tab change comleted, return the current tab's index
backgroundColorAllSlidesColor?TransparentBackground color for all slides (if backgroundColor on each slide not set)
Behavior
scrollablebool?trueIf false, user only scroll by tap nav button
autoScrollbool?falseEnable auto scroll slides
loopAutoScrollbool?falseLoop transition by go to first slide when reach the end
pauseAutoPlayOnTouchbool?trueAuto scroll will be paused if user touch to slide
autoScrollIntervalDuration?4 secondsSets duration to determine the frequency of slides
curveScrollCurve?Curves.easeSet transition animation curves.
scrollPhysicsScrollPhysics?ScrollPhysics()Determines the physics horizontal scroll for the slides
verticalScrollbarBehaviorenum ScrollbarBehavior?ScrollbarBehavior.HIDEAllow to specify how the vertical scrollbar should behave
hideStatusBarbool?falseShow or hide the status bar

Pull request and feedback are always appreciated #

839
likes
130
pub points
98%
popularity

Publisher

unverified uploader

Flutter Intro Slider is a flutter plugin that helps you make a cool intro for your app

Repository (GitHub)
View/report issues

Documentation

API reference

License

Icon for licenses.MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on intro_slider