introduction_screen 1.0.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 90

IntroductionScreen pub package

Introduction screen allow you to have a screen at launcher for example, where you can explain your app. This Widget is customizable (more in the future) with a great design.

Introduction_screen use another package, dots_indicator, that I also created.

Installation #

You just need to add introduction_screen as a dependency in your pubspec.yaml file.

dependencies:
  introduction_screen: ^0.0.5

Example #

In these example, listPagesViewModel is the list of pages. A page is base on PageViewModel. See example of a PageViewModel below.

PageViewModel #

Simple page #

This example only define title, body and an image (you can define any widget)

new PageViewModel(
  "Title of first page",
  "Here you can write the description of the page, to explain someting...",
  image: Center(child: Image.network("https://domaine.com/image.png", height: 175.0)),
)

Page with custom colors #

This example show you how to define the color of the page (background but also the dot indicator color)

new PageViewModel(
  "Title of first page",
  "Here you can write the description of the page, to explain someting...",
  image: Center(child: Image.asset("res/images/logo.png", height: 175.0)),
  pageColor: Colors.blue,
  progressColor: Colors.red,
)

Page with custom text style #

This example show you how to define another TextStyle for the title and the body

new PageViewModel(
  "Title of first page",
  "Here you can write the description of the page, to explain someting...",
  image: const Center(child: Icon(Icons.android)),
  titleTextStyle: const TextStyle(color: Colors.orange),
  bodyTextStyle: const TextStyle(fontWeight: FontWeight.w700, fontSize: 20.0),
)

This example show you how to define a page with a footer, like a Button

new PageViewModel(
  "Title of first page",
  "Here you can write the description of the page, to explain someting...",
  image: const Center(child: Icon(Icons.android)),
  footer: RaisedButton(
    onPressed: () {
      // On button presed
    },
    child: const Text("Let's Go !"),
  ),
);

IntroductionScreen #

Note :

If you not provide next parameter, the Next button will be not displayed. If you want to display a skip button, you must add skip parameter and showSkipButton: true The done parameter is required.

Simple intro screen #

Simple intro screen

Base intro

new IntroductionScreen(
  pages: listPagesViewModel,
  done: const Text("Done", style: TextStyle(fontWeight: FontWeight.w600))
  onDone: () {
    // When done button is press
  },
); //Material App

Intro screen with skip button #

With skip button

new IntroductionScreen(
  pages: listPagesViewModel,
  onDone: () {
    // When done button is press
  },
  showSkipButton: true,
  skip: const Text("Skip"),
  done: const Text("Done", style: TextStyle(fontWeight: FontWeight.w600)),
);

Intro screen with custom button text #

Custom button text

new IntroductionScreen(
  pages: listPagesViewModel,
  onDone: () {
    // When done button is press
  },
  onSkip: () {
    // You can also override onSkip callback
  },
  showSkipButton: true,
  skip: const Icon(Icons.skip_next),
  next: const Icon(Icons.next),
  done: const Text("Done", style: TextStyle(fontWeight: FontWeight.w600))
);

Others parameters #

There is other possibles parameters that you can add :

  • Freeze the scroll, by adding freeze: true parameter.
  • Duration of scrolling animation, by adding animationDuration: 400 parameter.
  • Initial page, by adding initialPage: 1 parameter.

1.0.0 #

  • Breaking changes : image (Widget) parameter is now optional
  • Add possibility to provide BoxDecoration (Thanks to https://github.com/MohiuddinM)
  • Add possibility to override default onSkip method

0.0.5 #

  • Breaking changes : done (Widget) parameter is now required
  • Breaking changes : skip (Widget) parameter is now required if you set showSkipButton: true
  • Fix bug
  • Add onChange listener
  • Add possibility to add a footer (like a button)
  • Add animation duration
  • Add possibility to define the initial page
  • Add possibility to freeze the scroll

0.0.4 #

  • Improve customization
  • Change String type to Widget for buttons, to set an Icon for example
  • Remove nextText parameter, use next instead
  • Remove doneText parameter, use done instead
  • Remove skipText parameter, use skip instead

0.0.3 #

  • Fix design padding layout on small device
  • Improve layout Expanded flex

0.0.2 #

  • Published on Pub
  • Fix bugs

0.0.1 #

  • First version

example/main.dart

import 'package:flutter/material.dart';
import 'package:introduction_screen/introduction_screen.dart';
import 'package:introduction_screen/model/page_view_model.dart';

const kImageDemo =
    "https://freeiconshop.com/wp-content/uploads/edd/bulb-curvy-flat.png";

void main() => runApp(App());

class App extends StatelessWidget {
  final pages = [
    PageViewModel(
      "First title page",
      "Text of the first page",
      image: Center(child: Image.network(kImageDemo, height: 175.0)),
    ),
    PageViewModel(
      "Second title page",
      "Text of the second page, with a button",
      image: Center(child: Image.network(kImageDemo, height: 175.0)),
      footer: RaisedButton(
        onPressed: () {/* Nothing */},
        child: const Text('Button', style: TextStyle(color: Colors.white)),
        color: Colors.lightBlue,
      ),
    ),
    PageViewModel(
      "Third title page",
      "Text of the third page",
      image: Center(child: Image.network(kImageDemo, height: 175.0)),
      titleTextStyle: TextStyle(fontSize: 28.0, fontWeight: FontWeight.w600),
      bodyTextStyle: TextStyle(fontSize: 22.0),
      progressColor: Colors.red,
      progressSize: Size.fromRadius(8),
    ),
  ];

  void _onIntroEnd(context) {
    Navigator.push(
      context,
      MaterialPageRoute(builder: (context) => HomePage()),
    );
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Introduction screen',
      theme: ThemeData(primarySwatch: Colors.blue),
      home: IntroductionScreen(
        pages: pages,
        onDone: () => _onIntroEnd(context),
        onSkip: () => _onIntroEnd(context),
        showSkipButton: true,
        skip: const Text('Skip'),
        next: const Icon(Icons.arrow_forward),
        done: const Text('Done', style: TextStyle(fontWeight: FontWeight.w600)),
      ),
    );
  }
}

class HomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Home')),
      body: const Center(child: Text("This is the screen after Introduction")),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  introduction_screen: ^1.0.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:introduction_screen/introduction_screen.dart';
  
Version Uploaded Documentation Archive
1.0.0 Apr 1, 2019 Go to the documentation of introduction_screen 1.0.0 Download introduction_screen 1.0.0 archive
0.0.5 Feb 21, 2019 Go to the documentation of introduction_screen 0.0.5 Download introduction_screen 0.0.5 archive
0.0.4 Oct 7, 2018 Go to the documentation of introduction_screen 0.0.4 Download introduction_screen 0.0.4 archive
0.0.3 Sep 21, 2018 Go to the documentation of introduction_screen 0.0.3 Download introduction_screen 0.0.3 archive
0.0.2 Sep 10, 2018 Go to the documentation of introduction_screen 0.0.2 Download introduction_screen 0.0.2 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
80
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]
90
Learn more about scoring.

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

  • Dart: 2.2.0
  • pana: 0.12.14
  • Flutter: 1.4.7

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/model/page_view_model.dart.

Run flutter format to format lib/model/page_view_model.dart.

Format lib/ui/intro_page.dart.

Run flutter format to format lib/ui/intro_page.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
dots_indicator ^0.0.4 0.0.4
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8