loading_mixin 0.0.1 copy "loading_mixin: ^0.0.1" to clipboard
loading_mixin: ^0.0.1 copied to clipboard

outdated

Add loading to your application with just two words, adding this mixin to your class.

logo

A highly customizable search component to accelerate your development.

Pub Package Buy Me A Coffee

Overview #

This package is for you to add loading to your application with just two words, adding this mixin to your class.

Contributing

Getting Started

In pubspec.yaml:

dependencies:
  loading_mixin: any

Basic:

First: in your State class, add the mixin to the LoadingMixin class

import 'package:loading_mixin/loading_mixin.dart';

class LoadingMixinTest extends StatefulWidget {
  @override
  _LoadingMixinTestState createState() => _LoadingMixinTestState();
}

//State Class
class _LoadingMixinTestState extends State<LoadingMixinTest> with LoadingMixin {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Loading Mixin'),
      ),
      body: buildBody(),
    );
  }
  .
  .
  .

Second: add the startLoad method by passing your asynchronous function wherever you need

  RaisedButton(onPressed: () async {
        var result = await this.startLoad(context, requestData);

        result != null ? print('$result') : print('No data found!');
    },
    child: Text('Async',style: TextStyle(color: Colors.white),
    ),
  )

  //HTTP request Example
  static Future requestData() async {
    await Future.delayed(Duration(milliseconds: 1500));
    return 1844;
  }
}

Custom: You can also customize your loading by passing the customLaod parameter


RaisedButton(
onPressed: () async {
    var customLoad = Container(
    height: 50,
    width: 50,
    color: Colors.transparent,
    child: Center(
        child: CircularProgressIndicator(
        valueColor: new AlwaysStoppedAnimation<Color>(Colors.yellow),
        ),
    ),
    );
    var result = await this.startLoad(context, requestData, customLoad: customLoad);

    result != null ? print('$result') : print('No data found!');
},
child: Text(
    'Async',
    style: TextStyle(color: Colors.white),
),
)

Features and bugs #

Please send feature requests and bugs at the issue tracker.

4
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Add loading to your application with just two words, adding this mixin to your class.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on loading_mixin