[DEV] Done with the text field testing.
This commit is contained in:
16
lib/Infrastructure/misc_extensions.dart
Normal file
16
lib/Infrastructure/misc_extensions.dart
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
extension TextAlignVerticalExtension on TextAlignVertical {
|
||||||
|
toAlignment() {
|
||||||
|
switch (this) {
|
||||||
|
case TextAlignVertical.top:
|
||||||
|
return Alignment.topCenter;
|
||||||
|
case TextAlignVertical.center:
|
||||||
|
return Alignment.center;
|
||||||
|
case TextAlignVertical.bottom:
|
||||||
|
return Alignment.bottomCenter;
|
||||||
|
default:
|
||||||
|
return Alignment.center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,7 +14,6 @@ class AstromicFieldConfiguration {
|
|||||||
final bool withObscurity;
|
final bool withObscurity;
|
||||||
final bool withAutomaticDirectionalitySwitching;
|
final bool withAutomaticDirectionalitySwitching;
|
||||||
final bool unfocusOnTapOutside;
|
final bool unfocusOnTapOutside;
|
||||||
final bool resetMessageOnChange;
|
|
||||||
//
|
//
|
||||||
final ui.TextDirection? hintDirection;
|
final ui.TextDirection? hintDirection;
|
||||||
final ui.TextDirection? textDirection;
|
final ui.TextDirection? textDirection;
|
||||||
@@ -34,7 +33,6 @@ class AstromicFieldConfiguration {
|
|||||||
this.withObscurity = false,
|
this.withObscurity = false,
|
||||||
this.withAutomaticDirectionalitySwitching = false,
|
this.withAutomaticDirectionalitySwitching = false,
|
||||||
this.unfocusOnTapOutside = false,
|
this.unfocusOnTapOutside = false,
|
||||||
this.resetMessageOnChange = false,
|
|
||||||
//
|
//
|
||||||
this.hintDirection,
|
this.hintDirection,
|
||||||
this.textDirection,
|
this.textDirection,
|
||||||
@@ -55,7 +53,6 @@ class AstromicFieldConfiguration {
|
|||||||
bool? withObscurity,
|
bool? withObscurity,
|
||||||
bool? withAutomaticDirectionalitySwitching,
|
bool? withAutomaticDirectionalitySwitching,
|
||||||
bool? unfocusOnTapOutside,
|
bool? unfocusOnTapOutside,
|
||||||
bool? resetMessageOnChange,
|
|
||||||
ui.TextDirection? hintDirection,
|
ui.TextDirection? hintDirection,
|
||||||
ui.TextDirection? textDirection,
|
ui.TextDirection? textDirection,
|
||||||
ui.TextDirection? messageDirection,
|
ui.TextDirection? messageDirection,
|
||||||
@@ -73,7 +70,6 @@ class AstromicFieldConfiguration {
|
|||||||
withObscurity: withObscurity ?? this.withObscurity,
|
withObscurity: withObscurity ?? this.withObscurity,
|
||||||
withAutomaticDirectionalitySwitching: withAutomaticDirectionalitySwitching ?? this.withAutomaticDirectionalitySwitching,
|
withAutomaticDirectionalitySwitching: withAutomaticDirectionalitySwitching ?? this.withAutomaticDirectionalitySwitching,
|
||||||
unfocusOnTapOutside: unfocusOnTapOutside ?? this.unfocusOnTapOutside,
|
unfocusOnTapOutside: unfocusOnTapOutside ?? this.unfocusOnTapOutside,
|
||||||
resetMessageOnChange: resetMessageOnChange ?? this.resetMessageOnChange,
|
|
||||||
hintDirection: hintDirection ?? this.hintDirection,
|
hintDirection: hintDirection ?? this.hintDirection,
|
||||||
textDirection: textDirection ?? this.textDirection,
|
textDirection: textDirection ?? this.textDirection,
|
||||||
messageDirection: messageDirection ?? this.messageDirection,
|
messageDirection: messageDirection ?? this.messageDirection,
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ class AstromicFieldStyle {
|
|||||||
final int? maxLength;
|
final int? maxLength;
|
||||||
//
|
//
|
||||||
final TextAlign textAlign;
|
final TextAlign textAlign;
|
||||||
|
|
||||||
|
/// Only works when it's a Text Area.
|
||||||
final TextAlignVertical textAlignVertical;
|
final TextAlignVertical textAlignVertical;
|
||||||
//
|
//
|
||||||
final EdgeInsetsGeometry contentPadding;
|
final EdgeInsetsGeometry contentPadding;
|
||||||
@@ -28,7 +30,6 @@ class AstromicFieldStyle {
|
|||||||
//s1 - Styling
|
//s1 - Styling
|
||||||
final TextStyle? hintStyle;
|
final TextStyle? hintStyle;
|
||||||
final TextStyle? textStyle;
|
final TextStyle? textStyle;
|
||||||
final TextStyle? messageStyle;
|
|
||||||
//s1 - MISC
|
//s1 - MISC
|
||||||
final InputBorder? border;
|
final InputBorder? border;
|
||||||
|
|
||||||
@@ -53,7 +54,6 @@ class AstromicFieldStyle {
|
|||||||
this.cursorColor,
|
this.cursorColor,
|
||||||
this.hintStyle,
|
this.hintStyle,
|
||||||
this.textStyle,
|
this.textStyle,
|
||||||
this.messageStyle,
|
|
||||||
//
|
//
|
||||||
this.border,
|
this.border,
|
||||||
});
|
});
|
||||||
@@ -78,7 +78,6 @@ class AstromicFieldStyle {
|
|||||||
Color? cursorColor,
|
Color? cursorColor,
|
||||||
TextStyle? hintStyle,
|
TextStyle? hintStyle,
|
||||||
TextStyle? textStyle,
|
TextStyle? textStyle,
|
||||||
TextStyle? messageStyle,
|
|
||||||
InputBorder? border,
|
InputBorder? border,
|
||||||
}) {
|
}) {
|
||||||
return AstromicFieldStyle(
|
return AstromicFieldStyle(
|
||||||
@@ -99,7 +98,6 @@ class AstromicFieldStyle {
|
|||||||
cursorColor: cursorColor ?? this.cursorColor,
|
cursorColor: cursorColor ?? this.cursorColor,
|
||||||
hintStyle: hintStyle ?? this.hintStyle,
|
hintStyle: hintStyle ?? this.hintStyle,
|
||||||
textStyle: textStyle ?? this.textStyle,
|
textStyle: textStyle ?? this.textStyle,
|
||||||
messageStyle: messageStyle ?? this.messageStyle,
|
|
||||||
border: border ?? this.border,
|
border: border ?? this.border,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import 'configuration.dart';
|
|||||||
import 'style.dart';
|
import 'style.dart';
|
||||||
//s2 MISC
|
//s2 MISC
|
||||||
import '../../../Infrastructure/insets_extension.dart';
|
import '../../../Infrastructure/insets_extension.dart';
|
||||||
|
import '../../../Infrastructure/misc_extensions.dart';
|
||||||
|
|
||||||
//!SECTION - Imports
|
//!SECTION - Imports
|
||||||
//
|
//
|
||||||
@@ -47,9 +48,9 @@ class AstromicTextField extends StatefulWidget {
|
|||||||
//s1 -- Content
|
//s1 -- Content
|
||||||
final String? hint;
|
final String? hint;
|
||||||
//
|
//
|
||||||
final Widget Function(bool isEnabled, bool isFocused, VoidCallback stateSetter)? prefixWidget;
|
final Widget? Function(bool isEnabled, bool isFocused, VoidCallback stateSetter)? prefixWidget;
|
||||||
final Widget Function(bool isEnabled, bool isFocused, VoidCallback stateSetter)? suffixWidget;
|
final Widget? Function(bool isEnabled, bool isFocused, VoidCallback stateSetter)? suffixWidget;
|
||||||
final Widget Function(bool isEnabled, bool isFocused)? messageBuilder;
|
final Widget? Function(bool isEnabled, bool isFocused)? messageBuilder;
|
||||||
//
|
//
|
||||||
final Iterable<ContextMenuButtonItem>? contextButtons;
|
final Iterable<ContextMenuButtonItem>? contextButtons;
|
||||||
//!SECTION
|
//!SECTION
|
||||||
@@ -89,7 +90,7 @@ class _AstromicTextFieldState extends State<AstromicTextField> {
|
|||||||
//s1 --Controllers
|
//s1 --Controllers
|
||||||
//
|
//
|
||||||
//s1 --State
|
//s1 --State
|
||||||
late bool _isEnabled;
|
// late bool widget.configuration.isEnabled;
|
||||||
final FocusNode _focusNode = FocusNode();
|
final FocusNode _focusNode = FocusNode();
|
||||||
late bool _isFocused;
|
late bool _isFocused;
|
||||||
//
|
//
|
||||||
@@ -109,7 +110,7 @@ class _AstromicTextFieldState extends State<AstromicTextField> {
|
|||||||
//s1 --Controllers & Listeners
|
//s1 --Controllers & Listeners
|
||||||
//
|
//
|
||||||
//s1 --State
|
//s1 --State
|
||||||
_isEnabled = widget.configuration.isEnabled;
|
// widget.configuration.isEnabled = widget.configuration.isEnabled;
|
||||||
_isFocused = false;
|
_isFocused = false;
|
||||||
//s1 --State
|
//s1 --State
|
||||||
//
|
//
|
||||||
@@ -139,6 +140,17 @@ class _AstromicTextFieldState extends State<AstromicTextField> {
|
|||||||
//!SECTION
|
//!SECTION
|
||||||
|
|
||||||
//SECTION - Stateless functions
|
//SECTION - Stateless functions
|
||||||
|
getTextHeight(String text, TextStyle style, ui.TextDirection direction) {
|
||||||
|
final span = TextSpan(text: text, style: style);
|
||||||
|
final tp = TextPainter(text: span, textDirection: direction);
|
||||||
|
tp.layout(maxWidth: double.infinity);
|
||||||
|
return tp.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-
|
||||||
|
//----------------------------------------------------------------
|
||||||
|
//-
|
||||||
|
|
||||||
ui.TextDirection finalTextDirection() {
|
ui.TextDirection finalTextDirection() {
|
||||||
ui.TextDirection fromLocale = intl.Bidi.isRtlLanguage(Localizations.localeOf(context).languageCode) ? ui.TextDirection.rtl : ui.TextDirection.ltr;
|
ui.TextDirection fromLocale = intl.Bidi.isRtlLanguage(Localizations.localeOf(context).languageCode) ? ui.TextDirection.rtl : ui.TextDirection.ltr;
|
||||||
//
|
//
|
||||||
@@ -169,9 +181,19 @@ class _AstromicTextFieldState extends State<AstromicTextField> {
|
|||||||
//
|
//
|
||||||
double borderOffset = widget.configuration.respectBorderWidthPadding ? style.border?.borderSide.strokeInset ?? 0.0 : 0.0;
|
double borderOffset = widget.configuration.respectBorderWidthPadding ? style.border?.borderSide.strokeInset ?? 0.0 : 0.0;
|
||||||
//
|
//
|
||||||
double fontOffset =
|
double fontOffset = getTextHeight(
|
||||||
((widget.textController.text.isNotEmpty ? widget.style(_isEnabled, _isFocused).textStyle : widget.style(_isEnabled, _isFocused).hintStyle) ?? const TextStyle(fontSize: 16)).fontSize! *
|
widget.textController.text.isNotEmpty
|
||||||
(((widget.textController.text.isNotEmpty ? widget.style(_isEnabled, _isFocused).textStyle : widget.style(_isEnabled, _isFocused).hintStyle) ?? const TextStyle(height: 1.0)).height!);
|
? widget.textController.text
|
||||||
|
: (widget.hint?.isNotEmpty ?? false)
|
||||||
|
? widget.hint!
|
||||||
|
: "",
|
||||||
|
widget.textController.text.isNotEmpty && widget.style(widget.configuration.isEnabled, _isFocused).textStyle != null
|
||||||
|
? widget.style(widget.configuration.isEnabled, _isFocused).textStyle!
|
||||||
|
: widget.style(widget.configuration.isEnabled, _isFocused).hintStyle != null
|
||||||
|
? widget.style(widget.configuration.isEnabled, _isFocused).hintStyle!
|
||||||
|
: const TextStyle(),
|
||||||
|
finalTextDirection(),
|
||||||
|
);
|
||||||
//
|
//
|
||||||
double finalVertical =
|
double finalVertical =
|
||||||
//-
|
//-
|
||||||
@@ -213,62 +235,79 @@ class _AstromicTextFieldState extends State<AstromicTextField> {
|
|||||||
isDense: true,
|
isDense: true,
|
||||||
hintTextDirection: widget.configuration.hintDirection ?? finalTextDirection(),
|
hintTextDirection: widget.configuration.hintDirection ?? finalTextDirection(),
|
||||||
//s1 -- Style
|
//s1 -- Style
|
||||||
filled: widget.style(_isEnabled, _isFocused).isFilled,
|
filled: widget.style(widget.configuration.isEnabled, _isFocused).isFilled,
|
||||||
fillColor: widget.style(_isEnabled, _isFocused).fillColor,
|
fillColor: widget.style(widget.configuration.isEnabled, _isFocused).fillColor,
|
||||||
//
|
//
|
||||||
hintStyle: widget.style(_isEnabled, _isFocused).hintStyle,
|
hintStyle: widget.style(widget.configuration.isEnabled, _isFocused).hintStyle,
|
||||||
//
|
//
|
||||||
enabledBorder: widget.style(_isEnabled, false).border,
|
enabledBorder: widget.style(widget.configuration.isEnabled, false).border,
|
||||||
focusedBorder: widget.style(_isEnabled, true).border,
|
focusedBorder: widget.style(widget.configuration.isEnabled, true).border,
|
||||||
disabledBorder: widget.style(_isEnabled, _isFocused).border,
|
disabledBorder: widget.style(widget.configuration.isEnabled, _isFocused).border,
|
||||||
errorBorder: widget.style(_isEnabled, false).border,
|
errorBorder: widget.style(widget.configuration.isEnabled, false).border,
|
||||||
focusedErrorBorder: widget.style(_isEnabled, true).border,
|
focusedErrorBorder: widget.style(widget.configuration.isEnabled, true).border,
|
||||||
//
|
//
|
||||||
errorStyle: const TextStyle(height: 0),
|
errorStyle: const TextStyle(height: 0),
|
||||||
contentPadding: finalVerticalPadding(widget.style(_isEnabled, _isFocused)),
|
contentPadding: finalVerticalPadding(widget.style(widget.configuration.isEnabled, _isFocused)),
|
||||||
//s1 -- Content
|
//s1 -- Content
|
||||||
hintText: widget.hint,
|
hintText: widget.hint,
|
||||||
//
|
//
|
||||||
prefixIcon: widget.prefixWidget != null
|
prefixIcon: widget.prefixWidget != null &&
|
||||||
|
widget.prefixWidget!(widget.configuration.isEnabled, _isFocused, () {
|
||||||
|
setState(() {});
|
||||||
|
}) !=
|
||||||
|
null
|
||||||
? Container(
|
? Container(
|
||||||
margin: EdgeInsetsDirectional.fromSTEB(
|
margin: EdgeInsetsDirectional.fromSTEB(widget.style(widget.configuration.isEnabled, _isFocused).prefixSpacing, 0,
|
||||||
widget.style(_isEnabled, _isFocused).prefixSpacing, 0, widget.style(_isEnabled, _isFocused).contentPadding.resolveToDirectional(finalTextDirection()).start, 0),
|
widget.style(widget.configuration.isEnabled, _isFocused).contentPadding.resolveToDirectional(finalTextDirection()).start, 0),
|
||||||
child: widget.prefixWidget!(_isEnabled, _isFocused, () {
|
child: widget.prefixWidget!(widget.configuration.isEnabled, _isFocused, () {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
: SizedBox(width: widget.style(_isEnabled, _isFocused).contentPadding.resolveToDirectional(finalTextDirection()).start),
|
: SizedBox(width: widget.style(widget.configuration.isEnabled, _isFocused).contentPadding.resolveToDirectional(finalTextDirection()).start),
|
||||||
//
|
//
|
||||||
prefixIconConstraints: widget.prefixWidget != null
|
prefixIconConstraints: widget.prefixWidget != null &&
|
||||||
? widget.style(_isEnabled, _isFocused).prefixSize != 0
|
widget.prefixWidget!(widget.configuration.isEnabled, _isFocused, () {
|
||||||
|
setState(() {});
|
||||||
|
}) !=
|
||||||
|
null
|
||||||
|
? widget.style(widget.configuration.isEnabled, _isFocused).prefixSize != 0
|
||||||
? BoxConstraints.expand(
|
? BoxConstraints.expand(
|
||||||
width: widget.style(_isEnabled, _isFocused).prefixSize +
|
width: widget.style(widget.configuration.isEnabled, _isFocused).prefixSize +
|
||||||
widget.style(_isEnabled, _isFocused).prefixSpacing +
|
widget.style(widget.configuration.isEnabled, _isFocused).prefixSpacing +
|
||||||
widget.style(_isEnabled, _isFocused).contentPadding.resolveToDirectional(finalTextDirection()).start,
|
widget.style(widget.configuration.isEnabled, _isFocused).contentPadding.resolveToDirectional(finalTextDirection()).start,
|
||||||
height: widget.style(_isEnabled, _isFocused).prefixSize,
|
height: widget.style(widget.configuration.isEnabled, _isFocused).prefixSize,
|
||||||
)
|
)
|
||||||
: const BoxConstraints.tightForFinite()
|
: const BoxConstraints.tightForFinite()
|
||||||
: BoxConstraints.tightForFinite(width: widget.style(_isEnabled, _isFocused).contentPadding.resolveToDirectional(finalTextDirection()).start),
|
: BoxConstraints.tightForFinite(width: widget.style(widget.configuration.isEnabled, _isFocused).contentPadding.resolveToDirectional(finalTextDirection()).start),
|
||||||
//
|
//
|
||||||
suffixIcon: widget.suffixWidget != null
|
suffixIcon: widget.suffixWidget != null &&
|
||||||
|
widget.suffixWidget!(widget.configuration.isEnabled, _isFocused, () {
|
||||||
|
setState(() {});
|
||||||
|
}) !=
|
||||||
|
null
|
||||||
? Container(
|
? Container(
|
||||||
margin: EdgeInsetsDirectional.fromSTEB(
|
margin: EdgeInsetsDirectional.fromSTEB(widget.style(widget.configuration.isEnabled, _isFocused).contentPadding.resolveToDirectional(finalTextDirection()).end, 0,
|
||||||
widget.style(_isEnabled, _isFocused).contentPadding.resolveToDirectional(finalTextDirection()).end, 0, widget.style(_isEnabled, _isFocused).suffixSpacing, 0),
|
widget.style(widget.configuration.isEnabled, _isFocused).suffixSpacing, 0),
|
||||||
child: widget.suffixWidget!(_isEnabled, _isFocused, () {
|
child: widget.suffixWidget!(widget.configuration.isEnabled, _isFocused, () {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
: SizedBox(width: widget.style(_isEnabled, _isFocused).contentPadding.resolveToDirectional(finalTextDirection()).end),
|
: SizedBox(width: widget.style(widget.configuration.isEnabled, _isFocused).contentPadding.resolveToDirectional(finalTextDirection()).end),
|
||||||
suffixIconConstraints: widget.suffixWidget != null
|
suffixIconConstraints: widget.suffixWidget != null &&
|
||||||
? widget.style(_isEnabled, _isFocused).suffixSize != 0
|
widget.suffixWidget != null &&
|
||||||
|
widget.suffixWidget!(widget.configuration.isEnabled, _isFocused, () {
|
||||||
|
setState(() {});
|
||||||
|
}) !=
|
||||||
|
null
|
||||||
|
? widget.style(widget.configuration.isEnabled, _isFocused).suffixSize != 0
|
||||||
? BoxConstraints.expand(
|
? BoxConstraints.expand(
|
||||||
width: widget.style(_isEnabled, _isFocused).suffixSize +
|
width: widget.style(widget.configuration.isEnabled, _isFocused).suffixSize +
|
||||||
widget.style(_isEnabled, _isFocused).suffixSpacing +
|
widget.style(widget.configuration.isEnabled, _isFocused).suffixSpacing +
|
||||||
widget.style(_isEnabled, _isFocused).contentPadding.resolveToDirectional(finalTextDirection()).end,
|
widget.style(widget.configuration.isEnabled, _isFocused).contentPadding.resolveToDirectional(finalTextDirection()).end,
|
||||||
height: widget.style(_isEnabled, _isFocused).suffixSize,
|
height: widget.style(widget.configuration.isEnabled, _isFocused).suffixSize,
|
||||||
)
|
)
|
||||||
: const BoxConstraints.tightForFinite()
|
: const BoxConstraints.tightForFinite()
|
||||||
: BoxConstraints.tightForFinite(width: widget.style(_isEnabled, _isFocused).contentPadding.resolveToDirectional(finalTextDirection()).end),
|
: BoxConstraints.tightForFinite(width: widget.style(widget.configuration.isEnabled, _isFocused).contentPadding.resolveToDirectional(finalTextDirection()).end),
|
||||||
);
|
);
|
||||||
//s1 --Contexted Widgets
|
//s1 --Contexted Widgets
|
||||||
//!SECTION
|
//!SECTION
|
||||||
@@ -284,9 +323,9 @@ class _AstromicTextFieldState extends State<AstromicTextField> {
|
|||||||
height: widget.configuration.isFixedHeight
|
height: widget.configuration.isFixedHeight
|
||||||
? !widget.configuration.isTextArea
|
? !widget.configuration.isTextArea
|
||||||
? null
|
? null
|
||||||
: widget.style(_isEnabled, _isFocused).fixedHeight
|
: widget.style(widget.configuration.isEnabled, _isFocused).fixedHeight
|
||||||
: null,
|
: null,
|
||||||
alignment: Alignment.center,
|
alignment: widget.style(widget.configuration.isEnabled, _isFocused).textAlignVertical.toAlignment(),
|
||||||
child: TextFormField(
|
child: TextFormField(
|
||||||
//s1 -- Functionality
|
//s1 -- Functionality
|
||||||
controller: _textController,
|
controller: _textController,
|
||||||
@@ -325,26 +364,26 @@ class _AstromicTextFieldState extends State<AstromicTextField> {
|
|||||||
obscureText: widget.configuration.withObscurity ? (widget.obscureText ?? false) : false,
|
obscureText: widget.configuration.withObscurity ? (widget.obscureText ?? false) : false,
|
||||||
inputFormatters: widget.inputFormatters,
|
inputFormatters: widget.inputFormatters,
|
||||||
//
|
//
|
||||||
minLines: widget.configuration.isFixedHeight && widget.configuration.isTextArea ? null : widget.style(_isEnabled, _isFocused).minLines,
|
minLines: widget.configuration.isFixedHeight && widget.configuration.isTextArea ? null : widget.style(widget.configuration.isEnabled, _isFocused).minLines,
|
||||||
maxLines: widget.configuration.isFixedHeight
|
maxLines: widget.configuration.isFixedHeight
|
||||||
? widget.configuration.isTextArea
|
? widget.configuration.isTextArea
|
||||||
? null
|
? null
|
||||||
: widget.style(_isEnabled, _isFocused).maxLines
|
: widget.style(widget.configuration.isEnabled, _isFocused).maxLines
|
||||||
: widget.style(_isEnabled, _isFocused).maxLines,
|
: widget.style(widget.configuration.isEnabled, _isFocused).maxLines,
|
||||||
|
|
||||||
//
|
//
|
||||||
maxLength: widget.style(_isEnabled, _isFocused).maxLength,
|
maxLength: widget.style(widget.configuration.isEnabled, _isFocused).maxLength,
|
||||||
maxLengthEnforcement: widget.configuration.maxLengthEnforcement,
|
maxLengthEnforcement: widget.configuration.maxLengthEnforcement,
|
||||||
//
|
//
|
||||||
expands: widget.configuration.isFixedHeight && widget.configuration.isTextArea ? true : false,
|
expands: widget.configuration.isFixedHeight && widget.configuration.isTextArea ? true : false,
|
||||||
// - Validation
|
// - Validation
|
||||||
validator: widget.validator != null ? (s) => widget.validator!(_isEnabled, _isFocused, s) : null,
|
validator: widget.validator != null ? (s) => widget.validator!(widget.configuration.isEnabled, _isFocused, s) : null,
|
||||||
// - Validation
|
// - Validation
|
||||||
//s1 -- Style
|
//s1 -- Style
|
||||||
style: widget.style(_isEnabled, _isFocused).textStyle,
|
style: widget.style(widget.configuration.isEnabled, _isFocused).textStyle,
|
||||||
cursorColor: widget.style(_isEnabled, _isFocused).cursorColor,
|
cursorColor: widget.style(widget.configuration.isEnabled, _isFocused).cursorColor,
|
||||||
textAlign: widget.style(_isEnabled, _isFocused).textAlign,
|
textAlign: widget.style(widget.configuration.isEnabled, _isFocused).textAlign,
|
||||||
textAlignVertical: widget.style(_isEnabled, _isFocused).textAlignVertical,
|
textAlignVertical: widget.style(widget.configuration.isEnabled, _isFocused).textAlignVertical,
|
||||||
//
|
//
|
||||||
//s1 -- Input Decoration
|
//s1 -- Input Decoration
|
||||||
decoration: inputDecoration,
|
decoration: inputDecoration,
|
||||||
@@ -362,7 +401,17 @@ class _AstromicTextFieldState extends State<AstromicTextField> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
widget.messageBuilder != null ? widget.messageBuilder!(_isEnabled, _isFocused) : Container()
|
widget.messageBuilder != null &&
|
||||||
|
widget.messageBuilder!(
|
||||||
|
widget.configuration.isEnabled,
|
||||||
|
_isFocused,
|
||||||
|
) !=
|
||||||
|
null
|
||||||
|
? Padding(
|
||||||
|
padding: widget.style(widget.configuration.isEnabled, _isFocused).messagePadding,
|
||||||
|
child: widget.messageBuilder!(widget.configuration.isEnabled, _isFocused) ?? Container(),
|
||||||
|
)
|
||||||
|
: Container()
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
//!SECTION
|
//!SECTION
|
||||||
|
|||||||
Reference in New Issue
Block a user