zdsSearchThemeData method
- ThemeData baseTheme,
- ZdsSearchFieldVariant variant,
- ZetaColors zetaColors
Gets default theme data for ZdsSearchField
Implementation
ThemeData zdsSearchThemeData(ThemeData baseTheme, ZdsSearchFieldVariant variant, ZetaColors zetaColors) {
final OutlineInputBorder border = OutlineInputBorder(
borderRadius: BorderRadius.circular(kSearchBorderRadius),
borderSide: const BorderSide(
style: BorderStyle.none,
),
);
InputDecorationTheme inputDecorationTheme(OutlineInputBorder border) {
return InputDecorationTheme(
border: border,
focusedBorder: border,
errorBorder: border,
enabledBorder: border,
disabledBorder: border,
focusedErrorBorder: border,
contentPadding: const EdgeInsets.symmetric(horizontal: 10, vertical: 10),
);
}
final CardTheme cardTheme = this.cardTheme.copyWith(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(kSearchBorderRadius),
),
);
switch (variant) {
case ZdsSearchFieldVariant.outlined:
return baseTheme.copyWith(
inputDecorationTheme: inputDecorationTheme(
border.copyWith(
borderSide: BorderSide(color: zetaColors.borderSubtle),
),
),
textSelectionTheme: TextSelectionThemeData(cursorColor: colorScheme.onSurface),
hintColor: colorScheme.onSurface.withOpacity(0.5),
cardTheme: cardTheme.copyWith(shadowColor: Colors.transparent),
);
case ZdsSearchFieldVariant.elevated:
return baseTheme.copyWith(
inputDecorationTheme: inputDecorationTheme(border),
textSelectionTheme: TextSelectionThemeData(
cursorColor: colorScheme.onSurface,
),
cardTheme: cardTheme,
hintColor: colorScheme.onSurface.withOpacity(0.5),
);
}
}