テキストフィールドの境界線の色を変更できない 質問する

テキストフィールドの境界線の色を変更できない 質問する

TextFieldを使用しての境界線の色を変更しようとしていますBorderSideが、うまくいきません。

以下は私のコードです。

new TextField(
  decoration: new InputDecoration(
    border: new OutlineInputBorder(
      borderSide: new BorderSide(color: Colors.teal)
    ),
    hintText: 'Tell us about yourself',
    helperText: 'Keep it short, this is just a demo.',
    labelText: 'Life story',
    prefixIcon: const Icon(Icons.person, color: Colors.green,),
    prefixText: ' ',
    suffixText: 'USD',
    suffixStyle: const TextStyle(color: Colors.green)),
  )
)

結果のスクリーンショットを以下に示します。

ベストアンサー1

新しい方法は、enabledBorder次のように使用することです。

new TextField(
  decoration: new InputDecoration(
    enabledBorder: const OutlineInputBorder(
      borderSide: const BorderSide(color: Colors.grey, width: 0.0),
    ),
    focusedBorder: ...
    border: ...
  ),
)

おすすめ記事