show static method

void show(
  1. BuildContext? context,
  2. String msg, {
  3. int? duration = 1,
  4. int? gravity = 0,
  5. Color backgroundColor = const Color(0xAA000000),
  6. dynamic textStyle = const TextStyle(fontSize: 15, color: Colors.white),
  7. double backgroundRadius = 20,
  8. bool? rootNavigator,
  9. Border? border,
})

Implementation

static void show(BuildContext? context, String msg,
    {int? duration = 1,
    int? gravity = 0,
    Color backgroundColor = const Color(0xAA000000),
    textStyle = const TextStyle(fontSize: 15, color: Colors.white),
    double backgroundRadius = 20,
    bool? rootNavigator,
    Border? border}) {
  ///
  /// 上下文不能为空
  ///
  if (context == null) {
    throw Exception(
        'Context is null, please call ToastContext.init(context) first');
  }
  ToastView.dismiss();
  ToastView.createView(msg, context, duration, gravity, backgroundColor,
      textStyle, backgroundRadius, border, rootNavigator);
}