screen_loader 1.0.3 copy "screen_loader: ^1.0.3" to clipboard
screen_loader: ^1.0.3 copied to clipboard

outdated

Easy to use mixin ScreenLoader, which will hadle the loading on the screen. You can customise the loading as well.

example/main.dart

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ScreenLoaderApp(
      app: MaterialApp(
        debugShowCheckedModeBanner: false,
        title: 'Screen Loader',
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
        home: Screen(),
      ),
      globalLoader: AlertDialog(
        title: Text('Gobal Loader..'),
      ),
    );
  }
}

class Screen extends StatefulWidget {
  @override
  _ScreenState createState() => _ScreenState();
}

class _ScreenState extends State<Screen> with ScreenLoader {
  loader() {
    return AlertDialog(
      title: Text('Wait.. Loading data..'),
    );
  }

  _getData() async {
    this.startLoading(this);
    await Future.delayed(Duration(seconds: 3));
    this.stopLoading(this);
  }

  Widget _buildBody() {
    return Center(
      child: Image.network(
          'https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcQgQu8nlAEzW63m0pKcq9csbtk-3ni_QlvW4uy6DgeaWbO4Fze1'),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('ScreenLoader Example'),
      ),
      body: this.screenWrapper(
        this._buildBody(),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: this._getData,
        child: Icon(Icons.refresh),
      ),
    );
  }
}
45
likes
0
pub points
82%
popularity

Publisher

verified publisherdart.nonstopio.com

Easy to use mixin ScreenLoader, which will hadle the loading on the screen. You can customise the loading as well.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on screen_loader