loading_loading 0.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 77

loading_loading #

Simple loading to your project.

pubspec.yaml #

loading_loading: <last_version>

Import #

import 'package:loading_loading/loading_loading.dart';

main.dart #

In main.dart file, add in home parameter the widget LoadingWidget, according example:

MaterialApp(
  title: 'Flutter Demo',
  theme: ThemeData(
    primarySwatch: Colors.blue,
  ),
  home: LoadingWidget(child: HomePage()),
);

Change loading status #

This package have a two functions to change a loading:

void LoadingWidget.toggle(); //To toggle a loading status
void LoadingWidget.setLoading(bool status); //To set a loading status

Verify loading #

To verify the loading status, look at this property:

bool LoadingWidget.isLoading;

Custom loading widget #

To use a custom loading widget, add a loading parameter, according example:

LoadingWidget(
  child: HomePage(),
  loading: Container(
    alignment: Alignment.center,
    color: Colors.black38,
    child: Container(
      width: 100,
      height: 100,
      alignment: Alignment.center,
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(5),
      ),
      child: CircularProgressIndicator(),
    ),
  ),
);

Getting Started #

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

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.1] - 2019.11.12

  • Added property "isLoading".

[0.1.0] - 2019.11.12

  • Initial Commit.

example/README.md

loading_loading example #

import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:loading_loading/loading_widget.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: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: LoadingWidget(
        child: HomePage(),
        loading: Material(
          color: Colors.black38,
          child: Center(
            child: Container(
              width: 100,
              height: 100,
              alignment: Alignment.center,
              decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.circular(5),
              ),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: <Widget>[
                  CircularProgressIndicator(),
                  Text("LOADING")
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }
}

class HomePage extends StatefulWidget {
  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("Loading Test")),
      floatingActionButton: FloatingActionButton(
        child: Icon(Icons.refresh),
        onPressed: () {
          LoadingWidget.toggle();
          Future.delayed(Duration(seconds: 3), LoadingWidget.toggle);
        },
      ),
    );
  }
}

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

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

Use this package as a library

1. Depend on it

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


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

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

  • Dart: 2.7.0
  • pana: 0.13.1+4
  • Flutter: 1.12.13+hotfix.4

Maintenance suggestions

The package description is too short. (-20 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.

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