import 'package:flutter/material.dart'; import 'package:loading_indicator/loading_indicator.dart'; class LoadingDialog extends StatelessWidget { final String message; const LoadingDialog({Key key, this.message}) : super(key: key); @override Widget build(BuildContext context) { return GestureDetector( onTap: () { if (Navigator.canPop(context)) { Navigator.pop(context); } }, child: Scaffold( backgroundColor: Colors.transparent, body: Center( child: UnconstrainedBox( child: Container( padding: EdgeInsets.all(10), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(8)), child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ Container( width: 80, height: 80, child: LoadingIndicator( indicatorType: Indicator.ballSpinFadeLoader, color: Colors.redAccent, ), ), message == null || message == '' ? Container() : Container( margin: EdgeInsets.only(top: 8), child: Text( message, style: TextStyle(fontSize: 14), ), ), ], ), ), ), ), ), ); } }