From 2baaf5c0bbbbf6098949595fdc24bd004ba036ca Mon Sep 17 00:00:00 2001 From: Hugo Pointcheval Date: Tue, 18 Apr 2023 09:33:00 +0200 Subject: [PATCH] feat(ui_kit): add more control over flat button prefix/suffix color --- .../flat_button/flat_button_screen.dart | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/packages/wyatt_ui_kit/lib/src/components/buttons/flat_button/flat_button_screen.dart b/packages/wyatt_ui_kit/lib/src/components/buttons/flat_button/flat_button_screen.dart index cffc95da..da65300f 100644 --- a/packages/wyatt_ui_kit/lib/src/components/buttons/flat_button/flat_button_screen.dart +++ b/packages/wyatt_ui_kit/lib/src/components/buttons/flat_button/flat_button_screen.dart @@ -169,7 +169,11 @@ class FlatButtonScreen extends CubitScreen { mainAxisSize: mainAxisSize ?? MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - if (style.foregroundColors?.color != null && + if (prefix != null && + (prefix is Icon?) && + ((prefix as Icon?)?.color != null)) ...[ + prefix! + ] else if (style.foregroundColors?.color != null && prefix != null) ...[ ColorFiltered( colorFilter: ColorFilter.mode( @@ -208,7 +212,21 @@ class FlatButtonScreen extends CubitScreen { ) ], Gap(style.padding?.vertical ?? 10), - if (style.foregroundColors?.color != null && + if (suffix != null && + (suffix is Icon?) && + ((suffix as Icon?)?.color != null)) ...[ + suffix! + ] else if (style.foregroundColors?.colors != null && + style.foregroundColors!.colors.isNotEmpty && + suffix != null) ...[ + ColorFiltered( + colorFilter: ColorFilter.mode( + style.foregroundColors!.colors.last, + BlendMode.srcIn, + ), + child: suffix, + ) + ] else if (style.foregroundColors?.color != null && suffix != null) ...[ ColorFiltered( colorFilter: ColorFilter.mode(