홈>
키보드가
TextField
에서 제대로 작동하지 않습니다
.
아래 코드는 14 개의
TextField
를 넣었습니다.
, 그러나 예를 들어 필드 14에서 클릭하면 키보드가 나타나지 않고
TextField
아래에 있지 않습니다
탭했습니다.
이 키보드 문제가 표시되지 않고 선택한 필드에 표시되지 않도록 도와 주실 수 있습니까?
import 'package:flutter/material.dart';
void main() {
runApp(new MaterialApp(home: new HomePage()));
}
class HomePage extends StatefulWidget {
@override
HomePageState createState() => new HomePageState();
}
class HomePageState extends State<HomePage> {
final TextEditingController _controller = new TextEditingController();
@override
Widget build(BuildContext context) {
return new Scaffold(
body: new Stack(
children: <Widget>[
new ListView(
shrinkWrap: true,
children: <Widget>[
new TextField(
controller: _controller,
decoration: new InputDecoration(
hintText: 'Type something 1',
),
),
new TextField(
controller: _controller,
decoration: new InputDecoration(
hintText: 'Type something 2',
),
),
new TextField(
controller: _controller,
decoration: new InputDecoration(
hintText: 'Type something 3',
),
),
new TextField(
controller: _controller,
decoration: new InputDecoration(
hintText: 'Type something 4',
),
),
new TextField(
controller: _controller,
decoration: new InputDecoration(
hintText: 'Type something 5',
),
),
new TextField(
controller: _controller,
decoration: new InputDecoration(
hintText: 'Type something 6',
),
),
new TextField(
controller: _controller,
decoration: new InputDecoration(
hintText: 'Type something 7',
),
),
new TextField(
controller: _controller,
decoration: new InputDecoration(
hintText: 'Type something 8',
),
),
new TextField(
controller: _controller,
decoration: new InputDecoration(
hintText: 'Type something 9',
),
),
new TextField(
controller: _controller,
decoration: new InputDecoration(
hintText: 'Type something 10',
),
),
new TextField(
controller: _controller,
decoration: new InputDecoration(
hintText: 'Type something 11',
),
),
new TextField(
controller: _controller,
decoration: new InputDecoration(
hintText: 'Type something 12',
),
),
new TextField(
controller: _controller,
decoration: new InputDecoration(
hintText: 'Type something 13',
),
),
new TextField(
controller: _controller,
decoration: new InputDecoration(
hintText: 'Type something 14',
),
),
],
)
]
)
);
}
}
- 답변 # 1
- 답변 # 2
같은 문제가 있었지만 제 경우에는 Key 객체에있었습니다
await showDialog( context: context, barrierDismissible: false, builder: (context) { final _textKey = GlobalKey<FormState>(); TextEditingController controller = TextEditingController(); return AlertDialog( title: Text('Load conference'), content: Form( key: _textKey, child: TextFormField( controller: controller, validator: (str) { if (str.isEmpty) { return 'Empty url'; } else if (str.length >= 4 && str.substring(0, 4).toLowerCase() != 'http') { return 'Url has to start from \'http\''; } }, ), onChanged: () { if (controller.text.isNotEmpty) { _textKey.currentState.validate(); } }, ),
키 정적 클래스 필드를 만들어서 문제를 해결했습니다
static final _textKey = GlobalKey<FormState>();
- 답변 # 3
compileSdkVersion및targetSdkVersion을로 업데이트하는 Android앱 수준 gradle파일을 수정 한 후이 문제가 발생했습니다. 기본값에서 28(27) 기본 버전으로 유지하십시오. Google Play 스토어에서 Android 9 에뮬레이터에서 테스트하고있었습니다.
- 답변 # 4
오류를 재현 할 수 없었습니다. 모든 것이 제대로 작동하는 것 같습니다.Flutter SDK가 업데이트되었는지 확인 (
flutter doctor
실행) ). 오류가 지속되는지 확인하기 위해 대상 플랫폼을 IOS로 변경하려고 했습니까?
관련 자료
- networking - Wi-Fi와 LAN에 동시에 연결하면 PC가 두 개의 IP 주소 아래에 나타나는 것이 정상입니까?
- Android 사용자 정의 대화 상자에 키보드가 나타나지 않습니다
- android - 실룩 거리다 - textformfield를 선택할 때 키보드가 표시되지 않음
- android - 키보드가 플러터로 열리면 UI 오버플로
- dart - Flutter 앱의 ListView 스크롤에서 키보드 숨기기/해제
- controller - Flutter 키보드 완료 버튼으로 인해 텍스트 필드 내용이 파기 됨
- forms - 실룩 거리다 - 키보드가 나타날 때 텍스트가 어떻게 쌓이지 않습니까?
- dart - HTML 콘텐츠 내부의 비디오가 플러터에 나타나지 않습니다
- floating action button - 닫는 태그 아래 빨간색 선
- dart - 키보드를 열 때 Flutter의 오버플로 오류
- 키보드 팝업시 Flutter Google Maps 크기 조정
- dart - Flutter Text Color 테마가 ListTile 제목에서 작동하지 않습니다
- ios : 키보드 모양에서 Flutter 레이아웃을 애니메이션하는 방법
관련 질문
- flutter : 클래스 '미래 <동적>'은 인스턴스 메소드 '[]'이 없습니다. 실룩 거리다
- flutter : SvgPicture는 ImageProvider에 할당 할 수 없습니다
- flutter : 공급자가있는 펄터가있는 종속성 주입을 추가하는 방법
- 내 앱은 Firebase Plugins를 펄럭이로 업데이트하자마자 오류를 던졌습니다.
- flutter : 열의 마지막 항목을 아래로 가져 오는 방법
- flutter : <문자열>목록을 할당하는 방법 <문자열>펄럭이 는가요?
- Flutter : STATEFULWIDGET의 하위 클래스를 상속하여 특정 속성의 사용을 수정하는 방법은 무엇입니까?
- flutter : 새로운 펄터 프로젝트를 만들 수 없습니다
- flutter : 로컬 변수 'Basename'은 선언 /펄럭이기 전에 참조 할 수 없습니다.
- Android 에뮬레이터에서 가장 많은 텍스트가 누락되었습니다
모든 텍스트 필드가 동일한
TextEditingController
를 공유하지 않아야합니다 . 각각에 대해 별도의 컨트롤러를 사용하십시오.