custom_toast_widget.dart 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import 'package:flutter/material.dart';
  2. import 'package:widgets/ext/ex_widget.dart';
  3. import '../../utils/dark_theme_util.dart';
  4. import 'package:cs_resources/constants/color_constants.dart';
  5. /// 自定义气泡(吐司)的UI展示
  6. class CustomToastWidget extends StatelessWidget {
  7. const CustomToastWidget({
  8. Key? key,
  9. required this.msg,
  10. // required this.alignment,
  11. }) : super(key: key);
  12. final String msg;
  13. // final AlignmentGeometry alignment;
  14. @override
  15. Widget build(BuildContext context) {
  16. return Align(
  17. alignment: Alignment.bottomCenter,
  18. child: Container(
  19. margin: const EdgeInsets.symmetric(vertical: 80),
  20. padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
  21. decoration: BoxDecoration(
  22. color: DarkThemeUtil.multiColors(const Color(0XB3000000),darkColor: ColorConstants.darkBlackItem) ,
  23. borderRadius: BorderRadius.circular(10),
  24. ),
  25. child: Text(
  26. msg,
  27. style: const TextStyle(color: Colors.white, fontSize: 15),
  28. textAlign: TextAlign.center,
  29. ),
  30. ).constrained(maxWidth: 280),
  31. );
  32. }
  33. }