step_progress_indicator 0.1.1+2

Step Progress Indicator #

GitHub: SandroMaglione Twitter: SandroMaglione

Open source Flutter package, bar indicator made of a series of selected and unselected steps.

Made by Sandro Maglione, check out his personal official website sandromaglione.com

Check out the full step_progress_indicator tutorial

See the full example here

Check out the official dartdoc for the package here

Example #

Install and import the package. Then just customize its parameters.

HorizontalVertical
Horizontal indicator screenVertical indicator screen

Horizontal step bar indicators examples code:

Column(
    mainAxisAlignment: MainAxisAlignment.spaceEvenly,
    children: <Widget>[
        StepProgressIndicator(
            totalSteps: 10,
            currentStep: 6,
        ),
        StepProgressIndicator(
            totalSteps: 16,
            currentStep: 10,
            unselectedColor: Colors.red,
            selectedColor: Colors.yellow,
            height: 10.0,
        ),
        StepProgressIndicator(
            totalSteps: 6,
            customColor: (index) =>
                index % 2 == 0 ? Colors.pink : Colors.black,
            height: 20.0,
        ),
        StepProgressIndicator(
            totalSteps: 10,
            currentStep: 9,
            customStep: (index, color) => Container(
                color: color,
                child: Text(
                '$index',
                textAlign: TextAlign.center,
                ),
            ),
            height: 20.0,
        ),
        StepProgressIndicator(
            totalSteps: 10,
            customColor: (index) =>
                index % 3 == 0 ? Colors.white : Colors.green,
            progressDirection: TextDirection.rtl,
            height: 6.0,
            padding: 10.0,
        ),
        StepProgressIndicator(
            totalSteps: 10,
            direction: Axis.horizontal,
            width: 30,
            progressDirection: TextDirection.rtl,
            onTap: (index) {
                return () {
                print('$index pressed');
                };
            },
            customStep: (index, color) => Container(
                color: color.withOpacity(index / 10),
                padding: EdgeInsets.symmetric(vertical: 16.0),
                child: Text(
                '$index',
                textAlign: TextAlign.center,
                style: TextStyle(
                    fontSize: 6.0 + (index * 5.2),
                    color: Colors.white,
                ),
                ),
            ),
            currentStep: 7,
            customColor: (index) => index % 2 == 0
                ? Colors.yellow[900]
                : index % 3 == 0 ? Colors.blue[900] : Colors.black54,
            padding: 6.0,
        ),
    ],
)

Vertical step bar indicators examples code:

Row(
    mainAxisAlignment: MainAxisAlignment.spaceEvenly,
    children: <Widget>[
        StepProgressIndicator(
            totalSteps: 10,
            direction: Axis.vertical,
            currentStep: 2,
        ),
        StepProgressIndicator(
            totalSteps: 20,
            direction: Axis.vertical,
            currentStep: 2,
            selectedColor: Colors.amber,
            unselectedColor: Colors.black12,
            width: 10.0,
        ),
        StepProgressIndicator(
            totalSteps: 25,
            direction: Axis.vertical,
            customColor: (index) => Colors.deepOrange,
            customStep: (index, color) => Icon(
                Icons.tag_faces,
                color: color,
            ),
        ),
        StepProgressIndicator(
            totalSteps: 10,
            direction: Axis.vertical,
            padding: 6.0,
            width: 30.0,
            customColor: (index) => Colors.lightBlue,
            customStep: (index, color) => Container(
                color: color,
                alignment: Alignment.center,
                child: Text('$index'),
            ),
        ),
        StepProgressIndicator(
            totalSteps: 20,
            direction: Axis.vertical,
            padding: 3.0,
            width: 40.0,
            progressDirection: TextDirection.rtl,
            customColor: (index) => Colors.lightGreen,
            customStep: (index, color) => Container(
                color: color,
                alignment: Alignment.center,
                child: Text('$index'),
            ),
        ),
    ],
)

Parameters #

ParameterTypeDescriptionDefault
totalStepsintTotal number of step of the complete indicator.@required
currentStepintNumber of steps to underline, all the steps with index <= currentStep will have Color equal to selectedColor.0
customStep(int, Color)WidgetDefines a custom Widget to display at each step, given the current step index and the Color, which could be defined with selectedColor and unselectedColor or using customColor.-
onTap(int)void Function()Defines onTap function given index of the pressed step.-
customColor(int)ColorAssign a custom Color for each step.-
directionAxisDefines if indicator is horizontal or vertical.Axis.horizontal
progressDirectionTextDirectionDefines if steps grow from left-to-right / top-to-bottom TextDirection.ltr or right-to-left / bottom-to-top TextDirection.rtl.TextDirection.ltr
heightdoubleHeight of the indicator.4.0
widthdoubleWidth of the indicator.4.0
selectedColorColorColor of the selected steps.Colors.blue
unselectedColorColorColor of the unselected steps.Colors.grey
paddingdoubleSpacing between each step.2.0

Ideas #

I am always open for suggestions and ideas for possible improvements or fixes.

Here below a list of coming/future improvements:

  • Adding support for animations

Versioning #

  • v0.1.1+2 - 24 January 2020
  • v0.1.0+1 - 23 January 2020

License #

GNU General Public License v3.0, see the LICENSE.md file for details.

[0.1.1+2] - 24 January 2020

[0.1.0+1] - 23 January 2020

Initial release.

example/main.dart

import 'package:flutter/material.dart';

import 'horizontal_bar.dart';
import 'vertical_bar.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  int _bottomBarIndex = 0;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Step Progress Bar',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      debugShowCheckedModeBanner: false,
      home: SafeArea(
        child: Scaffold(
          body: _bottomBarIndex == 0 ? HorizontalBar() : VerticalBar(),
          bottomNavigationBar: BottomNavigationBar(
            currentIndex: _bottomBarIndex,
            onTap: (index) => setState(() => _bottomBarIndex = index),
            items: [
              BottomNavigationBarItem(
                icon: Icon(Icons.more_horiz),
              ),
              BottomNavigationBarItem(
                icon: Icon(Icons.more_vert),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  step_progress_indicator: ^0.1.1+2

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:step_progress_indicator/step_progress_indicator.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
57
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]
79
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.7

Dependencies

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