Repository navigation
Widgets inserted to an Overlay have different ancestral InheritedWidget(s) than commonly expected #36220
Description
Activity
- addedframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.
on Jul 15, 2019 I've implemented the workaround, but am still getting a line-wrap during transition, that causes my text to flicker:
http://treefortress.com/shared/2019-10-20_09-49-24.mp4Tried wrapping the content in Material, and DefaultTextStyle, both still result in this flicker.
I can manually size the container to get rid of it, but these containers are variable width, depending on the size of their text, so that's not ideal.
LongCatIsLooong commented
on Oct 20, 2019 ContributorAuthorMore actions- added a commit that references this issue
on Dec 6, 2019 We'd like to wrap a
BottomAppBarin aHero, but sinceBottomAppBardepends on having aScaffoldavailable via the context, it throws an exception on every transition, and I suspect that is due to this issue. I cannot see a viable workaround.Reacted by Sh1d0wReacted by Md Ismail Alam KhanWas still having trouble with the fix for a Text Hero using the suggested flightShuttleBuilder because it wasn't taking my from/to style font with the DefaultTextStyle, so I had to tweak it a bit and got it working for my needs. I made it as an extension on Text just because it's prettier to use. Here's my code:
extension HeroText on Text { Widget hero(Object tag) { return Hero( flightShuttleBuilder: (_, Animation<double> animation, HeroFlightDirection flightDirection, BuildContext fromHeroContext, BuildContext toHeroContext) { return AnimatedBuilder( animation: animation, child: this, builder: (_, _child) { return DefaultTextStyle.merge( child: _child, style: TextStyle.lerp(((fromHeroContext.widget as Hero).child as Text).style, ((toHeroContext.widget as Hero).child as Text).style, flightDirection == HeroFlightDirection.pop ? 1 - animation.value : animation.value), ); }, ); }, tag: tag, transitionOnUserGestures: true, child: this, ); } }So on the from page, you have something like:
Text("Title as Hero", style: TextStyle(fontSize: 16.0, fontFamily: "Fira", color: Colors.blue.shade800)).hero("title"),
and the same on the to page
Text("Title as Hero", style: TextStyle(fontSize: 22.0, fontFamily: "Fira", color: Colors.blue.shade500)).hero("title"),
Now lerps the TextStyle nicely enough, but still should be fixed on the Flutter side so we don't have to hack it..Reacted by Rebar AhmadHappens with
package:animationtoo rrousselGit/riverpod#10 (comment)- addedcustomer: crowdAffects or could affect many people, though not necessarily a specific customer.Affects or could affect many people, though not necessarily a specific customer.f: routesNavigator, Router, and related APIs.Navigator, Router, and related APIs.
on Aug 6, 2020 diego-lipinski-de-castro commented
on Aug 30, 2020 More actionsTry a " hack " fix. Something to do with Flutter measuring it like 1px diffently while in motion, putting in padding spaces seemed to work for me like 6mths ago, ymmv
diego-lipinski-de-castro commented
on Aug 30, 2020 More actionsIt kinda works. But it flashes the text, like a blinking
10 remaining items
LongCatIsLooong commented
on May 26, 2022 ContributorAuthorMore actionsHi @rrousselGit @fzyzcjy I checked out the https://github.com/fzyzcjy/flutter_portal project and it looks like a really promising solution to this problem. Are you ok with integrating some of its APIs into
Overlay, as an addition to theOverlayEntryAPI? I'll be happy to create a pull request and attribute the idea to you/the flutter_portal package, and let you review it if you're ok with that.Reacted by Remi Rousselet and fzyzcjyThat'd be lovely! In fact, I proposed that a long time ago (#50961)
It'd be awesome to have that be an official solution.
Reacted by JohannesPertl and Sergio Molchanovsky@LongCatIsLooong Sure! It would be great to be in official package!
Reacted by JohannesPertlAfter trying to port
PortaltoOverlay, I wonder would thePortalTarget'sRenderObject(a_RenderPortalTargetTheater) re-layout when the incoming constraints on the portal (RenderPortalTheaterI assume) changes? For instance when you have a widget tree like this:Portal (RenderPortalTheater) | Center | SizedBox.square(dimension: 50) | PortalTarget (filled)It seems to me that
PortalTargetwon't resize ifPortalis resized from 150x150 to 100x100? With theSizedBoxthe incoming constraints on thePortalTargetwould still be 50x50, andPortalTargetis also not marked needs layout.I'm not sure if it does, but it should.
The Portal should have access to the list of associated entries, so it should be able to make them relayout right?
+1
When PortalTarget feels its environment changes, it will tell Portal about it.
- addedP1High-priority issues at the top of the work listHigh-priority issues at the top of the work list
on Jan 24, 2023 - addedteam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
on Jul 8, 2023 - removedtriaged-frameworkTriaged by Framework teamTriaged by Framework team
on Nov 25, 2023 This issue is marked P1 but has had no recent status updates.
The P1 label indicates high-priority issues that are at the top of the work list. This is the highest priority level a bug can have if it isn't affecting a top-tier customer or breaking the build. Bugs marked P1 are generally actively being worked on unless the assignee is dealing with a P0 bug (or another P1 bug). Issues at this level should be resolved in a matter of months and should have monthly updates on GitHub.
Please consider where this bug really falls in our current priorities, and label it or assign it accordingly. This allows people to have a clearer picture of what work is actually planned. Thanks!
Reacted by Diego Lipinski de CastroThis thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.- locked as resolved and limited conversation to collaborators
on Dec 10, 2023

This seems to be a very common source of bugs when using the Hero API:
and in the framework:
Workaround
As a temporary workaround, manually wrap whatever is missing inside the hero, or in its
shuttleBuilder.See: #30647 (comment)
additional context:
#6072 (comment)