Reputation: 31
I mean, I want to go to another view when the title is tapped and expand/collapse when the icon in ExpansionTile is tapped.
here's my code:
ExpansionTile(
title: categories.isEmpty
? Text('no items')
: Text(categories[i].name),
children: getSubCategories(i),
);
Upvotes: 0
Views: 2337
Reputation: 46596
ExpansionTile
expands by design, if you want the children to be tappable either choose a widget that has onTap or wrap it with GestureDetector
.
ExpansionTile(title: Text('Expansion tile'), children: [
ListTile(
leading: const Text('List tile'),
onTap: () => Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
return Container();
},
),
),
),
GestureDetector(
child: const Text('Wrapped'),
onTap: () => Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
return Container();
},
),
),
)
])
Upvotes: 1