From e43571b397bb9c30f5d49b6aa685a02f58c8f201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malo=20L=C3=A9on?= Date: Tue, 21 Feb 2023 13:15:47 +0100 Subject: [PATCH] refactor(ui_kit): update textinput component using borderColors as Color --- .../example/lib/theme/text_input_theme.dart | 36 +++++-------------- .../text_inputs/text_input_screen.dart | 9 ++--- .../text_input_theme_resolver.dart | 9 +++-- 3 files changed, 14 insertions(+), 40 deletions(-) diff --git a/packages/wyatt_ui_kit/example/lib/theme/text_input_theme.dart b/packages/wyatt_ui_kit/example/lib/theme/text_input_theme.dart index 93e583f4..63b6dc41 100644 --- a/packages/wyatt_ui_kit/example/lib/theme/text_input_theme.dart +++ b/packages/wyatt_ui_kit/example/lib/theme/text_input_theme.dart @@ -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), diff --git a/packages/wyatt_ui_kit/lib/src/components/text_inputs/text_input_screen.dart b/packages/wyatt_ui_kit/lib/src/components/text_inputs/text_input_screen.dart index 0766f8c0..f7b3945b 100644 --- a/packages/wyatt_ui_kit/lib/src/components/text_inputs/text_input_screen.dart +++ b/packages/wyatt_ui_kit/lib/src/components/text_inputs/text_input_screen.dart @@ -273,15 +273,10 @@ class TextInputScreen extends CubitScreen { ? 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, ), diff --git a/packages/wyatt_ui_kit/lib/src/components/text_inputs/text_input_theme_resolver.dart b/packages/wyatt_ui_kit/lib/src/components/text_inputs/text_input_theme_resolver.dart index f421b762..62bd59f4 100644 --- a/packages/wyatt_ui_kit/lib/src/components/text_inputs/text_input_theme_resolver.dart +++ b/packages/wyatt_ui_kit/lib/src/components/text_inputs/text_input_theme_resolver.dart @@ -49,8 +49,7 @@ class TextInputThemeResolver extends ThemeResolver