Better methods to organize the vertical position of layers #1553
Replies: 2 comments 1 reply
-
One thing worth bearing in mind, and I'm unsure of this, there could be a performance penalty with having multiple children each with their own rotation, vs one rotation with several children. It's worth trying to test that with any possible solutions (or at least have it somehow as an option still to group some together). |
Beta Was this translation helpful? Give feedback.
1 reply
-
Converted to #1564 to allow tracking in v6 Release Planning. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Converted to #1564 to allow tracking in v6 Release Planning.
In flutter_map, all
nonRotatedChildren
always appear on top of allchildren
. This can cause issues for some users, who need to be able to control exactly where each layer is positioned within the layer stack, and also need to control whether the layer rotates.As such, it may be desirable in the long term to find a solution to this issue. Three proposals discussed somewhat in #1551 (#1551 (comment), #1551 (comment), #1551 (comment), #1551 (comment)) are listed below, but all FM users are welcome to add their ideas or opinions!
The
builder
proposalAn initial suggestion by @rorystephenson, started in #1551, was to introduce (or potentially replace the current
children
/nonRotatedChildren
arguments with) abuilder
method. The user would create aStack
widget themselves, using a new widgetFlutterMapTransform.rotate
to enable rotation on specific layers.I (@JaffaKetchup) think that having the user handle the stack and opt-in to rotation on layers:
Stack
is required, or anotherFlutterMapTransform
wrapper is requiredFlutterMap
or a related widgetrequires migration across all users(a later proposal made the builder optional via an alternative constructor)The wrapper widget and mixin proposal
I (@JaffaKetchup) proposed an alternative that aimed to solve most of these. Create a widget
NonRotatedLayer
that did nothing more than direct it's builder to build thechild
argument, meaning it essentially acts like a tag.nonRotatedChildren
still appear above all otherchildren
, and don't require an explicitNonRotatedLayer
, howeverchildren
can use aNonRotatedLayer
just to force non-rotation to its direct descendant, as FM internals would recognise the tag.To avoid redundant wrapping, this could (also) be implemented via a mixin (as proposed by @rorystephenson), and be allowed to be applied to all widgets. This would allow maximum flexibility.
However, as pointed out by @rorystephenson, this will not work if the layer is not directly below the
children
. If it is a descendant of, lets say aFutureBuilder
, the effect will not apply.I'm (@JaffaKetchup) not sure this is an issue, as either method does not restrict it's
child
type, so the order of theFutureBuilder
and mixin/NonRotatedLayer
could be swapped to restore functionality.Beta Was this translation helpful? Give feedback.
All reactions