|
@@ -32,23 +32,23 @@ class FlowyKeyboard extends StatefulWidget {
|
|
|
|
|
|
class _FlowyKeyboardState extends State<FlowyKeyboard>
|
|
|
with FlowyKeyboardService {
|
|
|
- final FocusNode focusNode = FocusNode(debugLabel: 'flowy_keyboard_service');
|
|
|
+ final FocusNode _focusNode = FocusNode(debugLabel: 'flowy_keyboard_service');
|
|
|
|
|
|
bool isFocus = true;
|
|
|
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
return Focus(
|
|
|
- focusNode: focusNode,
|
|
|
- autofocus: true,
|
|
|
+ focusNode: _focusNode,
|
|
|
onKey: _onKey,
|
|
|
+ onFocusChange: _onFocusChange,
|
|
|
child: widget.child,
|
|
|
);
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
void dispose() {
|
|
|
- focusNode.dispose();
|
|
|
+ _focusNode.dispose();
|
|
|
|
|
|
super.dispose();
|
|
|
}
|
|
@@ -56,13 +56,17 @@ class _FlowyKeyboardState extends State<FlowyKeyboard>
|
|
|
@override
|
|
|
void enable() {
|
|
|
isFocus = true;
|
|
|
- focusNode.requestFocus();
|
|
|
+ _focusNode.requestFocus();
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
void disable() {
|
|
|
isFocus = false;
|
|
|
- focusNode.unfocus();
|
|
|
+ _focusNode.unfocus();
|
|
|
+ }
|
|
|
+
|
|
|
+ void _onFocusChange(bool value) {
|
|
|
+ debugPrint('[KeyBoard Service] focus change $value');
|
|
|
}
|
|
|
|
|
|
KeyEventResult _onKey(FocusNode node, RawKeyEvent event) {
|