【发布时间】:2020-04-14 05:06:53
【问题描述】:
首先,我将 google_fonts 包添加到您的 pubspec 依赖项中。
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
google_fonts: ^0.2.0
然后
import 'package:google_fonts/google_fonts.dart';
并应用于文本小部件
Text(
'This is Google Fonts',
style: GoogleFonts.lato(fontSize: 40),
),
Text(
'This is Google Fonts',
style: GoogleFonts.adventPro(fontSize: 40),
),
【问题讨论】:
-
重启应用
-
安装 Google 字体包后,您是否关闭并重新构建了应用程序?
-
是的,我已经关闭了项目和 IDE,但我还没有尝试过 flutter clean 命令 :) 我希望这个有效。非常感谢本杰明和若昂·苏亚雷斯。
-
我也尝试过flutter clean但没有工作