小编Tof*_*ali的帖子

Flutter 应用中的 Google 字体包不起作用

首先,我将 google_fonts 包添加到您的 pubspec 依赖项中。

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^0.1.2
  google_fonts: ^0.2.0
Run Code Online (Sandbox Code Playgroud)

然后

import 'package:google_fonts/google_fonts.dart';
Run Code Online (Sandbox Code Playgroud)

并应用于文本小部件

        Text(
          'This is Google Fonts',
          style: GoogleFonts.lato(fontSize: 40),
        ),
        Text(
          'This is Google Fonts',
          style: GoogleFonts.adventPro(fontSize: 40),
        ),
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

fonts package flutter

5
推荐指数
1
解决办法
5179
查看次数

标签 统计

flutter ×1

fonts ×1

package ×1