12345678910111213141516171819202122232425262728293031323334353637 |
- import 'package:flutter/material.dart';
- /// 自定义Loading的UI展示
- class CustomLoadingWidget extends StatelessWidget {
- const CustomLoadingWidget({
- Key? key,
- required this.msg,
- }) : super(key: key);
- final String msg;
- @override
- Widget build(BuildContext context) {
- return _buildBg(children: [
- const CircularProgressIndicator(
- strokeWidth: 2.5,
- valueColor: AlwaysStoppedAnimation(Colors.white),
- ),
- Container(
- margin: const EdgeInsets.only(top: 15),
- child: Text(msg, style: const TextStyle(color: Colors.white,fontSize: 14)),
- ),
- ]);
- }
- Widget _buildBg({required List<Widget> children}) {
- return Container(
- padding: const EdgeInsets.symmetric(horizontal: 25, vertical: 15),
- decoration: BoxDecoration(
- color: const Color(0xcc000000), //不使用传递的背景色 制定自己的背景颜色
- borderRadius: BorderRadius.circular(10),
- ),
- child: Column(mainAxisSize: MainAxisSize.min, children: children),
- );
- }
- }
|