refactor(ui_kit): update textinput component using borderColors as Color

This commit is contained in:
Malo Léon 2023-02-21 13:15:47 +01:00
parent 51672cc95a
commit f2b8c03dd7
3 changed files with 14 additions and 40 deletions

View File

@ -30,10 +30,7 @@ class TextInputTheme extends TextInputThemeExtension {
factory TextInputTheme.light() => TextInputTheme(
normalStyle: TextInputStyle(
radius: BorderRadius.circular(12),
borderColors: const MultiColor([
Color.fromRGBO(221, 224, 227, 1),
Color.fromRGBO(202, 204, 212, 1),
]),
borderColors: const Color.fromRGBO(221, 224, 227, 1),
labelStyle: GoogleFonts.montserrat(
fontWeight: FontWeight.w300,
color: const Color.fromRGBO(55, 65, 81, 1),
@ -45,10 +42,7 @@ class TextInputTheme extends TextInputThemeExtension {
),
focusedStyle: TextInputStyle(
radius: BorderRadius.circular(12),
borderColors: const MultiColor([
Color.fromRGBO(60, 125, 251, 1),
Color.fromRGBO(68, 109, 244, 1),
]),
borderColors: const Color.fromRGBO(60, 125, 251, 1),
labelStyle: GoogleFonts.montserrat(
fontWeight: FontWeight.w300,
color: const Color.fromRGBO(55, 65, 81, 1),
@ -60,10 +54,7 @@ class TextInputTheme extends TextInputThemeExtension {
),
errorStyle: TextInputStyle(
radius: BorderRadius.circular(12),
borderColors: const MultiColor([
Color.fromRGBO(251, 94, 60, 1),
Color.fromRGBO(244, 68, 100, 1),
]),
borderColors: const Color.fromRGBO(244, 68, 100, 1),
labelStyle: GoogleFonts.montserrat(
fontWeight: FontWeight.w300,
color: const Color.fromRGBO(244, 68, 100, 1),
@ -75,8 +66,7 @@ class TextInputTheme extends TextInputThemeExtension {
),
disableStyle: TextInputStyle(
radius: BorderRadius.circular(12),
borderColors:
const MultiColor.single(Color.fromRGBO(229, 231, 235, 1)),
borderColors: const Color.fromRGBO(229, 231, 235, 1),
labelStyle: GoogleFonts.montserrat(
fontWeight: FontWeight.w300,
color: const Color.fromRGBO(156, 163, 175, 1),
@ -91,9 +81,7 @@ class TextInputTheme extends TextInputThemeExtension {
factory TextInputTheme.dark() => TextInputTheme(
normalStyle: TextInputStyle(
radius: BorderRadius.circular(12),
borderColors: const MultiColor.single(
Color.fromRGBO(96, 101, 106, 1),
),
borderColors: const Color.fromRGBO(96, 101, 106, 1),
labelStyle: GoogleFonts.montserrat(
fontWeight: FontWeight.w300,
color: const Color.fromRGBO(204, 204, 204, 1),
@ -105,10 +93,7 @@ class TextInputTheme extends TextInputThemeExtension {
),
focusedStyle: TextInputStyle(
radius: BorderRadius.circular(12),
borderColors: const MultiColor([
Color.fromRGBO(60, 125, 251, 1),
Color.fromRGBO(68, 109, 244, 1),
]),
borderColors: const Color.fromRGBO(60, 125, 251, 1),
labelStyle: GoogleFonts.montserrat(
fontWeight: FontWeight.w300,
color: const Color.fromRGBO(204, 204, 204, 1),
@ -120,10 +105,7 @@ class TextInputTheme extends TextInputThemeExtension {
),
errorStyle: TextInputStyle(
radius: BorderRadius.circular(12),
borderColors: const MultiColor([
Color.fromRGBO(251, 94, 60, 1),
Color.fromRGBO(244, 68, 100, 1),
]),
borderColors: const Color.fromRGBO(244, 68, 100, 1),
labelStyle: GoogleFonts.montserrat(
fontWeight: FontWeight.w300,
color: const Color.fromRGBO(244, 68, 100, 1),
@ -135,9 +117,7 @@ class TextInputTheme extends TextInputThemeExtension {
),
disableStyle: TextInputStyle(
radius: BorderRadius.circular(12),
borderColors: const MultiColor.single(
Color.fromRGBO(96, 101, 106, 1),
),
borderColors: const Color.fromRGBO(96, 101, 106, 1),
labelStyle: GoogleFonts.montserrat(
fontWeight: FontWeight.w300,
color: const Color.fromRGBO(96, 101, 106, 1),

View File

@ -273,15 +273,10 @@ class TextInputScreen extends CubitScreen<TextInputCubit, TextInputState> {
? style.backgroundColors?.color
: null,
borderRadius: style.radius ?? BorderRadius.circular(4),
border: (style.borderColors?.isGradient ?? false) ||
(style.borderColors?.isColor ?? false)
border: (style.borderColors != null)
? Border.all(
width: 1.5,
color: (style.borderColors?.isGradient ?? false)
? style.borderColors!.colors.first
: (style.borderColors?.isColor ?? false)
? style.borderColors!.color
: Colors.transparent,
color: style.borderColors!,
)
: null,
),

View File

@ -49,8 +49,7 @@ class TextInputThemeResolver extends ThemeResolver<TextInputStyle,
Color? prefixIconColor = Theme.of(context).unselectedWidgetColor;
Color? suffixIconColor = Theme.of(context).unselectedWidgetColor;
MultiColor? borderColors =
MultiColor.single(Theme.of(context).unselectedWidgetColor);
Color? borderColors = Theme.of(context).unselectedWidgetColor;
MultiColor? backgroundColors;
BoxShadow? boxShadow;
@ -68,7 +67,7 @@ class TextInputThemeResolver extends ThemeResolver<TextInputStyle,
suffixStyle?.copyWith(color: Theme.of(context).disabledColor);
inputStyle =
inputStyle?.copyWith(color: Theme.of(context).disabledColor);
borderColors = MultiColor.single(Theme.of(context).disabledColor);
borderColors = Theme.of(context).disabledColor;
prefixIconColor = Theme.of(context).disabledColor;
suffixIconColor = Theme.of(context).disabledColor;
@ -78,7 +77,7 @@ class TextInputThemeResolver extends ThemeResolver<TextInputStyle,
prefixIconColor = context.colorScheme.primary;
suffixIconColor = context.colorScheme.primary;
iconColor = context.colorScheme.primary;
borderColors = MultiColor.single(context.colorScheme.primary);
borderColors = context.colorScheme.primary;
labelStyle = labelStyle?.copyWith(color: context.colorScheme.primary);
break;
case ControlState.hovered:
@ -95,7 +94,7 @@ class TextInputThemeResolver extends ThemeResolver<TextInputStyle,
case StatusState.error:
labelStyle = context.textTheme.labelLarge
?.copyWith(color: context.colorScheme.error);
borderColors = MultiColor.single(context.colorScheme.error);
borderColors = context.colorScheme.error;
break;
case StatusState.initial:
break;