updateDecoration method
void
updateDecoration(
- dynamic context
Implementation
void updateDecoration(context) {
if (!widget.autoUpdateDecoration) return;
onTextColor ??= Theme.of(context).primaryColor;
onClearTextColor ??= Theme.of(context).disabledColor;
widget.decoration = widget.decoration.copyWith(
errorText: widget.controller!.error,
errorStyle: widget.decoration.errorStyle != null
? widget.decoration.errorStyle!
.copyWith(color: Theme.of(context).colorScheme.error)
: TextStyle(color: Theme.of(context).colorScheme.error),
labelStyle: widget.decoration.labelStyle != null
? widget.decoration.labelStyle!
.copyWith(color: hasText ? onTextColor : onClearTextColor)
: TextStyle(color: hasText ? onTextColor : onClearTextColor),
disabledBorder: widget.decoration.disabledBorder != null
? widget.decoration.disabledBorder!.copyWith(
borderSide: BorderSide(
color: hasText ? onTextColor! : onClearTextColor!,
width: hasText ? 2 : 1,
))
: UnderlineInputBorder(
borderSide: BorderSide(
color: hasText ? onTextColor! : onClearTextColor!,
width: hasText ? 2 : 1,
)),
);
}