flutter 错误:未为类“AppBarTheme”定义getter“textTheme”,没有名称为“accentColor”的命名参数

jw5wzhpr  于 2023-06-24  发布在  Flutter
关注(0)|答案(1)|浏览(469)
Running Gradle task 'assembleDebug'...
../../../.pub-cache/hosted/pub.dev/flutter_neumorphic-3.2.0/lib/src/widget/app_bar.dart:183:29: Error: The getter 'textTheme' isn't defined for the class 'AppBarTheme'.
 - 'AppBarTheme' is from 'package:flutter/src/material/app_bar_theme.dart' ('../../../MycodingLibs/flutter/packages/flutter/lib/src/material/app_bar_theme.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'textTheme'.
        style: (appBarTheme.textTheme?.headline5 ??
                            ^^^^^^^^^
../../../.pub-cache/hosted/pub.dev/flutter_neumorphic-3.2.0/lib/src/widget/app.dart:89:7: Error: No named parameter with the name 'accentColor'.
      accentColor: theme.variantColor,
      ^^^^^^^^^^^
../../../MycodingLibs/flutter/packages/flutter/lib/src/material/theme_data.dart:290:11: Context: Found this candidate, but the arguments don't match.
  factory ThemeData({
          ^
Target kernel_snapshot failed: Exception

FAILURE: Build failed with an exception.

* Where:
Script '/home/corecreater/MycodingLibs/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1201

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/home/corecreater/MycodingLibs/flutter/bin/flutter'' 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 17s
Exception: Gradle task assembleDebug failed with exit code 1

这是一个老项目,在我看来,我不知道该怎么办。我试图更新pubspec.yaml中的所有包。Android Studio没有代码错误。我觉得是Flutter版本的问题。

nuypyhwy

nuypyhwy1#

对于flutter_neumorphic包来说,这可能是一个问题,您可能会在其他项目之前使用该包。如果发生此问题,则可以在终端上运行此命令。

flutter pub cache clean

运行该命令后,计算机上的发布缓存将被清除,并且需要重新下载以前下载的任何软件包。
注意:如果您没有使用Flutter,您可以将'flutter pub cache clean'替换为**'pub cache clean'**,以清除常规Dart包的pub cache。

相关问题