toast_util.dart 543 B

1234567891011121314151617181920212223
  1. import 'package:flutter/material.dart';
  2. import 'package:fluttertoast/fluttertoast.dart';
  3. import '../constant/color_res.dart';
  4. /// @author: bo.zeng
  5. /// @email: cnhbwds@gmail.com
  6. /// @date: 2025 2025/4/9 16:00
  7. /// @description:
  8. void showToast(String message) {
  9. if (message.isEmpty) {
  10. return;
  11. }
  12. Fluttertoast.showToast(
  13. msg: message,
  14. toastLength: Toast.LENGTH_SHORT,
  15. gravity: ToastGravity.CENTER,
  16. timeInSecForIosWeb: 1,
  17. backgroundColor: colorToastBackground,
  18. textColor: Colors.white,
  19. fontSize: 16.0,
  20. );
  21. }