intro_views_flutter 2.6.0


Platform Pub Package Build Status License: MIT

IntroViews is inspired by Paper Onboarding and developed with love from scratch. I decided to rewrite almost all the features in order to make it available to the flutter developers and extensible as possible.

Table of contents #

Features #

  • Easy addition of pages.

  • Circular page reveal.

  • Cool Animations.

  • Animation control, if the user stops sliding in the midway.

  • Skip button, for skipping the app intro.

  • Custom font selection.

  • Material Design.

Getting Started #

You should ensure that you add the intro_views_flutter as a dependency in your flutter project.

dependencies:
  intro_views_flutter: '^2.6.0'

You can also reference the git repository directly if you want:

dependencies:
  intro_views_flutter:
    git: git://github.com/aagarwal1012/IntroViews-Flutter

You should then run flutter packages get in your terminal so as to get the package.

Usage #

  • IntroViewsFlutter widget require a list of PageViewModel , and some other parameters. Refer the code below to create a PageViewModel page.

    Final page = new PageViewModel(
        pageColor: const Color(0xFF607D8B),
          iconImageAssetPath: 'assets/taxi-driver.png',
          iconColor: null,
          bubbleBackgroundColor: null,
          body: Text(
            'Easy  cab  booking  at  your  doorstep  with  cashless  payment  system',
          ),
          title: Text('Cabs'),
          mainImage: Image.asset(
            'assets/taxi.png',
            height: 285.0,
            width: 285.0,
            alignment: Alignment.center,
          ),
          textStyle: TextStyle(fontFamily: 'MyFont', color: Colors.white),
        );
    
  • Now refer the code below to get the IntroViewsFlutter widget.

    final Widget introViews = new IntroViewsFlutter(
          [page],
          onTapDoneButton: (){
            //Void Callback
          },
          showSkipButton: true,
          pageButtonTextStyles: new TextStyle(
              color: Colors.white,
              fontSize: 18.0,
              fontFamily: "Regular",
            ),
        );
    

    For further usage refer the example available.

    For Landscape preview click the link.

    Note : If you added more than four pages in the list then there might be overlapping between page icons and skip button, so my suggestion is just make the showSkipButton: false.

Documentation #

PageViewModel Class #

Dart attributeDatatypeDescriptionDefault Value
pageColorColorSet color of the page.Null
mainImageImage / WidgetSet the main image of the page.Null
titleText / WidgetSet the title text of the page.Null
bodyText / WidgetSet the body text of the page.Null
iconImageAssetPathStringSet the icon image asset path that would be displayed in page bubble.Null
iconColorColorSet the page bubble icon color.Null
bubbleBackgroundColorColorSet the page bubble background color.Colors.white / Color(0x88FFFFFF)
textStyleTextStyleSet TextStyle for both title and bodytitle: color: Colors.white , fontSize: 50.0
body: color: Colors.white , fontSize: 24.0
bubbleWidgetSet a custom widget for the inner bubblenull

IntroViewFlutter Class #

Dart attributeDatatypeDescriptionDefault Value
pagesListSet the pages of the intro screen.Null
onTapDoneButtonVoidCallbackMethod executes on tapping done button.Null
onTapBackButtonVoidCallbackMethod executes on tapping back button.Null
onTapNextButtonVoidCallbackMethod executes on tapping next button.Null
showSkipButtonBoolShow the skip button at the bottom of page.true
showBackButtonBoolShow the Back button at the bottom of page. Overrides showSkipButton starting from the second pagefalse
showNextButtonBoolShow the Next button at the bottom of page. Overrides doneButtonPersist.false
pageButtonTextSizeDoubleSet the button text size.18.0
pageButtonFontFamilyStringSet the font of button text.Default
onTapSkipButtonVoidCallbackMethod executes on tapping skip button.null
pageButtonTextStylesTextStyleConfigure TextStyle for skip, done buttons, overrides pageButtonFontFamily, pageButtonsColor, pageButtonTextSize.fontSize: 18.0, color: Colors.white
skipTextText / WidgetOverride Skip Button Text and styles.Text('SKIP')
doneTextText / WidgetOverride Done Button Text and styles.Text('DONE')
backTextText / WidgetOverride Back Button Text and styles.Text('BACK')
nextTextText / WidgetOverride Next Button Text and styles.Text('NEXT')
doneButtonPersistBoolShow done Button throughout pagesfalse
columnMainAxisAlignmentMainAxisAlignmentControl [MainAxisAlignment] for columnMainAxisAlignment.spaceAround
fullTransitiondoubleAdjust scroll distance for full transition300.0
backgroundColorSet the background color to Colors.transparent if you have your own background image belownull

For help on editing package code, view the flutter documentation.

Want to contribute ! #

This is the well documented package. I have documented each and every method that I have used, so have a good read to the code and suggest some changes and new feature to be added in the package. See Contributing.md. Feel free to open an issue.

License #

IntroViews-Flutter is licensed under MIT license.

2.6.0 #

  • Fix problem padding top in title of pageViews.
  • Background property added that can be used to add full screen image to IntroViews.

2.5.0 #

  • Added Next Button to move to the next screen. Overriding doneButtonPersist.
  • Added Back Button. Overrides showSkipButton starting from the second page.

2.4.0 #

Feature Enhancement

  • Exposed the way to change the distance a user needs to drag for a full transition to occur using fullTransition and its default value is set to 300.0.
  • Added ability to insert a custom widget in the page bubble.
  • Changed title, body, mainImage PageViewModel types to be more dynamic.
  • Removed all new keywords.

2.3.0 #

Feature Enhancement

  • Exposed columnMainAxisAlignment to change mainAxisAlignment.
  • Updated Readme.

2.2.4 #

  • Adjust the Scaffold in fullscreen.

2.2.3 #

  • General Update.

2.2.2 #

  • Added Widget testing.
  • Updated Readme.

2.2.1 #

  • Added feature to override Text widget styles for skip and done button.
  • Added doneButtonPersist to show done button throughout the session.
  • Updated Readme.

2.1.1 #

  • Fixed overflow for small screen apps.

2.0.1 #

Major Updates

  • Made intro views responsive.
  • Refracting page view model.
    • Body title, expects Text Widget.
    • Main image, expects Image Widget.
    • Added TextStyle property to page view model that can be used to set styles for both title and body.
  • Added TextStyle property for page indicator buttons which overrides previous button properties.
  • Updated Readme and example.

1.0.3 #

  • Made intro views responsive.
  • Added onTapSkipButton voidCallback.
  • Updated Readme.

1.0.2 #

  • Updated Readme.
  • Fixed bugs.
  • Fixed formatting issues.

1.0.1 #

  • Updated Readme.
  • Fixed static analyzers issues.
  • Fixed formatting issues.

1.0.0 #

  • Initial Release.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:intro_views_flutter/Models/page_view_model.dart';
import 'package:intro_views_flutter/intro_views_flutter.dart';

/// This is the main method of app, from here execution starts.
void main() => runApp(App());

/// App widget class

class App extends StatelessWidget {
  //making list of pages needed to pass in IntroViewsFlutter constructor.
  final pages = [
    PageViewModel(
        pageColor: const Color(0xFF03A9F4),
        // iconImageAssetPath: 'assets/air-hostess.png',
        bubble: Image.asset('assets/air-hostess.png'),
        body: Text(
          'Haselfree  booking  of  flight  tickets  with  full  refund  on  cancelation',
        ),
        title: Text(
          'Flights',
        ),
        textStyle: TextStyle(fontFamily: 'MyFont', color: Colors.white),
        mainImage: Image.asset(
          'assets/airplane.png',
          height: 285.0,
          width: 285.0,
          alignment: Alignment.center,
        )),
    PageViewModel(
      pageColor: const Color(0xFF8BC34A),
      iconImageAssetPath: 'assets/waiter.png',
      body: Text(
        'We  work  for  the  comfort ,  enjoy  your  stay  at  our  beautiful  hotels',
      ),
      title: Text('Hotels'),
      mainImage: Image.asset(
        'assets/hotel.png',
        height: 285.0,
        width: 285.0,
        alignment: Alignment.center,
      ),
      textStyle: TextStyle(fontFamily: 'MyFont', color: Colors.white),
    ),
    PageViewModel(
      pageColor: const Color(0xFF607D8B),
      iconImageAssetPath: 'assets/taxi-driver.png',
      body: Text(
        'Easy  cab  booking  at  your  doorstep  with  cashless  payment  system',
      ),
      title: Text('Cabs'),
      mainImage: Image.asset(
        'assets/taxi.png',
        height: 285.0,
        width: 285.0,
        alignment: Alignment.center,
      ),
      textStyle: TextStyle(fontFamily: 'MyFont', color: Colors.white),
    ),
  ];

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'IntroViews Flutter', //title of app
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ), //ThemeData
      home: Builder(
        builder: (context) => IntroViewsFlutter(
              pages,
              onTapDoneButton: () {
                Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) => HomePage(),
                  ), //MaterialPageRoute
                );
              },
              pageButtonTextStyles: TextStyle(
                color: Colors.white,
                fontSize: 18.0,
              ),
            ), //IntroViewsFlutter
      ), //Builder
    ); //Material App
  }
}

/// Home Page of our example app.

class HomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Home'),
      ), //Appbar
      body: Center(
        child: Text("This is the home page of the app"),
      ), //Center
    ); //Scaffold
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  intro_views_flutter: ^2.6.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:intro_views_flutter/intro_views_flutter.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
95
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
98
Learn more about scoring.

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

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

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