Notification
Overview
Notifications are messages that communicate information to the user. The two main variants of notifications are toast notifications and inline notifications.

Widget API
title
The title to display.
Type:
WidgetDefault: required
subtitle
The subtitle to display.
Type:
WidgetDefault: required
hideCloseButton
Whether the close button should be disabled, or not.
Type:
boolDefault:
false
kind
The state that the notification represents. It can be error, info, success, or warning.
Type:
CNotificationKindDefault:
CNotificationKind.info
lowContrast
Whether you are using the low contrast variant of the notification.
Type:
boolDefault:
true
onCloseButtonTap
Called when the close button is tapped.
Type:
VoidCallback?Default: optional
onClose
Called after the given timeout duration has passed.
Type:
VoidCallback?Default: optional
actions
A list of CNotificationActionButton to display in a row when the notification is inline.
Type:
List<CNotificationActionButton>?Default: optional
title
The title to display.
Type:
WidgetDefault: required
subtitle
The subtitle to display.
Type:
WidgetDefault: required
hideCloseButton
Whether the close button should be disabled, or not.
Type:
boolDefault:
false
lowContrast
Whether you are using the low contrast variant of the notification.
Type:
boolDefault:
true
kind
The state that the notification represents. It can be error, info, success, or warning.
Type:
CNotificationKindDefault:
CNotificationKind.info
onCloseButtonTap
Called when the close button is tapped.
Type:
VoidCallback?Default: optional
onClose
Called after the given timeout duration has passed.
Type:
VoidCallback?Default: optional
caption
An optional caption to display.
Type:
Widget?Default: optional
Example
CNotification.toast(
onCloseButtonTap: () {},
lowContrast: false,
kind: CNotificationKind.error,
title: CText(data: 'Notification title'),
subtitle: CText(data: 'Subtitle text goes here.'),
caption: CText(data: 'Time stamp [00:00:00]'),
)
// OR
CNotification.inline(
onCloseButtonTap: () {},
kind: CNotificationKind.success,
lowContrast: false,
title: CText(data: 'Notification title'),
subtitle: CText(data: 'Subtitle text goes here.'),
actions: [
CNotificationActionButton(child: CText(data: 'Action'), onTap: () {}),
],
)Last updated
Was this helpful?