After updating to Flutter 3.10 : screen not scrolling up when keyboard appears / ResizeToAvoidBottomInset stopped working

huangapple go评论78阅读模式
英文:

After updating to Flutter 3.10 : screen not scrolling up when keyboard appears / ResizeToAvoidBottomInset stopped working

问题

I have updated flutter sdk to latest 3.10.0 and dart 3 then screen not scrolling up when keyboard appears in android, mostly when a text field get focus. Before this update it was working fine in flutter sdk version 3.7 etc..

尝试使用
resizeToAvoidBottomInset: false / true
SingleChildScrollView - reverse - true 等

英文:

I have updated flutter sdk to latest 3.10.0 and dart 3 then screen not scrolling up when keyboard appears in android, mostly when a text field get focus. Before this update it was working fine in flutter sdk version 3.7 etc..

Tried using
resizeToAvoidBottomInset: false / true
SingleSchildScrollView -reverse - true etc

答案1

得分: 7

更新:最新版本的 ScreenUtil(5.8.2)更改了 useInheritedMediaQuery 的默认值为 true

根据 github 中的讨论,我已在我的应用程序中解决了这个问题。

这个问题可以通过将 ScreenUtil 升级到最新版本(5.8.1)并设置 useInheritedMediaQuery = true 来解决。

flutter_screenutil: ^5.8.1

ScreenUtilInit(
  useInheritedMediaQuery: true,
  designSize: const Size(376, 812),
  builder: (context, child) {
    return const Scaffold(
      resizeToAvoidBottomInset: true,
      body: Column(
        children: [
          Spacer(),
          TextField(),
        ],
      ),
    );
  },
);
英文:

Update :- latest version of ScreenUtil (5.8.2) they changed useInheritedMediaQuery default value to true


As per the discussion in github I have fixed this issue in my app.

This issue can be fixed by
Upgrading ScreenUtil to latest (5.8.1) and setting

useInheritedMediaQuery = true

flutter_screenutil: ^5.8.1

ScreenUtilInit(
  useInheritedMediaQuery: true,
  designSize: const Size(376, 812),
  builder: (context, child) {
    return const Scaffold(
      resizeToAvoidBottomInset: true,
      body: Column(
        children: [
          Spacer(),
          TextField(),
        ],
      ),
    );
  },
);

huangapple
  • 本文由 发表于 2023年5月17日 13:49:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/76268902.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定