NotificationActionInput
Input collected when a notification action is selected.
Used by NotificationAction.input.
- Android supports reply choices, free-form text, and MIME-type hints. iOS/macOS use a text-input action; Windows uses a separate text box associated with the action ID. Linux and Web show the action as a regular button without an input.
On Android, a notification the user replied to that isn't dismissed shows a progress spinner until the app updates it. With
NotificationAction.cancel_notificationset toTrue, Android 15 and earlier dismiss it after the reply, so updating it posts a new notification that alerts again, while Android 16 and later keep it, spinning. To get the same result on every version, setcancel_notificationtoFalse, so no version dismisses it, and update the notification fromNotifications.on_action:import flet as ftimport flet_notifications as ftnreply = ftn.NotificationAction(id="reply",title="Reply",input=ftn.NotificationActionInput(label="Message"),cancel_notification=False,)async def handle_action(e: ftn.NotificationActionEvent):if (e.page.platform == ft.PagePlatform.ANDROIDand e.action_id == "reply"and e.id is not None):await notifications.show(id=e.id,title="Ada",body=f"You: {e.input}",payload=e.payload,options=ftn.NotificationOptions(android=ftn.AndroidOptions(# Doesn't alert again for the update.only_alert_once=True,# Removes it after a second; leave out to keep it.# Cancelling right after the update can be refused.timeout_after=ft.Duration(seconds=1),)),)
Properties
allow_free_form- Whether to allow the user to type an arbitrary reply.allowed_mime_types- Accepted reply MIME types, such as"image/png".choices- Suggested reply strings.label- User-visible label describing the input.
Properties
allow_free_formclass-attributeinstance-attribute
allow_free_form: bool = TrueWhether to allow the user to type an arbitrary reply.
Set to False with choices to restrict replies to suggestions.
Supported only on Android. Reply inputs on iOS, macOS, and Windows allow free-form text.
allowed_mime_typesclass-attributeinstance-attribute
allowed_mime_types: list[str] = field(default_factory=list)Accepted reply MIME types, such as "image/png".
An empty list requests no MIME-type-specific input.
The event model exposes text responses, not a dedicated attachment-result field. MIME-type filtering is supported only on Android.
choicesclass-attributeinstance-attribute
choices: list[str] = field(default_factory=list)Suggested reply strings.
An empty list provides no predefined choices.
Supported only on Android.
labelclass-attributeinstance-attribute
label: str | None = NoneUser-visible label describing the input.
On Android, labels the reply input. On iOS/macOS, supplies the text-input button
title and placeholder; None uses the action title for the button. On
Windows, supplies the text box title and placeholder.