在Flutter
中创建的新项目中,我想知道Flutter为什么不显示Material
包中的图标,请在下面的屏幕快照中查看,这是我的应用程序的一部分
import 'package:flutter/material.dart';
import 'package:xxxxx/src/partials/home_app_bar.dart';
import 'package:xxxxx/src/partials/home_card.dart';
import 'package:xxxxx/src/partials/top_slider.dart';
...
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
OutlineButton(
onPressed: () {},
child: Text('Read More'),
),
IconButton(icon: Icon(Icons.fingerprint), onPressed: () {}),
IconButton(icon: Icon(Icons.comment), onPressed: () {}),
IconButton(icon: Icon(Icons.subdirectory_arrow_right), onPressed: () {}),
],
),
flutter doctor -v
输出:
[√] Flutter (Channel stable, 1.22.0, on Microsoft Windows [Version 10.0.19041.508], locale en-US)
• Flutter version 1.22.0 at F:\software\flutter
• Framework revision d408d302e2 (10 days ago), 2020-09-29 11:49:17 -0700
• Engine revision 5babba6c4d
• Dart version 2.10.0
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at F:\software\sdk
• Platform android-30, build-tools 30.0.2
• ANDROID_HOME = F:\software\sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[√] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 49.0.2
• Dart plugin version 193.7547
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] Connected device (1 available)
• WAS LX1A (mobile) • 2XJDU17C14006203 • android-arm64 • Android 8.0.0 (API 26)
• No issues found!
pubspec.yaml
:
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.0
sailor: ^0.7.1
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
assets:
- assets/
- assets/images/
- assets/images/icons/
答案 0 :(得分:0)
您需要在uses-material-design
中将pubspec.yaml file
设置为true
flutter:
uses-material-design: true