-
TextFormField에 텍스트 형식 지정하기프로그래밍 공부 메모/flutter 2022. 12. 15. 23:31
허용된 형식의 텍스트만 입력 가능하게 만들기
inputFormatters 속성에 여러 가지 조건을 넣을 수 있다
FilteringTextInputFormatter.allow 함수에 정규화 형식을 작성!
TextFormField( controller: _quantityTextController, key: ValueKey('10'), style: TextStyle( color: color, fontSize: 18, ), keyboardType: TextInputType.number, maxLines: 1, enabled: true, //* input text 활성화 //* input text에 허용된 형식의 텍스트만 받기 inputFormatters: [ FilteringTextInputFormatter.allow( RegExp('[0-9].')), ], ),
반응형'프로그래밍 공부 메모 > flutter' 카테고리의 다른 글
provider with SharedPreferences같이 쓰기 (0) 2022.12.29 ExpansionPanel 펼치고 접기 (0) 2022.12.25 RotatedBox 클래스 (수직, 수평 방향 전환) (0) 2022.12.15 FittedBox 클래스(서로 다른 크기의 box를 합치기) (0) 2022.12.15 TapGestureRecognizer() (0) 2022.12.14