progress_line 0.1.0 copy "progress_line: ^0.1.0" to clipboard
progress_line: ^0.1.0 copied to clipboard

A Flutter package to display the progress bar with a lot of personalization and make the progress percentage dynamic by using various colors and activating the animation.

Flutter

Default Progress Bar Progress Bar Example1 Progress Bar Example2 Progress Bar Example3

Progress Line #

pub package

Getting started #

Use progress_line package to display linear charts/graph with dynamic progress percentage by enabling animation.

Where is it used? #

  • When you want to display the progress of the file download
  • In music or video players
  • In applications that display currency and gold rates to the user
  • In sports applications that calculate the length of a period of time
  • In applications that provide diet to the user
  • In educational applications in order to display the student's academic progress
  • In store applications in the shopping cart section
  • ...

📈 📉 🎛 📱

Install Package #

Add the following line to your pubspec.yaml under dependencies:

dependencies:
  progress_line: ^0.1.0

Then run:

flutter pub get

Usage #

Import it

import 'package:progress_line/progress_line.dart';

Now in your flutter code, you can use:

  • The percent should be between 0.0 and 1.0.
  • Feature lineColors is nullable. For the color of the progress line, you can consider a list of colors. Depending on the percent feature, this line can take one of the colors from the list. If the progress rate is 0%, the color in zeroth index will be taken, and if the progress percentage is 100%, the color of the last index will be taken.
  • Animation is enabled by default. You can set a duration for it or disable it.

Progress Bar Example3

ProgressLineWidget(
  percent: 0.9,
  lineWidth: 20,
  lineColors: const [
    Colors.purple,
    Colors.pink,
    Colors.red,
    Colors.orange,
    Colors.yellow,
    Colors.lightGreenAccent,
    Colors.lightGreen,
    Colors.green,
  ],
  bgColor: Colors.grey.withOpacity(0.4),
  innerPadding: const EdgeInsets.all(20),
  outerPadding: const EdgeInsets.only(left: 16),
  width: 180,
  height: 100,
  animationDuration: const Duration(seconds: 5),
  start: Text(
    (_value * 100).toStringAsFixed(0),
    style: const TextStyle(
      fontSize: 20,
      color: Colors.black,
    ),
  ),
  end: Text(
    ((1 - _value) * 100).toStringAsFixed(0),
    style: const TextStyle(
      fontSize: 20,
      color: Colors.black,
    ),
  ),
  callback: (value) {
    setState(() {
      _value = value;
    });
  },
)

By default :

  • Progress line Color is Colors.cyan
  • Background line Color is Colors.grey.shade200
  • Line width is 10
  • Width of Progress widget is 100

Default Progress Bar

ProgressLineWidget(percent: 0.8)

Progress Bar Example1

ProgressLineWidget(
  percent: 0.8,
  lineWidth: 24,
  width: 200,
  lineColors: const [
    Colors.green
  ],
)

  • You can set start and end widgets for the progress bar
  • For example, these widgets can be text that shows the progress percentage and the remaining percentage
  • You can create space between the progress bar and the widgets around it (start and end widgets) by using the innerPadding feature
  • You can also set the outerPadding attribute to space among the progress bar and other page widgets in widget tree

Progress Bar Example2

ProgressLineWidget.widgets(
  percent: 0.4,
  lineWidth: 20,
  lineColors: const [Colors.orange],
  bgColor: Colors.orange.withOpacity(0.2),
  innerPadding: const EdgeInsets.symmetric(horizontal: 16),
  outerPadding: const EdgeInsetsDirectional.only(start: 16),
  width: 200,
  start: Text(
    (_value * 100).toStringAsFixed(0),
    style: const TextStyle(
      fontSize: 20,
      color: Colors.black,
    ),
  ),
  end: Text(
    ((1 - _value) * 100).toStringAsFixed(0),
    style: const TextStyle(
      fontSize: 20,
      color: Colors.black,
    ),
  ),
  callback: (value) {
    setState(() {
      _value = value;
    });
  },
)

by Shervin Hassanzadeh #

Contact me at

linkedin Email telegram github stackoverflow
7
likes
150
points
186
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package to display the progress bar with a lot of personalization and make the progress percentage dynamic by using various colors and activating the animation.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on progress_line