Adnan abid
Adnan abid

Reputation: 21

How to create a drop down tab in flutter

Hi I am new to flutter I want to know is there any way to create a drop down menu as shown in image above. It should be clickable with a text in it and when user clicks on it will show more text about heading. The closest thing to I can get is inkwell but I don't know how to add dropdown effect on it. I would be very thankful if you could help me with it enter image description here

Upvotes: 0

Views: 544

Answers (1)

Marco Domingos
Marco Domingos

Reputation: 715

If you are looking for something similar to the image, then the ExpansionTile is the right widget, you just need to put the Text as a children inside the ExpansionTile, this way it will be hidden unless the user clicks it, like this:

Card(
      child: ExpansionTile(
        title: Text('Click on me',
          style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.w500),
        ),
        children: <Widget>[
          Text('Your text here',
              style: TextStyle(fontWeight: FontWeight.w700),
            )
        ],
      ),
    );

Upvotes: 1

Related Questions