Overview
Thesirenapp_flutter_inbox
is a comprehensive and customizable Flutter UI kit for displaying and managing notifications. This documentation provides comprehensive information on how to install, configure, and use the SDK effectively.
Installation
To install thesirenapp_flutter_inbox
package:
1
Open your
pubspec.yaml
file2
Add
sirenapp_flutter_inbox
to your dependencies:Add sirenapp_flutter_inbox
to your dependencies:3
Run
flutter pub get
in your terminal to install the packageConfiguration
Initialization
Initialize the SDK with user token and recipient ID. Wrap the provider around your App’s root widget.Configure Notification Icon
This widget displays a notification icon with a badge showing the number of unviewed notifications.Notification Icon Arguments
Argument | Description | Type | Default |
---|---|---|---|
darkMode | Enable dark mode when custom theme is not provided | bool | false |
disabled | Disable click on icon | bool | false |
hideBadge | Hide unviewed count badge | bool | false |
notificationIcon | Custom notification icon | Widget | null |
onError | Error callback | Function(SirenErrorType) | null |
onTap | Custom tap handler | VoidCallback | null |
theme | Theme properties | CustomThemeColors | null |
customStyles | Style properties | CustomStyles | null |
Configure Notification Inbox
TheSirenInbox
widget provides a paginated list view for displaying notifications.
Inbox Arguments
Argument | Description | Type | Default |
---|---|---|---|
darkMode | Enable dark mode | bool | false |
hideTab | Show/hide All/Unread tabs | bool | false |
itemsPerFetch | Notifications per request (max 50) | int | 20 |
listEmptyWidget | Custom empty state widget | Widget | null |
customCard | Custom card builder | Widget Function(NotificationType) | null |
customLoader | Custom loading widget | Widget | null |
customErrorWidget | Custom error widget | Widget | null |
cardParams | Card properties | CardParams | CardParams(hideAvatar: false , disableAutoMarkAsRead: false , hideDelete: false , deleteIcon: Icon(Icons.close) , onAvatarClick: Function(NotificationType) , hideMediaThumbnail: false , onMediaThumbnailClick: Function(NotificationType)) |
headerParams | Header properties | HeaderParams | HeaderParams(hideHeader: false , hideClearAll: false , title: 'Notifications' , customHeader: null , showBackButton: false , backButton: null , onBackPress: null ) |
tabParams | Tab bar properties | TabParams | TabParams(tabs: [TabItem(key: 'ALL', title: 'All'), TabItem(key: 'UNREAD', title: 'Unread')], activeTabIndex: 0 ) |
onCardClick | Card tap handler | Function(NotificationType) | null |
onError | Error callback | Function(SirenErrorType) | null |
theme | Theme properties | CustomThemeColors | null |
customStyles | Style properties | CustomStyles | null |
customTabIndicator | Tab indicator decoration | BoxDecoration | null |
filterParams | Filter configuration | FilterParams | FilterParams(categoryFilterParams: CategoryFilterParams(showFilters: true , filterIconWidget: null , hideBadge: false , categoryFilterStyles: CategoryFilterStyles(dropdownTextStyle: null)) ) |
Filter Configuration
Customization
Theme Customization
Style Customization
Siren Class
TheSiren
class provides utility functions for managing notifications:
Function | Arguments | Type | Description |
---|---|---|---|
markAsReadByDate | startDate: String | String | Sets notifications as read until the given date |
markAsReadById | id: String | String | Marks a specific notification as read |
deleteById | id: String | String | Deletes a specific notification |
deleteByDate | startDate: String | String | Deletes notifications until the given date |
markAllAsViewed | startDate: String | String | Marks all notifications as viewed until the given date |