onPressed property
A callback function that is called whenever the button is pressed. This
parameter is a function that receives a String
argument representing the
new message. It is Invoked when the button is pressed.
Defaults to null
,
Example:
@override
Widget build(BuildContext context) {
return SfChat(
actionButton: ChatActionButton(
onPressed: (String newMessage) {
setState(() {
_messages.add(
ChatMessage(
text: newMessage,
time: DateTime.now(),
author: const ChatAuthor(
id: '123-001',
name: 'Chat A',
),
),
);
});
},
),
);
}
Implementation
final ValueChanged<String>? onPressed;