how to animate collapse elements in flutter

前端 未结 4 1865
轻奢々
轻奢々 2020-12-07 17:06

How can i expand and collapse widget when user taps on different widget ( sibling or parent ) with animation ?

new Column(
    children: [
            


        
4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-07 18:06

    I think you are looking for ExpansionTile widget. This takes a title property which is equivalent to header and children property to which you can pass widgets to be shown or hidden on toggle. You can find an example of how to use it here.

    Simple Example Usage:

    new ExpansionTile(title: new Text("Numbers"),
          children: [
            new Text("Number: 1"),
            new Text("Number: 2"),
            new Text("Number: 3"),
            new Text("Number: 4"),
            new Text("Number: 5")
          ],
    ),
    

    Hope that helps!

提交回复
热议问题