[Flutter]TextFormFieldのプレースホルダーのテキストサイズを設定するには?

Flutter

どうも、ちょげ(@chogetarou)です。

TextFormFieldで表示するプレスホルダーのテキストの色を設定する方法を紹介します。

スポンサーリンク

方法

インターフェース, インターネット, プログラム, ブラウザ, Www

TextFormFieldのプレースホルダーのテキストカラーを設定するには、InputDecorationの引数「hintStyle」を使います。

まず、InputDecorationの引数「hintStyle」にTextStyleを指定します。

そして、TextStyleの引数「color」にテキストの色を指定します。

TextFormField(
  decoration: InputDecoration(
    hintText: 'プレースホルダー',
    hintStyle: TextStyle(
      color: /*テキストの色*/,
    ),
  ),
),

InputDecorationの引数「hintStyle」を使えば、TextFormFieldのプレースホルダーのテキストカラーを設定することが出来ます。

使用例

以下は、使用例です。

TextFormField(
  decoration: InputDecoration(
    hintText: 'Hint Text',
    hintStyle: TextStyle(
      color: Colors.blue,
    ),
  ),
),

コメント

タイトルとURLをコピーしました