show static method

void show(
  1. BuildContext context, {
  2. dynamic msg = '加载中...',
})

Implementation

static void show(BuildContext context, {msg = '加载中...'}) {

  WidgetsBinding widgetsBinding = WidgetsBinding.instance;
  widgetsBinding.addPostFrameCallback((callback) {
    dismiss();
    isLoading = true;
    isAutoShow = false;
    _context = context;

    timerTread();

    overlayEntry = new OverlayEntry(
      builder: (context) {
        return new Center(
          child: new Material(
            type: MaterialType.transparency,
            textStyle: new TextStyle(color: const Color(0xFF212121)),
            child: new Container(
              decoration: BoxDecoration(
                borderRadius: new BorderRadius.all(new Radius.circular(4.0)),
                color: Color.fromRGBO(0, 0, 0, 0.3),
              ),
              padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 4),
              width: 90.0,
              height: 90.0,
              alignment: Alignment.center,
              child: new Wrap(
                crossAxisAlignment: WrapCrossAlignment.center,
                children: <Widget>[
                  new Container(
                    width: double.infinity,
                    alignment: Alignment.center,
                    child: new Image.asset(icon, package: package),
                  ),
                  new Padding(
                    padding: EdgeInsets.only(top: 10),
                    child: new Center(
                      child: new Text(
                        msg,
                        style: TextStyle(color: Colors.white),
                        maxLines: 3,
                      ),
                    ),
                  ),
                ],
              ),
            ),
          ),
        );
      },
    );

    if (overlayEntry != null) {
      Overlay.of(_context!).insert(overlayEntry!);
    }
  });
}