import 'package:flutter/material.dart'; import 'package:widgets/ext/ex_widget.dart'; /// Notify的Success样式 class CustomSuccessWidget extends StatelessWidget { const CustomSuccessWidget({ Key? key, required this.msg, }) : super(key: key); final String msg; @override Widget build(BuildContext context) { return _buildBg(children: [ const Icon(Icons.check, size: 38, color: Colors.white), Container( margin: const EdgeInsets.only(top: 15), child: Text( msg, style: const TextStyle(color: Colors.white, fontSize: 14), textAlign: TextAlign.center, ), ), ]); } Widget _buildBg({required List children}) { return Container( padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 20), decoration: BoxDecoration( color: const Color(0xcc000000), //不使用传递的背景色 制定自己的背景颜色 borderRadius: BorderRadius.circular(10), ), child: Column(mainAxisSize: MainAxisSize.min, children: children), ).constrained(maxWidth: 250); } }