zombie45
zombie's dev story
zombie45

공지사항

  • 분류 전체보기
    • iPhone
    • Study

인기 글

최근 댓글

최근 글

티스토리

반응형

블로그 메뉴

  • 홈
  • 태그
  • 미디어로그
  • 위치로그
  • 방명록
  • 글쓰기
전체 방문자
오늘
어제

태그

  • 티스토리챌린지
  • Animtaion
  • Box2d cocos2dx cocos2d-x
  • cache
  • Nodejs node express expressjs
  • intl
  • cspell
  • caching
  • 카카오 로그인
  • 안드로이드
  • code spell checker
  • actions
  • 큰파일
  • appDelegate
  • 자동배포
  • nextFocus
  • 오블완
  • Flutter
  • flutter l10n helper
  • TextInputAction
  • CI/CD
  • FocusScope
  • textformfield
  • UIViewController
  • jks
  • android_key_hash
  • flutter_localizations
  • 큰폴더
  • l10nization
  • cocoapods-binary-cache
hELLO · Designed By 정상우.
zombie45

zombie's dev story

Study

[Flutter] nextFocus가 이상한데로 이동할때

2021. 5. 29. 18:23

TextFormField Focus가 다음으로 넘어갈때 그냥

node.nextFocus() 하거나

textInputAction: TextInputAction.next 를 이용하면

포커스가 아이콘으로 이동해서 매번 삽질을 하게됩니다.

BuildContext extension을 만들어서 해결하면 잘됩니다.

TextFormField(
  hintText: "아이디",
  onEditingComplete: () => context.nextEditableTextFocus(),
  validator: (value) {
  return value == null || value.length < 6
	? "아이디를 6 글자 이상으로 해주세요"
	: null;
  },
),

 

extension Utility on BuildContext {
  void nextEditableTextFocus() {
    do {
      FocusScope.of(this).nextFocus();
    } while (FocusScope.of(this).focusedChild!.context!.widget is! EditableText);
  }
}



반응형
저작자표시 (새창열림)

'Study' 카테고리의 다른 글

안드로이드 invalid android_key_hash or ios_bundle_id or web_site_url  (0) 2021.07.02
안드로이드 keystore 비밀번호 변경  (0) 2021.06.04
Flutter iOS Fastlane 설정  (0) 2021.05.08
change git remote  (0) 2020.11.17
게임 개발  (0) 2016.07.30
    'Study' 카테고리의 다른 글
    • 안드로이드 invalid android_key_hash or ios_bundle_id or web_site_url
    • 안드로이드 keystore 비밀번호 변경
    • Flutter iOS Fastlane 설정
    • change git remote
    zombie45
    zombie45
    잡다한 개발

    티스토리툴바