floating_label_inputs
A Flutter package providing highly customizable text input fields with beautifully animated floating labels, inspired by modern design trends.
Preview

This package offers a FloatingAnimatedInput widget that enhances the standard TextFormField with:
- A label that smoothly animates to a "floating" position above the input field when focused or when text is entered.
- Extensive customization options for both the floating label and the text input field itself.
Features
- Animated Floating Label: Smooth transition for the label from placeholder to floating state.
- Customizable Label Appearance:
- Control text style for both normal and floated states.
- Set active text color for the floated label.
- Unique background color for the floated label.
- Padding and border radius for the floated label's background.
- Customizable TextFormField:
- Control overall widget height and width.
- Define input text style and cursor color.
- Set background fill color for the input area.
- Customize border radius for the input field.
- Specify border colors and styles (via
BorderSide) for enabled and focused states.
- Standard TextFormField Features: Integrates with
TextEditingController,FocusNode,validator,onChanged,autovalidateMode, etc.
Getting started
Add this to your package's pubspec.yaml file:
dependencies:
floating_label_inputs: ^0.1.0 # Replace with the latest version
Then, run flutter pub get in your terminal.
Usage
Import the package in your Dart file:
import 'package:floating_label_inputs/floating_label_inputs.dart';
Here's a basic example:
FloatingAnimatedInput(
labelText: 'Your Name',
// controller: _yourNameController, // Optional: for getting the value
// focusNode: _yourNameFocusNode, // Optional: for managing focus
)
Customization Options
The FloatingAnimatedInput widget offers numerous parameters for customization:
Label Customization:
labelText: (required) The text for the label.labelStyle:TextStylefor the label when it's acting as a placeholder.floatingLabelStyle: BaseTextStylefor the floated label (primarily for font size, letter spacing).floatingLabelActiveColor:Colorfor the text of the floated label.floatingLabelActiveBackgroundColor:Colorfor the background of the floated label.floatingLabelPadding:EdgeInsetsGeometryfor padding within the floated label's background.floatingLabelBorderRadius:BorderRadiusGeometryfor the floated label's background.
TextFormField Customization:
height:double?to set a fixed height for the widget. Note: If set, it's recommended to use a value that accommodates the font size and internal padding (e.g., at least45.0for default settings). The widget will internally clamp any explicitly set height to a minimum of45.0to prevent text clipping. If not provided, the widget sizes itself intrinsically.width:double?to set a fixed width for the widget.textStyle:TextStylefor the user input text.cursorColor:Colorfor the input cursor.fillColor:Colorfor the background of the input area (ensurefilled: trueinInputDecoration).textFieldBorderRadius:BorderRadiusGeometryfor the input field's border.enabledTextFieldBorderColor:Colorfor the border when the field is enabled but not focused.focusedTextFieldBorderColor:Colorfor the border when the field is focused.enabledTextFieldBorderSide:BorderSide?for more detailed control over the enabled border (width, style).focusedTextFieldBorderSide:BorderSide?for more detailed control over the focused border.
Example with more customization:
FloatingAnimatedInput(
labelText: 'Email Address',
height: 60,
textFieldBorderRadius: BorderRadius.circular(15.0),
focusedTextFieldBorderColor: Colors.deepPurpleAccent,
floatingLabelActiveBackgroundColor: Colors.deepPurpleAccent,
floatingLabelActiveColor: Colors.white,
floatingLabelPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
floatingLabelBorderRadius: BorderRadius.circular(4.0),
)
Additional information
- Issue Tracker: If you find a bug or have a feature request, please file an issue at
TODO: Link to your GitHub issues page if you create one. - Contributing: Contributions are welcome!.
This package is currently under development.