TextField
A TextFormField wrapper with three border styles, validation, input formatting, and a built-in error state — the parameters mirror Flutter's own InputDecoration where it makes sense.
CLI
Install this component into your project:
textfield
$
flutter_beautify add textfieldVariants
FBTextField.outline() · FBTextField.filled() · FBTextField.underline() — the plain constructor forwards to .outline().
Key parameters
| Parameter | Type | Default |
|---|---|---|
label / hint | String? | — |
controller | TextEditingController? | — |
keyboardType | TextInputType | .text |
obscureText | bool | false |
validator | String? Function(String?)? | — |
prefixIcon / suffixIcon | Widget? | — |
errorText / isError | String? / bool? | — |
inputFormatters | List<TextInputFormatter>? | — |
Usage
dart
import 'package:your_app/widgets/textfield.dart';
FBTextField.outline(
label: 'Email',
keyboardType: TextInputType.emailAddress,
validator: (v) => v != null && v.contains('@') ? null : 'Invalid email',
);