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

A weird ViewportInset issue #54

Open
david675566 opened this issue Jan 25, 2024 · 3 comments
Open

A weird ViewportInset issue #54

david675566 opened this issue Jan 25, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@david675566
Copy link

I got a case where I need to use keyboard inside PageView, initialInset: const ViewportInset.fractional(0.9),

The pages are dynamically generated, at least 1 page will be build,
but while there's exactly 1 page, the keyboard will covered a bit of space inside page,
until I slide the page so slightly that it won't close & force rebuild itself.
While if I got >= 2 pages to be build, this weird behaviour doesn't present at all, works normally.

@fujidaiti
Copy link
Owner

Could you post more information about the problem, like screenshots or a code snippet?

@david675566
Copy link
Author

Hi, sorry for the late reply
This is the case I'm facing:
When there's exactly 1 page present, Keyboard will covered a bit spaces, slide the page a bit and release could make it 'fix' itself,
but everytime open up the same page, this issue would still present:
Calendar_Card打開Comment鍵盤會卡住
If >= 2 pages, keyboard just works as normal:
IMG_1475

This is the ViewportConfiguration we're using:

ViewportConfiguration(
      initialInset: const ViewportInset.fractional(0.9),
      minFraction: 0.9,
      maxFraction: 1,
    ),

@fujidaiti fujidaiti added the bug Something isn't working label Jan 26, 2024
@fujidaiti
Copy link
Owner

fujidaiti commented Jan 26, 2024

@david675566

Thanks for the further information!
I couldn't figure out the cause of this problem for now, but I came up with a (dirty) workaround; when the user taps the input area, we can programmatically expand the page using ExprollablePageController.jumpViewportInsetTo:

TextField(
  maxLines: 1,
  onTap: () {
    final controller = ExprollablePageController.of(context);
    // Check if the page is not fully expanded
    if (controller != null && !controller.viewport.isPageExpanded) {
      // Force the page to expand
      controller.jumpViewportInsetTo(ViewportInset.expanded);
    }
  },
),

I plan to re-implement the ExprollablePageView using my other package, smooth_sheets, which I am currently developing. Once this reimplementation is complete, it should resolve the issue of the on-screen keyboard overlapping, as the mentioned package specifically addresses this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants