Compare commits
No commits in common. "008facdb6c7cc905b5ff91c1521072c306cf4bef" and "5a7b8bf958d6d5528bde7e8093790b5b209fc64e" have entirely different histories.
008facdb6c
...
5a7b8bf958
@ -18,7 +18,6 @@ import 'package:copy_with_extension/copy_with_extension.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:wyatt_ui_components/src/core/utils/component_registry.dart';
|
import 'package:wyatt_ui_components/src/core/utils/component_registry.dart';
|
||||||
import 'package:wyatt_ui_components/src/domain/entities/entities.dart';
|
import 'package:wyatt_ui_components/src/domain/entities/entities.dart';
|
||||||
|
|
||||||
part 'component_theme_data.g.dart';
|
part 'component_theme_data.g.dart';
|
||||||
|
|
||||||
/// {@template component_theme_data}
|
/// {@template component_theme_data}
|
||||||
@ -129,35 +128,17 @@ class ComponentThemeData {
|
|||||||
return returned;
|
return returned;
|
||||||
}
|
}
|
||||||
|
|
||||||
R? _getOrNull<T extends Component, R>(T? component, R? returned) {
|
|
||||||
if (component == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return returned;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bars
|
// Bars
|
||||||
final ComponentRegistry<TopAppBarComponent>? topAppBars;
|
final ComponentRegistry<TopAppBarComponent>? topAppBars;
|
||||||
$TopAppBarComponentCWProxy topAppBarComponent([String? id]) =>
|
$TopAppBarComponentCWProxy topAppBarComponent([String? id]) =>
|
||||||
_get(topAppBars?.call(id), topAppBars?.call(id)?.copyWith);
|
_get(topAppBars?.call(id), topAppBars?.call(id)?.copyWith);
|
||||||
|
|
||||||
$TopAppBarComponentCWProxy? topAppBarComponentOrNull([String? id]) =>
|
|
||||||
_getOrNull(topAppBars?.call(id), topAppBars?.call(id)?.copyWith);
|
|
||||||
|
|
||||||
final ComponentRegistry<TopNavigationBarComponent>? topNavigationBars;
|
final ComponentRegistry<TopNavigationBarComponent>? topNavigationBars;
|
||||||
$TopNavigationBarComponentCWProxy topNavigationBarComponent([String? id]) =>
|
$TopNavigationBarComponentCWProxy topNavigationBarComponent([String? id]) =>
|
||||||
_get(
|
_get(
|
||||||
topNavigationBars?.call(id),
|
topNavigationBars?.call(id),
|
||||||
topNavigationBars?.call(id)?.copyWith,
|
topNavigationBars?.call(id)?.copyWith,
|
||||||
);
|
);
|
||||||
$TopNavigationBarComponentCWProxy? topNavigationBarComponentOrNull([
|
|
||||||
String? id,
|
|
||||||
]) =>
|
|
||||||
_getOrNull(
|
|
||||||
topNavigationBars?.call(id),
|
|
||||||
topNavigationBars?.call(id)?.copyWith,
|
|
||||||
);
|
|
||||||
|
|
||||||
final ComponentRegistry<BottomNavigationBarComponent>? bottomNavigationBars;
|
final ComponentRegistry<BottomNavigationBarComponent>? bottomNavigationBars;
|
||||||
$BottomNavigationBarComponentCWProxy bottomNavigationBarComponent([
|
$BottomNavigationBarComponentCWProxy bottomNavigationBarComponent([
|
||||||
@ -167,84 +148,46 @@ class ComponentThemeData {
|
|||||||
bottomNavigationBars?.call(id),
|
bottomNavigationBars?.call(id),
|
||||||
bottomNavigationBars?.call(id)?.copyWith,
|
bottomNavigationBars?.call(id)?.copyWith,
|
||||||
);
|
);
|
||||||
$BottomNavigationBarComponentCWProxy? bottomNavigationBarComponentOrNull([
|
|
||||||
String? id,
|
|
||||||
]) =>
|
|
||||||
_getOrNull(
|
|
||||||
bottomNavigationBars?.call(id),
|
|
||||||
bottomNavigationBars?.call(id)?.copyWith,
|
|
||||||
);
|
|
||||||
|
|
||||||
// CRUD Widgets
|
// CRUD Widgets
|
||||||
final ComponentRegistry<ErrorComponent>? errors;
|
final ComponentRegistry<ErrorComponent>? errors;
|
||||||
$ErrorComponentCWProxy errorComponent([String? id]) =>
|
$ErrorComponentCWProxy errorComponent([String? id]) =>
|
||||||
_get(errors?.call(id), errors?.call(id)?.copyWith);
|
_get(errors?.call(id), errors?.call(id)?.copyWith);
|
||||||
$ErrorComponentCWProxy? errorComponentOrNull([String? id]) =>
|
|
||||||
_getOrNull(errors?.call(id), errors?.call(id)?.copyWith);
|
|
||||||
|
|
||||||
final ComponentRegistry<LoaderComponent>? loaders;
|
final ComponentRegistry<LoaderComponent>? loaders;
|
||||||
$LoaderComponentCWProxy loaderComponent([String? id]) =>
|
$LoaderComponentCWProxy loaderComponent([String? id]) =>
|
||||||
_get(loaders?.call(id), loaders?.call(id)?.copyWith);
|
_get(loaders?.call(id), loaders?.call(id)?.copyWith);
|
||||||
$LoaderComponentCWProxy? loaderComponentOrNull([String? id]) =>
|
|
||||||
_getOrNull(loaders?.call(id), loaders?.call(id)?.copyWith);
|
|
||||||
|
|
||||||
// Cards
|
// Cards
|
||||||
final ComponentRegistry<InformationCardComponent>? informationCards;
|
final ComponentRegistry<InformationCardComponent>? informationCards;
|
||||||
$InformationCardComponentCWProxy informationCardComponent([String? id]) =>
|
$InformationCardComponentCWProxy informationCardComponent([String? id]) =>
|
||||||
_get(informationCards?.call(id), informationCards?.call(id)?.copyWith);
|
_get(informationCards?.call(id), informationCards?.call(id)?.copyWith);
|
||||||
$InformationCardComponentCWProxy? informationCardComponentOrNull([
|
|
||||||
String? id,
|
|
||||||
]) =>
|
|
||||||
_getOrNull(
|
|
||||||
informationCards?.call(id),
|
|
||||||
informationCards?.call(id)?.copyWith,
|
|
||||||
);
|
|
||||||
|
|
||||||
final ComponentRegistry<PortfolioCardComponent>? portfolioCards;
|
final ComponentRegistry<PortfolioCardComponent>? portfolioCards;
|
||||||
$PortfolioCardComponentCWProxy portfolioCardComponent([String? id]) =>
|
$PortfolioCardComponentCWProxy portfolioCardComponent([String? id]) =>
|
||||||
_get(portfolioCards?.call(id), portfolioCards?.call(id)?.copyWith);
|
_get(portfolioCards?.call(id), portfolioCards?.call(id)?.copyWith);
|
||||||
$PortfolioCardComponentCWProxy? portfolioCardComponentOrNull([String? id]) =>
|
|
||||||
_getOrNull(
|
|
||||||
portfolioCards?.call(id),
|
|
||||||
portfolioCards?.call(id)?.copyWith,
|
|
||||||
);
|
|
||||||
|
|
||||||
final ComponentRegistry<QuoteCardComponent>? quoteCards;
|
final ComponentRegistry<QuoteCardComponent>? quoteCards;
|
||||||
$QuoteCardComponentCWProxy quoteCardComponent([String? id]) =>
|
$QuoteCardComponentCWProxy quoteCardComponent([String? id]) =>
|
||||||
_get(quoteCards?.call(id), quoteCards?.call(id)?.copyWith);
|
_get(quoteCards?.call(id), quoteCards?.call(id)?.copyWith);
|
||||||
$QuoteCardComponentCWProxy? quoteCardComponentOrNull([String? id]) =>
|
|
||||||
_getOrNull(quoteCards?.call(id), quoteCards?.call(id)?.copyWith);
|
|
||||||
|
|
||||||
final ComponentRegistry<SkillCardComponent>? skillCards;
|
final ComponentRegistry<SkillCardComponent>? skillCards;
|
||||||
$SkillCardComponentCWProxy skillCardComponent([String? id]) =>
|
$SkillCardComponentCWProxy skillCardComponent([String? id]) =>
|
||||||
_get(skillCards?.call(id), skillCards?.call(id)?.copyWith);
|
_get(skillCards?.call(id), skillCards?.call(id)?.copyWith);
|
||||||
$SkillCardComponentCWProxy? skillCardComponentOrNull([String? id]) =>
|
|
||||||
_getOrNull(skillCards?.call(id), skillCards?.call(id)?.copyWith);
|
|
||||||
|
|
||||||
final ComponentRegistry<PricingCardComponent>? pricingCards;
|
final ComponentRegistry<PricingCardComponent>? pricingCards;
|
||||||
$PricingCardComponentCWProxy pricingCardComponent([String? id]) =>
|
$PricingCardComponentCWProxy pricingCardComponent([String? id]) =>
|
||||||
_get(pricingCards?.call(id), pricingCards?.call(id)?.copyWith);
|
_get(pricingCards?.call(id), pricingCards?.call(id)?.copyWith);
|
||||||
$PricingCardComponentCWProxy? pricingCardComponentOrNull([String? id]) =>
|
|
||||||
_getOrNull(pricingCards?.call(id), pricingCards?.call(id)?.copyWith);
|
|
||||||
|
|
||||||
// Rich Text
|
// Rich Text
|
||||||
final ComponentRegistry<RichTextBuilderComponent>? richTextBuilders;
|
final ComponentRegistry<RichTextBuilderComponent>? richTextBuilders;
|
||||||
$RichTextBuilderComponentCWProxy richTextBuilderComponent([String? id]) =>
|
$RichTextBuilderComponentCWProxy richTextBuilderComponent([String? id]) =>
|
||||||
_get(richTextBuilders?.call(id), richTextBuilders?.call(id)?.copyWith);
|
_get(richTextBuilders?.call(id), richTextBuilders?.call(id)?.copyWith);
|
||||||
$RichTextBuilderComponentCWProxy? richTextBuilderComponentOrNull([
|
|
||||||
String? id,
|
|
||||||
]) =>
|
|
||||||
_getOrNull(
|
|
||||||
richTextBuilders?.call(id),
|
|
||||||
richTextBuilders?.call(id)?.copyWith,
|
|
||||||
);
|
|
||||||
|
|
||||||
// Text Inputs
|
// Text Inputs
|
||||||
final ComponentRegistry<TextInputComponent>? textInputs;
|
final ComponentRegistry<TextInputComponent>? textInputs;
|
||||||
$TextInputComponentCWProxy textInputComponent([String? id]) =>
|
$TextInputComponentCWProxy textInputComponent([String? id]) =>
|
||||||
_get(textInputs?.call(id), textInputs?.call(id)?.copyWith);
|
_get(textInputs?.call(id), textInputs?.call(id)?.copyWith);
|
||||||
$TextInputComponentCWProxy? textInputComponentOrNull([String? id]) =>
|
|
||||||
_getOrNull(textInputs?.call(id), textInputs?.call(id)?.copyWith);
|
|
||||||
|
|
||||||
// Buttons
|
// Buttons
|
||||||
final ComponentRegistry<FileSelectionButtonComponent>? fileSelectionButtons;
|
final ComponentRegistry<FileSelectionButtonComponent>? fileSelectionButtons;
|
||||||
@ -255,19 +198,10 @@ class ComponentThemeData {
|
|||||||
fileSelectionButtons?.call(id),
|
fileSelectionButtons?.call(id),
|
||||||
fileSelectionButtons?.call(id)?.copyWith,
|
fileSelectionButtons?.call(id)?.copyWith,
|
||||||
);
|
);
|
||||||
$FileSelectionButtonComponentCWProxy? fileSelectionButtonComponentOrNull([
|
|
||||||
String? id,
|
|
||||||
]) =>
|
|
||||||
_getOrNull(
|
|
||||||
fileSelectionButtons?.call(id),
|
|
||||||
fileSelectionButtons?.call(id)?.copyWith,
|
|
||||||
);
|
|
||||||
|
|
||||||
final ComponentRegistry<FlatButtonComponent>? flatButtons;
|
final ComponentRegistry<FlatButtonComponent>? flatButtons;
|
||||||
$FlatButtonComponentCWProxy flatButtonComponent([String? id]) =>
|
$FlatButtonComponentCWProxy flatButtonComponent([String? id]) =>
|
||||||
_get(flatButtons?.call(id), flatButtons?.call(id)?.copyWith);
|
_get(flatButtons?.call(id), flatButtons?.call(id)?.copyWith);
|
||||||
$FlatButtonComponentCWProxy? flatButtonComponentOrNull([String? id]) =>
|
|
||||||
_getOrNull(flatButtons?.call(id), flatButtons?.call(id)?.copyWith);
|
|
||||||
|
|
||||||
final ComponentRegistry<SimpleIconButtonComponent>? simpleIconButtons;
|
final ComponentRegistry<SimpleIconButtonComponent>? simpleIconButtons;
|
||||||
$SimpleIconButtonComponentCWProxy simpleIconButtonComponent([String? id]) =>
|
$SimpleIconButtonComponentCWProxy simpleIconButtonComponent([String? id]) =>
|
||||||
@ -275,19 +209,10 @@ class ComponentThemeData {
|
|||||||
simpleIconButtons?.call(id),
|
simpleIconButtons?.call(id),
|
||||||
simpleIconButtons?.call(id)?.copyWith,
|
simpleIconButtons?.call(id)?.copyWith,
|
||||||
);
|
);
|
||||||
$SimpleIconButtonComponentCWProxy? simpleIconButtonComponentOrNull([
|
|
||||||
String? id,
|
|
||||||
]) =>
|
|
||||||
_getOrNull(
|
|
||||||
simpleIconButtons?.call(id),
|
|
||||||
simpleIconButtons?.call(id)?.copyWith,
|
|
||||||
);
|
|
||||||
|
|
||||||
final ComponentRegistry<SymbolButtonComponent>? symbolButtons;
|
final ComponentRegistry<SymbolButtonComponent>? symbolButtons;
|
||||||
$SymbolButtonComponentCWProxy symbolButtonComponent([String? id]) =>
|
$SymbolButtonComponentCWProxy symbolButtonComponent([String? id]) =>
|
||||||
_get(symbolButtons?.call(id), symbolButtons?.call(id)?.copyWith);
|
_get(symbolButtons?.call(id), symbolButtons?.call(id)?.copyWith);
|
||||||
$SymbolButtonComponentCWProxy? symbolButtonComponentOrNull([String? id]) =>
|
|
||||||
_getOrNull(symbolButtons?.call(id), symbolButtons?.call(id)?.copyWith);
|
|
||||||
|
|
||||||
final ComponentRegistry<FloatingActionButtonComponent>? floatingActionButtons;
|
final ComponentRegistry<FloatingActionButtonComponent>? floatingActionButtons;
|
||||||
$FloatingActionButtonComponentCWProxy floatingActionButtonComponent([
|
$FloatingActionButtonComponentCWProxy floatingActionButtonComponent([
|
||||||
@ -297,11 +222,4 @@ class ComponentThemeData {
|
|||||||
floatingActionButtons?.call(id),
|
floatingActionButtons?.call(id),
|
||||||
floatingActionButtons?.call(id)?.copyWith,
|
floatingActionButtons?.call(id)?.copyWith,
|
||||||
);
|
);
|
||||||
$FloatingActionButtonComponentCWProxy? floatingActionButtonComponentOrNull([
|
|
||||||
String? id,
|
|
||||||
]) =>
|
|
||||||
_getOrNull(
|
|
||||||
floatingActionButtons?.call(id),
|
|
||||||
floatingActionButtons?.call(id)?.copyWith,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
@ -57,13 +57,9 @@ class BottomNavigationBarLayout extends StructuralLayout {
|
|||||||
Widget build(BuildContext context) => Scaffold(
|
Widget build(BuildContext context) => Scaffold(
|
||||||
body: body,
|
body: body,
|
||||||
bottomNavigationBar: custom?.call(
|
bottomNavigationBar: custom?.call(
|
||||||
context.components
|
context.components.bottomNavigationBarComponent(barId).call(),
|
||||||
.bottomNavigationBarComponentOrNull(barId)
|
|
||||||
?.call(),
|
|
||||||
) ??
|
) ??
|
||||||
context.components
|
context.components.bottomNavigationBarComponent(barId).call(),
|
||||||
.bottomNavigationBarComponentOrNull(barId)
|
|
||||||
?.call(),
|
|
||||||
floatingActionButtonLocation:
|
floatingActionButtonLocation:
|
||||||
scaffoldFieldsWrapper?.floatingActionButtonLocation,
|
scaffoldFieldsWrapper?.floatingActionButtonLocation,
|
||||||
floatingActionButtonAnimator:
|
floatingActionButtonAnimator:
|
||||||
|
@ -76,37 +76,29 @@ class FrameLayout extends StructuralLayout {
|
|||||||
|
|
||||||
final ScaffoldFieldsWrapper? scaffoldFieldsWrapper;
|
final ScaffoldFieldsWrapper? scaffoldFieldsWrapper;
|
||||||
|
|
||||||
PreferredSize? _buildAppBar(BuildContext context) {
|
|
||||||
final appBar = customAppBar?.call(
|
|
||||||
context.components.topAppBarComponentOrNull(appBarId)?.call(),
|
|
||||||
) ??
|
|
||||||
context.components.topAppBarComponentOrNull(appBarId)?.call();
|
|
||||||
|
|
||||||
return appBar != null
|
|
||||||
? PreferredSize(
|
|
||||||
preferredSize: Size.fromHeight(height),
|
|
||||||
child: appBar,
|
|
||||||
)
|
|
||||||
: null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => Scaffold(
|
Widget build(BuildContext context) => Scaffold(
|
||||||
appBar: _buildAppBar(context),
|
appBar: (customAppBar
|
||||||
|
?.call(context.components.topAppBarComponent(appBarId)()) !=
|
||||||
|
null)
|
||||||
|
? PreferredSize(
|
||||||
|
preferredSize: Size.fromHeight(height),
|
||||||
|
child: customAppBar?.call(
|
||||||
|
context.components.topAppBarComponent(appBarId)(),
|
||||||
|
) ??
|
||||||
|
context.components.topAppBarComponent(appBarId)(),
|
||||||
|
)
|
||||||
|
: null,
|
||||||
floatingActionButton: customFloatingActionButton?.call(
|
floatingActionButton: customFloatingActionButton?.call(
|
||||||
context.components
|
context.components
|
||||||
.floatingActionButtonComponentOrNull(floatingActionButtonId)
|
.floatingActionButtonComponent(floatingActionButtonId)(),
|
||||||
?.call(),
|
|
||||||
) ??
|
) ??
|
||||||
context.components
|
context.components
|
||||||
.floatingActionButtonComponentOrNull(floatingActionButtonId)
|
.floatingActionButtonComponent(floatingActionButtonId)(),
|
||||||
?.call(),
|
|
||||||
bottomNavigationBar: customBottomNavBar?.call(
|
bottomNavigationBar: customBottomNavBar?.call(
|
||||||
context.components.bottomNavigationBarComponent(bottomNavBarId)(),
|
context.components.bottomNavigationBarComponent(bottomNavBarId)(),
|
||||||
) ??
|
) ??
|
||||||
context.components
|
context.components.bottomNavigationBarComponent(bottomNavBarId)(),
|
||||||
.bottomNavigationBarComponentOrNull(bottomNavBarId)
|
|
||||||
?.call(),
|
|
||||||
body: body,
|
body: body,
|
||||||
floatingActionButtonLocation:
|
floatingActionButtonLocation:
|
||||||
scaffoldFieldsWrapper?.floatingActionButtonLocation,
|
scaffoldFieldsWrapper?.floatingActionButtonLocation,
|
||||||
|
@ -59,7 +59,7 @@ abstract class TopBarLayout<T extends TopBarComponent>
|
|||||||
final double height;
|
final double height;
|
||||||
|
|
||||||
/// Returns the top bar component for the given [BuildContext].
|
/// Returns the top bar component for the given [BuildContext].
|
||||||
T? appBar(BuildContext context, String? barId);
|
T appBar(BuildContext context, String? barId);
|
||||||
|
|
||||||
/// The [scaffoldFieldsWrapper] is a final variable that serves as a wrapper
|
/// The [scaffoldFieldsWrapper] is a final variable that serves as a wrapper
|
||||||
/// for customizing the scaffold.
|
/// for customizing the scaffold.
|
||||||
@ -67,21 +67,18 @@ abstract class TopBarLayout<T extends TopBarComponent>
|
|||||||
/// scaffold functionality.
|
/// scaffold functionality.
|
||||||
final ScaffoldFieldsWrapper? scaffoldFieldsWrapper;
|
final ScaffoldFieldsWrapper? scaffoldFieldsWrapper;
|
||||||
|
|
||||||
PreferredSize? _buildAppBar(BuildContext context) {
|
|
||||||
final topAppBar =
|
|
||||||
custom?.call(appBar(context, barId)) ?? appBar(context, barId);
|
|
||||||
|
|
||||||
return topAppBar != null
|
|
||||||
? PreferredSize(
|
|
||||||
preferredSize: Size.fromHeight(height),
|
|
||||||
child: topAppBar,
|
|
||||||
)
|
|
||||||
: null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => Scaffold(
|
Widget build(BuildContext context) => Scaffold(
|
||||||
appBar: _buildAppBar(context),
|
appBar: (custom?.call(
|
||||||
|
appBar(context, barId),
|
||||||
|
) !=
|
||||||
|
null)
|
||||||
|
? PreferredSize(
|
||||||
|
preferredSize: Size.fromHeight(height),
|
||||||
|
child: custom?.call(appBar(context, barId)) ??
|
||||||
|
appBar(context, barId),
|
||||||
|
)
|
||||||
|
: null,
|
||||||
body: body,
|
body: body,
|
||||||
floatingActionButtonLocation:
|
floatingActionButtonLocation:
|
||||||
scaffoldFieldsWrapper?.floatingActionButtonLocation,
|
scaffoldFieldsWrapper?.floatingActionButtonLocation,
|
||||||
@ -133,23 +130,9 @@ class TopAppBarLayout extends TopBarLayout<TopAppBarComponent> {
|
|||||||
super.key,
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
PreferredSize? _buildAppBar(BuildContext context) {
|
|
||||||
final appBar = custom?.call(
|
|
||||||
context.components.topAppBarComponentOrNull(barId)?.call(),
|
|
||||||
) ??
|
|
||||||
context.components.topAppBarComponentOrNull(barId)?.call();
|
|
||||||
|
|
||||||
return appBar != null
|
|
||||||
? PreferredSize(
|
|
||||||
preferredSize: Size.fromHeight(height),
|
|
||||||
child: appBar,
|
|
||||||
)
|
|
||||||
: null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
TopAppBarComponent? appBar(BuildContext context, String? barId) =>
|
TopAppBarComponent appBar(BuildContext context, String? barId) =>
|
||||||
context.components.topAppBarComponentOrNull(barId)?.call();
|
context.components.topAppBarComponent(barId).call();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A concrete implementation of [TopBarLayout] for a navigation bar.
|
/// A concrete implementation of [TopBarLayout] for a navigation bar.
|
||||||
@ -170,6 +153,6 @@ class TopNavigationBarLayout extends TopBarLayout<TopNavigationBarComponent> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
TopNavigationBarComponent? appBar(BuildContext context, String? barId) =>
|
TopNavigationBarComponent appBar(BuildContext context, String? barId) =>
|
||||||
context.components.topNavigationBarComponentOrNull(barId)?.call();
|
context.components.topNavigationBarComponent(barId).call();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user