颤振显示实质图标失败

时间:2020-10-09 21:19:37

标签: flutter

Flutter中创建的新项目中,我想知道Flutter为什么不显示Material包中的图标,请在下面的屏幕快照中查看,这是我的应用程序的一部分

enter image description here

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/

1 个答案:

答案 0 :(得分:0)

您需要在uses-material-design中将pubspec.yaml file设置为true

flutter:
  uses-material-design: true