[Flutter]TextFormFieldの背景色を設定するには?

Flutter

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

TextFormFieldの背景色を設定する方法を紹介します。

スポンサーリンク

方法

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

TextFormFieldの背景色を設定するには、InpuDecorationを使います。

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

次に、InputDecorationの引数「fillColor」に背景色を指定します。

そして、InputDecorationの引数「filled」にtrueを指定します。

TextFormField(
  decoration: InputDecoration(
    fillColor: /*背景色*/,
    filled: true,
  ),
),

InputDecorationを使えば、TextFormFieldの背景色を設定することが出来ます。

使用例

以下は、使用例です。

TextFormField(
  decoration: InputDecoration(
    fillColor: Colors.blue[100],
    filled: true,
  ),
),

コメント

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