toast.dart 667 B

123456789101112131415161718192021222324
  1. import 'package:flutter/material.dart';
  2. import 'package:fluttertoast/fluttertoast.dart';
  3. class ToastUtil {
  4. static void show(String msg) {
  5. Fluttertoast.showToast(
  6. msg: msg,
  7. toastLength: Toast.LENGTH_SHORT,
  8. gravity: ToastGravity.CENTER,
  9. backgroundColor: Colors.black.withOpacity(.9),
  10. textColor: Colors.white,
  11. fontSize: 14.0);
  12. }
  13. static void showBottom(String msg) {
  14. Fluttertoast.showToast(
  15. msg: msg,
  16. toastLength: Toast.LENGTH_SHORT,
  17. gravity: ToastGravity.BOTTOM,
  18. backgroundColor: Colors.black.withOpacity(.9),
  19. textColor: Colors.white,
  20. fontSize: 14.0);
  21. }
  22. }