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 3 years have passed since last update.

Flutter テキストテーマを編集(Theme.of(context).textTheme.XXX)

Posted at

これからも使いそうだなと思ったことを、メモ用として書きます。

記述する対象は、マテリアルデザインのテキストテーマについてです。

テキストテーマ

マテリアルデザインのテキストテーマについては、以下の記事について見てください。 https://qiita.com/kurararara/items/e452d8fd5a33ae391378

編集方法

テキストテーマを編集するには、copyWithを使えば編集できます。 ソースコードは、こんな感じです。
Theme.of(context)>textTheme.XXX.copyWith(XXX: XXX)

以下のコードを実行すると、デバイスには写真のように表示されます。

         children: <Widget>[
            Text(
              'Color is red',
              style: Theme.of(context).textTheme.headline4?.copyWith(color: Colors.red),
            ),
            Text(
              'Color is blue, size is 30',
              style: Theme.of(context).textTheme.headline4?.copyWith(fontSize: 60, color: Colors.blue),
            ),
            Text(
              'Color is red, size is 15, weight is w900',
              style: Theme.of(context).textTheme.headline4?.copyWith(fontWeight: FontWeight.w900,fontSize: 50, color: Colors.blue),
            ),
          ],
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?