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

loading_dialog.dart 1.6 KiB

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