簡體   English   中英

Flutter - 發布版本中的屏幕是灰色的,但從 Android Studio 運行時可以正常工作

[英]Flutter - A screen is grey in release build, but works fine when run from Android Studio

這是飛鏢文件的鏈接

每當我從 android studio 運行此應用程序時,該應用程序都可以正常工作,但是當我構建 apk 並從那里運行時,它會顯示空白屏幕。

它應該看起來如何

看起來如何

發生這種情況是因為某些小部件未正確呈現。

在 android studio 中檢查應用程序日志以及相關的錯誤。

我遇到了同樣的問題。 該應用程序在調試模式下運行良好,但某些小部件存在一些問題並以灰色顯示。

解決方案是刪除包裹在 Column 上的 Expanded 小部件

                      Expanded(
                        flex: 5,
                        child: Column(
                          children: [
                            Padding(
                              padding: const EdgeInsets.only(top: 30),
                              child: Container(
                                child: Align(
                                  alignment: Alignment.centerLeft,
                                  child: Column(
                                    children: [
                                      Text(
                                        "Peramangalam House",
                                        style: TextStyle(
                                            fontSize: 24,
                                            fontWeight: FontWeight.bold,
                                            color: kTextColor),
                                      ),
                                      Text(
                                        "Methottuthazham, Kozhikode",
                                        style: TextStyle(
                                            fontSize: 18,
                                            fontWeight: FontWeight.bold,
                                            color: kTextLightColor),
                                      ),
                                    ],
                                  ),
                                ),
                              ),
                            ),
                          ],
                        ),
                      ),

只是——

                         Column(
                          children: [
                            Padding(
                              padding: const EdgeInsets.only(top: 30),
                              child: Container(
                                child: Align(
                                  alignment: Alignment.centerLeft,
                                  child: Column(
                                    children: [
                                      Text(
                                        "Peramangalam House",
                                        style: TextStyle(
                                            fontSize: 24,
                                            fontWeight: FontWeight.bold,
                                            color: kTextColor),
                                      ),
                                      Text(
                                        "Methottuthazham, Kozhikode",
                                        style: TextStyle(
                                            fontSize: 18,
                                            fontWeight: FontWeight.bold,
                                            color: kTextLightColor),
                                      ),
                                    ],
                                  ),
                                ),
                              ),
                            ),
                          ],
                        ),```

暫無
暫無

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

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