add DrAppToastMsg and handle error in the login page
parent
f3a96adf3c
commit
c0168cb8fb
@ -0,0 +1,76 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_flexible_toast/flutter_flexible_toast.dart';
|
||||||
|
mixin DrAppToastMsg {
|
||||||
|
void showLongToast(msg) {
|
||||||
|
FlutterFlexibleToast.showToast(
|
||||||
|
message: msg,
|
||||||
|
toastLength: Toast.LENGTH_LONG,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void showSuccesToast(msg) {
|
||||||
|
FlutterFlexibleToast.showToast(
|
||||||
|
message: msg,
|
||||||
|
toastLength: Toast.LENGTH_SHORT,
|
||||||
|
backgroundColor: Colors.green,
|
||||||
|
icon: ICON.SUCCESS,
|
||||||
|
fontSize: 16,
|
||||||
|
imageSize: 35,
|
||||||
|
textColor: Colors.white);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void showErrorToast(msg) {
|
||||||
|
FlutterFlexibleToast.showToast(
|
||||||
|
message: msg,
|
||||||
|
toastLength: Toast.LENGTH_SHORT,
|
||||||
|
backgroundColor: Colors.red,
|
||||||
|
icon: ICON.CLOSE,
|
||||||
|
fontSize: 16,
|
||||||
|
imageSize: 35,
|
||||||
|
textColor: Colors.white);
|
||||||
|
}
|
||||||
|
|
||||||
|
void showShortToast(msg) {
|
||||||
|
FlutterFlexibleToast.showToast(
|
||||||
|
message: msg,
|
||||||
|
toastLength: Toast.LENGTH_SHORT,
|
||||||
|
icon: ICON.INFO,
|
||||||
|
timeInSeconds: 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void showTopShortToast(msg) {
|
||||||
|
FlutterFlexibleToast.showToast(
|
||||||
|
message: msg,
|
||||||
|
toastLength: Toast.LENGTH_SHORT,
|
||||||
|
toastGravity: ToastGravity.TOP,
|
||||||
|
icon: ICON.WARNING,
|
||||||
|
timeInSeconds: 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void showCenterShortToast(msg) {
|
||||||
|
FlutterFlexibleToast.showToast(
|
||||||
|
message: msg,
|
||||||
|
toastLength: Toast.LENGTH_SHORT,
|
||||||
|
toastGravity: ToastGravity.CENTER,
|
||||||
|
icon: ICON.WARNING,
|
||||||
|
timeInSeconds: 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void showCenterShortLoadingToast(msg) {
|
||||||
|
FlutterFlexibleToast.showToast(
|
||||||
|
message: msg,
|
||||||
|
toastLength: Toast.LENGTH_LONG,
|
||||||
|
toastGravity: ToastGravity.BOTTOM,
|
||||||
|
icon: ICON.LOADING,
|
||||||
|
radius: 20,
|
||||||
|
elevation: 10,
|
||||||
|
textColor: Colors.white,
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
timeInSeconds: 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cancelToast(msg) {
|
||||||
|
FlutterFlexibleToast.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue