作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
运行我的应用程序时出现此错误。
Launching lib/main.dart on DAEGIL의 iPhone in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: T6ULPGT4J7
Xcode build done. 20.2s
Failed to build iOS app
Error output from Xcode build:
↳
** BUILD FAILED **
Xcode's output:
↳
../../.pub-cache/hosted/pub.dartlang.org/modal_bottom_sheet-0.2.2/lib/src/material_with_modal_page_route.dart:21:16: Error: Getter not found: 'opaque'.
assert(opaque),
^^^^^^
../../.pub-cache/hosted/pub.dartlang.org/modal_bottom_sheet-0.2.2/lib/src/bottom_sheets/cupertino_bottom_sheet.dart:344:46: Error: No named parameter with the name 'shadowThemeOnly'.
final isCupertinoApp = Theme.of(context, shadowThemeOnly: true) == null;
^^^^^^^^^^^^^^^
../../fvm/versions/2.0.0/packages/flutter/lib/src/material/theme.dart:107:20: Context: Found this candidate, but the arguments don't match.
static ThemeData of(BuildContext context) {
^^
../../.pub-cache/hosted/pub.dartlang.org/modal_bottom_sheet-0.2.2/lib/src/bottom_sheets/material_bottom_sheet.dart:42:32: Error: No named parameter with the name 'shadowThemeOnly'.
theme: Theme.of(context, shadowThemeOnly: true),
^^^^^^^^^^^^^^^
../../fvm/versions/2.0.0/packages/flutter/lib/src/material/theme.dart:107:20: Context: Found this candidate, but the arguments don't match.
static ThemeData of(BuildContext context) {
^^
Command PhaseScriptExecution failed with a nonzero exit code
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
Could not build the precompiled application for the device.
Error launching application on DAEGIL의 iPhone.
Exited (sigterm)
Flutter 医生显示:
[✓] Flutter (Channel stable, 2.0.1, on macOS 11.2.2 20D80 darwin-x64, locale en-CA)
• Flutter version 2.0.1 at /Users/daegilpyo/Developer/flutter
• Framework revision c5a4b4029c (3 days ago), 2021-03-04 09:47:48 -0800
• Engine revision 40441def69
• Dart version 2.12.0
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.0-rc1)
• Android SDK at /Users/daegilpyo/Library/Android/sdk
• Platform android-30, build-tools 30.0.0-rc1
• Java binary at: /Applications/12.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.3, Build version 12C33
• CocoaPods version 1.10.0
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 3.6)
• Android Studio at /Applications/12.app/Contents
• Flutter plugin version 47.1.1
• Dart plugin version 192.8052
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
[✓] Connected device (2 available)
• DAEGIL의 iPhone (mobile) • 00008020-0011243A2279002E • ios • iOS 14.4
• Chrome (web) • chrome • web-javascript • Google Chrome 88.0.4324.192
我不知道为什么会发生这个问题,这个错误与我的 flutter 版本有关吗?
最佳答案
据我所知,这是因为 modal_bottom_sheet
包裹。
Flutter 中的一些更改使这个问题与空指针安全有关。它在版本 2.0.0-nullsafety.1
中得到修复.此版本引入了一些代码破坏性更改。
// Replace this
showMaterialModalBottomSheet(
context: context,
builder: (context, scrollController) {
return SingleChildScrollView(
controller: scrollController,
child: Container()
)
},
)
// With this
showMaterialModalBottomSheet(
context: context,
builder: (context) {
return SingleChildScrollView(
controller: ModalScrollController.of(context),
child: Container()
)
},
)
在
documentation 中进一步查看
关于在 material_with_modal_page 中 Flutter 运行与 Flutter 版本相关的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66521630/
运行我的应用程序时出现此错误。 Launching lib/main.dart on DAEGIL의 iPhone in debug mode... Automatically sig
我是一名优秀的程序员,十分优秀!