Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I Do I Retrieve The Value Of A Chatbubble MessageBar Widget

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 :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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: () {},
      ),
    ),
  ],
),

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading