dialog.dart 732 Bytes

import 'package:flutter/material.dart';

class ShowDialog extends Dialog {
  Widget? child;
  ShowDialog({Key? key, this.child}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Material(
        //透明层
        type: MaterialType.transparency,
        child: Stack(
          children: <Widget>[
            InkWell(
              onTap: () {
              if (Navigator.canPop(context)) {
          Navigator.pop(context);
          }
              },
              child: Container(
                width: MediaQuery.of(context).size.width,
                height: MediaQuery.of(context).size.height,
              ),
            ),
            child! //内容
          ],
        ));
  }
}