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 resizeToAvoidBottomInset Option to WoltModalSheet to Control Keyboard Overlay Behavior #163

Merged

Conversation

ulusoyca
Copy link
Collaborator

@ulusoyca ulusoyca commented Mar 13, 2024

Description

This PR introduces a new flag, resizeToAvoidBottomInset, to the WoltModalSheetPage. This enhancement addresses an issue (#154). With this change, developers can now choose whether the WoltModalSheet.mainContent should resize when the onscreen keyboard appears, preventing it from shifting up and down.

Solution

To address this problem, we have added the resizeToAvoidBottomInset flag to the WoltModalSheetPage. This flag allows developers to specify whether the main content of the modal sheet should be resized to avoid being obscured by the keyboard. Internally, WoltModalSheet uses a Scaffold widget to implement this functionality. The flag's default value is sourced from [WoltModalSheetDefaultThemeData.resizeToAvoidBottomInset], and set to true so that existing package users are not affected.

Usage

To prevent the wolt_modal_sheet from shifting when the keyboard appears, set resizeToAvoidBottomInset to false in the WoltModalSheetPage. This will cause the keyboard to overlay directly on top of the modal sheet, without affecting its position or triggering a page reconstruction.

WoltModalSheetPage(
  resizeToAvoidBottomInset: false,
  // other properties
)
resizeToAvoidBottomInset false resizeToAvoidBottomInset true
resize_false.mp4
resize_true.mp4

Related Issues

#154

Breaking Change

Does your PR require plugin users to manually update their apps to accommodate your change?

  • Yes, this is a breaking change.
  • No, this is not a breaking change.

Copy link

github-actions bot commented Mar 13, 2024

Visit the preview URL for this PR (updated for commit 20e0325):

(expires Mon, 25 Mar 2024 04:41:12 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 906758393beb0353b979d020649d6a1efc40fb5b

@AcarFurkan
Copy link
Collaborator

LGTM

@ulusoyca ulusoyca force-pushed the issue-154-add-functionality-to-resize-to-avoid-bottom-inset branch from 540e201 to 20e0325 Compare March 18, 2024 04:38
Copy link
Collaborator

@TahaTesser TahaTesser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ulusoyca ulusoyca merged commit 58cd184 into main Mar 18, 2024
4 checks passed
@ulusoyca ulusoyca deleted the issue-154-add-functionality-to-resize-to-avoid-bottom-inset branch March 18, 2024 07:31
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

3 participants