show method

OverlayTier? show(
  1. BuildContext context,
  2. Widget widget, {
  3. Duration? duration,
  4. bool opaque = false,
  5. bool maintainState = false,
  6. bool replace = true,
})

Implementation

OverlayTier? show(
  BuildContext context,
  Widget widget, {
  Duration? duration,
  bool opaque = false,
  bool maintainState = false,
  bool replace = true,
}) {
  /// 不替换且显示中则不处理
  if (!replace && _tier != null && _tier!.isShowing) {
    return this;
  }

  _tier?.dismiss();
  _tier = TimeOverlayEntry(
    duration: duration,
    maintainState: maintainState,
    opaque: opaque, //不透明
    builder: (_) {
      return Material(type: MaterialType.transparency, child: widget);
    },
  );
  _tier?.show(context);
  return this;
}