簡體   English   中英

面對 sliver appbar 的 RenderFlex 溢出問題

[英]Facing RenderFlex overflowed issue with sliver appbar

我在 sliver appbar 中面臨 RenderFlex 溢出問題,我嘗試了Expanded widget ,但到目前為止效果不佳。 當向上滾動時會發生這種情況。 我應該如何解決?

錯誤

一個 RenderFlex 在底部溢出了 62 個像素。

代碼

         SliverAppBar(

        expandedHeight: 120.0,
        floating: true,
        pinned: false,
        snap: true,
        elevation: 40,
        backgroundColor: Colors.orange,
        flexibleSpace: FlexibleSpaceBar(
            centerTitle: true,
            title: Padding(
              padding: const EdgeInsets.only(top: 25),
              child: Column( // error is pointed to this in logs
                  children: <Widget>[
                  SizedBox(height: 15,),
                    Column(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: <Widget>[

                      Text('DETAILS OF THE TEXT',
                          
                      ),
                      Text(widget.detail1,
                          ),
                    ],),


                  SizedBox(height: 5,),

                 Row(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: <Widget>[


                           Column(children: <Widget>[

                            Text('detail2',
                                ),
                            SizedBox(width: 5,),
                            Text(widget.detailing),
                          ],),

                        SizedBox(width: 20,),
                           Column(children: <Widget>[
                            Text('detail3',
                                ),
                            SizedBox(width: 10,),
                            Text(widget.detailing4, ),
                          ],), ],),],    )

        ),
      ),

您可以使用SingleChildScrollView

            SliverAppBar(
          expandedHeight: 120.0,
          floating: true,
          pinned: false,
          snap: true,
          elevation: 40,
          backgroundColor: Colors.orange,

          flexibleSpace: FlexibleSpaceBar(
            centerTitle: true,
            title: SizedBox(
              height: 120,
              child: SingleChildScrollView(
                    child: Padding(
                    padding: const EdgeInsets.only(top: 25),
                    child: Column(
                      children: <Widget>[
                        SizedBox(
                          height: 15,
                        ),
                        Column(
                          crossAxisAlignment: CrossAxisAlignment.center,
                          children: <Widget>[
                            Text(
                              'DETAILS OF THE TEXT',
                            ),
                            Text(
                              "widget.detail1",
                            ),
                          ],
                        ),
                        SizedBox(
                          height: 5,
                        ),
                        SingleChildScrollView(
                          scrollDirection: Axis.horizontal,
                                                      child: Row(
                            mainAxisAlignment: MainAxisAlignment.center,
                            children: <Widget>[
                              Column(
                                children: <Widget>[
                                  Text(
                                    'detail2',
                                  ),
                                  SizedBox(
                                    width: 5,
                                  ),
                                  Text("widget.detailing"),
                                ],
                              ),
                              SizedBox(
                                width: 20,
                              ),
                              Column(
                                children: <Widget>[
                                  Text(
                                    'detail3',
                                  ),
                                  SizedBox(
                                    width: 10,
                                  ),
                                  Text(
                                    "widget.detailing4",
                                  ),
                                ],
                              ),
                            ],
                          ),
                        ),
                      ],
                    )),
              ),
            ),
          ),
        )

暫無
暫無

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

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