基础组件库
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.
 
 
 
 
 

55 regels
1.7 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. if (Navigator.canPop(context)) {
  11. Navigator.pop(context);
  12. }
  13. },
  14. child: Scaffold(
  15. backgroundColor: Colors.transparent,
  16. body: Center(
  17. child: UnconstrainedBox(
  18. child: Container(
  19. padding: EdgeInsets.all(10),
  20. decoration: BoxDecoration(
  21. color: Colors.white, borderRadius: BorderRadius.circular(8)),
  22. child: Column(
  23. crossAxisAlignment: CrossAxisAlignment.center,
  24. mainAxisAlignment: MainAxisAlignment.center,
  25. children: <Widget>[
  26. Container(
  27. width: 80,
  28. height: 80,
  29. child: LoadingIndicator(
  30. indicatorType: Indicator.ballSpinFadeLoader,
  31. color: Colors.redAccent,
  32. ),
  33. ),
  34. message == null || message == ''
  35. ? Container()
  36. : Container(
  37. margin: EdgeInsets.only(top: 8),
  38. child: Text(
  39. message,
  40. style: TextStyle(fontSize: 14),
  41. ),
  42. ),
  43. ],
  44. ),
  45. ),
  46. ),
  47. ),
  48. ),
  49. );
  50. }
  51. }