どうも、ちょげ(@chogetarou)です。
TextFormFieldの横幅の最大値を設定する方法を紹介します。
方法

TextFormFieldの横幅の最大値を設定するには、ConstrainedBoxを使います。
まず、TextFormFieldをConstrainedBoxでラップします。
次に、ConstrainedBoxの引数「constraints」にBoxConstraintsを指定します。
そして、BoxConstraintsの引数「maxWidth」に横幅の最大値を指定します。
ConstrainedBox(
constraints: BoxConstraints(
maxWidth: /*横幅の最大値*/,
),
child: TextFormField(),
),
これでTextFormFieldの横幅の最大値を設定できます。
使用例
以下は、使用例です。

ConstrainedBox(
constraints: BoxConstraints(
maxWidth: 200,
),
child: TextFormField(
decoration: InputDecoration(
border: OutlineInputBorder(),
),
),
),

[Flutter]TextFormFieldのバリデーションエラーテキストの色を設定するには?
TextFormFieldがバリデーションエラーを起こした時に表示されるテキストの色を設定する方法を紹介します。

[Flutter]TextFormFieldに枠線を付けるには?
TextFromFieldに枠線を付ける方法を紹介します。

[Flutter]TextFormFieldの左側にアイコンを表示するには?
TextFormFieldの左側にアイコンを表示する方法を紹介します。

[Flutter]TextFormFieldの右側にアイコンを表示するには?
TextFormFieldの右側にアイコンを表示する方法を紹介します。
コメント