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

问题描述

嗨,我在使用pull_to_refresh包时遇到问题,初始加载的内容位于两个顶部固定容器的后面,我不了解此行为。当我使用普通的Refreshindicator时,一切都按预期进行。我尝试设置容器的固定高度,将两个容器都放入Column中,在ListView上将Shrinkwrap设置为false,但这些都不起作用

enter image description here

下面的代码

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'],style: TextStyle(
                      fontStyle: FontStyle.italic,fontSize: 28.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(

physics:AlwaysScrollableScrollPhysics(),

shrinkWrap:是,

主要:否,

itemCount:按时间顺序排列的allRecords?.length? 0,

说明,为什么主要:错误? -其在列内的ListView.Builder,列为 作为主滚动,Listview在列之内,但必须与列分离(无法从实际列的开始处开始,因为它在上方有两个容器),并且由于容器固定在顶部,因此它必须可从父窗口小部件滚动(展开)