I am using the Chat Bubble flutter package to build a message App. I am finding it difficult to retrieve the user input of the message sent. In a Textfield widget, we use the Controller to retrieve the inputs made by a user. How do I get the input made on a Bubble MessageBar. Here is my code:
MessageBar(
onSend: (_) => print('Message sent'),
actions: [
InkWell(
child: Icon(
Icons.add,
color: Colors.black,
size: 24,
),
onTap: () {},
),
Padding(
padding: EdgeInsets.only(left: 8, right: 8),
child: InkWell(
child: Icon(
Icons.camera_alt,
color: Colors.green,
size: 24,
),
onTap: () {},
),
),
],
),
>Solution :
As @psking has pointed out in the comment section, you can specify a name for your parameter and then refer to it by name, like
MessageBar(
onSend: (msg) => print('Message sent: $msg'),
actions: [
InkWell(
child: Icon(
Icons.add,
color: Colors.black,
size: 24,
),
onTap: () {},
),
Padding(
padding: EdgeInsets.only(left: 8, right: 8),
child: InkWell(
child: Icon(
Icons.camera_alt,
color: Colors.green,
size: 24,
),
onTap: () {},
),
),
],
),