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 1/8] 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, ); } -- 2.47.2 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 2/8] 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(), ); } -- 2.47.2 From 791a6d0f83eb133f0cc85b010848643361865e09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malo=20L=C3=A9on?= Date: Mon, 28 Aug 2023 14:20:14 +0200 Subject: [PATCH 3/8] refactor(ui_layouts): Refactored block using the UI components package, introducing breaking changes --- .../custom_bottom_navigation_bar.g.dart | 4 + .../components/custom_desktop_app_bar.dart | 21 ++++ .../components/custom_desktop_app_bar.g.dart | 104 ++++++++++++++++++ ...pp_bar.dart => custom_mobile_app_bar.dart} | 8 +- .../components/custom_mobile_app_bar.g.dart | 103 +++++++++++++++++ .../example/lib/core/app_theme_component.dart | 12 +- .../lib/pages/app_bar_layout_page.dart | 15 ++- .../bottom_navigation_bar_layout_page_1.dart | 2 +- .../bottom_navigation_bar_layout_page_2.dart | 2 +- .../ephemeral/Flutter-Generated.xcconfig | 4 +- .../ephemeral/flutter_export_environment.sh | 4 +- .../macos/Runner.xcodeproj/project.pbxproj | 2 +- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- packages/wyatt_ui_layout/example/pubspec.yaml | 2 +- .../content_layouts/content_layout.dart | 39 +++++++ .../content_layouts/content_layouts.dart | 1 + .../layouts/content_layouts/grid_layout.dart | 2 +- .../lib/src/presentation/layouts/layout.dart | 18 --- .../bottom_navigation_bar_layout.dart | 14 ++- .../structural_layouts/frame_layout.dart | 44 ++++++-- .../structural_layouts/structural_layout.dart | 99 +++++++++++++++++ .../structural_layouts.dart | 1 + .../top_app_bar_layout.dart | 34 ++++-- packages/wyatt_ui_layout/pubspec.yaml | 2 +- 24 files changed, 477 insertions(+), 62 deletions(-) create mode 100644 packages/wyatt_ui_layout/example/lib/components/custom_desktop_app_bar.dart create mode 100644 packages/wyatt_ui_layout/example/lib/components/custom_desktop_app_bar.g.dart rename packages/wyatt_ui_layout/example/lib/components/{custom_app_bar.dart => custom_mobile_app_bar.dart} (68%) create mode 100644 packages/wyatt_ui_layout/example/lib/components/custom_mobile_app_bar.g.dart create mode 100644 packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/content_layout.dart create mode 100644 packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/structural_layout.dart diff --git a/packages/wyatt_ui_layout/example/lib/components/custom_bottom_navigation_bar.g.dart b/packages/wyatt_ui_layout/example/lib/components/custom_bottom_navigation_bar.g.dart index fc15f676..2602e144 100644 --- a/packages/wyatt_ui_layout/example/lib/components/custom_bottom_navigation_bar.g.dart +++ b/packages/wyatt_ui_layout/example/lib/components/custom_bottom_navigation_bar.g.dart @@ -17,11 +17,15 @@ class $CustomBottomNavigationBarCWProxyImpl CustomBottomNavigationBar currentIndex(int? currentIndex) => this(currentIndex: currentIndex); @override + CustomBottomNavigationBar items(List? items) => + this(items: items); + @override CustomBottomNavigationBar key(Key? key) => this(key: key); @override CustomBottomNavigationBar call({ void Function(BuildContext, int)? onTap, int? currentIndex, + List? items, Key? key, }) => CustomBottomNavigationBar( diff --git a/packages/wyatt_ui_layout/example/lib/components/custom_desktop_app_bar.dart b/packages/wyatt_ui_layout/example/lib/components/custom_desktop_app_bar.dart new file mode 100644 index 00000000..d250eb2d --- /dev/null +++ b/packages/wyatt_ui_layout/example/lib/components/custom_desktop_app_bar.dart @@ -0,0 +1,21 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:wyatt_component_copy_with_extension/wyatt_component_copy_with_extension.dart'; +import 'package:wyatt_ui_components/wyatt_ui_components.dart'; + +part 'custom_desktop_app_bar.g.dart'; + +@ComponentCopyWithExtension() +class CustomDesktopAppBar extends TopAppBarComponent + with $CustomDesktopAppBarCWMixin { + const CustomDesktopAppBar({ + super.title, + super.key, + }); + + @override + Widget build(BuildContext context) => AppBar( + backgroundColor: Colors.green, + title: Text(title?.data ?? ''), + ); +} diff --git a/packages/wyatt_ui_layout/example/lib/components/custom_desktop_app_bar.g.dart b/packages/wyatt_ui_layout/example/lib/components/custom_desktop_app_bar.g.dart new file mode 100644 index 00000000..809792c0 --- /dev/null +++ b/packages/wyatt_ui_layout/example/lib/components/custom_desktop_app_bar.g.dart @@ -0,0 +1,104 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'custom_desktop_app_bar.dart'; + +// ************************************************************************** +// ComponentCopyWithGenerator +// ************************************************************************** + +class $CustomDesktopAppBarCWProxyImpl implements $TopAppBarComponentCWProxy { + const $CustomDesktopAppBarCWProxyImpl(this._value); + final CustomDesktopAppBar _value; + @override + CustomDesktopAppBar title(TextWrapper? title) => this(title: title); + @override + CustomDesktopAppBar centerTitle(bool? centerTitle) => + this(centerTitle: centerTitle); + @override + CustomDesktopAppBar shape(ShapeBorder? shape) => this(shape: shape); + @override + CustomDesktopAppBar systemOverlayStyle( + SystemUiOverlayStyle? systemOverlayStyle) => + this(systemOverlayStyle: systemOverlayStyle); + @override + CustomDesktopAppBar automaticallyImplyLeading( + bool? automaticallyImplyLeading) => + this(automaticallyImplyLeading: automaticallyImplyLeading); + @override + CustomDesktopAppBar flexibleSpace(Widget? flexibleSpace) => + this(flexibleSpace: flexibleSpace); + @override + CustomDesktopAppBar bottom(PreferredSizeWidget? bottom) => + this(bottom: bottom); + @override + CustomDesktopAppBar elevation(double? elevation) => + this(elevation: elevation); + @override + CustomDesktopAppBar scrolledUnderElevation(double? scrolledUnderElevation) => + this(scrolledUnderElevation: scrolledUnderElevation); + @override + CustomDesktopAppBar shadowColor(Color? shadowColor) => + this(shadowColor: shadowColor); + @override + CustomDesktopAppBar surfaceTintColor(Color? surfaceTintColor) => + this(surfaceTintColor: surfaceTintColor); + @override + CustomDesktopAppBar backgroundColor(MultiColor? backgroundColor) => + this(backgroundColor: backgroundColor); + @override + CustomDesktopAppBar iconTheme(IconThemeData? iconTheme) => + this(iconTheme: iconTheme); + @override + CustomDesktopAppBar primary(bool? primary) => this(primary: primary); + @override + CustomDesktopAppBar excludeHeaderSemantics(bool? excludeHeaderSemantics) => + this(excludeHeaderSemantics: excludeHeaderSemantics); + @override + CustomDesktopAppBar toolbarHeight(double? toolbarHeight) => + this(toolbarHeight: toolbarHeight); + @override + CustomDesktopAppBar leadingWidth(double? leadingWidth) => + this(leadingWidth: leadingWidth); + @override + CustomDesktopAppBar leading(Widget? leading) => this(leading: leading); + @override + CustomDesktopAppBar actions(List? actions) => this(actions: actions); + @override + CustomDesktopAppBar expandedWidget(List? expandedWidget) => + this(expandedWidget: expandedWidget); + @override + CustomDesktopAppBar key(Key? key) => this(key: key); + @override + CustomDesktopAppBar call({ + TextWrapper? title, + bool? centerTitle, + ShapeBorder? shape, + SystemUiOverlayStyle? systemOverlayStyle, + bool? automaticallyImplyLeading, + Widget? flexibleSpace, + PreferredSizeWidget? bottom, + double? elevation, + double? scrolledUnderElevation, + Color? shadowColor, + Color? surfaceTintColor, + MultiColor? backgroundColor, + IconThemeData? iconTheme, + bool? primary, + bool? excludeHeaderSemantics, + double? toolbarHeight, + double? leadingWidth, + Widget? leading, + List? actions, + List? expandedWidget, + Key? key, + }) => + CustomDesktopAppBar( + title: title ?? _value.title, + key: key ?? _value.key, + ); +} + +mixin $CustomDesktopAppBarCWMixin on Component { + $TopAppBarComponentCWProxy get copyWith => + $CustomDesktopAppBarCWProxyImpl(this as CustomDesktopAppBar); +} diff --git a/packages/wyatt_ui_layout/example/lib/components/custom_app_bar.dart b/packages/wyatt_ui_layout/example/lib/components/custom_mobile_app_bar.dart similarity index 68% rename from packages/wyatt_ui_layout/example/lib/components/custom_app_bar.dart rename to packages/wyatt_ui_layout/example/lib/components/custom_mobile_app_bar.dart index 9c7da189..bac09e22 100644 --- a/packages/wyatt_ui_layout/example/lib/components/custom_app_bar.dart +++ b/packages/wyatt_ui_layout/example/lib/components/custom_mobile_app_bar.dart @@ -3,17 +3,19 @@ import 'package:flutter/services.dart'; import 'package:wyatt_component_copy_with_extension/wyatt_component_copy_with_extension.dart'; import 'package:wyatt_ui_components/wyatt_ui_components.dart'; -part 'custom_app_bar.g.dart'; +part 'custom_mobile_app_bar.g.dart'; @ComponentCopyWithExtension() -class CustomAppBar extends TopAppBarComponent with $CustomAppBarCWMixin { - const CustomAppBar({ +class CustomMobileAppBar extends TopAppBarComponent + with $CustomMobileAppBarCWMixin { + const CustomMobileAppBar({ super.title, super.key, }); @override Widget build(BuildContext context) => AppBar( + backgroundColor: Colors.red, title: Text(title?.data ?? ''), ); } diff --git a/packages/wyatt_ui_layout/example/lib/components/custom_mobile_app_bar.g.dart b/packages/wyatt_ui_layout/example/lib/components/custom_mobile_app_bar.g.dart new file mode 100644 index 00000000..f825797a --- /dev/null +++ b/packages/wyatt_ui_layout/example/lib/components/custom_mobile_app_bar.g.dart @@ -0,0 +1,103 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'custom_mobile_app_bar.dart'; + +// ************************************************************************** +// ComponentCopyWithGenerator +// ************************************************************************** + +class $CustomMobileAppBarCWProxyImpl implements $TopAppBarComponentCWProxy { + const $CustomMobileAppBarCWProxyImpl(this._value); + final CustomMobileAppBar _value; + @override + CustomMobileAppBar title(TextWrapper? title) => this(title: title); + @override + CustomMobileAppBar centerTitle(bool? centerTitle) => + this(centerTitle: centerTitle); + @override + CustomMobileAppBar shape(ShapeBorder? shape) => this(shape: shape); + @override + CustomMobileAppBar systemOverlayStyle( + SystemUiOverlayStyle? systemOverlayStyle) => + this(systemOverlayStyle: systemOverlayStyle); + @override + CustomMobileAppBar automaticallyImplyLeading( + bool? automaticallyImplyLeading) => + this(automaticallyImplyLeading: automaticallyImplyLeading); + @override + CustomMobileAppBar flexibleSpace(Widget? flexibleSpace) => + this(flexibleSpace: flexibleSpace); + @override + CustomMobileAppBar bottom(PreferredSizeWidget? bottom) => + this(bottom: bottom); + @override + CustomMobileAppBar elevation(double? elevation) => this(elevation: elevation); + @override + CustomMobileAppBar scrolledUnderElevation(double? scrolledUnderElevation) => + this(scrolledUnderElevation: scrolledUnderElevation); + @override + CustomMobileAppBar shadowColor(Color? shadowColor) => + this(shadowColor: shadowColor); + @override + CustomMobileAppBar surfaceTintColor(Color? surfaceTintColor) => + this(surfaceTintColor: surfaceTintColor); + @override + CustomMobileAppBar backgroundColor(MultiColor? backgroundColor) => + this(backgroundColor: backgroundColor); + @override + CustomMobileAppBar iconTheme(IconThemeData? iconTheme) => + this(iconTheme: iconTheme); + @override + CustomMobileAppBar primary(bool? primary) => this(primary: primary); + @override + CustomMobileAppBar excludeHeaderSemantics(bool? excludeHeaderSemantics) => + this(excludeHeaderSemantics: excludeHeaderSemantics); + @override + CustomMobileAppBar toolbarHeight(double? toolbarHeight) => + this(toolbarHeight: toolbarHeight); + @override + CustomMobileAppBar leadingWidth(double? leadingWidth) => + this(leadingWidth: leadingWidth); + @override + CustomMobileAppBar leading(Widget? leading) => this(leading: leading); + @override + CustomMobileAppBar actions(List? actions) => this(actions: actions); + @override + CustomMobileAppBar expandedWidget(List? expandedWidget) => + this(expandedWidget: expandedWidget); + @override + CustomMobileAppBar key(Key? key) => this(key: key); + @override + CustomMobileAppBar call({ + TextWrapper? title, + bool? centerTitle, + ShapeBorder? shape, + SystemUiOverlayStyle? systemOverlayStyle, + bool? automaticallyImplyLeading, + Widget? flexibleSpace, + PreferredSizeWidget? bottom, + double? elevation, + double? scrolledUnderElevation, + Color? shadowColor, + Color? surfaceTintColor, + MultiColor? backgroundColor, + IconThemeData? iconTheme, + bool? primary, + bool? excludeHeaderSemantics, + double? toolbarHeight, + double? leadingWidth, + Widget? leading, + List? actions, + List? expandedWidget, + Key? key, + }) => + CustomMobileAppBar( + title: title ?? _value.title, + key: key ?? _value.key, + ); +} + +mixin $CustomMobileAppBarCWMixin on Component { + $TopAppBarComponentCWProxy get copyWith => + $CustomMobileAppBarCWProxyImpl(this as CustomMobileAppBar); +} diff --git a/packages/wyatt_ui_layout/example/lib/core/app_theme_component.dart b/packages/wyatt_ui_layout/example/lib/core/app_theme_component.dart index 3df937d1..a4cb8695 100644 --- a/packages/wyatt_ui_layout/example/lib/core/app_theme_component.dart +++ b/packages/wyatt_ui_layout/example/lib/core/app_theme_component.dart @@ -1,14 +1,18 @@ import 'package:flutter/material.dart'; import 'package:wyatt_ui_components/wyatt_ui_components.dart'; -import 'package:wyatt_ui_layout_example/components/custom_app_bar.dart'; import 'package:wyatt_ui_layout_example/components/custom_bottom_navigation_bar.dart'; +import 'package:wyatt_ui_layout_example/components/custom_desktop_app_bar.dart'; +import 'package:wyatt_ui_layout_example/components/custom_mobile_app_bar.dart'; import 'package:wyatt_ui_layout_example/pages/bottom_navigation_bar_layout_page_1.dart'; import 'package:wyatt_ui_layout_example/pages/bottom_navigation_bar_layout_page_2.dart'; class AppThemeComponent { static ComponentThemeData get components => ComponentThemeData.raw( - topAppBar: const CustomAppBar(), - bottomNavigationBar: CustomBottomNavigationBar( + topAppBars: { + 'mobile': const CustomMobileAppBar(), + 'desktop': const CustomDesktopAppBar(), + }.registry(), + bottomNavigationBars: CustomBottomNavigationBar( onTap: (context, index) { switch (index) { case 0: @@ -37,6 +41,6 @@ class AppThemeComponent { break; } }, - ), + ).registry(), ); } diff --git a/packages/wyatt_ui_layout/example/lib/pages/app_bar_layout_page.dart b/packages/wyatt_ui_layout/example/lib/pages/app_bar_layout_page.dart index 4b3177e2..cfbb747d 100644 --- a/packages/wyatt_ui_layout/example/lib/pages/app_bar_layout_page.dart +++ b/packages/wyatt_ui_layout/example/lib/pages/app_bar_layout_page.dart @@ -6,12 +6,15 @@ class AppBarLayoutPage extends StatelessWidget { const AppBarLayoutPage({super.key}); @override - Widget build(BuildContext context) => TopAppBarLayout( - custom: (topBar) => - topBar?.copyWith.title(const TextWrapper('New Title')), - body: const Center( - child: Text( - 'Body', + Widget build(BuildContext context) => LayoutBuilder( + builder: (context, constraint) => StructuralLayout.withTopAppBar( + barId: constraint.maxWidth < 600 ? 'mobile' : 'desktop', + custom: (topBar) => + topBar?.copyWith.title(const TextWrapper('New Title')), + body: const Center( + child: Text( + 'Body', + ), ), ), ); diff --git a/packages/wyatt_ui_layout/example/lib/pages/bottom_navigation_bar_layout_page_1.dart b/packages/wyatt_ui_layout/example/lib/pages/bottom_navigation_bar_layout_page_1.dart index 84c3d95d..0ffd8ea4 100644 --- a/packages/wyatt_ui_layout/example/lib/pages/bottom_navigation_bar_layout_page_1.dart +++ b/packages/wyatt_ui_layout/example/lib/pages/bottom_navigation_bar_layout_page_1.dart @@ -5,7 +5,7 @@ class BottomNavigationBarLayoutPage1 extends StatelessWidget { const BottomNavigationBarLayoutPage1({super.key}); @override - Widget build(BuildContext context) => BottomNavigationBarLayout( + Widget build(BuildContext context) => StructuralLayout.withBottomNavBar( custom: (p0) => p0?.copyWith.call(currentIndex: 0), body: const TopAppBarLayout( body: Center( diff --git a/packages/wyatt_ui_layout/example/lib/pages/bottom_navigation_bar_layout_page_2.dart b/packages/wyatt_ui_layout/example/lib/pages/bottom_navigation_bar_layout_page_2.dart index fbd6b13a..ae4d9880 100644 --- a/packages/wyatt_ui_layout/example/lib/pages/bottom_navigation_bar_layout_page_2.dart +++ b/packages/wyatt_ui_layout/example/lib/pages/bottom_navigation_bar_layout_page_2.dart @@ -5,7 +5,7 @@ class BottomNavigationBarLayoutPage2 extends StatelessWidget { const BottomNavigationBarLayoutPage2({super.key}); @override - Widget build(BuildContext context) => BottomNavigationBarLayout( + Widget build(BuildContext context) => StructuralLayout.withBottomNavBar( custom: (p0) => p0?.copyWith.currentIndex(1), body: const TopAppBarLayout( body: Center( diff --git a/packages/wyatt_ui_layout/example/macos/Flutter/ephemeral/Flutter-Generated.xcconfig b/packages/wyatt_ui_layout/example/macos/Flutter/ephemeral/Flutter-Generated.xcconfig index a59a9b7e..80a67b61 100644 --- a/packages/wyatt_ui_layout/example/macos/Flutter/ephemeral/Flutter-Generated.xcconfig +++ b/packages/wyatt_ui_layout/example/macos/Flutter/ephemeral/Flutter-Generated.xcconfig @@ -2,10 +2,12 @@ FLUTTER_ROOT=/Users/maloleon/Library/flutter FLUTTER_APPLICATION_PATH=/Users/maloleon/Studio/wyatt-packages/packages/wyatt_ui_layout/example COCOAPODS_PARALLEL_CODE_SIGN=true +FLUTTER_TARGET=/Users/maloleon/Studio/wyatt-packages/packages/wyatt_ui_layout/example/lib/main.dart FLUTTER_BUILD_DIR=build FLUTTER_BUILD_NAME=1.0.0 FLUTTER_BUILD_NUMBER=1 +DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==,RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC9iMjAxODNlMDQwOTYwOTRiY2MzN2Q5Y2RlMmE0Yjk2ZjVjYzY4NGNmLw== DART_OBFUSCATION=false TRACK_WIDGET_CREATION=true TREE_SHAKE_ICONS=false -PACKAGE_CONFIG=.dart_tool/package_config.json +PACKAGE_CONFIG=/Users/maloleon/Studio/wyatt-packages/packages/wyatt_ui_layout/example/.dart_tool/package_config.json diff --git a/packages/wyatt_ui_layout/example/macos/Flutter/ephemeral/flutter_export_environment.sh b/packages/wyatt_ui_layout/example/macos/Flutter/ephemeral/flutter_export_environment.sh index 4883d2d9..51db70ad 100755 --- a/packages/wyatt_ui_layout/example/macos/Flutter/ephemeral/flutter_export_environment.sh +++ b/packages/wyatt_ui_layout/example/macos/Flutter/ephemeral/flutter_export_environment.sh @@ -3,10 +3,12 @@ export "FLUTTER_ROOT=/Users/maloleon/Library/flutter" export "FLUTTER_APPLICATION_PATH=/Users/maloleon/Studio/wyatt-packages/packages/wyatt_ui_layout/example" export "COCOAPODS_PARALLEL_CODE_SIGN=true" +export "FLUTTER_TARGET=/Users/maloleon/Studio/wyatt-packages/packages/wyatt_ui_layout/example/lib/main.dart" export "FLUTTER_BUILD_DIR=build" export "FLUTTER_BUILD_NAME=1.0.0" export "FLUTTER_BUILD_NUMBER=1" +export "DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==,RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC9iMjAxODNlMDQwOTYwOTRiY2MzN2Q5Y2RlMmE0Yjk2ZjVjYzY4NGNmLw==" export "DART_OBFUSCATION=false" export "TRACK_WIDGET_CREATION=true" export "TREE_SHAKE_ICONS=false" -export "PACKAGE_CONFIG=.dart_tool/package_config.json" +export "PACKAGE_CONFIG=/Users/maloleon/Studio/wyatt-packages/packages/wyatt_ui_layout/example/.dart_tool/package_config.json" diff --git a/packages/wyatt_ui_layout/example/macos/Runner.xcodeproj/project.pbxproj b/packages/wyatt_ui_layout/example/macos/Runner.xcodeproj/project.pbxproj index d9333e47..c5fd5489 100644 --- a/packages/wyatt_ui_layout/example/macos/Runner.xcodeproj/project.pbxproj +++ b/packages/wyatt_ui_layout/example/macos/Runner.xcodeproj/project.pbxproj @@ -182,7 +182,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 1300; + LastUpgradeCheck = 1430; ORGANIZATIONNAME = ""; TargetAttributes = { 33CC10EC2044A3C60003C045 = { diff --git a/packages/wyatt_ui_layout/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/wyatt_ui_layout/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index fb7259e1..83d88728 100644 --- a/packages/wyatt_ui_layout/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/packages/wyatt_ui_layout/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ =2.17.0 <3.0.0" + sdk: ">=3.0.0 <4.0.0" # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions diff --git a/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/content_layout.dart b/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/content_layout.dart new file mode 100644 index 00000000..f2f88eba --- /dev/null +++ b/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/content_layout.dart @@ -0,0 +1,39 @@ +// Copyright (C) 2022 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import 'package:flutter/material.dart'; +import 'package:wyatt_ui_layout/src/presentation/layouts/layout.dart'; +import 'package:wyatt_ui_layout/wyatt_ui_layout.dart'; + +/// {@template content_layout} +/// An abstract class that provides a base for creating custom content layout +/// widgets. +/// {@endtemplate} +abstract class ContentLayout extends Layout { + /// {@macro content_layout} + const ContentLayout({super.key}); + + factory ContentLayout.withGrid({ + required List children, + double verticalGap = 30, + double horizontalGap = 30, + }) => + GridLayout( + verticalGap: verticalGap, + horizontalGap: horizontalGap, + children: children, + ); +} diff --git a/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/content_layouts.dart b/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/content_layouts.dart index e5215b69..6d33cfcd 100644 --- a/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/content_layouts.dart +++ b/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/content_layouts.dart @@ -14,4 +14,5 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +export './content_layout.dart'; export './grid_layout.dart'; diff --git a/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/grid_layout.dart b/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/grid_layout.dart index 04c9a7a0..86d4b0ef 100644 --- a/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/grid_layout.dart +++ b/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/grid_layout.dart @@ -16,7 +16,7 @@ import 'package:flutter/material.dart'; import 'package:gap/gap.dart'; -import 'package:wyatt_ui_layout/src/presentation/layouts/layout.dart'; +import 'package:wyatt_ui_layout/src/presentation/layouts/content_layouts/content_layout.dart'; /// {@template grid_layout} /// A concrete implementation of the [ContentLayout] abstract class for a layout diff --git a/packages/wyatt_ui_layout/lib/src/presentation/layouts/layout.dart b/packages/wyatt_ui_layout/lib/src/presentation/layouts/layout.dart index 28068913..fd618d81 100644 --- a/packages/wyatt_ui_layout/lib/src/presentation/layouts/layout.dart +++ b/packages/wyatt_ui_layout/lib/src/presentation/layouts/layout.dart @@ -28,21 +28,3 @@ abstract class Layout extends StatelessWidget { /// {@macro layout} const Layout({super.key}); } - -/// {@template structural_layout} -/// An abstract class that provides a base for creating custom structural layout -/// widgets. -/// {@endtemplate} -abstract class StructuralLayout extends Layout { - /// {@macro structural_layout} - const StructuralLayout({super.key}); -} - -/// {@template content_layout} -/// An abstract class that provides a base for creating custom content layout -/// widgets. -/// {@endtemplate} -abstract class ContentLayout extends Layout { - /// {@macro content_layout} - const ContentLayout({super.key}); -} diff --git a/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/bottom_navigation_bar_layout.dart b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/bottom_navigation_bar_layout.dart index 3c72ffcf..8746fc0c 100644 --- a/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/bottom_navigation_bar_layout.dart +++ b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/bottom_navigation_bar_layout.dart @@ -19,6 +19,7 @@ import 'package:flutter/material.dart'; import 'package:wyatt_ui_components/wyatt_ui_components.dart'; import 'package:wyatt_ui_layout/src/core/scaffold_fields_wrapper.dart'; import 'package:wyatt_ui_layout/src/presentation/layouts/layout.dart'; +import 'package:wyatt_ui_layout/src/presentation/layouts/structural_layouts/structural_layout.dart'; /// {@template bottom_navigation_bar_layout} /// A concrete implementation of the [Layout] abstract class for a layout which @@ -29,6 +30,7 @@ class BottomNavigationBarLayout extends StructuralLayout { const BottomNavigationBarLayout({ required this.body, this.custom, + this.barId, this.scaffoldFieldsWrapper, super.key, }); @@ -41,15 +43,23 @@ class BottomNavigationBarLayout extends StructuralLayout { final BottomNavigationBarComponent? Function(BottomNavigationBarComponent?)? custom; + /// The parameter [barId] enables to specify the particular + /// bottom bar to utilize. + final String? barId; + + /// The [scaffoldFieldsWrapper] is a final variable that serves as a wrapper + /// for customizing the scaffold. + /// It allows for tailored modifications and enhancements to the standard + /// scaffold functionality. final ScaffoldFieldsWrapper? scaffoldFieldsWrapper; @override Widget build(BuildContext context) => Scaffold( body: body, bottomNavigationBar: custom?.call( - context.components.bottomNavigationBar, + context.components.bottomNavigationBarComponent(barId).call(), ) ?? - context.components.bottomNavigationBar, + context.components.bottomNavigationBarComponent(barId).call(), floatingActionButtonLocation: scaffoldFieldsWrapper?.floatingActionButtonLocation, floatingActionButtonAnimator: diff --git a/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/frame_layout.dart b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/frame_layout.dart index e44a8163..5b1a8879 100644 --- a/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/frame_layout.dart +++ b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/frame_layout.dart @@ -18,7 +18,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:wyatt_ui_components/wyatt_ui_components.dart'; import 'package:wyatt_ui_layout/src/core/scaffold_fields_wrapper.dart'; -import 'package:wyatt_ui_layout/src/presentation/layouts/layout.dart'; +import 'package:wyatt_ui_layout/src/presentation/layouts/structural_layouts/structural_layout.dart'; /// {@template frame_layout} /// A layout that contains a top app bar, a body and a bottom navigation bar. @@ -36,6 +36,9 @@ class FrameLayout extends StructuralLayout { this.customAppBar, this.customBottomNavBar, this.customFloatingActionButton, + this.appBarId, + this.bottomNavBarId, + this.floatingActionButtonId, this.height = 60, this.scaffoldFieldsWrapper, super.key, @@ -53,6 +56,18 @@ class FrameLayout extends StructuralLayout { final FloatingActionButtonComponent? Function(FloatingActionButtonComponent?)? customFloatingActionButton; + /// The parameter [appBarId] enables to specify the particular + /// app bar to utilize. + final String? appBarId; + + /// The parameter [bottomNavBarId] enables to specify the particular + /// bottom bar to utilize. + final String? bottomNavBarId; + + /// The parameter [floatingActionButtonId] enables to specify + /// the particular floating action button to utilize. + final String? floatingActionButtonId; + /// The main content of the layout. final Widget body; @@ -63,20 +78,27 @@ class FrameLayout extends StructuralLayout { @override Widget build(BuildContext context) => Scaffold( - appBar: (customAppBar?.call(context.components.topAppBar) != null || - context.components.topAppBar != null) + appBar: (customAppBar + ?.call(context.components.topAppBarComponent(appBarId)()) != + null) ? PreferredSize( preferredSize: Size.fromHeight(height), - child: customAppBar?.call(context.components.topAppBar) ?? - context.components.topAppBar!, + child: customAppBar?.call( + context.components.topAppBarComponent(appBarId)(), + ) ?? + context.components.topAppBarComponent(appBarId)(), ) : null, - floatingActionButton: customFloatingActionButton - ?.call(context.components.floatingActionButton) ?? - context.components.floatingActionButton, - bottomNavigationBar: - customBottomNavBar?.call(context.components.bottomNavigationBar) ?? - context.components.bottomNavigationBar, + floatingActionButton: customFloatingActionButton?.call( + context.components + .floatingActionButtonComponent(floatingActionButtonId)(), + ) ?? + context.components + .floatingActionButtonComponent(floatingActionButtonId)(), + bottomNavigationBar: customBottomNavBar?.call( + context.components.bottomNavigationBarComponent(bottomNavBarId)(), + ) ?? + context.components.bottomNavigationBarComponent(bottomNavBarId)(), body: body, floatingActionButtonLocation: scaffoldFieldsWrapper?.floatingActionButtonLocation, diff --git a/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/structural_layout.dart b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/structural_layout.dart new file mode 100644 index 00000000..78bcdde9 --- /dev/null +++ b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/structural_layout.dart @@ -0,0 +1,99 @@ +// Copyright (C) 2022 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import 'package:flutter/widgets.dart'; +import 'package:wyatt_ui_components/wyatt_ui_components.dart'; +import 'package:wyatt_ui_layout/src/presentation/layouts/layout.dart'; +import 'package:wyatt_ui_layout/wyatt_ui_layout.dart'; + +typedef ComponentCallBack = T? Function(T? component); + +/// {@template structural_layout} +/// An abstract class that provides a base for creating custom structural layout +/// widgets. +/// {@endtemplate} +abstract class StructuralLayout extends Layout { + /// {@macro structural_layout} + const StructuralLayout({super.key}); + + factory StructuralLayout.withTopAppBar({ + required Widget body, + ComponentCallBack? custom, + String? barId, + double height = 60, + ScaffoldFieldsWrapper? scaffoldFieldsWrapper, + }) => + TopAppBarLayout( + body: body, + barId: barId, + custom: custom, + height: height, + scaffoldFieldsWrapper: scaffoldFieldsWrapper, + ); + + factory StructuralLayout.withTopNavigationBar({ + required Widget body, + ComponentCallBack? custom, + String? barId, + double height = 60, + ScaffoldFieldsWrapper? scaffoldFieldsWrapper, + }) => + TopNavigationBarLayout( + body: body, + barId: barId, + custom: custom, + height: height, + scaffoldFieldsWrapper: scaffoldFieldsWrapper, + ); + + factory StructuralLayout.withFrame({ + required Widget body, + ComponentCallBack? customAppBar, + ComponentCallBack? customBottomNavBar, + ComponentCallBack? + customFloatingActionButton, + String? appBarId, + String? bottomNavBarId, + String? floatingActionButtonId, + double height = 60, + ScaffoldFieldsWrapper? scaffoldFieldsWrapper, + }) => + FrameLayout( + body: body, + customAppBar: customAppBar, + customBottomNavBar: customBottomNavBar, + customFloatingActionButton: customFloatingActionButton, + appBarId: appBarId, + bottomNavBarId: bottomNavBarId, + floatingActionButtonId: floatingActionButtonId, + height: height, + scaffoldFieldsWrapper: scaffoldFieldsWrapper, + ); + + factory StructuralLayout.withBottomNavBar({ + required Widget? body, + BottomNavigationBarComponent? Function(BottomNavigationBarComponent?)? + custom, + String? barId, + ScaffoldFieldsWrapper? scaffoldFieldsWrapper, + }) => + BottomNavigationBarLayout( + body: body, + custom: custom, + barId: barId, + scaffoldFieldsWrapper: scaffoldFieldsWrapper, + ); +} diff --git a/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/structural_layouts.dart b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/structural_layouts.dart index e22f407c..9ac4e11f 100644 --- a/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/structural_layouts.dart +++ b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/structural_layouts.dart @@ -16,4 +16,5 @@ export './bottom_navigation_bar_layout.dart'; export './frame_layout.dart'; +export './structural_layout.dart'; export './top_app_bar_layout.dart'; diff --git a/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/top_app_bar_layout.dart b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/top_app_bar_layout.dart index 0f9acc41..89322fa7 100644 --- a/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/top_app_bar_layout.dart +++ b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/top_app_bar_layout.dart @@ -18,7 +18,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:wyatt_ui_components/wyatt_ui_components.dart'; import 'package:wyatt_ui_layout/src/core/scaffold_fields_wrapper.dart'; -import 'package:wyatt_ui_layout/src/presentation/layouts/layout.dart'; +import 'package:wyatt_ui_layout/src/presentation/layouts/structural_layouts/structural_layout.dart'; /// {@template top_bar_layout} /// An abstract class for creating layouts with a top bar component. @@ -27,7 +27,7 @@ import 'package:wyatt_ui_layout/src/presentation/layouts/layout.dart'; /// component, such as an app bar or navigation bar. /// /// Implementations of this class must provide a concrete implementation of -/// the [child] method, which returns the specific top bar component for the +/// the [appBar] method, which returns the specific top bar component for the /// given [BuildContext]. /// /// [T] represents the type of the top bar component. @@ -38,6 +38,7 @@ abstract class TopBarLayout const TopBarLayout({ required this.body, this.custom, + this.barId, this.height = 60, this.scaffoldFieldsWrapper, super.key, @@ -51,20 +52,31 @@ abstract class TopBarLayout /// a customized top bar component. final T? Function(T?)? custom; + /// The parameter [barId] enables to specify the particular app bar to use. + final String? barId; + /// The height of the top bar. final double height; /// Returns the top bar component for the given [BuildContext]. - T? child(BuildContext context); + T appBar(BuildContext context, String? barId); + /// The [scaffoldFieldsWrapper] is a final variable that serves as a wrapper + /// for customizing the scaffold. + /// It allows for tailored modifications and enhancements to the standard + /// scaffold functionality. final ScaffoldFieldsWrapper? scaffoldFieldsWrapper; @override Widget build(BuildContext context) => Scaffold( - appBar: (custom?.call(child(context)) != null || child(context) != null) + appBar: (custom?.call( + appBar(context, barId), + ) != + null) ? PreferredSize( preferredSize: Size.fromHeight(height), - child: custom?.call(child(context)) ?? child(context)!, + child: custom?.call(appBar(context, barId)) ?? + appBar(context, barId), ) : null, body: body, @@ -111,14 +123,16 @@ class TopAppBarLayout extends TopBarLayout { /// [height] represents the height of the top bar. const TopAppBarLayout({ required super.body, + super.barId, super.custom, super.height, + super.scaffoldFieldsWrapper, super.key, }); @override - TopAppBarComponent? child(BuildContext context) => - context.components.topAppBar; + TopAppBarComponent appBar(BuildContext context, String? barId) => + context.components.topAppBarComponent(barId).call(); } /// A concrete implementation of [TopBarLayout] for a navigation bar. @@ -131,12 +145,14 @@ class TopNavigationBarLayout extends TopBarLayout { /// [height] represents the height of the top bar. const TopNavigationBarLayout({ required super.body, + super.barId, super.custom, super.height, + super.scaffoldFieldsWrapper, super.key, }); @override - TopNavigationBarComponent? child(BuildContext context) => - context.components.topNavigationBar; + TopNavigationBarComponent appBar(BuildContext context, String? barId) => + context.components.topNavigationBarComponent(barId).call(); } diff --git a/packages/wyatt_ui_layout/pubspec.yaml b/packages/wyatt_ui_layout/pubspec.yaml index 3c737053..4f01b1ea 100644 --- a/packages/wyatt_ui_layout/pubspec.yaml +++ b/packages/wyatt_ui_layout/pubspec.yaml @@ -6,7 +6,7 @@ version: 0.1.1 publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub environment: - sdk: ">=2.17.0 <3.0.0" + sdk: ">=3.0.0 <4.0.0" dependencies: flutter: { sdk: flutter } -- 2.47.2 From 1c47fa8e94debe4626f5fa4fe34c69803dd719de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malo=20L=C3=A9on?= Date: Mon, 28 Aug 2023 14:20:49 +0200 Subject: [PATCH 4/8] refactor(bloc_layouts): refactored block using the ui layout package, due to breaking changes --- .../lib/components/theme_components.dart | 10 ++++----- .../crud_cubit_consumer_screen_mixin.dart | 9 ++++---- ...ar_grid_layout_cubit_screen_crud_list.dart | 3 ++- ...om_navigation_bar_layout_cubit_screen.dart | 13 +++++++----- ...vigation_bar_layout_cubit_screen_crud.dart | 3 ++- ...ion_bar_layout_cubit_screen_crud_item.dart | 3 ++- ...ion_bar_layout_cubit_screen_crud_list.dart | 3 ++- ...me_grid_layout_cubit_screen_crud_list.dart | 6 +++++- .../frame_layout_cubit_screen.dart | 21 +++++++++++++++---- .../frame_layout_cubit_screen_crud.dart | 6 +++++- .../frame_layout_cubit_screen_crud_item.dart | 6 +++++- .../frame_layout_cubit_screen_crud_list.dart | 6 +++++- .../presentation/structural_bloc_layout.dart | 1 + ...ar_grid_layout_cubit_screen_crud_list.dart | 2 ++ .../top_app_bar_layout_cubit_screen.dart | 8 ++++++- .../top_app_bar_layout_cubit_screen_crud.dart | 2 ++ ...app_bar_layout_cubit_screen_crud_item.dart | 2 ++ ...app_bar_layout_cubit_screen_crud_list.dart | 2 ++ ...ar_grid_layout_cubit_screen_crud_list.dart | 2 ++ ...op_navigation_bar_layout_cubit_screen.dart | 13 +++++++++--- ...vigation_bar_layout_cubit_screen_crud.dart | 2 ++ ...ion_bar_layout_cubit_screen_crud_item.dart | 2 ++ ...ion_bar_layout_cubit_screen_crud_list.dart | 2 ++ 23 files changed, 97 insertions(+), 30 deletions(-) create mode 100644 packages/wyatt_bloc_layout/lib/src/presentation/structural_bloc_layout.dart diff --git a/packages/wyatt_bloc_layout/example/lib/components/theme_components.dart b/packages/wyatt_bloc_layout/example/lib/components/theme_components.dart index 888522dd..0be4d529 100644 --- a/packages/wyatt_bloc_layout/example/lib/components/theme_components.dart +++ b/packages/wyatt_bloc_layout/example/lib/components/theme_components.dart @@ -5,10 +5,10 @@ import 'package:bloc_layout_example/components/custom_loading_widget.dart'; import 'package:wyatt_ui_components/wyatt_ui_components.dart'; abstract class AppThemeComponent { - static const ComponentThemeData components = ComponentThemeData.raw( - topAppBar: CustomAppBar(), - bottomNavigationBar: CustomBottomBar(), - loader: CustomLoadingWidget(), - error: CustomErrorWidget(), + static ComponentThemeData components = ComponentThemeData.raw( + topAppBars: const CustomAppBar().registry(), + bottomNavigationBars: const CustomBottomBar().registry(), + loaders: const CustomLoadingWidget().registry(), + errors: const CustomErrorWidget().registry(), ); } diff --git a/packages/wyatt_bloc_layout/lib/src/core/crud_cubit_consumer_screen_mixin.dart b/packages/wyatt_bloc_layout/lib/src/core/crud_cubit_consumer_screen_mixin.dart index 7a083f3c..79e5f00d 100644 --- a/packages/wyatt_bloc_layout/lib/src/core/crud_cubit_consumer_screen_mixin.dart +++ b/packages/wyatt_bloc_layout/lib/src/core/crud_cubit_consumer_screen_mixin.dart @@ -23,12 +23,13 @@ import 'package:wyatt_ui_components/wyatt_ui_components.dart'; mixin CrudMixin, SuccessState extends CrudSuccess> { Widget errorBuilder(BuildContext context, CrudError state) => - context.components.errorComponent.call( - message: (state.message != null) ? TextWrapper(state.message!) : null, - ); + context.components.errorComponent().call( + message: + (state.message != null) ? TextWrapper(state.message!) : null, + ); Widget loadingBuilder(BuildContext context, CrudLoading state) => - context.components.loader ?? const SizedBox.shrink(); + context.components.loaderComponent()(); Widget initialBuilder(BuildContext context, CrudInitial state) => const SizedBox.shrink(); diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_grid_layout_cubit_screen_crud_list.dart b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_grid_layout_cubit_screen_crud_list.dart index 952a2c81..3bef8e64 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_grid_layout_cubit_screen_crud_list.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_grid_layout_cubit_screen_crud_list.dart @@ -24,7 +24,8 @@ abstract class BottomNavigationBarGridLayoutCubitScreenCrudList< with GridLayoutMixin { const BottomNavigationBarGridLayoutCubitScreenCrudList({ super.custom, - super.height = 60, + super.barId, + super.scaffoldFieldsWrapper, super.key, }); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen.dart b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen.dart index 0a02294f..ed0c7a82 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen.dart @@ -26,18 +26,21 @@ abstract class BottomNavigationBarLayoutCubitScreen< State extends Object> extends CubitScreenBase { const BottomNavigationBarLayoutCubitScreen({ this.custom, - this.height = 60, + this.barId, + this.scaffoldFieldsWrapper, super.key, }); - final double height; - final BottomNavigationBarComponent? Function(BottomNavigationBarComponent?)? - custom; + final ComponentCallBack? custom; + final ScaffoldFieldsWrapper? scaffoldFieldsWrapper; + final String? barId; @override Widget parent(BuildContext context, Widget child) => - BottomNavigationBarLayout( + StructuralLayout.withBottomNavBar( custom: custom, + barId: barId, + scaffoldFieldsWrapper: scaffoldFieldsWrapper, body: child, ); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud.dart b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud.dart index c1cc938d..f6fcbad6 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud.dart @@ -26,7 +26,8 @@ abstract class BottomNavigationBarLayoutCubitScreenCrud< with CrudMixin { const BottomNavigationBarLayoutCubitScreenCrud({ super.custom, - super.height, + super.barId, + super.scaffoldFieldsWrapper, super.key, }); diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud_item.dart b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud_item.dart index 69ff4371..aa65e30a 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud_item.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud_item.dart @@ -24,7 +24,8 @@ abstract class BottomNavigationBarLayoutCubitScreenCrudItem< CrudLoaded> { const BottomNavigationBarLayoutCubitScreenCrudItem({ super.custom, - super.height = 60, + super.barId, + super.scaffoldFieldsWrapper, super.key, }); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud_list.dart b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud_list.dart index 7c6c5b21..2d884bfa 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud_list.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud_list.dart @@ -24,7 +24,8 @@ abstract class BottomNavigationBarLayoutCubitScreenCrudList< CrudListLoaded> { const BottomNavigationBarLayoutCubitScreenCrudList({ super.custom, - super.height = 60, + super.barId, + super.scaffoldFieldsWrapper, super.key, }); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_grid_layout_cubit_screen_crud_list.dart b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_grid_layout_cubit_screen_crud_list.dart index 044776d5..162464dc 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_grid_layout_cubit_screen_crud_list.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_grid_layout_cubit_screen_crud_list.dart @@ -25,7 +25,11 @@ abstract class FrameLayoutGridCubitScreenCrudList< const FrameLayoutGridCubitScreenCrudList({ super.customAppBar, super.customBottomNavBar, - super.height = 60, + super.floatingActionButtonId, + super.height, + super.appBarId, + super.bottomNavBarId, + super.customFloatingActionButton, super.scaffoldFieldsWrapper, super.key, }); diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen.dart b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen.dart index d5b6d415..2adc78c2 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen.dart @@ -26,21 +26,34 @@ abstract class FrameLayoutCubitScreen, const FrameLayoutCubitScreen({ this.customAppBar, this.customBottomNavBar, + this.customFloatingActionButton, + this.appBarId, + this.bottomNavBarId, + this.floatingActionButtonId, this.scaffoldFieldsWrapper, this.height = 60, super.key, }); - final TopAppBarComponent? Function(TopAppBarComponent?)? customAppBar; - final BottomNavigationBarComponent? Function(BottomNavigationBarComponent?)? - customBottomNavBar; + final ComponentCallBack? customAppBar; + final ComponentCallBack? customBottomNavBar; + final ComponentCallBack? + customFloatingActionButton; + final String? appBarId; + final String? bottomNavBarId; + final String? floatingActionButtonId; final double height; final ScaffoldFieldsWrapper? scaffoldFieldsWrapper; @override - Widget parent(BuildContext context, Widget child) => FrameLayout( + Widget parent(BuildContext context, Widget child) => + StructuralLayout.withFrame( customAppBar: customAppBar, customBottomNavBar: customBottomNavBar, + customFloatingActionButton: customFloatingActionButton, + appBarId: appBarId, + bottomNavBarId: bottomNavBarId, + floatingActionButtonId: floatingActionButtonId, height: height, scaffoldFieldsWrapper: scaffoldFieldsWrapper, body: child, diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud.dart b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud.dart index 0803c37e..f29a6afd 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud.dart @@ -27,9 +27,13 @@ abstract class FrameLayoutCubitScreenCrud< const FrameLayoutCubitScreenCrud({ super.customAppBar, super.customBottomNavBar, + super.floatingActionButtonId, super.height, - super.key, + super.appBarId, + super.bottomNavBarId, + super.customFloatingActionButton, super.scaffoldFieldsWrapper, + super.key, }); @override diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud_item.dart b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud_item.dart index e3d9e965..ec3b37a4 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud_item.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud_item.dart @@ -24,7 +24,11 @@ abstract class FrameLayoutCubitScreenCrudItem< const FrameLayoutCubitScreenCrudItem({ super.customAppBar, super.customBottomNavBar, - super.height = 60, + super.floatingActionButtonId, + super.height, + super.appBarId, + super.bottomNavBarId, + super.customFloatingActionButton, super.scaffoldFieldsWrapper, super.key, }); diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud_list.dart b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud_list.dart index 7ff1910b..e6831695 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud_list.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud_list.dart @@ -24,7 +24,11 @@ abstract class FrameLayoutCubitScreenCrudList< const FrameLayoutCubitScreenCrudList({ super.customAppBar, super.customBottomNavBar, - super.height = 60, + super.floatingActionButtonId, + super.height, + super.appBarId, + super.bottomNavBarId, + super.customFloatingActionButton, super.scaffoldFieldsWrapper, super.key, }); diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/structural_bloc_layout.dart b/packages/wyatt_bloc_layout/lib/src/presentation/structural_bloc_layout.dart new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/packages/wyatt_bloc_layout/lib/src/presentation/structural_bloc_layout.dart @@ -0,0 +1 @@ + diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_grid_layout_cubit_screen_crud_list.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_grid_layout_cubit_screen_crud_list.dart index e20a1842..d0bfcd07 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_grid_layout_cubit_screen_crud_list.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_grid_layout_cubit_screen_crud_list.dart @@ -25,6 +25,8 @@ abstract class TopAppBarGridLayoutCubitScreenCrudList< const TopAppBarGridLayoutCubitScreenCrudList({ super.custom, super.height = 60, + super.barId, + super.scaffoldFieldsWrapper, super.key, }); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen.dart index 48fe0abe..4f79e518 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen.dart @@ -25,17 +25,23 @@ abstract class TopAppBarLayoutCubitScreen, State extends Object> extends CubitScreenBase { const TopAppBarLayoutCubitScreen({ this.custom, + this.barId, + this.scaffoldFieldsWrapper, this.height = 60, super.key, }); final double height; - final TopAppBarComponent? Function(TopAppBarComponent?)? custom; + final ComponentCallBack? custom; + final String? barId; + final ScaffoldFieldsWrapper? scaffoldFieldsWrapper; @override Widget parent(BuildContext context, Widget child) => TopAppBarLayout( height: height, custom: custom, + barId: barId, + scaffoldFieldsWrapper: scaffoldFieldsWrapper, body: child, ); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud.dart index efa82d3e..9a15513e 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud.dart @@ -27,6 +27,8 @@ abstract class TopAppBarLayoutCubitScreenCrud< const TopAppBarLayoutCubitScreenCrud({ super.custom, super.height, + super.barId, + super.scaffoldFieldsWrapper, super.key, }); diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud_item.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud_item.dart index dd7e2bb1..9011b564 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud_item.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud_item.dart @@ -24,6 +24,8 @@ abstract class TopAppBarLayoutCubitScreenCrudItem< const TopAppBarLayoutCubitScreenCrudItem({ super.custom, super.height = 60, + super.barId, + super.scaffoldFieldsWrapper, super.key, }); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud_list.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud_list.dart index 902ce24c..e4b36161 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud_list.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud_list.dart @@ -24,6 +24,8 @@ abstract class TopAppBarLayoutCubitScreenCrudList< const TopAppBarLayoutCubitScreenCrudList({ super.custom, super.height = 60, + super.barId, + super.scaffoldFieldsWrapper, super.key, }); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_grid_layout_cubit_screen_crud_list.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_grid_layout_cubit_screen_crud_list.dart index b57d29cf..ff8f6bb8 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_grid_layout_cubit_screen_crud_list.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_grid_layout_cubit_screen_crud_list.dart @@ -25,6 +25,8 @@ abstract class TopNavigationBarGridLayoutCubitScreenCrudList< const TopNavigationBarGridLayoutCubitScreenCrudList({ super.custom, super.height = 60, + super.barId, + super.scaffoldFieldsWrapper, super.key, }); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen.dart index b1903cdc..71352ce3 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen.dart @@ -27,16 +27,23 @@ abstract class TopNavigationBarLayoutCubitScreen< const TopNavigationBarLayoutCubitScreen({ this.custom, this.height = 60, + this.barId, + this.scaffoldFieldsWrapper, super.key, }); final double height; - final TopNavigationBarComponent? Function(TopNavigationBarComponent?)? custom; + final ComponentCallBack? custom; + final String? barId; + final ScaffoldFieldsWrapper? scaffoldFieldsWrapper; @override - Widget parent(BuildContext context, Widget child) => TopNavigationBarLayout( - height: height, + Widget parent(BuildContext context, Widget child) => + StructuralLayout.withTopNavigationBar( + barId: barId, custom: custom, + height: height, + scaffoldFieldsWrapper: scaffoldFieldsWrapper, body: child, ); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud.dart index 76bd6beb..4de19691 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud.dart @@ -27,6 +27,8 @@ abstract class TopNavigationBarLayoutCubitScreenCrud< const TopNavigationBarLayoutCubitScreenCrud({ super.custom, super.height, + super.barId, + super.scaffoldFieldsWrapper, super.key, }); diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud_item.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud_item.dart index 112b8844..d1fce340 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud_item.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud_item.dart @@ -25,6 +25,8 @@ abstract class TopNavigationBarLayoutCubitScreenCrudItem< const TopNavigationBarLayoutCubitScreenCrudItem({ super.custom, super.height = 60, + super.barId, + super.scaffoldFieldsWrapper, super.key, }); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud_list.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud_list.dart index 0f17b282..092fee71 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud_list.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud_list.dart @@ -25,6 +25,8 @@ abstract class TopNavigationBarLayoutCubitScreenCrudList< const TopNavigationBarLayoutCubitScreenCrudList({ super.custom, super.height = 60, + super.barId, + super.scaffoldFieldsWrapper, super.key, }); } -- 2.47.2 From 59fcd93aa5e00a7272270737d9d4b225409c1eb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malo=20L=C3=A9on?= Date: Mon, 28 Aug 2023 14:33:48 +0200 Subject: [PATCH 5/8] feat(bloc_layout): add components ids in crud mixin --- .../lib/src/core/crud_cubit_consumer_screen_mixin.dart | 7 +++++-- .../lib/src/presentation/cubit_screen_crud_item_base.dart | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/wyatt_bloc_layout/lib/src/core/crud_cubit_consumer_screen_mixin.dart b/packages/wyatt_bloc_layout/lib/src/core/crud_cubit_consumer_screen_mixin.dart index 79e5f00d..90e0df4e 100644 --- a/packages/wyatt_bloc_layout/lib/src/core/crud_cubit_consumer_screen_mixin.dart +++ b/packages/wyatt_bloc_layout/lib/src/core/crud_cubit_consumer_screen_mixin.dart @@ -22,14 +22,17 @@ import 'package:wyatt_ui_components/wyatt_ui_components.dart'; mixin CrudMixin, SuccessState extends CrudSuccess> { + String? get loaderId => null; + String? get erroId => null; + Widget errorBuilder(BuildContext context, CrudError state) => - context.components.errorComponent().call( + context.components.errorComponent(erroId).call( message: (state.message != null) ? TextWrapper(state.message!) : null, ); Widget loadingBuilder(BuildContext context, CrudLoading state) => - context.components.loaderComponent()(); + context.components.loaderComponent(loaderId).call(); Widget initialBuilder(BuildContext context, CrudInitial state) => const SizedBox.shrink(); diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/cubit_screen_crud_item_base.dart b/packages/wyatt_bloc_layout/lib/src/presentation/cubit_screen_crud_item_base.dart index 3fe2becb..be09290c 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/cubit_screen_crud_item_base.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/cubit_screen_crud_item_base.dart @@ -20,5 +20,7 @@ import 'package:wyatt_crud_bloc/wyatt_crud_bloc.dart'; abstract class CubitScreenCrudItemBase, T extends Object?> extends CubitScreenCrudBase> { - const CubitScreenCrudItemBase({super.key}); + const CubitScreenCrudItemBase({ + super.key, + }); } -- 2.47.2 From 2add09840d40c4812078ec4339d01d41f0ee4169 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malo=20L=C3=A9on?= Date: Mon, 28 Aug 2023 15:09:26 +0200 Subject: [PATCH 6/8] docs: update plantuml models --- .../models/class-models.puml | 55 ++++++++++++++++--- 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/packages/wyatt_bloc_layout/models/class-models.puml b/packages/wyatt_bloc_layout/models/class-models.puml index 60bf99ae..29f179c8 100644 --- a/packages/wyatt_bloc_layout/models/class-models.puml +++ b/packages/wyatt_bloc_layout/models/class-models.puml @@ -1,12 +1,16 @@ -@startuml Class Model +@startuml _ set namespaceSeparator :: abstract class "wyatt_bloc_layout::src::core::mixins::gird_view_mixin.dart::GridLayoutMixin" { + +double verticalGap + +double horizontalGap +Widget gridChild() +Widget successBuilder() } abstract class "wyatt_bloc_layout::src::core::crud_cubit_consumer_screen_mixin.dart::CrudMixin" { + +String? loaderId + +String? erroId +Widget errorBuilder() +Widget loadingBuilder() +Widget initialBuilder() @@ -19,11 +23,26 @@ abstract class "wyatt_bloc_layout::src::presentation::cubit_screen_base.dart::Cu "wyatt_bloc_helper::src::cubit.dart::CubitScreen" <|-- "wyatt_bloc_layout::src::presentation::cubit_screen_base.dart::CubitScreenBase" +abstract class "wyatt_bloc_layout::src::presentation::cubit_consumer_crud_list_base.dart::CubitConsumerCrudListBase" { +} + +"wyatt_bloc_layout::src::presentation::cubit_consumer_crud_base.dart::CubitConsumerCrudBase" <|-- "wyatt_bloc_layout::src::presentation::cubit_consumer_crud_list_base.dart::CubitConsumerCrudListBase" + +abstract class "wyatt_bloc_layout::src::presentation::cubit_consumer_base.dart::CubitConsumerBase" { +} + +"wyatt_bloc_helper::src::cubit.dart::CubitConsumerScreen" <|-- "wyatt_bloc_layout::src::presentation::cubit_consumer_base.dart::CubitConsumerBase" + abstract class "wyatt_bloc_layout::src::presentation::cubit_screen_crud_list_base.dart::CubitScreenCrudListBase" { } "wyatt_bloc_layout::src::presentation::cubit_screen_crud_base.dart::CubitScreenCrudBase" <|-- "wyatt_bloc_layout::src::presentation::cubit_screen_crud_list_base.dart::CubitScreenCrudListBase" +abstract class "wyatt_bloc_layout::src::presentation::cubit_consumer_crud_item_base.dart::CubitConsumerCrudItemBase" { +} + +"wyatt_bloc_layout::src::presentation::cubit_consumer_crud_base.dart::CubitConsumerCrudBase" <|-- "wyatt_bloc_layout::src::presentation::cubit_consumer_crud_item_base.dart::CubitConsumerCrudItemBase" + abstract class "wyatt_bloc_layout::src::presentation::frame_bloc_layout::frame_layout_cubit_screen_crud.dart::FrameLayoutCubitScreenCrud" { +Widget onBuild() } @@ -39,12 +58,19 @@ abstract class "wyatt_bloc_layout::src::presentation::frame_bloc_layout::frame_l abstract class "wyatt_bloc_layout::src::presentation::frame_bloc_layout::frame_layout_cubit_screen.dart::FrameLayoutCubitScreen" { +TopAppBarComponent? Function(TopAppBarComponent?)? customAppBar +BottomNavigationBarComponent? Function(BottomNavigationBarComponent?)? customBottomNavBar + +FloatingActionButtonComponent? Function(FloatingActionButtonComponent?)? customFloatingActionButton + +String? appBarId + +String? bottomNavBarId + +String? floatingActionButtonId +double height + +ScaffoldFieldsWrapper? scaffoldFieldsWrapper +Widget parent() } -"wyatt_bloc_layout::src::presentation::frame_bloc_layout::frame_layout_cubit_screen.dart::FrameLayoutCubitScreen" o-- "null::TopAppBarComponent Function(TopAppBarComponent)" -"wyatt_bloc_layout::src::presentation::frame_bloc_layout::frame_layout_cubit_screen.dart::FrameLayoutCubitScreen" o-- "null::BottomNavigationBarComponent Function(BottomNavigationBarComponent)" +"wyatt_bloc_layout::src::presentation::frame_bloc_layout::frame_layout_cubit_screen.dart::FrameLayoutCubitScreen" o-- "wyatt_ui_layout::src::presentation::layouts::structural_layouts::structural_layout.dart::TopAppBarComponent Function(TopAppBarComponent)" +"wyatt_bloc_layout::src::presentation::frame_bloc_layout::frame_layout_cubit_screen.dart::FrameLayoutCubitScreen" o-- "wyatt_ui_layout::src::presentation::layouts::structural_layouts::structural_layout.dart::BottomNavigationBarComponent Function(BottomNavigationBarComponent)" +"wyatt_bloc_layout::src::presentation::frame_bloc_layout::frame_layout_cubit_screen.dart::FrameLayoutCubitScreen" o-- "wyatt_ui_layout::src::presentation::layouts::structural_layouts::structural_layout.dart::FloatingActionButtonComponent Function(FloatingActionButtonComponent)" +"wyatt_bloc_layout::src::presentation::frame_bloc_layout::frame_layout_cubit_screen.dart::FrameLayoutCubitScreen" o-- "wyatt_ui_layout::src::core::scaffold_fields_wrapper.dart::ScaffoldFieldsWrapper" "wyatt_bloc_layout::src::presentation::cubit_screen_base.dart::CubitScreenBase" <|-- "wyatt_bloc_layout::src::presentation::frame_bloc_layout::frame_layout_cubit_screen.dart::FrameLayoutCubitScreen" abstract class "wyatt_bloc_layout::src::presentation::frame_bloc_layout::frame_grid_layout_cubit_screen_crud_list.dart::FrameLayoutGridCubitScreenCrudList" { @@ -71,10 +97,13 @@ abstract class "wyatt_bloc_layout::src::presentation::top_app_bar_bloc_layout::t abstract class "wyatt_bloc_layout::src::presentation::top_app_bar_bloc_layout::top_app_bar_layout_cubit_screen.dart::TopAppBarLayoutCubitScreen" { +double height +TopAppBarComponent? Function(TopAppBarComponent?)? custom + +String? barId + +ScaffoldFieldsWrapper? scaffoldFieldsWrapper +Widget parent() } -"wyatt_bloc_layout::src::presentation::top_app_bar_bloc_layout::top_app_bar_layout_cubit_screen.dart::TopAppBarLayoutCubitScreen" o-- "null::TopAppBarComponent Function(TopAppBarComponent)" +"wyatt_bloc_layout::src::presentation::top_app_bar_bloc_layout::top_app_bar_layout_cubit_screen.dart::TopAppBarLayoutCubitScreen" o-- "wyatt_ui_layout::src::presentation::layouts::structural_layouts::structural_layout.dart::TopAppBarComponent Function(TopAppBarComponent)" +"wyatt_bloc_layout::src::presentation::top_app_bar_bloc_layout::top_app_bar_layout_cubit_screen.dart::TopAppBarLayoutCubitScreen" o-- "wyatt_ui_layout::src::core::scaffold_fields_wrapper.dart::ScaffoldFieldsWrapper" "wyatt_bloc_layout::src::presentation::cubit_screen_base.dart::CubitScreenBase" <|-- "wyatt_bloc_layout::src::presentation::top_app_bar_bloc_layout::top_app_bar_layout_cubit_screen.dart::TopAppBarLayoutCubitScreen" abstract class "wyatt_bloc_layout::src::presentation::top_app_bar_bloc_layout::top_app_bar_layout_cubit_screen_crud.dart::TopAppBarLayoutCubitScreenCrud" { @@ -108,13 +137,22 @@ abstract class "wyatt_bloc_layout::src::presentation::cubit_screen_crud_base.dar "wyatt_bloc_layout::src::presentation::cubit_screen_base.dart::CubitScreenBase" <|-- "wyatt_bloc_layout::src::presentation::cubit_screen_crud_base.dart::CubitScreenCrudBase" "wyatt_bloc_layout::src::core::crud_cubit_consumer_screen_mixin.dart::CrudMixin" <|-- "wyatt_bloc_layout::src::presentation::cubit_screen_crud_base.dart::CubitScreenCrudBase" +abstract class "wyatt_bloc_layout::src::presentation::cubit_consumer_crud_base.dart::CubitConsumerCrudBase" { + +Widget onBuild() +} + +"wyatt_bloc_layout::src::presentation::cubit_consumer_base.dart::CubitConsumerBase" <|-- "wyatt_bloc_layout::src::presentation::cubit_consumer_crud_base.dart::CubitConsumerCrudBase" +"wyatt_bloc_layout::src::core::crud_cubit_consumer_screen_mixin.dart::CrudMixin" <|-- "wyatt_bloc_layout::src::presentation::cubit_consumer_crud_base.dart::CubitConsumerCrudBase" + abstract class "wyatt_bloc_layout::src::presentation::bottom_navigation_bar_bloc_layout::bottom_navigation_bar_layout_cubit_screen.dart::BottomNavigationBarLayoutCubitScreen" { - +double height +BottomNavigationBarComponent? Function(BottomNavigationBarComponent?)? custom + +ScaffoldFieldsWrapper? scaffoldFieldsWrapper + +String? barId +Widget parent() } -"wyatt_bloc_layout::src::presentation::bottom_navigation_bar_bloc_layout::bottom_navigation_bar_layout_cubit_screen.dart::BottomNavigationBarLayoutCubitScreen" o-- "null::BottomNavigationBarComponent Function(BottomNavigationBarComponent)" +"wyatt_bloc_layout::src::presentation::bottom_navigation_bar_bloc_layout::bottom_navigation_bar_layout_cubit_screen.dart::BottomNavigationBarLayoutCubitScreen" o-- "wyatt_ui_layout::src::presentation::layouts::structural_layouts::structural_layout.dart::BottomNavigationBarComponent Function(BottomNavigationBarComponent)" +"wyatt_bloc_layout::src::presentation::bottom_navigation_bar_bloc_layout::bottom_navigation_bar_layout_cubit_screen.dart::BottomNavigationBarLayoutCubitScreen" o-- "wyatt_ui_layout::src::core::scaffold_fields_wrapper.dart::ScaffoldFieldsWrapper" "wyatt_bloc_layout::src::presentation::cubit_screen_base.dart::CubitScreenBase" <|-- "wyatt_bloc_layout::src::presentation::bottom_navigation_bar_bloc_layout::bottom_navigation_bar_layout_cubit_screen.dart::BottomNavigationBarLayoutCubitScreen" abstract class "wyatt_bloc_layout::src::presentation::bottom_navigation_bar_bloc_layout::bottom_navigation_bar_layout_cubit_screen_crud_item.dart::BottomNavigationBarLayoutCubitScreenCrudItem" { @@ -154,10 +192,13 @@ abstract class "wyatt_bloc_layout::src::presentation::top_navigation_bar_bloc_la abstract class "wyatt_bloc_layout::src::presentation::top_navigation_bar_bloc_layout::top_navigation_bar_layout_cubit_screen.dart::TopNavigationBarLayoutCubitScreen" { +double height +TopNavigationBarComponent? Function(TopNavigationBarComponent?)? custom + +String? barId + +ScaffoldFieldsWrapper? scaffoldFieldsWrapper +Widget parent() } -"wyatt_bloc_layout::src::presentation::top_navigation_bar_bloc_layout::top_navigation_bar_layout_cubit_screen.dart::TopNavigationBarLayoutCubitScreen" o-- "null::TopNavigationBarComponent Function(TopNavigationBarComponent)" +"wyatt_bloc_layout::src::presentation::top_navigation_bar_bloc_layout::top_navigation_bar_layout_cubit_screen.dart::TopNavigationBarLayoutCubitScreen" o-- "wyatt_ui_layout::src::presentation::layouts::structural_layouts::structural_layout.dart::TopNavigationBarComponent Function(TopNavigationBarComponent)" +"wyatt_bloc_layout::src::presentation::top_navigation_bar_bloc_layout::top_navigation_bar_layout_cubit_screen.dart::TopNavigationBarLayoutCubitScreen" o-- "wyatt_ui_layout::src::core::scaffold_fields_wrapper.dart::ScaffoldFieldsWrapper" "wyatt_bloc_layout::src::presentation::cubit_screen_base.dart::CubitScreenBase" <|-- "wyatt_bloc_layout::src::presentation::top_navigation_bar_bloc_layout::top_navigation_bar_layout_cubit_screen.dart::TopNavigationBarLayoutCubitScreen" abstract class "wyatt_bloc_layout::src::presentation::top_navigation_bar_bloc_layout::top_navigation_bar_layout_cubit_screen_crud_item.dart::TopNavigationBarLayoutCubitScreenCrudItem" { -- 2.47.2 From 2addc94405d9c325844356fe355a4cb13fcad92b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malo=20L=C3=A9on?= Date: Mon, 28 Aug 2023 15:10:52 +0200 Subject: [PATCH 7/8] fix(bloc_layout): typo on erroId --- .../lib/src/core/crud_cubit_consumer_screen_mixin.dart | 8 ++++---- packages/wyatt_bloc_layout/models/class-models.puml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/wyatt_bloc_layout/lib/src/core/crud_cubit_consumer_screen_mixin.dart b/packages/wyatt_bloc_layout/lib/src/core/crud_cubit_consumer_screen_mixin.dart index 90e0df4e..a549af5b 100644 --- a/packages/wyatt_bloc_layout/lib/src/core/crud_cubit_consumer_screen_mixin.dart +++ b/packages/wyatt_bloc_layout/lib/src/core/crud_cubit_consumer_screen_mixin.dart @@ -22,17 +22,17 @@ import 'package:wyatt_ui_components/wyatt_ui_components.dart'; mixin CrudMixin, SuccessState extends CrudSuccess> { - String? get loaderId => null; - String? get erroId => null; + String? get loaderComponentId => null; + String? get errorComponentId => null; Widget errorBuilder(BuildContext context, CrudError state) => - context.components.errorComponent(erroId).call( + context.components.errorComponent(errorComponentId).call( message: (state.message != null) ? TextWrapper(state.message!) : null, ); Widget loadingBuilder(BuildContext context, CrudLoading state) => - context.components.loaderComponent(loaderId).call(); + context.components.loaderComponent(loaderComponentId).call(); Widget initialBuilder(BuildContext context, CrudInitial state) => const SizedBox.shrink(); diff --git a/packages/wyatt_bloc_layout/models/class-models.puml b/packages/wyatt_bloc_layout/models/class-models.puml index 29f179c8..06105fad 100644 --- a/packages/wyatt_bloc_layout/models/class-models.puml +++ b/packages/wyatt_bloc_layout/models/class-models.puml @@ -9,8 +9,8 @@ abstract class "wyatt_bloc_layout::src::core::mixins::gird_view_mixin.dart::Grid } abstract class "wyatt_bloc_layout::src::core::crud_cubit_consumer_screen_mixin.dart::CrudMixin" { - +String? loaderId - +String? erroId + +String? loaderComponentId + +String? errorComponentId +Widget errorBuilder() +Widget loadingBuilder() +Widget initialBuilder() -- 2.47.2 From 0a950638db425724ab11fdca340340869fd0a138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Malo=20L=C3=A9on?= Date: Mon, 28 Aug 2023 15:14:24 +0200 Subject: [PATCH 8/8] chore(ui_layput): update gitignore with macos config files --- packages/wyatt_ui_layout/example/macos/.gitignore | 3 ++- .../Flutter/ephemeral/Flutter-Generated.xcconfig | 13 ------------- .../ephemeral/flutter_export_environment.sh | 14 -------------- 3 files changed, 2 insertions(+), 28 deletions(-) delete mode 100644 packages/wyatt_ui_layout/example/macos/Flutter/ephemeral/Flutter-Generated.xcconfig delete mode 100755 packages/wyatt_ui_layout/example/macos/Flutter/ephemeral/flutter_export_environment.sh diff --git a/packages/wyatt_ui_layout/example/macos/.gitignore b/packages/wyatt_ui_layout/example/macos/.gitignore index 746adbb6..b0f7d879 100644 --- a/packages/wyatt_ui_layout/example/macos/.gitignore +++ b/packages/wyatt_ui_layout/example/macos/.gitignore @@ -1,5 +1,6 @@ # Flutter-related -**/Flutter/ephemeral/ +Flutter/ephemeral/ +Flutter/Generated.xcconfig **/Pods/ # Xcode-related diff --git a/packages/wyatt_ui_layout/example/macos/Flutter/ephemeral/Flutter-Generated.xcconfig b/packages/wyatt_ui_layout/example/macos/Flutter/ephemeral/Flutter-Generated.xcconfig deleted file mode 100644 index 80a67b61..00000000 --- a/packages/wyatt_ui_layout/example/macos/Flutter/ephemeral/Flutter-Generated.xcconfig +++ /dev/null @@ -1,13 +0,0 @@ -// This is a generated file; do not edit or check into version control. -FLUTTER_ROOT=/Users/maloleon/Library/flutter -FLUTTER_APPLICATION_PATH=/Users/maloleon/Studio/wyatt-packages/packages/wyatt_ui_layout/example -COCOAPODS_PARALLEL_CODE_SIGN=true -FLUTTER_TARGET=/Users/maloleon/Studio/wyatt-packages/packages/wyatt_ui_layout/example/lib/main.dart -FLUTTER_BUILD_DIR=build -FLUTTER_BUILD_NAME=1.0.0 -FLUTTER_BUILD_NUMBER=1 -DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==,RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC9iMjAxODNlMDQwOTYwOTRiY2MzN2Q5Y2RlMmE0Yjk2ZjVjYzY4NGNmLw== -DART_OBFUSCATION=false -TRACK_WIDGET_CREATION=true -TREE_SHAKE_ICONS=false -PACKAGE_CONFIG=/Users/maloleon/Studio/wyatt-packages/packages/wyatt_ui_layout/example/.dart_tool/package_config.json diff --git a/packages/wyatt_ui_layout/example/macos/Flutter/ephemeral/flutter_export_environment.sh b/packages/wyatt_ui_layout/example/macos/Flutter/ephemeral/flutter_export_environment.sh deleted file mode 100755 index 51db70ad..00000000 --- a/packages/wyatt_ui_layout/example/macos/Flutter/ephemeral/flutter_export_environment.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# This is a generated file; do not edit or check into version control. -export "FLUTTER_ROOT=/Users/maloleon/Library/flutter" -export "FLUTTER_APPLICATION_PATH=/Users/maloleon/Studio/wyatt-packages/packages/wyatt_ui_layout/example" -export "COCOAPODS_PARALLEL_CODE_SIGN=true" -export "FLUTTER_TARGET=/Users/maloleon/Studio/wyatt-packages/packages/wyatt_ui_layout/example/lib/main.dart" -export "FLUTTER_BUILD_DIR=build" -export "FLUTTER_BUILD_NAME=1.0.0" -export "FLUTTER_BUILD_NUMBER=1" -export "DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==,RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC9iMjAxODNlMDQwOTYwOTRiY2MzN2Q5Y2RlMmE0Yjk2ZjVjYzY4NGNmLw==" -export "DART_OBFUSCATION=false" -export "TRACK_WIDGET_CREATION=true" -export "TREE_SHAKE_ICONS=false" -export "PACKAGE_CONFIG=/Users/maloleon/Studio/wyatt-packages/packages/wyatt_ui_layout/example/.dart_tool/package_config.json" -- 2.47.2