Flutter 滚动在 iOS 15.4 上出现抖动,且促销为“120hz”

Jal*_*lal 9 iphone scroll ios flutter

Flutter 应用程序滚动在 iOS 上15.4启动时会出现抖动,但从后台恢复后就会变得平滑。

这个问题仅出现在 iPhone 13 pro 和 13 pro max 上,我删除了有关重型组件和大图像的所有内容,并创建了一个新的空项目仅用于测试,但仍然得到相同的结果。

而flutter版本是Stable Chanel2.10.3

在 iPhone 13 pro max 上进行测试(促销)120hz

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: HomeScreen(), //MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class HomeScreen extends StatelessWidget{
  const HomeScreen({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold( appBar: AppBar(),
      body: Scrollbar(
        child: ListView.builder(
          addAutomaticKeepAlives: true,
          primary: false,
          shrinkWrap: false,
          physics:  const AlwaysScrollableScrollPhysics(),
          itemCount: 300,
            itemBuilder: (contx, index){
              return Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Container( child: Image.asset('assets/ic_test_image.png', fit: BoxFit.cover),),
                  Padding(
                    padding: const EdgeInsets.all(8.0),
                    child: Text('test scroll, dummy data',
                      style: TextStyle(color: Colors.orange, fontSize: 30),),
                  ),
                  Container(height: 0.9, color: Colors.blue,)
                ],
              );
            }, ),
      ),);
  }

}
Run Code Online (Sandbox Code Playgroud)

info.plist文件中,我添加了这个以启用120hz

<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
Run Code Online (Sandbox Code Playgroud)

lep*_*sch 3

这已在 Flutter 3.x 中修复。来自Flutter 3 的新增功能

iOS 可变刷新率支持

Flutter 现在支持配备 ProMotion 显示屏的 iOS 设备(包括 iPhone 13 Pro 和 iPad Pro)上的可变刷新率。在这些设备上,Flutter 应用程序可以以高达 120 Hz 的刷新率进行渲染,而之前的刷新率仅限于 60 Hz。这会在滚动等快速动画过程中带来更流畅的体验。有关更多详细信息,请参阅 flutter.dev/go/variable-refresh-rate。