bs_overlay_loader 0.0.1
bs_overlay_loader: ^0.0.1 copied to clipboard

Overlay simple progress loader to screen.

example/lib/main.dart

import 'dart:async';

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

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  double progress = 0;
  @override
  Widget build(BuildContext context) {
    print("build");
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            RaisedButton(
              onPressed: () {
                Timer.periodic(Duration(seconds: 1), (_) {
                  progress += 0.25;
                  BsOverlayLoader.update(progress);

                  if (progress >= 1) {
                    Future.delayed(Duration(milliseconds: 300)).then((_) {
                      BsOverlayLoader.refresh();
                    });
                    progress = 0;
                  }
                });
                BsOverlayLoader.show(context, text: '업로드...');
              },
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {},
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ),
    );
  }
}
2
likes
90
pub points
42%
popularity

Overlay simple progress loader to screen.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache 2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on bs_overlay_loader