Hi i am trying to make filter for my search with ExpansionTile in the end of ListView to show more suggestions but i am getting error
'package:flutter/src/rendering/sliver_multi_box_adaptor.dart': Failed assertion: line 259 pos 16: 'child == null || indexOf(child) > index': is not true.
The relevant error-causing widget was
ListView
A RenderSliverPadding expected a child of type RenderSliver but received a child of type RenderErrorBox.
The relevant error-causing widget was
ListView
here is my code:
Widget buildListView(){
Map<String, dynamic> searchFilter = {
"opened": false
}
ExpansionTileController moreSuggestionController = ExpansionTileController();
return ListView(
children: [
IconButton(onPressed: (){
setState((){
searchFilter["opened"] = !searchFilter["opened"];
});
},
icon: Icon(searchFilter["opened"]? Icons.filter_alt: Icons.filter_alt_outlined)
),
if(searchFilter["opened"])
Container(
width: 20,
height: 20,
color: Colors.green,
),
ExpansionTile(
controller: moreSuggestionController,
title: Text("More"),
children: [
Container(
width: 20,
height: 20,
color: Colors.red,
),
Container(
width: 20,
height: 20,
color: Colors.blue,
)
],
),
]
)
}
When i want to open expansion tile everythink works fine, but when i click on IconButton, an error pops...