error_progress_button 0.2.1

  • Readme
  • Changelog
  • Installing
  • 57

error_progress_button #

A Flutter custom button with progress and error message by simply nesting two AnimatedCrossFade widgets and alternating between them.

Getting Started #

Usage #

To use this package add the dependency to your pubspec.yaml file.

      sdk: flutter
    error_progress_button: 0.2.1

Example #

import 'dart:async';

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

class ExampleApp extends StatefulWidget {
  ExampleAppState createState() => ExampleAppState();

class ExampleAppState extends State<ExampleApp> {
  Text buttonText = Text(
    style: const TextStyle(
      color: Colors.white,

  Text errorText = Text(
    "Failed with error",
    style: const TextStyle(color:, fontSize: 14),

  ErrorButtonState state = ErrorButtonState.normal;

  Duration duration = Duration(milliseconds: 500);

  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: ErrorProgressButton(
          buttonText: buttonText,
          buttonOnPress: () => onButtonPress(),
          errorText: errorText,
          state: state,

  onButtonPress() async {
    setState(() {
      state = ErrorButtonState.loading;
    Timer(const Duration(milliseconds: 4000), () {
      setState(() {
        state = ErrorButtonState.error;

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

[0.1.0] - 20 June 2019 #

Simply using the flutter internal widget AnimatedCrossFade

[0.2.0] - 20 June 2019 #

Adding progress color property

[0.2.1] - 20 June 2019 #

fixing the progress color property type

Use this package as a library

1. Depend on it

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

  error_progress_button: ^0.2.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:error_progress_button/error_progress_button.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

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

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health suggestions

Fix lib/error_progress_button.dart. (-0.50 points)

Analysis of lib/error_progress_button.dart reported 1 hint:

line 4 col 7: This class (or a class which this class inherits from) is marked as '@immutable', but one or more of its instance fields are not final: ErrorProgressButton.buttonText, ErrorProgressButton.buttonColor, ErrorProgressButton.buttonOnPress, ErrorProgressButton.state, ErrorProgressButton.errorText, ErrorProgressButton.progressColor

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and error_progress_button.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.

The package description is too short. (-5 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.


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