1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| _buildExpansionPanelList() { return ExpansionPanelList( dividerColor: Colors.red, animationDuration: Duration(seconds: 2), expansionCallback: (index, isExpanded) { setState(() { dataList[index] = !isExpanded; }); }, children: dataList.asMap().entries.map((value) { return ExpansionPanel( canTapOnHeader: true, //backgroundColor: Colors.grey, isExpanded: value.value, headerBuilder: (context, isExpanded) { return ListTile( title: Text("扩展列表${value.key}"), ); }, body: Container( height: 100, color: Colors.primaries[value.key % 18], )); }).toList()); }
|