How I can input the text in the SplittedBox
of TextFieldForm
,
which consist of letters and numbers?
here is my source code:
Container(
color: Colors.grey[200],
padding: EdgeInsets.all(20),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Vehicle Number:",
style: TextStyle(
fontWeight: FontWeight.bold,
),
),
Padding(
padding: const EdgeInsets.all(10),
child: TextFormField(
controller: vehicleNo,
style: const TextStyle(
fontWeight: FontWeight.bold),
decoration: InputDecoration(
border: UnderlineInputBorder(
borderRadius:
BorderRadius.circular(5.0),
borderSide: const BorderSide(
width: 0,
style: BorderStyle.none,
),
),
fillColor: Colors.white,
filled: true,
//labelText: 'Vehicle Number.*',
contentPadding:
const EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 10.0),
),
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter vehicle number';
} else {
I write simple class for that:
you can customize that. easily you can use that like below:
d
isdigit
ands
isString
and after them you should write theirlength
and split by space.The output is like below: