Conversation
|
cc @HansMuller, I mentioned this in a meeting today |
|
@andreidiaconu I've watched your talk at Flutter Vikings, which was very informative and well presented!, and tried out |
30c70f5 to
4acaa23
Compare
|
Gold has detected about 38 new digest(s) on patchset 15. |
4acaa23 to
b738bd3
Compare
|
@Piinks This is also ready for review now. Thank you |
|
@PieterAelse Thank you for having a look at this. I refactored most of what you saw last time as I was not happy with a number of things. Thank you |
Piinks
left a comment
There was a problem hiding this comment.
I am wondering if this may be better served as a package on pub.dev, WDYT @andreidiaconu?
| import 'framework.dart'; | ||
| import 'media_query.dart'; | ||
|
|
||
| /// A widget that positions two panes side by side on uninterrupted screens or |
There was a problem hiding this comment.
This does not appear true based on the mobile phone image in OP.
| /// * it obstructs the screen, meaning the area it occupies is not 0. Display | ||
| /// features of type [DisplayFeatureType.fold] can have height 0 or width 0 | ||
| /// and not be obstructing the screen. |
There was a problem hiding this comment.
Does this mean the TwoPane will not work with devices that fold without a hinge?
There was a problem hiding this comment.
It means it works, but the separation between the two panes does not need to coincide with the folding feature since the screen is continuous.
| /// On screens that have multiple separating [DisplayFeature]s, [textDirection] | ||
| /// and [verticalDirection] parameters are used to decide which one is first and | ||
| /// is used as a separator between the two panes. If both horizontal and | ||
| /// vertical [DisplayFeature]s exist, the [direction] parameter is used to | ||
| /// ignore the [DisplayFeature]s that would conflict with it. | ||
| /// | ||
| /// This widget is similar to [Flex] and also takes [textDirection] and | ||
| /// [verticalDirection] parameters, which are used for deciding in what order | ||
| /// the panes are laid out (e.g [TextDirection.ltr] would position [startPane] | ||
| /// on the left and [endPane] on the right). |
There was a problem hiding this comment.
These two paragraphs seem redundant
| /// If [panePriority] is [TwoPanePriority.start], this is the only pane | ||
| /// visible. |
There was a problem hiding this comment.
Why? What happens to the second pane then?
There was a problem hiding this comment.
If TwoPanePriority is start or end, then only one pane is part of the tree. In this case endPane is not part of the tree.
| /// If [panePriority] is [TwoPanePriority.end], this is the only pane | ||
| /// visible. |
There was a problem hiding this comment.
Same question, but reversed for pane. :)
| /// [DisplayFeature], in which case each pane takes over one sub-screen. | ||
| final double paneProportion; | ||
|
|
||
| /// Same as [Flex.textDirection]. |
There was a problem hiding this comment.
You could template some docs from Flex for these following parameters and use a macro. Just saying they are the same isn't super helpful if folks don't know what they are.
| /// measures the distance between TwoPane and the ambient MediaQuery. | ||
| /// | ||
| /// Defaults to [EdgeInsets.zero]. | ||
| final EdgeInsets inset; |
There was a problem hiding this comment.
This should probably be padding to remain consistent with the framework
There was a problem hiding this comment.
Ok, it was padding but at the last minute I found it confusing and renamed it. Will change back 👍
| /// Returns only the display features that separate the screen into | ||
| /// sub-screens. | ||
| /// | ||
| /// A [DisplayFeature] separates the screen into sub-screens when both these |
There was a problem hiding this comment.
This seems to leave out foldable devices with a continuous screen, but I may be misunderstanding
There was a problem hiding this comment.
If the screen is continuous the two panes don't need to split on the folding feature, so they are free to take the proportions provided to the widget, the same way they would on a tablet or larger screen.
Our hope was to have everything related to foldable support in the framework in order to make it a seamless dev experience - but TwoPane is not used in any other part of the framework, so I understand the advantages of moving it to a separate package. |
|
I agree with @Piinks that this widget would be better suited in a separate package. |
|
Ok, closing this and moving the widget to a separate package. |
This PR adds the
TwoPanewidget which helps with creating layouts on foldable and large screen devices. The goal is to provide an easy way to write two-pane layouts that show less or more content according to available space, while at the same time reacting to existing display features on the device.Here is an image of what the simplest usage of the widget will produce on 3 different platforms and available screen space:
This is split from a larger PR for foldable support in order to make it easier to review (#77156).
Issues that will be fixed by this PR:
Depends on:
Pre-launch Checklist
///).