Saturday, November 21, 2026
HomeiOS Developmentandroid - Flutter: The way to mix sliding_up_panel ListView.builder and pull_to_refresh

android – Flutter: The way to mix sliding_up_panel ListView.builder and pull_to_refresh

[ad_1]

I exploit sliding_up_panel library that mixes with ListView to point out some gadgets in a vertical record. To keep away from sudden scroll habits when sliding_up_panel opens and ListView scrolls up, I exploit scrollController sliding_up_panel and put that worth as scrollController worth for ListView.

I wish to add refresh_indicator for knowledge refreshing utilizing pull_to_refresh library. I set RefreshIndicator widget as a father or mother for my ListView, however as ListView has a scrollController it does not scroll up, does not present a refresh indicator and I am unable to refresh my record.

Please see code under:

class CustomSlidingPanel extends StatelessWidget {
  const CustomSlidingPanel({
    Key /*?*/ key,
    @required this.minHeight,
    @required this.maxHeight,
    this.panelBuilder,
  }) : tremendous(key: key);

  closing double minHeight;
  closing double maxHeight;
  closing Operate(ScrollController) panelBuilder;

  @override
  Widget construct(BuildContext context) {
    return SlidingUpPanel(
      minHeight: minHeight,
      maxHeight: maxHeight,
      panelBuilder: (sc) => Padding(
        padding: const EdgeInsets.solely(high: 20),
        little one RefreshIndicator(
            onRefresh: () {}
            little one: ListView.builder(
              padding: const EdgeInsets.solely(backside: 30),
              controller: sc,
              itemCount: 10,
              itemBuilder: (context, index) {
                return Textual content('1');
              },
            ),
         ),
      ),
    );
  }
}

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments