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

Viewed 532
2 Answers

This happens because some widget is not rendering correctly.

Check the application log while in android studio and what error is being related.

I have faced the same issue. The app worked perfectly fine in debug mode but some widgets were having some issues and were showing in grey color in the release build.

The solution is that you remove Expanded widgets which are wrapped on Column:

                      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),
                                      ),
                                    ],
                                  ),
                                ),
                              ),
                            ),
                          ],
                        ),
                      ),

To just:

                         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),
                                      ),
                                    ],
                                  ),
                                ),
                              ),
                            ),
                          ],
                        ),```
Related