基础组件库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

53 lines
1.6 KiB

  1. import 'package:flutter/material.dart';
  2. import 'package:loading_indicator/loading_indicator.dart';
  3. class LoadingDialog extends StatelessWidget {
  4. final String message;
  5. const LoadingDialog({Key key, this.message}) : super(key: key);
  6. @override
  7. Widget build(BuildContext context) {
  8. return GestureDetector(
  9. onTap: () {
  10. Navigator.pop(context);
  11. },
  12. child: Scaffold(
  13. backgroundColor: Colors.transparent,
  14. body: Center(
  15. child: UnconstrainedBox(
  16. child: Container(
  17. padding: EdgeInsets.all(10),
  18. decoration: BoxDecoration(
  19. color: Colors.white, borderRadius: BorderRadius.circular(8)),
  20. child: Column(
  21. crossAxisAlignment: CrossAxisAlignment.center,
  22. mainAxisAlignment: MainAxisAlignment.center,
  23. children: <Widget>[
  24. Container(
  25. width: 80,
  26. height: 80,
  27. child: LoadingIndicator(
  28. indicatorType: Indicator.ballSpinFadeLoader,
  29. color: Colors.redAccent,
  30. ),
  31. ),
  32. message == null || message == ''
  33. ? Container()
  34. : Container(
  35. margin: EdgeInsets.only(top: 8),
  36. child: Text(
  37. message,
  38. style: TextStyle(fontSize: 14),
  39. ),
  40. ),
  41. ],
  42. ),
  43. ),
  44. ),
  45. ),
  46. ),
  47. );
  48. }
  49. }