-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Closed
Copy link
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsplatform-androidAndroid applications specificallyAndroid applications specificallyplatform-iosiOS applications specificallyiOS applications specifically
Description
Now our unfocus signal always sends from framework side. But when platform side close the keyboard, we should sync this state to framework side and unfoucs the FocusNode to let UI state correct.
Now on flutter master channel:
Demo code
void main() {
runApp(const MyApp());
}
class KeyboardPage extends StatefulWidget {
const KeyboardPage({Key? key}) : super(key: key);
@override
State<KeyboardPage> createState() => _KeyboardPageState();
}
class _KeyboardPageState extends State<KeyboardPage> {
FocusNode node = FocusNode();
@override
void initState() {
super.initState();
node.addListener(() {
setState(() {});
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
node.hasFocus ? 'focus' : 'unfocus',
style: const TextStyle(fontSize: 26, color: Colors.black),
),
CupertinoTextField(
focusNode: node,
decoration: const BoxDecoration(color: Colors.red),
)
],
),
);
}
}| iPhone | iPad | Android |
|---|---|---|
![]() |
![]() |
Screenrecorder-2023-03-27-15-17-18-568.mp4 |
TODO PRs:
Flutter framework PR:
iOS engine PR:
Android engine PR
Metadata
Metadata
Assignees
Labels
P1High-priority issues at the top of the work listHigh-priority issues at the top of the work lista: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsplatform-androidAndroid applications specificallyAndroid applications specificallyplatform-iosiOS applications specificallyiOS applications specifically

