loading_indicator 1.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 91

LoadingIndicator #

pub package 中文版

A collection of out of the box loading animations written in pure dart, no extra dependency, inspired by loaders.css and NVActivityIndicatorView.

Demo #

Animation types #

TypeTypeTypeType
1. ballPulse2. ballGridPulse3. ballClipRotate4. squareSpin
5. ballClipRotatePulse6. ballClipRotateMultiple7. ballPulseRise8. ballRotate
9. cubeTransition10. ballZigZag11. ballZigZagDeflect12. ballTrianglePath
13. ballScale14. lineScale15. lineScaleParty16. ballScaleMultiple
17. ballPulseSync18. ballBeat19. lineScalePulseOut20. lineScalePulseOutRapid
21. ballScaleRipple22. ballScaleRippleMultiple23. ballSpinFadeLoader24. lineSpinFadeLoader
25. triangleSkewSpin26. pacman27. ballGridBeat28. semiCircleSpin
29. ballRotateChase30. orbit31. audioEqualizer32. circleStrokeSpin

Installing #

Install the latest version from pub

Usage #

very simple to use

LoadingIndicator(indicatorType: Indicator.ballPulse, color: Colors.white,)

License #

Apache 2.0

Todo #

☑️ remove setState to improve performance

[1.1.0] - 2019/05/23 #

  • color is not required, if it is null, it will follow primary color.
  • aspectRatio is 1 to keep all animation play as expected.

[1.0.0] - 2019/05/14. #

  • improve performance.
  • add chinese readme.

[0.0.1] - 2019/05/11. #

  • initial release.

example/lib/main.dart

// This example shows a [Scaffold] with an [AppBar], a [BottomAppBar] and a
// [FloatingActionButton]. The [body] is a [Text] placed in a [Center] in order
// to center the text within the [Scaffold] and the [FloatingActionButton] is
// centered and docked within the [BottomAppBar] using
// [FloatingActionButtonLocation.centerDocked]. The [FloatingActionButton] is
// connected to a callback that increments a counter.

import 'package:flutter/material.dart';
import 'package:loading_indicator/loading_indicator.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: 'LoadingIndicator example',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.pink,
        primaryColor: Colors.white,
      ),
      home: MainWidget(),
    );
  }
}

class MainWidget extends StatelessWidget {
  _showSingleAnimationDialog(BuildContext context, Indicator indicator) {
    Navigator.push(
      context,
      MaterialPageRoute(
        fullscreenDialog: false,
        builder: (ctx) {
          return Scaffold(
            appBar: AppBar(
              title: Text(indicator.toString().split('.').last),
              backgroundColor: Colors.pink,
            ),
            backgroundColor: Colors.teal,
            body: Padding(
              padding: const EdgeInsets.all(64),
              child: LoadingIndicator(
                indicatorType: indicator,
                color: Colors.white,
              ),
            ),
          );
        },
      ),
    );
  }

  @override
  Widget build(BuildContext context) => Scaffold(
        appBar: AppBar(
          title: Text('Demo'),
          backgroundColor: Colors.pink,
        ),
        floatingActionButton: FloatingActionButton(
            child: Icon(Icons.grid_on),
            onPressed: () {
              Navigator.of(context).push(
                MaterialPageRoute(
                  builder: (_) => GridWidget(),
                ),
              );
            }),
        body: ListView.builder(
          itemBuilder: (ctx, index) {
            return InkWell(
              onTap: () {
                _showSingleAnimationDialog(ctx, Indicator.values[index]);
              },
              child: Padding(
                padding: const EdgeInsets.only(left: 16, top: 16, bottom: 16),
                child: Text(
                  Indicator.values[index].toString().split('.').last,
                  style: TextStyle(
                    fontSize: 24,
                  ),
                ),
              ),
            );
          },
          itemCount: Indicator.values.length,
        ),
      );
}

class GridWidget extends StatelessWidget {
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.pink,
      body: GridView.builder(
        itemCount: Indicator.values.length,
        gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
          crossAxisCount: 4,
          childAspectRatio: 1,
        ),
        itemBuilder: (ctx, index) => Stack(
              fit: StackFit.expand,
              alignment: Alignment.center,
              children: <Widget>[
                Padding(
                  padding: const EdgeInsets.all(16),
                  child: LoadingIndicator(
                    color: Colors.white,
                    indicatorType: Indicator.values[index],
                  ),
                ),
                Align(
                  alignment: Alignment.bottomLeft,
                  child: Text(
                    '${index + 1}',
                    style: TextStyle(
                      color: Colors.white,
                      fontSize: 14,
                    ),
                  ),
                )
              ],
            ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  loading_indicator: ^1.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:loading_indicator/loading_indicator.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
90
Health:
Code health derived from static analysis. [more]
93
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
89
Overall:
Weighted score of the above. [more]
91
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

because of import path [loading_indicator] that is in a package requiring null.

Health suggestions

Fix lib/src/decorate/decorate.dart. (-0.50 points)

Analysis of lib/src/decorate/decorate.dart reported 1 hint:

line 44 col 20: 'inheritFromWidgetOfExactType' is deprecated and shouldn't be used. Use dependOnInheritedWidgetOfExactType instead. This feature was deprecated after v1.12.1..

Fix lib/src/indicators/ball_beat.dart. (-0.50 points)

Analysis of lib/src/indicators/ball_beat.dart reported 1 hint:

line 37 col 72: This function has a return type of 'FutureOr

Fix lib/src/indicators/ball_grid_pulse.dart. (-0.50 points)

Analysis of lib/src/indicators/ball_grid_pulse.dart reported 1 hint:

line 50 col 62: This function has a return type of 'FutureOr

Fix additional 15 files with analysis or formatting issues. (-5.50 points)

Additional issues in the following files:

  • lib/src/indicators/ball_pulse.dart (1 hint)
  • lib/src/indicators/ball_pulse_sync.dart (1 hint)
  • lib/src/indicators/ball_scale_multiple.dart (1 hint)
  • lib/src/indicators/ball_scale_ripple_multiple.dart (1 hint)
  • lib/src/indicators/ball_spin_fade_loader.dart (1 hint)
  • lib/src/indicators/line_scale.dart (1 hint)
  • lib/src/indicators/line_scale_party.dart (1 hint)
  • lib/src/indicators/line_scale_pulse_out.dart (1 hint)
  • lib/src/indicators/line_scale_pulse_out_rapid.dart (1 hint)
  • lib/src/indicators/line_spin_fade_loader.dart (1 hint)
  • lib/src/indicators/pacman.dart (1 hint)
  • lib/src/indicators/ball_clip_rotate_multiple.dart (Run flutter format to format lib/src/indicators/ball_clip_rotate_multiple.dart.)
  • lib/src/indicators/ball_clip_rotate_pulse.dart (Run flutter format to format lib/src/indicators/ball_clip_rotate_pulse.dart.)
  • lib/src/indicators/ball_zig_zag_deflect.dart (Run flutter format to format lib/src/indicators/ball_zig_zag_deflect.dart.)
  • lib/src/indicators/cube_transition.dart (Run flutter format to format lib/src/indicators/cube_transition.dart.)

Maintenance suggestions

Package is getting outdated. (-11.23 points)

The package was last published 58 weeks ago.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
async ^2.1.0 2.4.1
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8