'format all textfields the same in flutter
I'm trying to learn Flutter. I have the below TextField setup as I would like it, I could copy and paste all the settings/properties for each TextField in the app, however is there a better way to make all of the TextFields have the same setting/properties?
Flexible(
child: Padding(
padding: EdgeInsets.all(20.0),
child: TextField(
maxLength: 5,
maxLengthEnforcement: MaxLengthEnforcement.enforced,
keyboardType: TextInputType.numberWithOptions(decimal: true, signed: false, ),
inputFormatters: [
FilteringTextInputFormatter.allow(RegExp(r"[0-9.]"))],
//keyboardType: TextInputType.number,
decoration: InputDecoration(
labelStyle: TextStyle(color: Colors.black,
fontStyle: FontStyle.normal, fontSize: 20, fontWeight: FontWeight.bold ),
floatingLabelAlignment: FloatingLabelAlignment.center,
//border: OutlineInputBorder(),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(45),
),
floatingLabelBehavior: FloatingLabelBehavior.always,
labelText: 'Empty Weight',
filled: true,
fillColor: Colors.grey[350],
),
),
),
),
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
