列表视图构建器未在列中显示

时间:2019-08-30 18:30:04

标签: flutter dart

我有这个身体:

 body: Directionality(
            textDirection: direction,
            child: Container(
              child: SingleChildScrollView(
                child: Column(
                  children: <Widget>[
                    ....

                SingleChildScrollView(
                                    child: Column(
                                    children: <Widget>[
                                      NotificationListener(
                                        onNotification: (ScrollNotification
                                            scrollInfo) {
                                          if (scrollInfo
                                              is ScrollEndNotification) {
                                            setState(() {
                                              pageEventData(context);
                                            });
                                          }
                                        },
                                        child: SizedBox(
                                          height: MediaQuery.of(context)
                                                  .size
                                                  .height -
                                              300, // fixed height
                                          child: ListView.builder(
                                            controller: scrollController,
                                            shrinkWrap: true,
                                            padding: EdgeInsets.all(0.0),
                                            itemCount: searchEvents.length,
                                            itemBuilder:
                                                (BuildContext context,
                                                    int index) {
                                              return getEventCell(
                                                  searchEvents[index]);
                                            },
                                          ),
                                        ),
                                      ),
                                      .....
                  ],
                ),
              ),
            ))));

如图所示,我有一列包含一个listview构建器,运行此列不会出现任何错误,但也不会出现任何错误!我尝试了Expanded,SizedBox和rinkletowarp,但这些方法都无效!

您能告诉我如何解决此问题吗?

1 个答案:

答案 0 :(得分:0)

为什么要使用嵌套的SingleChildScrollView? 尝试用Expanded和ListView包装第二个。