TTextFieldTheme.defaultTheme constructor

TTextFieldTheme.defaultTheme(
  1. ColorScheme colors
)

Implementation

factory TTextFieldTheme.defaultTheme(ColorScheme colors) {
  final baseTheme = TInputFieldTheme.defaultTheme(colors);

  return TTextFieldTheme(
    size: baseTheme.size,
    decorationType: baseTheme.decorationType,
    color: baseTheme.color,
    backgroundColor: baseTheme.backgroundColor,
    borderColor: baseTheme.borderColor,
    labelStyle: baseTheme.labelStyle,
    helperTextStyle: baseTheme.helperTextStyle,
    errorTextStyle: baseTheme.errorTextStyle,
    tagStyle: baseTheme.tagStyle,
    decoration: baseTheme.decoration,
    borderRadius: baseTheme.borderRadius,
    borderWidth: baseTheme.borderWidth,
    labelBuilder: baseTheme.labelBuilder,
    helperTextBuilder: baseTheme.helperTextBuilder,
    errorsBuilder: baseTheme.errorsBuilder,
    preWidget: baseTheme.preWidget,
    postWidget: baseTheme.postWidget,
    height: baseTheme.height,
    padding: baseTheme.padding,
    fontSize: baseTheme.fontSize,
    textStyle: WidgetStateProperty.resolveWith((states) {
      final isDisabled = states.contains(WidgetState.disabled);
      return TextStyle(
        fontSize: baseTheme.fieldFontSize,
        color: isDisabled ? colors.onSurfaceVariant : colors.onSurface,
      );
    }),
    hintStyle: WidgetStateProperty.all(
      TextStyle(
        fontSize: baseTheme.fieldFontSize,
        color: colors.onSurfaceVariant.withAlpha(150),
      ),
    ),
  );
}