progress_indicator_overlay 0.0.1 progress_indicator_overlay: ^0.0.1 copied to clipboard
Make a progress indicator overlay
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();
});
},
),
),
),
);
}
}