showToast static method

Future<void> showToast(
  1. String msg, {
  2. Duration time = const Duration(milliseconds: 2000),
  3. dynamic alignment = Alignment.bottomCenter,
  4. Widget? widget,
})

提供toast示例

alignment:控制toast出现的位置

Implementation

static Future<void> showToast(
  String msg, {
  Duration time = const Duration(milliseconds: 2000),
  alignment: Alignment.bottomCenter,
  Widget? widget,
}) async {
  _toastAction.showToast(
    time: time,
    widget: ToastHelper(
      child: widget ?? ToastWidget(msg: msg, alignment: alignment),
    ),
  );
}