ChatUIToast class
跨平台 Toast 工具类。
- 移动端(iOS / Android):使用 fluttertoast。
- 桌面端 / Web(macOS / Windows / Linux / Web):使用 Overlay 悬浮提示。
桌面端使用前,请在 MaterialApp 上设置 navigatorKey,以支持 在无 BuildContext 的场景(如 ViewModel)中也能正常弹出 Toast:
MaterialApp(
navigatorKey: ChatUIToast.navigatorKey,
...
)
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
全局 Navigator Key,挂载到 MaterialApp 后可在任何地方显示 Toast。
final
Static Methods
-
show(
String msg, {BuildContext? context, ToastGravity? gravity}) → void - 显示一条 Toast 消息。