首页 > 解决方案 > ExpansionTile or ExpansionPanel with horizontal scrolling using flutter

问题描述

I'm trying to implement expansionTile with horizontal scrolling Listview not vertical . So in this below image I want make this enter image description here.

标签: flutter

解决方案


Answer is to use scrollDirection: Axis.horizontal, in your ListView

UPDATE

Column(
  children: <Widget>[
    Flexible(
      child: ListView(
        children: [
          Container(
            width: 100,
            child: ListTile(
              title: Text('No1'),
              onTap: () {
                setState(() {
                  selected = 0;
                });
              },
            ),
          ),
          Container(
            width: 100,
            child: ListTile(
              title: Text('No2'),
              onTap: () {
                setState(() {
                  selected = 1;
                });
              },
            ),
          )
        ],
        scrollDirection: Axis.horizontal,
      ),
    ),
    Container(
      height: 150,
      color: selected == 0 ? Colors.red : Colors.green,
    )
  ],
);

推荐阅读