flutter で、Google fonts を使用するには?

font を選択

https://fonts.google.com/?subset=japanese

#pubspec.yml
dependencies:
  flutter:
    sdk: flutter

  google_fonts: ^3.0.1
// dart 

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Text with Background Image',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        // Google Font の名前を指定する
        textTheme: GoogleFonts.zenKakuGothicAntiqueTextTheme (
        Theme.of(context).textTheme,
        ),
      ),
      home: AutoPlayScreen(1),
    );
  }
}

 

Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

© 2024 Falco Tech Blog Suffusion theme by Sayontan Sinha