Progress Indicator Overlay

Make a progress indicator overlay

Example

import 'dart:async';

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

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

class MyApp extends StatelessWidget {
  const MyApp({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Example Progress Indicator Overlay widget',
      home: MyPage(),
    );
  }
}

class MyPage extends StatefulWidget {
  @override
  _MyPageState createState() => _MyPageState();
}

class _MyPageState extends State<MyPage> {
  final GlobalKey<ProgressIndicatorOverlayState> _loadingKey = GlobalKey<ProgressIndicatorOverlayState>();

  @override
  Widget build(BuildContext context) {
    return ProgressIndicatorOverlay(
      key: _loadingKey,
      child: Scaffold(
        appBar: AppBar(
          centerTitle: true,
          title: Text('Example widget Progress Indicator Overlay'),
        ),
        body: Center(
          child: RaisedButton(
            child: Text('Show Loading'),
            onPressed: () {
              final loading = _loadingKey.currentState;
              loading.show();
              Timer(const Duration(seconds: 2), () {
                loading.hide();
              });
            },
          ),
        ),
      ),
    );
  }
}

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

Libraries

progress_indicator_overlay