12345678910111213141516171819202122232425262728 |
- import 'package:flutter/material.dart';
- import 'package:fluttertoast/fluttertoast.dart';
- class Component {
- static toast(String msg, int errLevel) {
- var bgColor = Colors.blue;
- switch(errLevel) {
- case 0:
- bgColor = Colors.red;
- break;
- case 1:
- bgColor = Colors.yellow;
- break;
- case 2:
- bgColor = Colors.blue;
- break;
- };
- Fluttertoast.showToast(
- msg: msg,
- toastLength: Toast.LENGTH_SHORT,
- gravity: ToastGravity.CENTER,
- timeInSecForIosWeb: 1,
- backgroundColor: bgColor,
- textColor: Colors.white,
- fontSize: 16.0);
- }
- }
|