Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: Container(
padding: const EdgeInsets.only(top: 16, left: 16, right: 16),
child: Container(
padding: const EdgeInsets.all(1.0),
child: FormBuilderPhoneField(
autovalidateMode: AutovalidateMode.onUserInteraction,
key: phoneNumberFieldKey,
maxLength: 10, //Adding this
name: 'phoneNumber',
priorityListByIsoCode: const ['US'],
titlePadding: EdgeInsets.zero,
keyboardType: TextInputType.phone,
focusNode: phoneNumberFocus,
textInputAction: TextInputAction.next,
iconSelector: const SizedBox(
width: 0,
height: 0,
),
decoration: const InputDecoration(
counterText: "", //This has no effect
labelText: "Phone Number",
contentPadding: EdgeInsets.symmetric(vertical: 7, horizontal: 16),
fillColor: Colors.white,
filled: true,
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black, width: 0.5),
borderRadius: BorderRadius.all(Radius.circular(
8.0) // <--- border radius here
),
),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.red, width: 0.5),
borderRadius: BorderRadius.all(Radius.circular(
8.0) // <--- border radius here
),
),
border: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black, width: 0.5),
borderRadius: BorderRadius.all(Radius.circular(
8.0) // <--- border radius here
),
),
focusedErrorBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.red, width: 0.5),
borderRadius: BorderRadius.all(Radius.circular(
8.0) // <--- border radius here
),
),
disabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black, width: 0.5),
borderRadius: BorderRadius.all(Radius.circular(
8.0) // <--- border radius here
),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.black, width: 0.5),
borderRadius: BorderRadius.all(Radius.circular(
8.0) // <--- border radius here
),
),
floatingLabelBehavior: FloatingLabelBehavior.auto,
),
validator: FormBuilderValidators.compose([
FormBuilderValidators.required(),
//FormBuilderValidators.numeric(),
]),
),
),
),
);