Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sheet size independent of its child size #278

Open
Tracked by #276
fujidaiti opened this issue Nov 14, 2024 · 0 comments
Open
Tracked by #276

Make sheet size independent of its child size #278

fujidaiti opened this issue Nov 14, 2024 · 0 comments
Assignees
Milestone

Comments

@fujidaiti
Copy link
Owner

fujidaiti commented Nov 14, 2024

The current sheet sizes itself to fit its child widget. This is fine in many cases, but making the sheet widget's size independent of the child widget's size allows the sheet to:

  • Remove unnecessary bottom areas of the child widget, for example, the blank bottom area of the Navigator in a NavigationSheet, and
  • Stretch the sheet height when the user over-drags it, creating the same visual effect as the iOS native bottom sheet as mentioned in Support iOS native modal sheet stretching behavior #169.

Implementation

Here's a rough sketch of the widget hierarchy:

SheetViewport
|- Sheet
   |- Material
      |- SheetContentViewport
         |- content-wrapper-widget (optional)
            |- ...
               |- SheetContentBoundary
                  |- content-widget

where,

  • content-widget, which is the content of the sheet containing meaningful components for the user such as buttons, text, a list-view, etc.
  • SheetContentBoundary, which notifies the SheetContentViewport of the content widget's size.
  • content-wrapper-widget, a widget that is optionally inserted between the SheetContentBoundary and the SheetContentViewport. For example, Navigator serves as the content-wrapper-widget for the NavigationSheet. This widget may be larger than the SheetContentViewport and clipped by the Material in such cases.
  • SheetContentViewport: a special OverflowBox that sizes itself to fit the content widget, and constraints the content wrapper widget to the size of the parent SheetViewport. This ensures that the content wrapper widget can be as large as the SheetViewport at most, while forcing the Material's size to match the content widget's size.
  • Material, which draws the background color, the shadow, and the rounded corners for the sheet.
@fujidaiti fujidaiti self-assigned this Nov 14, 2024
@fujidaiti fujidaiti modified the milestone: Refine sheet structure Nov 14, 2024
@fujidaiti fujidaiti moved this to Todo in Roadmap Nov 14, 2024
@fujidaiti fujidaiti removed the status in Roadmap Nov 14, 2024
@fujidaiti fujidaiti moved this to Todo in Roadmap Nov 14, 2024
@fujidaiti fujidaiti changed the title Make sheet independent of its content size Make sheet independent of its child size Nov 14, 2024
@fujidaiti fujidaiti changed the title Make sheet independent of its child size Make sheet size independent of its child size Nov 15, 2024
@fujidaiti fujidaiti added this to the v0.11.0 milestone Nov 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

1 participant