簡體   English   中英

getter 'secondaryContainer' 沒有為 class 'ColorScheme' 定義

[英]The getter 'secondaryContainer' isn't defined for the class 'ColorScheme'

當我將Syncfusion庫導入我的項目時,這些錯誤出現了。

我的 Flutter 版本是2.4.0-4.0.pre ,

/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_gauges-19.4.53/lib/src/radial_gauge/pointers/marker_pointer_renderer.dart:631:34: Error: The getter 'secondaryContainer' isn't defined for the class 'ColorScheme'.
 - 'ColorScheme' is from 'package:flutter/src/material/color_scheme.dart' ('/C:/src/flutter/packages/flutter/lib/src/material/color_scheme.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'secondaryContainer'.
          _themeData.colorScheme.secondaryContainer.withOpacity(0.8)
                                 ^^^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_gauges-19.4.53/lib/src/radial_gauge/pointers/marker_pointer_renderer.dart:642:36: Error: The getter 'secondaryContainer' isn't defined for the class 'ColorScheme'.
 - 'ColorScheme' is from 'package:flutter/src/material/color_scheme.dart' ('/C:/src/flutter/packages/flutter/lib/src/material/color_scheme.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'secondaryContainer'.
            _themeData.colorScheme.secondaryContainer.withOpacity(0.12)
                                   ^^^^^^^^^^^^^^^^^^
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/syncfusion_flutter_gauges-19.4.53/lib/src/radial_gauge/pointers/range_pointer_renderer.dart:567:34: Error: The getter 'secondaryContainer' isn't defined for the class 'ColorScheme'.
 - 'ColorScheme' is from 'package:flutter/src/material/color_scheme.dart' ('/C:/src/flutter/packages/flutter/lib/src/material/color_scheme.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'secondaryContainer'.
          _themeData.colorScheme.secondaryContainer.withOpacity(0.8)
                                 ^^^^^^^^^^^^^^^^^^

primaryContainersecondaryContainer屬性在 Flutter v2.6.0-0.0.pre 中被primaryVariantsecondaryVariant替換,因此要使用此版本的插件,您首先需要更新您的 Flutter 版本。

我發現您使用的是 flutter 穩定版 SDK 版本 2.4.0-4.0-pre。 將您的 SDK 更新到最新版本(>2.10.0) 以解決此問題。 如果您只想使用 SDK 版本 2.4.0-4.0-pre,請使用Flutter Gauge - 19.4.48版本。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM