RefreshIndicator 不显示

来源:12-16 加载进度条与下拉刷新的实现【实战应用】

慕神8170126

2023-08-16

  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Color(0xf2f2f2),
      body: LoadingContainer(isLoading: _loading,
        child: Stack(children: [
        MediaQuery.removePadding(
          removeTop: true,
          context: context,
          child: RefreshIndicator(
            onRefresh: _handleRefresh,
            child: NotificationListener(
            onNotification: (scrollNotification) {
              if (scrollNotification is ScrollUpdateNotification && scrollNotification.depth == 0) {
                _onScroll(scrollNotification.metrics.pixels);
              }
              return true;
            },
            child: ListView(
              children: [
                Container(
                  height: 160,
                  child: Swiper(
                      itemCount: _imageUrls.length,
                      autoplay: true,
                      itemBuilder: (BuildContext context, int index) {
                        return Image.network(_imageUrls[index], fit: BoxFit.fill,);
                      },
                      pagination: SwiperPagination()
                  ),
                ),
                Padding(
                    padding: EdgeInsets.fromLTRB(7, 4, 7, 4),
                    child: LocalNav(localNavList: localNavList)
                ),
                if (gridNavModel != null)
                  Padding(
                    padding: EdgeInsets.fromLTRB(7, 0, 7, 4),
                    child: GridNav(gridNavModel: gridNavModel!),
                  ),
                Padding(
                    padding: EdgeInsets.fromLTRB(7, 0, 7, 4),
                    child: SubNav(subNavList: subNavList)
                ),
                if (salesBox != null)
                  Padding(
                    padding: EdgeInsets.fromLTRB(7, 0, 7, 4),
                    child: SalesBox(salesBox: salesBox!),
                  ),
              ],
            ),
          ),),
        ),
        Opacity(
          opacity: appBarAlpha,
          child: Container(
            height: 80,
            decoration: BoxDecoration(color: Colors.white),
            child: Center(
              child: Padding(
                padding: EdgeInsets.only(top: 20),
                child: Text('首页'),
              ),
            ),
          ),
        )
      ],),),
    );
  }
写回答

1回答

CrazyCodeBoy

2023-08-16

安卓还是iOS是下拉不显示吗?
0
2
CrazyCodeBoy
回复
慕神8170126
对照下这块课程源码检查下你的代码实现看是否有出入的地方呢
2023-08-18
共2条回复

Flutter从入门到进阶 实战携程网App 一网打尽核心技术

解锁Flutter开发新姿势,,系统掌握Flutter开发核心技术。

4788 学习 · 3270 问题

查看课程