import 'dart:ui'; import 'package:flutter/material.dart'; // ignore: must_be_immutable class CustomAlert extends StatelessWidget { final Widget child; CustomAlert({ Key key, @required this.child }): super(key: key); double deviceWidth; double deviceHeight; double dialogHeight; @override Widget build(BuildContext context) { Orientation orientation = MediaQuery.of(context).orientation; Size screenSize = MediaQuery.of(context).size; deviceWidth = orientation == Orientation.portrait ? screenSize.width : screenSize.height; deviceHeight = orientation == Orientation.portrait ? screenSize.height : screenSize.width; dialogHeight = deviceHeight * (0.50); return MediaQuery( data: MediaQueryData(), child: GestureDetector( // onTap: ()=>Navigator.pop(context), child: BackdropFilter( filter: ImageFilter.blur( sigmaX: 0.5, sigmaY: 0.5, ), child: Container( child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.center, children: [ Expanded( child: Stack( children: [ Center( child: Container( width: deviceWidth*0.9, child: GestureDetector( onTap: (){}, child: Card( shape: RoundedRectangleBorder( borderRadius: BorderRadius.only( topLeft: Radius.circular(10.0), topRight: Radius.circular(10.0), bottomLeft: Radius.circular(10.0), bottomRight: Radius.circular(10.0), ), ), child: child, ), ), ), ), ], ), ), ], ), ), ), ), ); } }