progress_stepper 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 77

progress_stepper #

This package can be used to create custom stepper.

Main Classes #

ClassDescription
ProgressStepperYou have to initialise this class to create the custom stepper
ProgressStepWithChevronCustom step with the shape of an arrow
ProgressStepWithArrowCustom step with the shape of chevron

Usage #

You can use this control in two ways:

Method 1 #

You just need to initialise the ProgressStepper with required values, it will create a default progress step with chevron type.

ProgressStepper(
   width: 300,
   height: 10,
   padding: 2,
   currentStep: 1,
)

The above code will create a stepper as shown below:

Default Stepper

Method 2 #

You can use the builder to return your own custom step or use the provided steps as you need.

ProgressStepper(                              
   width: 200,
   height: 25,
   color: Colors.red,
   progressColor: Colors.green,
   stepCount: 3,
   builder: (index) {
      double widthOfStep = 200 / 3;
      if (index == 1) {
         return ProgressStepWithArrow(
            width: widthOfStep,
            defaultColor: Colors.red,
            progressColor: Colors.green,
            wasCompleted: true,
         );
      }
      return ProgressStepWithChevron(
         width: widthOfStep,
         defaultColor: Colors.red,
         progressColor: Colors.green,
         wasCompleted: false,
      );
   },
)

The above code will create a stepper as shown below:

Default Stepper

0.0.1 - 30 Apr 2020 #

  • Initial version with progress stepper
  • Two kinds of step indicator available
    • ProgressStepWithChevron
    • ProgressStepWithArrow

0.1.0 - 11 May 2020 #

  • Added onClick callback for notifying selection

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Progress Stepper Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Progress Stepper'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementStepper() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            ProgressStepper(
              width: 300,
              height: 10,
              padding: 2,
              currentStep: _counter,
              onClick: (index) {
                setState(() {
                  _counter = index;
                });
              },
            ),
            SizedBox(
              height: 10,
            ),
            ProgressStepper(
              width: 200,
              height: 25,
              stepCount: 3,
              builder: (index) {
                double widthOfStep = 200 / 3;
                if (index == 1) {
                  return ProgressStepWithArrow(
                    width: widthOfStep,
                    defaultColor: Colors.red,
                    progressColor: Colors.green,
                    wasCompleted: _counter >= index,
                  );
                }
                  return ProgressStepWithChevron(
                    width: widthOfStep,
                    defaultColor: Colors.red,
                    progressColor: Colors.green,
                    wasCompleted: _counter >= index,
                  );
              },
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementStepper,
        tooltip: 'Increment Stepper',
        child: Icon(Icons.plus_one),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  progress_stepper: ^0.1.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:progress_stepper/progress_stepper.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
55
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]
77
Learn more about scoring.

We analyzed this package on Jul 9, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • progress_stepper that is a package requiring null.

Health suggestions

Format lib/progress_stepper.dart.

Run flutter format to format lib/progress_stepper.dart.

Format lib/src/clippers/arrowClipper.dart.

Run flutter format to format lib/src/clippers/arrowClipper.dart.

Format lib/src/clippers/chevronCrumbClipper.dart.

Run flutter format to format lib/src/clippers/chevronCrumbClipper.dart.

Format lib/src/progressStepWithArrow.dart.

Run flutter format to format lib/src/progressStepWithArrow.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.1
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test