fujidaiti / exprollable_page_view

Yet another PageView widget that expands its viewport as it scrolls. Exprollable is a coined word combining the words expandable and scrollable.
https://pub.dev/packages/exprollable_page_view
MIT License
74 stars 5 forks source link

A weird ViewportInset issue #54

Open david675566 opened 9 months ago

david675566 commented 9 months ago

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 commented 9 months ago

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

david675566 commented 9 months ago

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 commented 9 months ago

@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.