import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
// ignore: must_be_immutable
class LoadingDialog extends Dialog {
  String text;
  final childCallback;

  LoadingDialog({
    Key key,
    @required this.text,
    @required this.childCallback
  }): super(key: key);

  @override
  Widget build(BuildContext context) {
    return new Material( //创建透明层
      type: MaterialType.transparency, //透明类型
      child: new Center( //保证控件居中效果
        child: Container(
          width: ScreenUtil.getInstance().setWidth(554),
          height: ScreenUtil.getInstance().setHeight(345),
          decoration: BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.all(Radius.circular(8))
          ),
          child: new Container(
            child: new Column(
              children: < Widget > [
                Container(
                  height: ScreenUtil.getInstance().setHeight(255),
                  decoration: BoxDecoration(
                    border: Border(bottom: BorderSide(width: 1, color: Color.fromRGBO(151, 151, 151, 0.27)))
                  ),
                  child: Center(
                    child: Text(text, style: TextStyle(
                      fontSize: ScreenUtil.getInstance().setSp(32)
                    ), )
                  ),
                ),
                Expanded(
                  flex: 1,
                  child: Container(
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: < Widget > [
                        Expanded(
                          flex: 1,
                          child: InkWell(
                            child: Container(
                              decoration: BoxDecoration(
                                border: Border(right: BorderSide(width: 1, color: Color.fromRGBO(151, 151, 151, 0.27))),
                              ),
                              child: Center(
                                child: Text('确定',
                                  style: TextStyle(
                                    fontSize: ScreenUtil.getInstance().setSp(32),
                                    color: Color.fromRGBO(64, 98, 254, 1)
                                  ), ),
                              )
                            ),
                            onTap: () {
                              Navigator.pop(context);
                              childCallback(true);
                            },
                          )
                        ),
                      ],
                    ),
                  )
                )
              ],
            ),
          ),
        ),
      ),
    );
  }
}