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

Dynamically changing sheet height doesn't respect snapping constraints #226

Closed
fujidaiti opened this issue Aug 24, 2024 · 1 comment · Fixed by #243
Closed

Dynamically changing sheet height doesn't respect snapping constraints #226

fujidaiti opened this issue Aug 24, 2024 · 1 comment · Fixed by #243
Assignees
Labels
bug Something isn't working P2
Milestone

Comments

@fujidaiti
Copy link
Owner

@fujidaiti What needs to be done to have a dynamically growing sheet while having set a custom minExtent? E.g. the sheet contains a Column with a Stateful widget as first element, let's say a Text box which may have either 2 or 3 lines. The second element of the column is a button.
Initially the sheet is rendered with 2 lines of text with maxExtent and initialExtent of Èxtent.proportional(1), so the button is perfectly aligned with the bottom of the screen.
After a few seconds the text box widget updates the state and has now 3 lines of text. But that leads to the situation that all content below the text box is pushed down, so the button is clipped by the bottom screen edge (absolut extent stays the same but proportional extent is now something like 0.9...)
I would rather have the sheet growing upwards, keeping the button completely visible, means the proportional extent should stay at 1 (absolute extent would increase by the height of the text line height).

tl;dr: While a custom minimum extent is set, the sheet should keep its extent when the content grows, if currentExtent == maxExtent.

Here's a minimal example of the situation:

DraggableSheet(
  controller: sheetController,
  minExtent: Extent.pixels(100.0),
  child: SheetContentScaffold(
    appBar: SomeHeaderWidget(),
    body: Padding(
      padding: EdgeInsets.symmetric(horizontal: 24),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          SizedBox(height: 12),
          SomeStatefulTextBox(),
          SizedBox(height: 12),
          SomeActionButton(),
        ],
      ),
    ),
  ),
);

Originally posted by @codeOfJannik in #203 (comment)

@codeOfJannik
Copy link

@fujidaiti Thanks for creating this bug ticket. But I think the title is kind of misleading since my issue is not related to anything with the keyboard.

@fujidaiti fujidaiti changed the title Closing keyboard on a non-fullscreen sheet doesn't respect snapping constraints Dynamically changing non-fullscreen sheet doesn't respect snapping constraints Aug 28, 2024
@fujidaiti fujidaiti changed the title Dynamically changing non-fullscreen sheet doesn't respect snapping constraints Dynamically changing sheet height doesn't respect snapping constraints Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants