railson-ferreira / scrollable_list_tab_scroller

Customizable Flutter widget that synchronizes a scrollable list of grouped items with tabs
https://pub.dev/packages/scrollable_list_tab_scroller
MIT License
19 stars 13 forks source link

Cannot get size from a render object that has not been through layout. #12

Closed fuadmostafij6 closed 7 months ago

fuadmostafij6 commented 7 months ago
     Column(
        children: [
          ScrollableListTabScroller(
            itemCount: tabData.length,
            // headerContainerBuilder: (context, widget)=>Text("Header"),
            tabBuilder: (BuildContext context, int index, bool active) => Padding(
              padding: EdgeInsets.symmetric(horizontal: 10),
              child: Text(
                tabData.keys.elementAt(index),
                style: !active
                    ? null
                    : TextStyle(fontWeight: FontWeight.bold, color: Colors.green),
              ),
            ),
            itemBuilder: (BuildContext context, int index) => Column(
              children: [
                Text(
                  tabData.keys.elementAt(index),
                  style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
                ),
                ...tabData.values
                    .elementAt(index)
                    .asMap()
                    .map(
                      (index, value) => MapEntry(
                    index,
                    value
                  ),
                )
                    .values
              ],
            ),
          ),
        ],
      );

when I wrap ScrollableListTabScroller with a Column, its show error

railson-ferreira commented 7 months ago

It is not a problem with this library. In order to use lists inside Column you may use Expanded, although there are other approaches you could try.

E.g.

Column(
  children: [
    Expanded(
      child: ScrollableListTabScroller