From 693e3398b66e49cfcf96c7131dc560f39180f159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malo=20L=C3=A9on?= Date: Mon, 28 Aug 2023 14:18:15 +0200 Subject: [PATCH] feat(ui_components): marking fields as private since it was accessible from getters --- .../src/features/component_theme_data.dart | 167 ++++++++++-------- 1 file changed, 95 insertions(+), 72 deletions(-) diff --git a/packages/wyatt_ui_components/lib/src/features/component_theme_data.dart b/packages/wyatt_ui_components/lib/src/features/component_theme_data.dart index 95293092..c085f226 100644 --- a/packages/wyatt_ui_components/lib/src/features/component_theme_data.dart +++ b/packages/wyatt_ui_components/lib/src/features/component_theme_data.dart @@ -68,23 +68,23 @@ class ComponentThemeData { // /// {@macro component_theme_data} factory ComponentThemeData.fromOther(ComponentThemeData other) => ComponentThemeData( - topAppBars: other.topAppBars, - topNavigationBars: other.topNavigationBars, - bottomNavigationBars: other.bottomNavigationBars, - errors: other.errors, - loaders: other.loaders, - richTextBuilders: other.richTextBuilders, - textInputs: other.textInputs, - fileSelectionButtons: other.fileSelectionButtons, - flatButtons: other.flatButtons, - simpleIconButtons: other.simpleIconButtons, - symbolButtons: other.symbolButtons, - informationCards: other.informationCards, - portfolioCards: other.portfolioCards, - quoteCards: other.quoteCards, - skillCards: other.skillCards, - pricingCards: other.pricingCards, - floatingActionButtons: other.floatingActionButtons, + topAppBars: other._topAppBars, + topNavigationBars: other._topNavigationBars, + bottomNavigationBars: other._bottomNavigationBars, + errors: other._errors, + loaders: other._loaders, + richTextBuilders: other._richTextBuilders, + textInputs: other._textInputs, + fileSelectionButtons: other._fileSelectionButtons, + flatButtons: other._flatButtons, + simpleIconButtons: other._simpleIconButtons, + symbolButtons: other._symbolButtons, + informationCards: other._informationCards, + portfolioCards: other._portfolioCards, + quoteCards: other._quoteCards, + skillCards: other._skillCards, + pricingCards: other._pricingCards, + floatingActionButtons: other._floatingActionButtons, ); /// Create a [ComponentThemeData] given a set of exact values. Most values @@ -94,24 +94,40 @@ class ComponentThemeData { /// create intermediate themes based on two themes created with the /// [ComponentThemeData] constructor. const ComponentThemeData.raw({ - this.topAppBars, - this.topNavigationBars, - this.bottomNavigationBars, - this.errors, - this.loaders, - this.richTextBuilders, - this.textInputs, - this.fileSelectionButtons, - this.flatButtons, - this.simpleIconButtons, - this.symbolButtons, - this.informationCards, - this.portfolioCards, - this.quoteCards, - this.skillCards, - this.pricingCards, - this.floatingActionButtons, - }); + ComponentRegistry? topAppBars, + ComponentRegistry? topNavigationBars, + ComponentRegistry? bottomNavigationBars, + ComponentRegistry? errors, + ComponentRegistry? loaders, + ComponentRegistry? richTextBuilders, + ComponentRegistry? textInputs, + ComponentRegistry? fileSelectionButtons, + ComponentRegistry? flatButtons, + ComponentRegistry? simpleIconButtons, + ComponentRegistry? symbolButtons, + ComponentRegistry? informationCards, + ComponentRegistry? portfolioCards, + ComponentRegistry? quoteCards, + ComponentRegistry? skillCards, + ComponentRegistry? pricingCards, + ComponentRegistry? floatingActionButtons, + }) : _floatingActionButtons = floatingActionButtons, + _symbolButtons = symbolButtons, + _simpleIconButtons = simpleIconButtons, + _flatButtons = flatButtons, + _fileSelectionButtons = fileSelectionButtons, + _textInputs = textInputs, + _richTextBuilders = richTextBuilders, + _pricingCards = pricingCards, + _skillCards = skillCards, + _quoteCards = quoteCards, + _portfolioCards = portfolioCards, + _informationCards = informationCards, + _loaders = loaders, + _errors = errors, + _bottomNavigationBars = bottomNavigationBars, + _topNavigationBars = topNavigationBars, + _topAppBars = topAppBars; R _get(T? component, R? returned) { if (component == null) { @@ -129,90 +145,97 @@ class ComponentThemeData { } // Bars - final ComponentRegistry? topAppBars; + final ComponentRegistry? _topAppBars; $TopAppBarComponentCWProxy topAppBarComponent([String? id]) => - _get(topAppBars?.call(id), topAppBars?.call(id)?.copyWith); + _get(_topAppBars?.call(id), _topAppBars?.call(id)?.copyWith); - final ComponentRegistry? topNavigationBars; + final ComponentRegistry? _topNavigationBars; $TopNavigationBarComponentCWProxy topNavigationBarComponent([String? id]) => - _get(topNavigationBars?.call(id), topNavigationBars?.call(id)?.copyWith); + _get( + _topNavigationBars?.call(id), + _topNavigationBars?.call(id)?.copyWith, + ); - final ComponentRegistry? bottomNavigationBars; + final ComponentRegistry? _bottomNavigationBars; $BottomNavigationBarComponentCWProxy bottomNavigationBarComponent([ String? id, ]) => _get( - bottomNavigationBars?.call(id), - bottomNavigationBars?.call(id)?.copyWith, + _bottomNavigationBars?.call(id), + _bottomNavigationBars?.call(id)?.copyWith, ); // CRUD Widgets - final ComponentRegistry? errors; + final ComponentRegistry? _errors; $ErrorComponentCWProxy errorComponent([String? id]) => - _get(errors?.call(id), errors?.call(id)?.copyWith); + _get(_errors?.call(id), _errors?.call(id)?.copyWith); - final ComponentRegistry? loaders; + final ComponentRegistry? _loaders; $LoaderComponentCWProxy loaderComponent([String? id]) => - _get(loaders?.call(id), loaders?.call(id)?.copyWith); + _get(_loaders?.call(id), _loaders?.call(id)?.copyWith); // Cards - final ComponentRegistry? informationCards; + final ComponentRegistry? _informationCards; $InformationCardComponentCWProxy informationCardComponent([String? id]) => - _get(informationCards?.call(id), informationCards?.call(id)?.copyWith); + _get(_informationCards?.call(id), _informationCards?.call(id)?.copyWith); - final ComponentRegistry? portfolioCards; + final ComponentRegistry? _portfolioCards; $PortfolioCardComponentCWProxy portfolioCardComponent([String? id]) => - _get(portfolioCards?.call(id), portfolioCards?.call(id)?.copyWith); + _get(_portfolioCards?.call(id), _portfolioCards?.call(id)?.copyWith); - final ComponentRegistry? quoteCards; + final ComponentRegistry? _quoteCards; $QuoteCardComponentCWProxy quoteCardComponent([String? id]) => - _get(quoteCards?.call(id), quoteCards?.call(id)?.copyWith); + _get(_quoteCards?.call(id), _quoteCards?.call(id)?.copyWith); - final ComponentRegistry? skillCards; + final ComponentRegistry? _skillCards; $SkillCardComponentCWProxy skillCardComponent([String? id]) => - _get(skillCards?.call(id), skillCards?.call(id)?.copyWith); - final ComponentRegistry? pricingCards; + _get(_skillCards?.call(id), _skillCards?.call(id)?.copyWith); + final ComponentRegistry? _pricingCards; $PricingCardComponentCWProxy pricingCardComponent([String? id]) => - _get(pricingCards?.call(id), pricingCards?.call(id)?.copyWith); + _get(_pricingCards?.call(id), _pricingCards?.call(id)?.copyWith); // Rich Text - final ComponentRegistry? richTextBuilders; + final ComponentRegistry? _richTextBuilders; $RichTextBuilderComponentCWProxy richTextBuilderComponent([String? id]) => - _get(richTextBuilders?.call(id), richTextBuilders?.call(id)?.copyWith); + _get(_richTextBuilders?.call(id), _richTextBuilders?.call(id)?.copyWith); // Text Inputs - final ComponentRegistry? textInputs; + final ComponentRegistry? _textInputs; $TextInputComponentCWProxy textInputComponent([String? id]) => - _get(textInputs?.call(id), textInputs?.call(id)?.copyWith); + _get(_textInputs?.call(id), _textInputs?.call(id)?.copyWith); // Buttons - final ComponentRegistry? fileSelectionButtons; + final ComponentRegistry? _fileSelectionButtons; $FileSelectionButtonComponentCWProxy fileSelectionButtonComponent([ String? id, ]) => _get( - fileSelectionButtons?.call(id), - fileSelectionButtons?.call(id)?.copyWith, + _fileSelectionButtons?.call(id), + _fileSelectionButtons?.call(id)?.copyWith, ); - final ComponentRegistry? flatButtons; + final ComponentRegistry? _flatButtons; $FlatButtonComponentCWProxy flatButtonComponent([String? id]) => - _get(flatButtons?.call(id), flatButtons?.call(id)?.copyWith); + _get(_flatButtons?.call(id), _flatButtons?.call(id)?.copyWith); - final ComponentRegistry? simpleIconButtons; + final ComponentRegistry? _simpleIconButtons; $SimpleIconButtonComponentCWProxy simpleIconButtonComponent([String? id]) => - _get(simpleIconButtons?.call(id), simpleIconButtons?.call(id)?.copyWith); + _get( + _simpleIconButtons?.call(id), + _simpleIconButtons?.call(id)?.copyWith, + ); - final ComponentRegistry? symbolButtons; + final ComponentRegistry? _symbolButtons; $SymbolButtonComponentCWProxy symbolButtonComponent([String? id]) => - _get(symbolButtons?.call(id), symbolButtons?.call(id)?.copyWith); + _get(_symbolButtons?.call(id), _symbolButtons?.call(id)?.copyWith); - final ComponentRegistry? floatingActionButtons; + final ComponentRegistry? + _floatingActionButtons; $FloatingActionButtonComponentCWProxy floatingActionButtonComponent([ String? id, ]) => _get( - floatingActionButtons?.call(id), - floatingActionButtons?.call(id)?.copyWith, + _floatingActionButtons?.call(id), + _floatingActionButtons?.call(id)?.copyWith, ); }