flutter_intro 0.0.4 copy "flutter_intro: ^0.0.4" to clipboard
flutter_intro: ^0.0.4 copied to clipboard

outdated

A better way for new feature introduction and step-by-step users guide for your Flutter project.

flutter_intro #

pub package

A better way for new feature introduction and step-by-step users guide for your Flutter project.

example

Usage #

To use this package, add flutter_intro as a dependency in your pubspec.yaml file.

Example #

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

class _MyHomePageState extends State<MyHomePage> {
  Intro intro;
  final GlobalKey key1 = GlobalKey();
  final GlobalKey key2 = GlobalKey();

  /// use stepWidgetParams get Intro current status
  /// and control the stepWidget position
  Widget widgetBuilder(StepWidgetParams stepWidgetParams) {
    return Center(
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          Text(
            '${stepWidgetParams.currentStepIndex + 1} / ${stepWidgetParams.stepCount}',
            style: TextStyle(color: Colors.white),
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              RaisedButton(
                onPressed: stepWidgetParams.onPrev,
                child: Text('Prev'),
              ),
              RaisedButton(
                onPressed: stepWidgetParams.onNext,
                child: Text('Next'),
              ),
              RaisedButton(
                onPressed: stepWidgetParams.onFinish,
                child: Text('Finish'),
              ),
            ],
          ),
        ],
      ),
    );
  }

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

    /// init Intro
    intro = Intro(steps: [
      IntroStep(
        key: key1,
        widgetBuilder: widgetBuilder,
      ),
      IntroStep(
        key: key2,
        widgetBuilder: widgetBuilder,
      ),
    ]);

    Timer(Duration(microseconds: 0), () {
      /// start the intro
      intro.start(context);
    });
  }

  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: SizedBox.expand(
        child: Container(
          padding: EdgeInsets.all(16),
          child: Column(
            children: [
              Row(
                children: [
                  Flexible(
                    child: Placeholder(
                      key: key2,
                      fallbackWidth: 200,
                      fallbackHeight: 200,
                    ),
                  ),
                  SizedBox(
                    width: 16,
                  ),
                  Flexible(
                    child: Placeholder(
                      fallbackWidth: 200,
                      fallbackHeight: 200,
                    ),
                  ),
                ],
              ),
            ],
          ),
        ),
      ),
      floatingActionButton: FloatingActionButton(
        key: key1,
        child: Icon(
          Icons.play_arrow,
        ),
        onPressed: () {
          intro.start(context);
        },
      ),
    );
  }
}
539
likes
0
pub points
94%
popularity

Publisher

verified publisher30x.link

A better way for new feature introduction and step-by-step users guide for your Flutter project.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on flutter_intro