rickypid / flutter_expandable_table

A Flutter widget for create an expandable table with header and first column fixed.
https://pub.dev/packages/flutter_expandable_table
BSD 3-Clause "New" or "Revised" License
38 stars 28 forks source link

Opening all children at 2nd level in a row. #1

Closed hs-dev1 closed 2 years ago

hs-dev1 commented 2 years ago

I had implemented it in a 3-level expansion, opening all children at the 2nd level in a row. i can't find a way to expand a specific row. Could anyone look for it?

rickypid commented 2 years ago

Hi @mhussnainshabbir,

Were you able to expand all the children at the same time? Each row has an "isExpanded" variable that indicates whether the row is expanded or not. This variable should be managed with the implementation of a method to force its expansion or not (I really like it as an idea, maybe I'll try to implement it in the next few weeks). If you just want to expand the row while building the table, setting "isExpanded" to true should suffice.

https://github.com/rickypid/flutter_expandable_table/blob/fc3bc2743175311ff5fc1a6dfd1511d7ce2d0fcd/lib/src/row.dart#L8

hs-dev1 commented 2 years ago

Thanks; After searching I got it solved:

before i was passing rows and subrows like that:

return ExpandableTable( headerHeight: 50, rows: rows, // here is row and subrows returning list header: header, scrollShadowColor: accentColor, );

return ExpandableTable(
  headerHeight: 50,

// here we have adding directly rows: List.generate( 5, (rowIndex) => ExpandableTableRow( height: 50, firstCell: Container(), legend: Container(), children: List.generate( 2, (rowIndex) => ExpandableTableRow( height: 60, firstCell: Container(), legend: Container(), children: subRows1, )), )), header: header, scrollShadowColor: accentColor, );