keyboard_detection 패키지는 하단 뷰 인셋을 모니터링함으로써 키보드 표시 여부를 간편하게 감지하는 Flutter 플러그인입니다. Android, iOS, Web, macOS, Windows, Linux 등 다양한 플랫폼에서 키보드가 나타나거나 사라질 때를 신뢰할 수 있는 방식으로 확인할 수 있도록 도와줍니다. 이는 입력 상호작용 중에 UI 레이아웃을 동적으로 조정하여 사용자 경험을 개선하는 데 도움이 됩니다. 기존의 Flutter 앱과 원활하게 통합되며 최소한의 설정만 필요합니다. 양식, 채팅 인터페이스 및 키보드 상태에 따라 반응형 레이아웃 조정이 필요한 모든 시나리오에서 특히 유용합니다.
사용 사례
동적 폼 레이아웃 조정
채팅 인터페이스 반응성
입력 필드 포커스 관리
모바일 및 데스크톱용 반응형 UI
키보드 겹침 처리
포커스된 필드로 자동 스크롤
주요 기능
하단 뷰 인셋을 통해 키보드 표시 여부를 감지합니다
크로스 플랫폼 지원 (Android, iOS, Web, macOS, Windows, Linux)
간단한 API 통합
실시간 키보드 상태 업데이트
필수 구성 최소화
물리 키보드와 화면 키보드 모두에서 작동
적합한 대상
입력 중심 앱을 개발하는 Flutter 개발자
적응형 UI 레이아웃을 필요로 하는 앱
다중 플랫폼을 대상으로 하는 개발자
동적 폼 또는 채팅 인터페이스를 갖춘 프로젝트
경량 키보드 감지가 필요한 팀
고려 사항
복잡한 중첩 스크롤 뷰에 대해 추가 처리가 필요할 수 있습니다
키보드 높이를 직접 측정하는 데 적합하지 않습니다
행동은 다양한 플랫폼 구현 간에 약간 다를 수 있습니다
Scaffold 또는 유사한 레이아웃 구조와 함께 사용하는 것이 가장 좋습니다
키보드 표시에 제한됨; 키보드 유형이나 언어를 감지하지 않음
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Keyboard Detection
Easily detect keyboard visibility in your Flutter app with this plugin. It leverages the resizing of the bottom view inset to determine keyboard visibility, ensuring a native Flutter experience.
keyboardDetectionController.state: Get the current keyboard visibility state as a KeyboardState enum.
keyboardDetectionController.stateAsBool([bool includeTransitionalState = false]): Get the keyboard visibility as a bool?. If includeTransitionalState is true, transitional states (visibling, hiding) are included.
keyboardDetectionController.addCallback(callback): Add a callback for state changes. Return true for repeated calls, false to stop.
keyboardDetectionController.stream: Listen to keyboard visibility changes as a stream.
keyboardDetectionController.size: Get the keyboard size. Use keyboardDetectionController.ensureSizeLoaded to ensure the size is loaded.
Limitations
This package uses the bottom inset to detect keyboard visibility, so it doesn't work with floating keyboards (Issue #1).
Contributions
Contributions and feedback are welcome! Feel free to open issues or submit pull requests.