对于UI应该略有不同的iOS和Android,必须有检测到您正在运行哪一个的方式,但在文档我找不到它.它是什么?
升级到 flutter 3.0.0 后,运行应用程序时开始出现问题,
\n(该应用程序可以运行,但终端中出现错误(警告))。
\n这似乎是一个绑定问题。
\n错误(警告)说:\n警告:null 感知操作 \'!\' 的操作数具有类型 \'WidgetsBinding\',其中排除 null。
\n: Warning: Operand of null-aware operation \'!\' has type \'WidgetsBinding\' which excludes null.\n../\xe2\x80\xa6/src/keyboard_visibility.dart:21\n- \'WidgetsBinding\' is from \'package:flutter/src/widgets/binding.dart\' (\'../../../fvm/versions/3.0.0/packages/flutter/lib/src/widgets/binding.dart\').\npackage:flutter/\xe2\x80\xa6/widgets/binding.dart:1\n WidgetsBinding.instance!.addObserver(this);\n\n ^\n: Warning: Operand of null-aware operation \'!\' has type \'WidgetsBinding\' which excludes null.\n../\xe2\x80\xa6/src/keyboard_visibility.dart:37\n- \'WidgetsBinding\' is from \'package:flutter/src/widgets/binding.dart\' (\'../../../fvm/versions/3.0.0/packages/flutter/lib/src/widgets/binding.dart\').\npackage:flutter/\xe2\x80\xa6/widgets/binding.dart:1\n WidgetsBinding.instance!.removeObserver(this);\n ^\n: Warning: Operand of null-aware operation \'!\' has type \'WidgetsBinding\' which excludes null.\n../\xe2\x80\xa6/src/bot_toast_init.dart:15\n- \'WidgetsBinding\' is from \'package:flutter/src/widgets/binding.dart\' (\'../../../fvm/versions/3.0.0/packages/flutter/lib/src/widgets/binding.dart\').\npackage:flutter/\xe2\x80\xa6/widgets/binding.dart:1\n WidgetsBinding.instance!.addObserver(this);\n ^\n: Warning: Operand of null-aware operation \'!\' …Run Code Online (Sandbox Code Playgroud) 在 Flutter 版本 3.0.1 中使用 Material3 useMaterial3: true,当滚动(比如列表视图)时,应用栏会变为较暗的颜色...可以禁用此功能吗?
来自本机 android Material3 MaterialToolbar 的示例禁用滚动着色:
这就是我想要做的:
在文本字段的Flutter文档(https://flutter.io/text-input/)中,它表示您可以通过传递null到装饰来删除下划线.但是,这也摆脱了提示文本.
我不想强调文本字段是否有焦点.
更新:显然这可以通过使用轻松完成
new InputDecoration.collapsed(...),
Run Code Online (Sandbox Code Playgroud)
它保留提示而不绘制边框.
我正在尝试为我的Flutter应用程序构建一个简单的登录页面.我已经成功构建了TextFields和Login/Signin按钮.我想添加一个水平ListView.当我运行代码时,我的元素消失,如果我没有ListView,它再次没问题.我该怎么做才能正确?
return new MaterialApp(
home: new Scaffold(
appBar: new AppBar(
title: new Text("Login / Signup"),
),
body: new Container(
child: new Center(
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new TextField(
decoration: new InputDecoration(
hintText: "E M A I L A D D R E S S"
),
),
new Padding(padding: new EdgeInsets.all(15.00)),
new TextField(obscureText: true,
decoration: new InputDecoration(
hintText: "P A S S W O R D"
),
),
new Padding(padding: new EdgeInsets.all(15.00)),
new TextField(decoration: new InputDecoration(
hintText: "U …Run Code Online (Sandbox Code Playgroud) 我不知道为什么,但我无法在我的新 Macbook 中构建或运行该应用程序,我在另一台 Mac 或我的 Windows 计算机上运行相同的文件夹并完美运行。在这里,当我运行 flutter clean 时,我必须运行 pub get 来解决问题,这正常吗?
如果我新建一个项目,我可以正常运行flutter run,所以我想可能那里我认为可能与插件有关。
你知道我该如何解决这个问题吗?谢谢
Flutter Doctor
[?] Flutter (Channel master, 1.24.0-8.0.pre.343, on macOS 11.0.1 20B29 darwin-x64, locale es-419)
• Flutter version 1.24.0-8.0.pre.343 at /Users/leo/tools/flutter
• Framework revision cf6c33e58a (2 days ago), 2020-11-21 14:04:01 -0800
• Engine revision 23a8e027db
• Dart version 2.12.0 (build 2.12.0-62.0.dev)
[?] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/leo/Library/Android/sdk
• Platform android-30, build-tools 30.0.2
• Java …Run Code Online (Sandbox Code Playgroud) Launching lib/main.dart on iPhone 13 Pro in debug mode...\nlib/main.dart:1\nXcode build done. 43.6s\nFailed to build iOS app\nError output from Xcode build:\n\xe2\x86\xb3\n --- xcodebuild: WARNING: Using the first of multiple matching destinations:\n { platform:iOS Simulator, id:dvtdevice-DVTiOSDeviceSimulatorPlaceholder-iphonesimulator:placeholder, name:Any iOS Simulator Device }\n { platform:iOS Simulator, id:320795B7-1385-4044-B442-87A9808936D9, OS:15.0, name:iPhone 13 Pro }\n { platform:iOS, id:dvtdevice-DVTiPhonePlaceholder-iphoneos:placeholder, name:Any iOS Device }\n { platform:iOS, id:00008101-000825EC3AE1001E, name:leobidoous iPhone, error:Device is busy (Making leobidoous iPhone ready for development, Processing cache …Run Code Online (Sandbox Code Playgroud) 我尝试将带有SVG源的图像添加到我的flutter应用程序中.
new AssetImage("assets/images/candle.svg"))
但我没有得到任何视觉反馈.如何在Flutter中渲染SVG图片?
我刚刚设置我的Macbook进行颤振开发,
所以我下载了flutter sdk,并把它放在我的文档中.之后,我将我的路径变量设置为在命令行中使用flutter.
我执行命令,flutter create todolist所以我实现了一个空白项目.
我还用Dart-Code设置了我的visual studio代码,所以我有正确的语法高亮,intellisense等.
因此,当我打开visual studio代码时,它会突出显示该import方法,如下图所示:

这意味着它还会突出显示正确的类,如果它是真正的错误则完全难以理解.
我已经执行了两个pub get并且flutter packages get正确地得到了一切.我的路径变量都正确.
为什么突出显示它无法找到'import'包?
我正在使用Flutter列出有关电影的信息.现在我想要左边的封面图片是圆角图片.我做了以下,但它没有奏效.谢谢!
getItem(var subject) {
var row = Container(
margin: EdgeInsets.all(8.0),
child: Row(
children: <Widget>[
Container(
width: 100.0,
height: 150.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(8.0)),
color: Colors.redAccent,
),
child: Image.network(
subject['images']['large'],
height: 150.0,
width: 100.0,
),
),
],
),
);
return Card(
color: Colors.blueGrey,
child: row,
);
}
Run Code Online (Sandbox Code Playgroud)
如下
flutter ×10
dart ×4
android ×1
cocoapods ×1
flutter-3.0 ×1
flutter-ios ×1
ios ×1
ios15 ×1
material-ui ×1
xcode13 ×1