AnimatedHintTextField class
A custom animated hint text field widget that rotates through a list of hint texts.
This widget provides an animated text field where the hint text cycles through them with fade and slide animations. It supports various customization options for text appearance, text field borders, and animation effects.
Example Usage:
AnimatedHintTextField(
controller: _controller,
hintTexts: ['Hint 1', 'Hint 2', 'Hint 3'],
)
Properties:
- controller: A TextEditingController to manage the text field input.
- hintTexts: A list of strings to be used as hint texts. The widget will cycle through them with animation.
- animationDuration: Duration of the animation for switching hint texts (default is 500 ms).
- switchDuration: Duration for how long each hint text is displayed before switching (default is 2 seconds).
- style: The style for the text input (optional).
- hintStyle: The style for the hint text (optional).
- hintTextColor: The color of the hint text (optional).
- focusedBorderColor: The border color when the text field is focused (optional).
- unfocusedBorderColor: The border color when the text field is not focused (optional).
- borderRadius: The radius of the text field's border (default is 8.0).
- decoration: Custom decoration for the text field (optional).
- maxLines: The maximum number of lines for the text field (default is 1).
- minLines: The minimum number of lines for the text field (default is 1).
- hintAlignment: The alignment of the hint text inside the text field (default is Alignment.centerLeft).
- contentPadding: Padding inside the text field (default is EdgeInsets.all(12.0)).
- enableAnimation: Whether to enable hint text animation (default is true).
- animationCurve: The curve for the animation (default is Curves.easeInOut).
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- AnimatedHintTextField
Constructors
-
AnimatedHintTextField({required TextEditingController controller, required List<
String> hintTexts, Duration animationDuration = const Duration(milliseconds: 500), Duration switchDuration = const Duration(seconds: 2), TextStyle? style, TextStyle? hintStyle, Color? hintTextColor, Color? focusedBorderColor, Color? unfocusedBorderColor, double borderRadius = 8.0, InputDecoration? decoration, int maxLines = 1, int minLines = 1, Alignment hintAlignment = Alignment.centerLeft, EdgeInsetsGeometry contentPadding = const EdgeInsets.all(12.0), bool enableAnimation = true, Curve animationCurve = Curves.easeInOut, FocusNode? focusNode, EdgeInsetsGeometry? hintPadding, VoidCallback? onTapOutside, Key? key}) -
Creates an AnimatedHintTextField widget with the provided properties.
const
Properties
- animationCurve → Curve
-
The curve for the animation.
final
- animationDuration → Duration
-
The duration of the animation for switching between hint texts.
final
- borderRadius → double
-
The border radius of the text field.
final
- contentPadding → EdgeInsetsGeometry
-
The padding for the content inside the text field.
final
- controller → TextEditingController
-
The controller for managing the text field input.
final
- decoration → InputDecoration?
-
The decoration for the text field.
final
- enableAnimation → bool
-
Whether to enable the animation for switching hint texts.
final
- focusedBorderColor → Color?
-
The color of the border when the text field is focused.
final
- focusNode → FocusNode?
-
The focus node for the text field.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hintAlignment → Alignment
-
The alignment of the hint text within the text field.
final
- hintPadding → EdgeInsetsGeometry?
-
The padding for the hint text.
final
- hintStyle → TextStyle?
-
The style for the hint text.
final
- hintTextColor → Color?
-
The color of the hint text.
final
-
hintTexts
→ List<
String> -
The list of hint texts to rotate through.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- maxLines → int
-
The maximum number of lines for the text field.
final
- minLines → int
-
The minimum number of lines for the text field.
final
- onTapOutside → VoidCallback?
-
Callback function to be triggered when tapping outside the text field.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- style → TextStyle?
-
The style for the text field's text.
final
- switchDuration → Duration
-
The duration for how long each hint text is displayed before switching.
final
- unfocusedBorderColor → Color?
-
The color of the border when the text field is not focused.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → _AnimatedHintTextFieldState -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited