From 8be4efbb52d1a22f89dac19324e78aa26feb0499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malo=20L=C3=A9on?= Date: Mon, 28 Aug 2023 14:19:36 +0200 Subject: [PATCH] refactor(ui_kit): Refactored code using the UI components package, due to breaking changes --- .../cards/portfolio_card/portfolio_cards.dart | 56 +++++++++---------- .../lib/cards/pricing_card/pricing_cards.dart | 52 ++++++++--------- .../features/wyatt_component_theme_data.dart | 35 ++++++------ 3 files changed, 71 insertions(+), 72 deletions(-) diff --git a/packages/wyatt_ui_kit/example/lib/cards/portfolio_card/portfolio_cards.dart b/packages/wyatt_ui_kit/example/lib/cards/portfolio_card/portfolio_cards.dart index 0b478d87..60df8268 100644 --- a/packages/wyatt_ui_kit/example/lib/cards/portfolio_card/portfolio_cards.dart +++ b/packages/wyatt_ui_kit/example/lib/cards/portfolio_card/portfolio_cards.dart @@ -30,13 +30,13 @@ class PortfolioCards extends StatelessWidget { 'quis elit ut amet velit. Incididunt fugiat proident ' 'proident deserunt tempor Lorem cillum qui do '), ctas: [ - context.components.flatButtonComponent.call( - label: const TextWrapper('En savoir plus'), - suffix: const Icon( - Icons.arrow_forward_ios, - size: 15, - ), - ), + context.components.flatButtonComponent().call( + label: const TextWrapper('En savoir plus'), + suffix: const Icon( + Icons.arrow_forward_ios, + size: 15, + ), + ), ], assets: [ Image.asset( @@ -65,13 +65,13 @@ class PortfolioCards extends StatelessWidget { 'quis elit ut amet velit. Incididunt fugiat proident ' 'proident deserunt tempor Lorem cillum qui do '), ctas: [ - context.components.flatButtonComponent.call( - label: const TextWrapper('En savoir plus'), - suffix: const Icon( - Icons.arrow_forward_ios, - size: 15, - ), - ), + context.components.flatButtonComponent().call( + label: const TextWrapper('En savoir plus'), + suffix: const Icon( + Icons.arrow_forward_ios, + size: 15, + ), + ), ], assets: [ Image.asset( @@ -100,13 +100,13 @@ class PortfolioCards extends StatelessWidget { 'quis elit ut amet velit. Incididunt fugiat proident ' 'proident deserunt tempor Lorem cillum qui do '), ctas: [ - context.components.flatButtonComponent.call( - label: const TextWrapper('En savoir plus'), - suffix: const Icon( - Icons.arrow_forward_ios, - size: 15, - ), - ), + context.components.flatButtonComponent().call( + label: const TextWrapper('En savoir plus'), + suffix: const Icon( + Icons.arrow_forward_ios, + size: 15, + ), + ), ], assets: [ Image.asset( @@ -145,13 +145,13 @@ class PortfolioCards extends StatelessWidget { 'quis elit ut amet velit. Incididunt fugiat proident ' 'proident deserunt tempor Lorem cillum qui do '), ctas: [ - context.components.flatButtonComponent.call( - label: const TextWrapper('En savoir plus'), - suffix: const Icon( - Icons.arrow_forward_ios, - size: 15, - ), - ), + context.components.flatButtonComponent().call( + label: const TextWrapper('En savoir plus'), + suffix: const Icon( + Icons.arrow_forward_ios, + size: 15, + ), + ), ], assets: [ Image.asset( diff --git a/packages/wyatt_ui_kit/example/lib/cards/pricing_card/pricing_cards.dart b/packages/wyatt_ui_kit/example/lib/cards/pricing_card/pricing_cards.dart index f2c67a31..35c46db5 100644 --- a/packages/wyatt_ui_kit/example/lib/cards/pricing_card/pricing_cards.dart +++ b/packages/wyatt_ui_kit/example/lib/cards/pricing_card/pricing_cards.dart @@ -73,20 +73,20 @@ class PricingCards extends StatelessWidget { ), ), ], - cta: context.components.flatButtonComponent.call( - label: const TextWrapper( - 'Contactez-nous', - style: TextStyle(color: Colors.white), - ), - normalStyle: FlatButtonThemeExtensionImpl.dark( - theme: Theme.of(context), - ).normalStyle?.copyWith( - backgroundColors: - const MultiColor(Constants.blueBtnGradient), - borderColors: - const MultiColor(Constants.blueBtnGradient), + cta: context.components.flatButtonComponent().call( + label: const TextWrapper( + 'Contactez-nous', + style: TextStyle(color: Colors.white), ), - ), + normalStyle: FlatButtonThemeExtensionImpl.dark( + theme: Theme.of(context), + ).normalStyle?.copyWith( + backgroundColors: + const MultiColor(Constants.blueBtnGradient), + borderColors: + const MultiColor(Constants.blueBtnGradient), + ), + ), ), const Gap(20), PricingCard( @@ -130,20 +130,20 @@ class PricingCards extends StatelessWidget { ), ), ], - cta: context.components.flatButtonComponent.call( - label: const TextWrapper( - 'Contactez-nous', - style: TextStyle(color: Colors.white), - ), - normalStyle: FlatButtonThemeExtensionImpl.dark( - theme: Theme.of(context), - ).normalStyle?.copyWith( - backgroundColors: - const MultiColor(Constants.purpleGradient), - borderColors: - const MultiColor(Constants.purpleGradient), + cta: context.components.flatButtonComponent().call( + label: const TextWrapper( + 'Contactez-nous', + style: TextStyle(color: Colors.white), ), - ), + normalStyle: FlatButtonThemeExtensionImpl.dark( + theme: Theme.of(context), + ).normalStyle?.copyWith( + backgroundColors: + const MultiColor(Constants.purpleGradient), + borderColors: + const MultiColor(Constants.purpleGradient), + ), + ), ), ], ), diff --git a/packages/wyatt_ui_kit/lib/src/features/wyatt_component_theme_data.dart b/packages/wyatt_ui_kit/lib/src/features/wyatt_component_theme_data.dart index cc809d17..e521bc80 100644 --- a/packages/wyatt_ui_kit/lib/src/features/wyatt_component_theme_data.dart +++ b/packages/wyatt_ui_kit/lib/src/features/wyatt_component_theme_data.dart @@ -22,23 +22,22 @@ import 'package:wyatt_ui_kit/wyatt_ui_kit.dart'; /// {@endtemplate} abstract class WyattComponentThemeData { /// {@macro wyatt_component_theme_data} - static const ComponentThemeData wyattComponentThemeData = - ComponentThemeData.raw( - topAppBar: TopAppBar(), - topNavigationBar: TopNavigationBar(), - // bottomNavigationBar: , - // error: , - loader: Loader(), - richTextBuilder: RichTextBuilder(), - textInput: TextInput(), - fileSelectionButton: FileSelectionButton(), - flatButton: FlatButton(), - simpleIconButton: SimpleIconButton(), - symbolButton: SymbolButton(), - informationCard: InformationCard(), - portfolioCard: PortfolioCard(), - quoteCard: QuoteCard(), - skillCard: SkillCard(), - pricingCard: PricingCard(), + static ComponentThemeData wyattComponentThemeData = ComponentThemeData.raw( + topAppBars: const TopAppBar().registry(), + topNavigationBars: const TopNavigationBar().registry(), + // bottomNavigationBars: , + // errors: , + loaders: const Loader().registry(), + richTextBuilders: const RichTextBuilder().registry(), + textInputs: const TextInput().registry(), + fileSelectionButtons: const FileSelectionButton().registry(), + flatButtons: const FlatButton().registry(), + simpleIconButtons: const SimpleIconButton().registry(), + symbolButtons: const SymbolButton().registry(), + informationCards: const InformationCard().registry(), + portfolioCards: const PortfolioCard().registry(), + quoteCards: const QuoteCard().registry(), + skillCards: const SkillCard().registry(), + pricingCards: const PricingCard().registry(), ); }