我在更新到3.10后得到了这个错误,并且我没有在代码中引用accentColor。我猜是使用这一行的图书馆之一。我怎么知道是哪一个?
错误:
: Error: The getter 'accentColor' isn't defined for the class 'ThemeData'.
rectangle_indicator.dart:17
- 'ThemeData' is from 'package:flutter/src/material/theme_data.dart' ('../../flutter/packages/flutter/lib/src/material/theme_data.dart').
theme_data.dart:1
Try correcting the name to the name of an existing getter, or defining a getter or field named 'accentColor'.
final borderColor = this.borderColor ?? Theme.of(context).accentColor;
^^^^^^^^^^^
: Error: The getter 'accentColor' isn't defined for the class 'ThemeData'.
triangle_indicator.dart:20
- 'ThemeData' is from 'package:flutter/src/material/theme_data.dart' ('../../flutter/packages/flutter/lib/src/material/theme_data.dart').
theme_data.dart:1
Try correcting the name to the name of an existing getter, or defining a getter or field named 'accentColor'.
color: color ?? theme.accentColor,
^^^^^^^^^^^
依赖关系:
dependencies:
flutter:
sdk: flutter
firebase_core: ^2.8.0
firebase_analytics: ^10.1.6
firebase_performance: ^0.9.0+16
firebase_crashlytics: ^3.0.17
shared_preferences: ^2.0.15
provider: ^6.0.4
url_launcher: ^6.1.6
flutter_boxicons: ^3.0.0
material_design_icons_flutter: ^6.0.7096
flutter_localizations:
sdk: flutter
flutter_fortune_wheel: ^1.2.0
dynamic_color: ^1.6.3
flutter_hooks: ^0.18.6
google_mobile_ads: ^3.0.0
purchases_flutter: ^4.11.1
font_awesome_flutter: ^10.4.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.1
flutter_native_splash: ^2.2.19
dependency_validator: ^3.0.0
3条答案
按热度按时间mfpqipee1#
它显示
rectangle_indicator.dart:17
和triangle_indicator.dart:20
,您可以看到它们来自flutter_fortune_wheel
库。gj3fmq9x2#
accentColor
在新版本的flutter中被删除。您可以使用
colorScheme.secondayColor
代替accentcolor。j0pj023g3#
尝试在Android Studio终端中运行
flutter clean
,并执行缓存无效化并重新启动IDE。