themeStyleOf method

TextFieldTheme themeStyleOf(
  1. BuildContext context
)

Implementation

TextFieldTheme themeStyleOf(BuildContext context) {
  final theme = Theme.of(context);
  final formTheme = FormTheme.of(context);
  final fieldTheme = formTheme.textTheme;
  final resolver = FieldThemeResolver(theme, formTheme, fieldTheme);
  final cleanTheme = fieldTheme.clearSuffixButtonTheme;
  final obscureTheme = fieldTheme.obscureSuffixButtonTheme;

  return TextFieldTheme(
    decorationTheme: resolver.decorationTheme,
    textStyle: textStyle ?? resolver.textStyle,
    textColor: textColor ?? resolver.textColor,
    textAlign: textAlign ?? fieldTheme.textAlign ?? TextAlign.start,
    clearSuffixButtonTheme: ClearSuffixButtonTheme(
      visibleWithoutValue: cleanTheme.visibleWithoutValue ??
          formTheme.clearSuffixButtonTheme.visibleWithoutValue ??
          true,
      appearDuration: cleanTheme.appearDuration,
      // ignore: deprecated_member_use_from_same_package
      icon: clearTextIcon ?? cleanTheme.icon ?? fieldTheme.clearIcon,
    ),
    obscureSuffixButtonTheme: ObscureSuffixButtonTheme(
      trueIcon: obscureTextTrueIcon ??
          obscureTheme.trueIcon ??
          // ignore: deprecated_member_use_from_same_package
          fieldTheme.obscureTrueIcon,
      falseIcon: obscureTextFalseIcon ??
          obscureTheme.falseIcon ??
          // ignore: deprecated_member_use_from_same_package
          fieldTheme.obscureFalseIcon,
    ),
    suggestionsTextStyle: fieldTheme.suggestionsTextStyle ??
        theme.textTheme.titleMedium!.copyWith(
          color: ThemeData.estimateBrightnessForColor(theme.canvasColor) ==
                  Brightness.dark
              ? Colors.white
              : Colors.grey[800],
        ),
  );
}