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

add Sheet.addPostLayoutCallback static method #413

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vishna
Copy link

@vishna vishna commented Jun 28, 2024

What is this PR about?

Addresses issue #412, adds the Sheet.addPostLayoutCallback which allows to defer SheetController calls.

Why do I need this?

Expanding Sheet using SheetController might not always work, e.g. you are trying to animate the sheet and expand controller at the same time (see: #412). You can use addPostLayoutCallback in order to defer your call to the moment RenderSheetViewport has finished RenderSheetViewport.performLayout Additionally you can provide timeout after which this callback should be called anyway incase RenderSheetViewport.performLayout doesn't start. Usually (this has not been super benchmarked!) layout starts under 50ms, putting 100ms to be on the safe side - YMMV

Sidenote

This is the best solution I could come up with, studying all the complexities of this package. This still doesn't fix the core issue, which is performing layout and expanding sheet at the same time - which just ends with setPixels(0.0) (as shown in the bug report). This PR adds rather ugly static method that provides a bit more reliable workaround than use of Future.delay.

Expanding [Sheet] using [SheetController] might not always work, e.g. you are trying to animate the sheet and expand controller at the same time (see: jamesblasco#412) You can use [addPostLayoutCallback] in order to defer your call to the moment [RenderSheetViewport] has finished [RenderSheetViewport.performLayout] Additionally you can provide [timeout] after which this callback should be called anyway incase [RenderSheetViewport.performLayout] doesn't start. Usually (this has not been super benchmarked!) layout starts under 50ms, putting 100ms to be on the safe side - YMMV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant