primary_secondary_progress_bar 0.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 68

primary_secondary_progress_bar #

Primary secondary progress bar, display 2 progress info in 1 progress bar

Sample result

Installation #

Add primary_secondary_progress_bar as dependencies into your pubspec.yaml

Example #

Container(
                height: 300,
                padding: const EdgeInsets.all(8.0),
                child: PrimarySecondaryProgressBar(
                  context,
                  primaryLabel: "${_primaryMax.round()}%",
                  primaryMax: _primaryMax,
                  primaryValue: _primaryValue,
                  secondaryValue: _secondaryValue,
                  secondaryMax: _secondaryMax,
                  secondaryLabel: "${_secondaryValue.round()} days",
                  primaryIndicatorLine1: "${(_primaryMax - _primaryValue).round()}%",
                  primaryIndicatorLine2: "more",
                ),
              )

0.1.1 #

  • Add Semantic label to support Talkback/voice over

0.1.0 #

  • Release version 0.1
  • Change Label widths to accommodate all label length

0.0.3 #

  • Update Example Readme.md

0.0.2 #

  • Update sample image

0.0.1 #

  • Initial release of Primary Secondary progress bar.

example/README.md

primary_secondary_progress_bar_example #

Demonstrates how to use the primary_secondary_progress_bar plugin.

Complete sample source code #

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

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

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

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: _PrimarySecondaryExample(),
    );
  }
}

class _PrimarySecondaryExample extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return _PrimarySecondaryExampleState();
  }
}

class _PrimarySecondaryExampleState extends State<_PrimarySecondaryExample> {

  final _primaryMax = 100.0;
  double _primaryValue = 0.0;

  final _secondaryMax = 30.0;
  double _secondaryValue = 0.0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: const Text('Progress Bar Example'),
        ),
        body: Column(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          crossAxisAlignment: CrossAxisAlignment.stretch,
          mainAxisSize: MainAxisSize.min,
          children: <Widget>[
            Card(
              color: Colors.indigo,
              borderOnForeground: true,
              child: Container(
                height: 300,
                padding: const EdgeInsets.all(8.0),
                child: PrimarySecondaryProgressBar(
                  context,
                  primaryLabel: "${_primaryMax.round()}%",
                  primaryMax: _primaryMax,
                  primaryValue: _primaryValue,
                  secondaryValue: _secondaryValue,
                  secondaryMax: _secondaryMax,
                  secondaryLabel: "${_secondaryValue.round()} days",
                  primaryIndicatorLine1: "${(_primaryMax - _primaryValue).round()}%",
                  primaryIndicatorLine2: "more",
                ),
              ),
            ),
            FittedBox(
              child: Column(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: <Widget>[
                  Text("Primary Value", style: Theme.of(context).textTheme.body2,),
                  Slider(
                    value: _primaryValue,
                    min: 0,
                    max: _primaryMax,
                    onChanged: (value) => setState(() => _primaryValue = value),
                  ),
                  Text("Secondary value", style: Theme.of(context).textTheme.body2,),
                  Slider(
                    value: _secondaryValue,
                    min: 0.0,
                    max: _secondaryMax,
                    onChanged: (value) => setState(() => _secondaryValue = value),
                  )
                ],
              ),
            )
          ],
        ));
  }

  void _updateProgressBar(double primaryValue) {}
}

Use this package as a library

1. Depend on it

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


dependencies:
  primary_secondary_progress_bar: ^0.1.1

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

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

  • Dart: 2.6.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.6

Health suggestions

Format lib/primary_secondary_progress_bar.dart.

Run flutter format to format lib/primary_secondary_progress_bar.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.11 1.14.12
meta 1.1.7 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test