show method
- BuildContext context, {
- AlignmentGeometry? alignment,
- Duration? duration,
Show the message during duration.
You can call hide if you want to dismiss it before
Implementation
void show(
BuildContext context, {
AlignmentGeometry? alignment,
Duration? duration,
}) {
_entry?.remove();
final double appBarHeight = Scaffold.maybeOf(context)?.hasAppBar == true
? (Scaffold.of(context).appBarMaxHeight ?? kToolbarHeight)
: MediaQuery.paddingOf(context).top;
_entry = OverlayEntry(
builder: (BuildContext context) {
return _SmoothFloatingMessageView(
message: message,
header: header,
type: type,
onTap: hide,
alignment: alignment,
margin: EdgeInsetsDirectional.only(
top: appBarHeight,
start: SMALL_SPACE,
end: SMALL_SPACE,
bottom: SMALL_SPACE,
),
);
},
);
Overlay.of(context).insert(_entry!);
_autoDismissMessage = Timer(duration ?? const Duration(seconds: 5), () {
hide();
});
}