Dev/Flutter

Flutter - TextFormField

healthyryu 2023. 11. 22. 09:26

TextFormField

- 텍스트 정렬 :

  • textAlignt : TextAlign.center

- 글자수 제한

  • inputFormatters : [ LengthLimitingTextInputFormatter() ]

- Border 처리

  • decoration : InputDecoration( border : OutlineInputBorder() )

- Padding 처리

  • decoration : InputDecoration( contentPadding : EdgeInsets. )

 

예시)

TextFormField(
    textAlign: TextAlign.center,
    inputFormatters: [
      LengthLimitingTextInputFormatter(1),
    ],
    decoration: const InputDecoration(
      contentPadding: EdgeInsets.symmetric(vertical: 23),
      border: OutlineInputBorder(
          borderSide: BorderSide(color: Colors.black54),
          borderRadius: BorderRadius.zero),
    ),
  ),
반응형