im using a BarCode Scanner Terminal.
When Im Scanning the BarCode, Code automatically is written in the TextField.
I have a button that is saving data and displaying it below, but I want to remove the button and somehow make a check if Textfield is not empty or If I paste a code then do the following action ... (display data below as example). So every time I change data, it makes the action without PRESSING BUTTON
Any ideas how to do this or help will help me a lot, thanks.
CodePudding user response:
Surely you have a controller for your TextField, so you can check if the controller is empty or not, and you can do like this:
yourcontroller.text.isEmpty? Container() : YourButton(),
CodePudding user response:
You can save text in list when text is changed in TextFormField
List<String> strList =[];
TextFormField(
onChanged: (str){
if(str.isNotEmpty)
strList.add(str);
},
),
It can help you