InputControl class
Experimental !
Extends TextEditingController and adds functionality to match Control library.
Currently usable with InputField, InputFieldV1
and other TextFields...
- Inheritance
-
- Object
- ChangeNotifier
- ValueNotifier<
TextEditingValue> - TextEditingController
- InputControl
- Mixed in types
- Available Extensions
Constructors
- InputControl({String? text, String? regex})
Properties
- error ↔ String?
-
Error text message.
getter/setter pair
- focus → FocusNode
-
Lazy focus notifier. Should be passed to TextField.
no setter
- focusable → bool
-
Checks if focus node is attached to corresponding Widget.
no setter
- hasFocus → bool
-
Checks if corresponding Widget is focused.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isDoneMounted → bool
-
Checks if 'done' callback is set.
no setter
- isEmpty → bool
-
Check si text is not empty.
no setter
- isNextChained → bool
-
Checks if 'next' control is chained.
no setter
- isNotEmpty → bool
-
Checks if text is null or empty.
no setter
- isValid → bool
-
Checks text validity. Proceed during submit and validate.
no setter
- obscure ↔ bool
-
Checks if corresponding Widget is obscured.
getter/setter pair
- preferSoftDispose ↔ bool
-
requestDispose will execute softDispose. Useful for items in list and objects store in ControlFactory. Final dispose must be handled manually.
getter/setter pairinherited
- preventDispose ↔ bool
-
requestDispose do nothing if set. Final dispose must be handled manually.
getter/setter pairinherited
- regex → String?
-
Regex to validate.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selection ↔ TextSelection
-
The currently selected range within text.
getter/setter pairinherited
- text ↔ String
-
The current string the user is editing.
getter/setter pairinherited-getteroverride-setter
- value ↔ TextEditingValue
-
The current value stored in this notifier.
getter/setter pairinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
buildTextSpan(
{required BuildContext context, TextStyle? style, required bool withComposing}) → TextSpan -
Builds TextSpan from current editing value.
inherited
-
chainSubmit(
{bool all = false}) → void -
Submits first possible field with done event.
Submits whole chain if
all
is set. -
change(
String text) → void - Notifies changed event.
-
changed(
ValueCallback< String> onChanged) → InputControl - Sets callback to change event. Returns this control.
-
clean(
{bool validity = true}) → void - Cleans all variables and events.
-
clear(
) → void -
Set the value to empty.
inherited
-
clearComposing(
) → void -
Set the composing region to an empty range.
inherited
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
override
-
done(
VoidCallback onDone) → InputControl - Sets callback to submit event. Returns this control.
-
focusNext(
) → void - Sets focus to next possible Widget in chain.
-
next(
InputControl control) → InputControl -
Sets
control
to chain. Returns chainedcontrol
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
requestDispose(
[dynamic parent]) → void -
Executes dispose based on preventDispose and preferSoftDispose settings.
parent
- actual object that requesting dispose.inherited -
setFocus(
bool requestFocus) → void - Changes focus if corresponding Widget is focusable.
-
softDispose(
) → void -
Just soft dispose - stop loading / subscriptions etc.
For example called when List item hides and is recycled.
Also useful when Control is used with multiple Widgets to prevent fatal dispose.
override
-
submit(
[String? text]) → void -
Submits
text
and validate input. Sets focus to next 'control' if chained. -
toString(
) → String -
A string representation of this object.
inherited
-
unfocusChain(
) → void - Unfocus corresponding Widgets in continuous chain. Typically called on first item in chain. Check validateChain to also validate inputs.
-
validate(
) → bool - Validates text with regex if set. Returns 'true' if text matches regex.
-
validateChain(
{bool unfocus = true}) → bool -
Validates continuous chain. Typically called on first item in chain..
Set
unfocus
to unfocusChain - Unfocus corresponding Widgets in chain. Returns 'true' if all controls are valid. -
validity(
bool value) → void
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited