I am developing a flutter application with below process
I could able to scan and upload the first data. then I cleared the text. but i could not place the cursor at the _text controller.
I dont want to press the text field every time before scan the textfield.
TextField(
controller: _text,
textInputAction: TextInputAction.go,
onSubmitted: (value) {
print(submit online using function");
_text.clear();
_text.selection= TextSelection.collapsed(offset: -1);
},
decoration: const InputDecoration(
icon: Icon(Icons.person),
hintText: 'Enter ID',
labelText: 'Enter ID',
),
autofocus: true,
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[
WhitelistingTextInputFormatter.digitsOnly
],
),
TextFormField(
enabled: true,
autofocus: true,
autocorrect: false,
textInputAction: TextInputAction.done,
keyboardType: TextInputType.text,
focusNode: focusBarCode,
onFieldSubmitted: (val) {
print(val); // the scan value
//process the val
barCodecontroller.text =""; // set to blank again
focusBarCode.requestFocus();//set focus again, so u can
//scan again
`enter code here`},
controller: barCodecontroller,
),