How to turn off warning/error bars on APK build
Solution 1
During the transition, the text receives a thick yellow underline.
That is because Hero
transition is done trough Overlay
, which is rendered outside of Scaffold
or other Material
widgets.
The problem ? It means during transition, there's no widget that introduce a valid Theme
(Scaffold
, Dialog
, Material
do for example).
So it fallback to a default Theme
. And that Theme
has yellow underline with a big font.
The solution : Wrap your Hero
child into a widget introducing Theme
or in Theme
itself.
Solution 2
These bars are only shown in debug build.
For release builds use
flutter build apk --release
haz
Updated on December 04, 2022Comments
-
haz over 1 year
I am using a
Hero
animation in my App. During the transition, the text receives a thick yellow underline. I'm pretty sure this is a overflow warning (or something similar), but it persists even when I runflutter build apk
andflutter install
, i.e. it exists in production builds.My app functions fine, so I'd like to hide these. How do I do so?
-
Rémi Rousselet about 6 yearsThat's not the problem actually
-
Günter Zöchbauer about 6 yearsI'm aware that the overflow should be fixed but he explicitely asked how to just get rid of the yellow bar :D As far as I know they are not shown in release builds.
-
Rémi Rousselet about 6 yearsYeah but it's not overflow he's talking about. It's about text having a yellow underline during hero transition.
-
Günter Zöchbauer about 6 yearsI think I see now what you mean
-
haz about 6 yearsPerfect! For future readers, I had to add
decoration: TextDecoration.none
to all myText
widgets, to revert the theme the hero transition widget recieved. -
haz about 6 yearsAs @RémiRousselet stated, I confused the overflow warnings with the default Hero transition behavior. However, flutter gives faux-warnings (i.e. it thinks there are sub-pixel overflows due to rounding errors), and this helped quell them. Cheers!