|
- /*
- * 自定义等待加载提示框
- * Created by ZhangJun on 2018-11-29
- */
-
- import 'package:flutter/material.dart';
- import 'package:chat/utils/my_dialog.dart' as myDialog;
-
- class LoadingManage {
- //私有构造函数
- LoadingManage._internal();
-
- //保存单例
- static LoadingManage _singleton = new LoadingManage._internal();
-
- //工厂构造函数
- factory LoadingManage() => _singleton;
-
- static BuildContext context;
- showLoading() {
- myDialog.showDialog(
- context: context,
- barrierDismissible: true,
- builder: (BuildContext context) {
- return LoadingDialog();
- });
- }
-
- closeLoading() {
- Navigator.of(context).pop();
- }
- }
-
- class LoadingDialog extends Dialog {
- final String text;
-
- LoadingDialog({Key key, this.text}) : super(key: key);
-
- @override
- Widget build(BuildContext context) {
- return new Material(
- type: MaterialType.transparency,
- child: new Center(
- child: new SizedBox(
- width: 120.0,
- height: 120.0,
- child: new Container(
- decoration: ShapeDecoration(
- color: Colors.black.withOpacity(0.5),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.all(
- Radius.circular(8.0),
- ),
- ),
- ),
- child: new Column(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- new CircularProgressIndicator(
- valueColor:
- AlwaysStoppedAnimation(Colors.white)),
- ],
- ),
- ),
- ),
- ),
- );
- }
- }
|