prepare keyboard
This commit is contained in:
parent
5d11700bdd
commit
adea49ee88
@ -79,7 +79,7 @@ class _HomePageState extends State<HomePage> {
|
|||||||
fontSize: 30,
|
fontSize: 30,
|
||||||
color: Color(0xFF00B6F0),
|
color: Color(0xFF00B6F0),
|
||||||
),
|
),
|
||||||
keyboardType: TextInputType.number,
|
// keyboardType: TextInputType.number,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: 'Remote ID',
|
labelText: 'Remote ID',
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
|
@ -23,6 +23,7 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
Timer _interval;
|
Timer _interval;
|
||||||
bool _showBar = true;
|
bool _showBar = true;
|
||||||
double _bottom = 0;
|
double _bottom = 0;
|
||||||
|
final FocusNode _focusNode = FocusNode();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -39,6 +40,7 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
|
_focusNode.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
FFI.close();
|
FFI.close();
|
||||||
_interval.cancel();
|
_interval.cancel();
|
||||||
@ -72,12 +74,19 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _handleKeyEvent(RawKeyEvent event) {
|
||||||
|
print('$event');
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// Size size = MediaQueryData.fromWindow(ui.window).size;
|
// Size size = MediaQueryData.fromWindow(ui.window).size;
|
||||||
// MediaQuery.of(context).size.height;
|
// MediaQuery.of(context).size.height;
|
||||||
EasyLoading.instance.loadingStyle = EasyLoadingStyle.light;
|
EasyLoading.instance.loadingStyle = EasyLoadingStyle.light;
|
||||||
return WillPopScope(
|
return RawKeyboardListener(
|
||||||
|
focusNode: _focusNode,
|
||||||
|
onKey: _handleKeyEvent,
|
||||||
|
child: WillPopScope(
|
||||||
onWillPop: () async {
|
onWillPop: () async {
|
||||||
close();
|
close();
|
||||||
return false;
|
return false;
|
||||||
@ -110,9 +119,11 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
IconButton(
|
IconButton(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
icon: Icon(Icons.keyboard),
|
icon: Icon(Icons.keyboard),
|
||||||
onPressed: () => SystemChannels.textInput
|
onPressed: () {
|
||||||
.invokeMethod('TextInput.show'),
|
SystemChannels.textInput
|
||||||
),
|
.invokeMethod('TextInput.show');
|
||||||
|
_focusNode.requestFocus();
|
||||||
|
}),
|
||||||
Transform.rotate(
|
Transform.rotate(
|
||||||
angle: 15 * math.pi / 180,
|
angle: 15 * math.pi / 180,
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
@ -159,7 +170,7 @@ class _RemotePageState extends State<RemotePage> {
|
|||||||
CursorPaint(),
|
CursorPaint(),
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
))));
|
)))));
|
||||||
}
|
}
|
||||||
|
|
||||||
void close() {
|
void close() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user