"uses-material-design: true" 不使用 pubspec.yaml 中的其他资产
"uses-material-design: true" not working with other assets in pubspec.yaml
在 delete/comment 这行
之前,我无法将任何资产(如图像、字体等)添加到我的项目应用程序
uses-material-design: true
错误
Error detected in pubspec.yaml:
Restarted application in ٨ms.
Error on line 25, column 4: Expected a key while parsing a block mapping.
╷
25 │ assets:
│ ^
╵
Exception: Please correct the pubspec.yaml file at .\pubspec.yaml
除了这个问题,pubspec.yaml
一切正常
name: mi_card
description: A new Flutter application.
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- images/
fonts:
- family: Pacifico
fonts:
- asset: fonts/Pacifico-Regular.ttf
- family: Source Sans Pro
fonts:
- asset: fonts/SourceSansPro-Regular.ttf
但是因为我需要使用material个图标,所以我需要把它添加到我的资产中,所以如何解决这个问题?
pubspec.yaml
对缩进敏感。
你的 in 文件在 uses-material-design: true
后缩进了一个 space ,尝试删除它,它会起作用。
复制并尝试:
name: mi_card
description: A new Flutter application.
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- images/
fonts:
- family: Pacifico
fonts:
- asset: fonts/Pacifico-Regular.ttf
- family: Source Sans Pro
fonts:
- asset: fonts/SourceSansPro-Regular.ttf
在 delete/comment 这行
之前,我无法将任何资产(如图像、字体等)添加到我的项目应用程序uses-material-design: true
错误
Error detected in pubspec.yaml:
Restarted application in ٨ms.
Error on line 25, column 4: Expected a key while parsing a block mapping.
╷
25 │ assets:
│ ^
╵
Exception: Please correct the pubspec.yaml file at .\pubspec.yaml
除了这个问题,pubspec.yaml
name: mi_card
description: A new Flutter application.
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- images/
fonts:
- family: Pacifico
fonts:
- asset: fonts/Pacifico-Regular.ttf
- family: Source Sans Pro
fonts:
- asset: fonts/SourceSansPro-Regular.ttf
但是因为我需要使用material个图标,所以我需要把它添加到我的资产中,所以如何解决这个问题?
pubspec.yaml
对缩进敏感。
你的 in 文件在 uses-material-design: true
后缩进了一个 space ,尝试删除它,它会起作用。
复制并尝试:
name: mi_card
description: A new Flutter application.
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- images/
fonts:
- family: Pacifico
fonts:
- asset: fonts/Pacifico-Regular.ttf
- family: Source Sans Pro
fonts:
- asset: fonts/SourceSansPro-Regular.ttf