我正在尝试运行包含“堆栈”的应用程序,但它给了我一个错误:
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/convex_bottom_bar-2.6.0/lib/src/stack.dart:43:25: Error: The getter 'ClipBehavior' isn't defined for the class 'Stack'.
- 'Stack' is from 'package:convex_bottom_bar/src/stack.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/convex_bottom_bar-2.6.0/lib/src/stack.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'ClipBehavior'.
clipBehavior: ClipBehavior,
^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/convex_bottom_bar-2.6.0/lib/src/stack.dart:53:21: Error: The getter 'ClipBehavior' isn't defined for the class 'Stack'.
- 'Stack' is from 'package:convex_bottom_bar/src/stack.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/convex_bottom_bar-2.6.0/lib/src/stack.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'ClipBehavior'.
clipBehavior: ClipBehavior,
^^^^^^^^^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/convex_bottom_bar-2.6.0/lib/src/stack.dart:70:25: Error: The getter 'ClipBehaviorehavior' isn't defined for the class '_RenderStack'.
- '_RenderStack' is from 'package:convex_bottom_bar/src/stack.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/convex_botvex_bottom_bar-2.6.0/lib/src/stack.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'ClipBehavior'.
clipBehavior: ClipBehavior,
^^^^^^^^^^^^
FAILURE: Build failed with an exception.
* Where:
Script 'C:\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 904
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\flutter\bin\flutter.bat'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 25s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 26.5s
Exception: Gradle task assembleDebug failed with exit code 1
我的 flutter doctor 一切都很好,没有错误,我的 flutter sdk 是最新版本。我队友的应用程序在她身上运行良好。请帮忙
答案 0 :(得分:0)
正如错误所说,您正在使用名为 ClipBehaviour 的变量 您应该在哪里使用类 Clip 的变量(您朋友的代码可能正在工作,因为他在他的代码中定义了一个名为 ClipBehaviour 的变量,而您没有)
Stack(
clipBehavior: Clip.none,
children: const <Widget>[
SizedBox(
width: 100.0,
height: 100.0,
),
],
);
就这样看看有没有帮助
答案 1 :(得分:0)
这就是窍门。谢谢
clipBehavior: Clip.none,