SantoMessage class
Message 消息通知组件
顶部轻量消息提示,支持多种类型:success、error、warning、info。 使用 Overlay 实现,自动消失。
使用示例:
// 显示成功消息
SantoMessage.show(
context: context,
content: '操作成功',
type: SantoMessageType.success,
);
// 显示自定义消息
SantoMessage.show(
context: context,
content: '自定义消息',
duration: Duration(seconds: 5),
);
Constructors
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 Methods
-
dismiss(
) → void - 手动关闭消息
-
error(
{required BuildContext context, required String content, Duration duration = const Duration(seconds: 2), Color? backgroundColor, Color? textColor, VoidCallback? onDismiss}) → void - 显示错误消息
-
info(
{required BuildContext context, required String content, Duration duration = const Duration(seconds: 2), Color? backgroundColor, Color? textColor, VoidCallback? onDismiss}) → void - 显示信息消息
-
show(
{required BuildContext context, required String content, SantoMessageType type = SantoMessageType.info, Duration duration = const Duration(seconds: 2), Color? backgroundColor, Color? textColor, IconData? icon, VoidCallback? onDismiss}) → void - 显示消息通知
-
success(
{required BuildContext context, required String content, Duration duration = const Duration(seconds: 2), Color? backgroundColor, Color? textColor, VoidCallback? onDismiss}) → void - 显示成功消息
-
warning(
{required BuildContext context, required String content, Duration duration = const Duration(seconds: 2), Color? backgroundColor, Color? textColor, VoidCallback? onDismiss}) → void - 显示警告消息