KeyboardUtil class
键盘工具类
使用示例:
class DemoController extends BaseController {
@override
void onInit() {
super.onInit();
// 初始化键盘管理器
KeyboardManager().init(Get.context!);
// 监听键盘状态
ever(KeyboardManager()._isKeyboardVisible, (isVisible) {
if (isVisible) {
// 键盘显示时的处理
handleKeyboardShow();
} else {
// 键盘隐藏时的处理
handleKeyboardHide();
}
});
}
void handleKeyboardShow() {
// 例如:调整UI布局
// 滚动到特定位置
// 显示或隐藏某些组件
}
void handleKeyboardHide() {
// 键盘隐藏时的处理逻辑
}
// 在需要时主动隐藏键盘
void hideKeyboard() {
KeyboardManager().hideKeyboard();
}
}
Constructors
- KeyboardUtil()
-
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isKeyboardVisible ↔ RxBool
-
getter/setter pair
- keyboardHeight ↔ RxDouble
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
hideKeyboard(
) → void -
init(
) → void -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onKeyboardHide(
) → void -
onKeyboardShow(
) → void -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → KeyboardUtil
-
no setter