Flutter dart - 固定顶部容器后面的 ListView

Flutter dart - ListView behind fixed top containers

您好,我在使用 pull_to_refresh 包时遇到问题,初始加载的内容位于两个顶部固定容器的后面,我不明白这个行为。当我使用普通的 RefreshIndicator 时,一切都按预期进行。我尝试设置容器的固定高度,将两个容器都放在 Column 中,在 ListView 上设置 Shrinkwrap false 但是 none 这些帮助

下面的代码

Column(
        crossAxisAlignment: CrossAxisAlignment.stretch,
        mainAxisSize: MainAxisSize.min,
        children: <Widget>[
          Container(
            width: 50,
            child: Column(children: [
              Container(
                child: Container(
                  margin: const EdgeInsets.only(top: 10.0),
                  child: Text(
                    AppLocalizations.of(context).translate(recordType + 'Records'),
                    textAlign: TextAlign.center,
                    style: TextStyle(
                      fontStyle: FontStyle.normal,
                      color: Colors.white,
                      fontSize: 30.0,
                      shadows: [
                        Shadow(
                          blurRadius: 10.0,
                          color: Colors.black,
                          offset: Offset(3.0, 3.0),
                        ),
                      ],
                    ),
                  ),
                ),
              ),
              Container(
                child: Container(
                  margin: const EdgeInsets.only(top: 5.0),
                  child: Text(
                    args['horseName'],
                    textAlign: TextAlign.center,
                    style: TextStyle(
                      fontStyle: FontStyle.italic,
                      color: Colors.white,
                      fontSize: 28.0,
                      shadows: [
                        Shadow(
                          blurRadius: 10.0,
                          color: Colors.black,
                          offset: Offset(3.0, 3.0),
                        ),
                      ],
                    ),
                  ),
                ),
              ),
            ]),
          ),
          Expanded(
              child: SmartRefresher(
            enablePullDown: true,
            enablePullUp: true,
            header: WaterDropHeader(
                complete: Text(AppLocalizations.of(context).translate('refreshDone'),
                    style: TextStyle(color: Colors.white))),
            footer: CustomFooter(
              builder: (BuildContext context, LoadStatus mode) {
                Widget body;
                if (noMoreData) {
                  mode = LoadStatus.noMore;
                }
                if (mode == LoadStatus.idle) {
                  body = Text(AppLocalizations.of(context).translate('pullToLoadMore'),
                      style: TextStyle(color: Colors.white));
                } else if (mode == LoadStatus.loading) {
                  body = RefreshProgressIndicator();
                } else if (mode == LoadStatus.failed) {
                  body = Text(AppLocalizations.of(context).translate('loadFailedTryAgain'),
                      style: TextStyle(color: Colors.white));
                } else {
                  body = Text(AppLocalizations.of(context).translate('noMoreData'),
                      style: TextStyle(color: Colors.white));
                }
                return Container(
                  height: 55.0,
                  child: Center(child: body),
                );
              },
            ),
            controller: _refreshController,
            onRefresh: refreshRecords,
            onLoading: fetchRecordByDateDesc,
            child: ListView.builder(
                      return Column(children: <Widget>[
                        Card(
                          child: ListTile(

解决了属性:

ListView.builder(

物理:AlwaysScrollableScrollPhysics(),

shrinkWrap: true,

主要:错误,

itemCount: allRecordsChronologically?.length ?? 0,

解释,为什么 primary: false ? - 它是列中的 ListView.Builder,列是 一个主滚动,Listview 在列内但必须与列分离(不能从实际列开始的地方开始,因为它上面有两个容器),并且因为容器固定在顶部,所以它必须可以从父窗口小部件滚动 - 这是 Expanded