Skip to content

Commit fea80f7

Browse files
added: FancyFromField documentation
1 parent 653bd7b commit fea80f7

File tree

4 files changed

+107
-2
lines changed

4 files changed

+107
-2
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 1.0.0+4
2+
- Added: FancyFromField documentation.
3+
14
## 1.0.0+3
25
- Fixed CHANGELOG.
36

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Add the package to your `pubspec.yaml`:
1616

1717
```yaml
1818
dependencies:
19-
fancy_form: ^1.0.0+3
19+
fancy_form: ^1.0.0+4
2020
```
2121
2222
Run `flutter pub get` to install.

lib/fancy_form_field.dart

+102
Original file line numberDiff line numberDiff line change
@@ -3,55 +3,156 @@ import 'package:flutter/material.dart';
33
import 'package:flutter/services.dart';
44
import 'package:mask_text_input_formatter/mask_text_input_formatter.dart';
55

6+
/// A custom form field widget that integrates with a form manager and offers various configurable input properties.
7+
///
8+
/// The `FancyFormField` widget allows you to customize the behavior and appearance of a text input field,
9+
/// including validation, input formatting, and styling.
610
class FancyFormField extends StatefulWidget {
11+
/// Controls the validation and auto-validation mode for the field.
712
final AutovalidateMode? autovalidateMode;
13+
14+
/// A unique key to identify this field in the form.
815
final FancyKey fancyKey;
16+
17+
/// The controller for the text input field.
918
final TextEditingController? controller;
19+
20+
/// Whether the field is enabled or not.
1021
final bool? enabled;
22+
23+
/// A forced error message to display instead of the default error messages.
1124
final String? forceErrorText;
25+
26+
/// The initial value of the field.
1227
final String? initialValue;
28+
29+
/// A callback that is invoked when the field value changes.
1330
final ValueChanged<String>? onChanged;
31+
32+
/// A callback that is invoked when the form is saved.
1433
final FormFieldSetter<String>? onSaved;
34+
35+
/// The restoration ID used to restore the state of the field.
1536
final String? restorationId;
37+
38+
/// A validator function that validates the field input.
1639
final FormFieldValidator<String>? validator;
40+
41+
/// A node that can be used to manage the focus state of the input field.
1742
final FocusNode? focusNode;
43+
44+
/// The decoration for the input field, such as label, hint, and icon.
1845
final InputDecoration? decoration;
46+
47+
/// The keyboard type (e.g., text, number, email).
1948
final TextInputType? keyboardType;
49+
50+
/// Controls text capitalization behavior for the field (e.g., none, sentences, words).
2051
final TextCapitalization textCapitalization;
52+
53+
/// The action button on the keyboard (e.g., next, done).
2154
final TextInputAction? textInputAction;
55+
56+
/// The text style for the input field.
2257
final TextStyle? style;
58+
59+
/// The style for the text strut (line height).
2360
final StrutStyle? strutStyle;
61+
62+
/// The text direction for the input field (e.g., left-to-right, right-to-left).
2463
final TextDirection? textDirection;
64+
65+
/// The alignment of the text within the field (e.g., left, right, center).
2566
final TextAlign textAlign;
67+
68+
/// The vertical alignment of the text within the field.
2669
final TextAlignVertical? textAlignVertical;
70+
71+
/// Whether the field should autofocus when the widget is built.
2772
final bool autofocus;
73+
74+
/// Whether the field is read-only.
2875
final bool readOnly;
76+
77+
/// Controls whether the cursor is visible in the field.
2978
final bool? showCursor;
79+
80+
/// The character to obscure the text when `obscureText` is enabled (e.g., `•`).
3081
final String obscuringCharacter;
82+
83+
/// Whether the field obscures the text (typically used for passwords).
3184
final bool obscureText;
85+
86+
/// Whether autocorrection is enabled for the field.
3287
final bool autocorrect;
88+
89+
/// A list of input formatters to apply to the input field.
3390
final List<TextInputFormatter>? inputFormatters;
91+
92+
/// Whether suggestions (e.g., predictive text) are enabled.
3493
final bool enableSuggestions;
94+
95+
/// The maximum number of lines that the input can occupy.
3596
final int? maxLines;
97+
98+
/// The minimum number of lines that the input can occupy.
3699
final int? minLines;
100+
101+
/// Whether the input should expand to fill the available space.
37102
final bool expands;
103+
104+
/// The maximum length of the input.
38105
final int? maxLength;
106+
107+
/// A callback that is triggered when the input field is tapped.
39108
final GestureTapCallback? onTap;
109+
110+
/// Whether the `onTap` callback should always be called.
40111
final bool onTapAlwaysCalled;
112+
113+
/// A callback that is triggered when tapping outside of the field.
41114
final TapRegionCallback? onTapOutside;
115+
116+
/// A callback that is triggered when editing is complete.
42117
final VoidCallback? onEditingComplete;
118+
119+
/// A callback that is triggered when the field value is submitted.
43120
final ValueChanged<String>? onFieldSubmitted;
121+
122+
/// The scroll physics to apply to the field's scrollable area.
44123
final ScrollPhysics? scrollPhysics;
124+
125+
/// The controller for the scrollable area of the field.
45126
final ScrollController? scrollController;
127+
128+
/// The width of the cursor in the input field.
46129
final double cursorWidth;
130+
131+
/// The height of the cursor in the input field.
47132
final double? cursorHeight;
133+
134+
/// The radius of the cursor.
48135
final Radius? cursorRadius;
136+
137+
/// The color of the cursor in the input field.
49138
final Color? cursorColor;
139+
140+
/// The color of the cursor when an error occurs.
50141
final Color? cursorErrorColor;
142+
143+
/// The appearance mode of the keyboard (e.g., light or dark).
51144
final Brightness? keyboardAppearance;
145+
146+
/// The padding for the scrollable area of the field.
52147
final EdgeInsets scrollPadding;
148+
149+
/// Whether to enable personalized learning for the IME (Input Method Editor).
53150
final bool enableIMEPersonalizedLearning;
151+
152+
/// Whether to allow interactive selection of the text in the input field.
54153
final bool? enableInteractiveSelection;
154+
155+
/// The clipping behavior for the input field.
55156
final Clip clipBehavior;
56157

57158
const FancyFormField({
@@ -111,6 +212,7 @@ class FancyFormField extends StatefulWidget {
111212
State<FancyFormField> createState() => _FancyFormFieldState();
112213
}
113214

215+
/// The state of the `FancyFormField` widget, managing the text input controller and input formatters.
114216
class _FancyFormFieldState extends State<FancyFormField> {
115217
late final TextEditingController controller;
116218
final List<TextInputFormatter> inputFormatters = [];

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: fancy_form
22
description: A flexible and easy-to-use form management solution for Flutter.
3-
version: 1.0.0+3
3+
version: 1.0.0+4
44
repository: https://github.com/MusilyApp/fancy_form.git
55

66
environment:

0 commit comments

Comments
 (0)