簡體   English   中英

Flutter:嵌套列表視圖溢出警告

[英]Flutter: Nested ListView Overflow warning

我有一個這樣的嵌套 ListView。

  AnimatedContainer(
            width: MediaQuery.of(context).size.width * 0.90,
            height:  MediaQuery.of(context).size.height * 0.45,
            child: Stack(
              children: [
                Positioned(
                  child: Column(
                    children: [
                      Container(
                        height: MediaQuery.of(context).size.height * 0.30,
                        width: MediaQuery.of(context).size.width * 0.90,
                        child: Column(
                          children: [
                            Container(
                          width: 300,
                              height: MediaQuery.of(context).size.height * 0.20,
                              child: Row(
                               crossAxisAlignment: CrossAxisAlignment.stretch,
                               children: [
                                Text('hmm'),
                                Row(
                                  ListView(     
                                  shrinkWrap: true,
                                  scrollDirection: Axis.horizontal,
                                   children: [
                                        Container(
                                      height: 40,
                                      width: 200,
                                      color: Colors.white,
                                       ),
                                       Container(
                                       height: 40,
                                       width: 200,
                                       color: Colors.white,
                                         ),
                                        Container(
                                         height: 40,
                                          width: 200,
                                        color: Colors.white,
                                         ),
                                            ]
       

我試圖在容器內產生滾動效果。 但是,我得到The overflowing RenderFlex has an orientation of Axis.horizontal.

首先,我認為這是因為Container小部件沒有高度和寬度。 但看起來這不是問題,因為我仍然有錯誤。 我嘗試添加Expanded小部件或另一個Container小部件來設置高度和寬度。 他們都沒有修復Overflow警告。

為了使ListViewAnimatedContainer內可以垂直滾動,我應該調整什么?

也許您可以嘗試將包裝 ListView 的 Row 替換為水平方向、Container 或具有固定高度的東西。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM