custom_loading_widget.dart 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import 'package:flutter/material.dart';
  2. import '../../utils/dark_theme_util.dart';
  3. import 'package:cs_resources/constants/color_constants.dart';
  4. /// 自定义Loading的UI展示
  5. class CustomLoadingWidget extends StatelessWidget {
  6. const CustomLoadingWidget({
  7. Key? key,
  8. required this.msg,
  9. }) : super(key: key);
  10. final String msg;
  11. @override
  12. Widget build(BuildContext context) {
  13. return _buildBg(children: [
  14. const SizedBox(
  15. width: 30,
  16. height: 30,
  17. child: CircularProgressIndicator(
  18. strokeWidth: 2,
  19. valueColor: AlwaysStoppedAnimation(Colors.white),
  20. ),
  21. ),
  22. Container(
  23. margin: const EdgeInsets.only(top: 12),
  24. child: Text(
  25. msg,
  26. style: const TextStyle(color: Colors.white, fontSize: 13),
  27. textAlign: TextAlign.center,
  28. ),
  29. ),
  30. ]);
  31. }
  32. Widget _buildBg({required List<Widget> children}) {
  33. return Container(
  34. width: 85,
  35. height: 85,
  36. alignment: Alignment.center,
  37. decoration: BoxDecoration(
  38. color: DarkThemeUtil.multiColors(const Color(0xcc000000),darkColor: ColorConstants.darkBlackItem),
  39. borderRadius: BorderRadius.circular(10),
  40. ),
  41. child: Column(mainAxisSize: MainAxisSize.min, children: children),
  42. );
  43. }
  44. }