বিষয়বস্তুতে যান

Setting up Message Inbox for Flutter

এই বিষয়বস্তু এখনও আপনার ভাষায় উপলব্ধ নয়।

Message Inbox (the “bell icon” App Inbox) for Flutter ships as a separate pushwoosh_inbox package, install it alongside the base pushwoosh_flutter package.

Prerequisites

Anchor link to

Add the package

Anchor link to

Add pushwoosh_inbox to your pubspec.yaml. Check pub.dev for the current version:

pubspec.yaml
dependencies:
pushwoosh_inbox: '^2.3.24'

Show the inbox

Anchor link to
import 'package:pushwoosh_inbox/pushwoosh_inbox.dart';
PushwooshInbox.presentInboxUI();

This opens a native screen (a view controller on iOS, an Activity on Android) with the SDK’s default appearance.

Customize the style

Anchor link to

Pass a PWInboxStyle to presentInboxUI(). Every field is optional and keeps its default value when left unset. Image fields are Flutter asset paths and must be declared in your pubspec.yaml:

FieldCustomizes
dateFormatDate formatting, e.g. "dd.MMMM.yyyy"
defaultImageThe default icon next to a message with no image
unreadImageThe unread-messages mark (iOS only)
listErrorImageShown when loading the list fails
listEmptyImageShown when the list has no messages
listErrorMessageError text (not localized)
listEmptyMessageEmpty-list text (not localized)
barTitleThe inbox screen’s title
defaultTextColorDefault text color (iOS only)
accentColorAccent color
backgroundColorBackground color
highlightColorSelection color
titleColorMessage title color
readTitleColorTitle color for read messages (Android only)
descriptionColorMessage description color
readDescriptionColorDescription color for read messages (Android only)
dateColorMessage date color
readDateColorDate color for read messages (Android only)
dividerColorSeparator color
barBackgroundColorThe title bar’s background color
barAccentColorThe title bar’s back-button color
barTextColorThe title bar’s text color
imageTypeColorThe unread action icon color, e.g. deep link or URL (Android only)
readImageTypeColorThe read action icon color (Android only)
PWInboxStyle style = PWInboxStyle();
style.barTitle = "Messages";
style.barBackgroundColor = "#3AD29F";
style.accentColor = "#6750A4";
style.listEmptyMessage = "No messages yet";
style.defaultImage = "assets/images/logo.png";
PushwooshInbox.presentInboxUI(style: style);

Manage messages programmatically

Anchor link to

Load the message list, read counts, and act on individual messages without opening the built-in screen. This is useful for a custom inbox UI or an unread badge:

try {
List<InboxMessage> messages = await PushwooshInbox.loadMessages();
for (final message in messages) {
print("${message.title}: ${message.message}");
}
int? unread = await PushwooshInbox.unreadMessagesCount();
int? total = await PushwooshInbox.messagesCount();
int? notActedOn = await PushwooshInbox.messagesWithNoActionPerformedCount();
} catch (error) {
print("Failed to load inbox data: $error");
}
PushwooshInbox.readMessage(messageCode);
PushwooshInbox.deleteMessage(messageCode);
PushwooshInbox.performAction(messageCode); // runs the message's default action, e.g. opening a URL

loadCachedMessages() returns the last locally cached list without a network call on Android. On iOS it currently behaves the same as loadMessages() and still calls the network.