我想设计一个按钮在Flutter,当它被按下它执行(Ctrl+P)的功能,就像键盘一样尝试在不使用任何库的情况下从 Flutter 卷筒纸打印到热敏打印机
mftmpeh81#
试试用你的纽扣包这个
RawKeyboardListener( focusNode: FocusNode(), onKey: (RawKeyEvent event) { if (event.isControlPressed && event.isKeyPressed(LogicalKeyboardKey.keyP)) { // Ctrl+P is pressed print('Ctrl+P is pressed'); // Perform your action here, such as showing a print dialog } }, child: Container( child: Text('Press Ctrl+P'), ), )
1条答案
按热度按时间mftmpeh81#
试试用你的纽扣包这个