0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Flutter】GoogleFontsを適用したが、AppBarのtitleにだけ適用されない

Posted at

問題

以下を参考にさせていただき、アプリの全体のフォントをGoogleFontsのキウイ丸に変更した。

しかし、AppBarのタイトルだけ、元のフォントのまま変わらない。

原因

appBarThemeでtitleTextStyleを指定していたため、そちらが優先して、デフォルトのフォントで表示されてしまったようでした。

解決方法

appBarThemeのtitleTextStyleをGoogleFonts.kiwiMaru(ここはお好きなフォント名)で囲むことで解決しました。

MaterialAppのtheme
 theme: ThemeData(
          primarySwatch: AppColors.mainBackColorMaterial,
          appBarTheme: AppBarTheme(
            titleTextStyle: GoogleFonts.kiwiMaru( //元のtextStyleをGoogleFonts.kiwiMaruで囲んだ
                textStyle: const TextStyle(
              color: AppColors.mainTitleTextColor,
              fontWeight: FontWeight.bold,
              fontSize: 25,
            )),
          ),
          textTheme: GoogleFonts.kiwiMaruTextTheme(
            Theme.of(context).textTheme,
          )),
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?