不知从哪里冒出来,我在运行iOS 15.2的模拟iPhone 12上滚动Flutter中的ListView时遇到了一个问题-经验告诉我,这是一款带有M1 Pro芯片的新MacBook Pro。当向上滚动一点时,ListView会跳到它的顶部,并做一些“Overbounce”运动。我没有改变代码中的任何内容,但突然发生了这种疯狂的反弹。
我不能在我的物理iOS设备上重现这个问题,我所有的ListViews滚动和反弹都很好。这可能是我的模拟器的问题,因为即使在我的模拟Android设备上,一切都在正常工作。我已经尝试重置模拟设备并启动另一个尚未启动的设备-没有效果。
还有什么我可以试试的吗
由于我是一个扑初学者,我希望所有需要的信息提供-让我知道,如果需要进一步
模拟器
FAQ.dart
import 'package:flutter/material.dart';
import '../../components/FAQExpansionTile.dart';
import '../../models/FAQEntry.dart';
class FAQScreen extends StatelessWidget {
@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(
title: const Text(
'FAQ',
style: TextStyle(
fontFamily: 'Amatic_SC',
fontSize: 35,
fontWeight: FontWeight.bold
)
)
),
body: ListView.builder(
itemCount: FAQEntryTopic.values.length,
itemBuilder: (context, index) {
return FAQExpansionTile(
faqEntryTopic: FAQEntryTopic.values[index]
);
}
),
);
}
Flutter医生
flutter doctor -v ✔ 1078 15:21:26
[✓] Flutter (Channel stable, 2.8.1, on macOS 12.1 21C52 darwin-arm, locale de-DE)
• Flutter version 2.8.1 at /Users/maxgruber/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 77d935af4d (4 weeks ago), 2021-12-16 08:37:33 -0800
• Engine revision 890a5fca2e
• Dart version 2.15.1
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/maxgruber/Library/Android/sdk
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2020.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
[✓] IntelliJ IDEA Ultimate Edition (version 2021.2.3)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 63.3.3
• Dart plugin version 212.5632
[✓] Connected device (3 available)
• iPhone 12 (mobile) • D900BB5F-546D-44A2-A941-CD597C9CB32F • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-2 (simulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 12.1 21C52 darwin-arm
• Chrome (web) • chrome • web-javascript • Google Chrome 97.0.4692.71
! Error: Maxs iPhone is not connected. Xcode will continue when Maxs iPhone is connected. (code -13)
! Doctor found issues in 1 category.
1条答案
按热度按时间92dk7w1h1#
编辑:
旧的答案不再起作用,所以这里是新的解决方案。打开您的Podfile,它可以在iOS目录中找到。找到
post_install do |installer|
部分,并在end
行之前添加以下内容:你很可能需要清理,从ios目录运行pod install,然后重建/运行。
老答案:
使用以下命令从终端在Rotessa模式下启动iOS模拟器:
这将解决m1 iOS模拟器上的滑动过快问题。