2022/6/9/Flutter/ThemeExtension

 

ThemeExtension | Decoding Flutterの訳

When I started my software career as a web developer, one of the first things I learned  was not to mix my semantic information with my presentation rules.

私がweb developerとしてソフトウェアキャリアをスタートした時、初めに学んだことの一つとして、意味的な情報(HTML)とプレゼンテーションルール(CSS)を混合させないことでした。

 

On the web, this …

2021/2/10 Use themes to share colors and font stylesの訳

Use themes to share colors and font styles

アプリ全体で色とフォントスタイルを共有するには、テーマ(theme)を使用します。

アプリ全体のテーマ(theme)を定義するか、アプリケーションの特定の部分の色とフォントスタイルを定義するThemeウィジェットを使用できます。

実際、アプリ全体のテーマは、MaterialAppによってアプリのルートで作成されたThemeウィジェットにすぎません。

テーマを定義したら、独自のウィジェット内で使用します。

Flutterのマテリアルウィジェットは、テーマを使用して、AppBar、ボタン、チェックボックスなどの背景色とフォントスタイルを設定します。


Creating an app theme

アプリ全体でテーマを共有するには、MaterialAppコンストラクターにThemeDataを提供します。

テーマ(theme)が提供されていない場合、Flutterは自動的にデフォルトのthemeを作成します。

MaterialApp(
  title: title,
  theme: ThemeData(
    // Define the default brightness and colors.
    brightness: Brightness.dark,
    primaryColor: