Reputation: 1523
i was searching how we can put collapse option on List, everything in search result was about listview
, i want to set collapse option on my ListTile
list, when user will tap on title
then subtitle
will be visible under title.
there was option of using ExpansionTile()
, but flutter documentations says it's not valid now.
child: ListTile(
title: Text(
"i am visible title",
),
subtitle: Text("i am hidden data, when you will tap on title i will be visible"),
);
Upvotes: 0
Views: 180
Reputation: 11669
Assuming you are using statefulwidget
, you can hide and display the subtitle
in setState()
using bool
datatype on onTap
method call.
If you are not using statefulwidget
, then you need to update your class first to be statefulwidget
.
check this SO answer for more details.
Upvotes: 1