Flutter iOS亮度未定义名称



我正在为Flutter构建iOS应用程序。在ColorScheme中有亮度属性,在Windows上没有错误,它可以工作,但是当我在mac上打开代码时,它显示&;undefined name ' brightness '

有谁能帮我修理一下吗?我重新设置了整个环境,更新了我的心房和一切,但仍然没有成功。

更新:

这是MaterialApp和Theme Build的代码:

return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme(
brightness: Brightness.light,
primary: Color(0xffa8a92f),
onPrimary: Colors.white,
secondary: Color(0xff7b7c80),
onSecondary: Colors.white,
surfaceVariant: Colors.red,
error: Colors.red,
onError: Colors.white,
background: Colors.white,
onBackground: Colors.black,
surface: Colors.yellow,
onSurface: Colors.white
),
cardTheme: CardTheme(
color: Color(0xff7b7c80),
)
),

更新2:

扑动医生输出:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.8, on macOS 12.5 21G72 darwin-arm (Rosetta), locale de-CH)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[!] Xcode - develop for iOS and macOS (Xcode 14.1)
✗ CocoaPods installed but not working.
You appear to have CocoaPods installed but it is not working.
This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke it.
This can usually be fixed by re-installing CocoaPods.
To re-install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.72.2)
[✓] VS Code (version 1.73.1)
[✓] Connected device (1 available)
[✓] HTTP Host Availability

扑动输出——版本:

Flutter 3.3.8 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 52b3dc25f6 (8 days ago) • 2022-11-09 12:09:26 +0800
Engine • revision 857bd6b74c
Tools • Dart 2.18.4 • DevTools 2.15.0

更新3:我从头开始安装了整个项目,安装了所有新的东西,但它仍然不能工作。

我不认为它会有帮助,但尝试添加

import 'dart:ui';
// also you can add this and dart:ui will be inherited from it
// import 'package:flutter/material.dart';

最新更新