child: KeyboardListener(
focusNode: _focusNode,
onKeyEvent: (KeyEvent event) {
if (event.runtimeType == KeyDownEvent) {
scanerIn += event.character.toString();
if (event.logicalKey.keyLabel == 'Enter') {
print("laststr:" + scanerIn);
scanerIn = '';
}
}
},
child: TextFormField(
controller: _controllerGoodsTitle,
showCursor: true,
readOnly: true,
maxLength: 50,
maxLines: 2, // 最大行数为5
cursorColor: Colors.pink,
onEditingComplete: () {},
decoration: const InputDecoration(
hintText: '请输入标题',
border: OutlineInputBorder(
borderSide: BorderSide(
style: BorderStyle.none,
),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.pink),
borderRadius:
BorderRadius.all(Radius.circular(16.0)),
),
focusColor: Colors.pink,
),
),
),