Flutter Flitter应用程序中的Google字体包不起作用
首先,我将google_字体包添加到您的pubspec依赖项中Flutter Flitter应用程序中的Google字体包不起作用,flutter,fonts,package,Flutter,Fonts,Package,首先,我将google_字体包添加到您的pubspec依赖项中 dependencies: flutter: sdk: flutter cupertino_icons: ^0.1.2 google_fonts: ^0.2.0 然后 并应用于文本小部件 Text( 'This is Google Fonts', style: GoogleFonts.lato(fontSize: 40), ),
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
google_fonts: ^0.2.0
然后
并应用于文本小部件
Text(
'This is Google Fonts',
style: GoogleFonts.lato(fontSize: 40),
),
Text(
'This is Google Fonts',
style: GoogleFonts.adventPro(fontSize: 40),
),
请检查internet连接-您的模拟器没有internet连接。谷歌字体需要在设备/模拟器上连接互联网 添加依赖项pubspec.yaml文件后
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
google_fonts: ^0.2.0
在terminal\cmd控制台中以以下方式运行命令:
> flutter packages get
这将把依赖项带入您的工作区。我通过删除仿真器并安装新仿真器修复了我的依赖项。由于某种原因,我的旧仿真器没有连接到internet,重新安装后为我修复了它。重新启动应用程序安装Google Fonts软件包后是否关闭并重建了应用程序?是的,我已经关闭了project和IDE,但我没有尝试使用flutter clean命令:)我希望这一个可以工作。非常感谢本杰明和若昂·苏亚雷斯。我也试过用弗利特清洁,但没有用耶稣!天寻找这个简单的解决方案!
> flutter packages get