feat(layout)!: update layout plugins with new components system
continuous-integration/drone/pr Build is failing

This commit is contained in:
2023-05-02 13:32:52 +02:00
parent 96369e24f9
commit e76857f118
14 changed files with 79 additions and 42 deletions
@@ -7,7 +7,7 @@ import 'package:wyatt_ui_layout_example/pages/bottom_navigation_bar_layout_page_
class AppThemeComponent {
static ComponentThemeData get components => ComponentThemeData.raw(
appBar: const CustomAppBar(),
topAppBar: const CustomAppBar(),
bottomNavigationBar: CustomBottomNavigationBar(
onTap: (context, index) {
switch (index) {
@@ -29,7 +29,7 @@ class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) => ComponentTheme(
componentThemeWidget: AppThemeComponent.components,
data: AppThemeComponent.components,
child: MaterialApp(
title: 'Wyatt Ui Layout Example',
theme: ThemeData(
@@ -7,7 +7,8 @@ class AppBarLayoutPage extends StatelessWidget {
@override
Widget build(BuildContext context) => TopAppBarLayout(
custom: (p0) => p0?.copyWith.title('New Title'.wrap()),
custom: (topBar) =>
topBar?.copyWith.title(const TextWrapper('New Title')),
body: const Center(
child: Text(
'Body',
@@ -52,12 +52,12 @@ class FrameLayout extends StructuralLayout {
@override
Widget build(BuildContext context) => Scaffold(
appBar: (customAppBar?.call(context.components.appBar) != null ||
context.components.appBar != null)
appBar: (customAppBar?.call(context.components.topAppBar) != null ||
context.components.topAppBar != null)
? PreferredSize(
preferredSize: Size.fromHeight(height),
child: customAppBar?.call(context.components.appBar) ??
context.components.appBar!,
child: customAppBar?.call(context.components.topAppBar) ??
context.components.topAppBar!,
)
: null,
body: body,
@@ -82,7 +82,8 @@ class TopAppBarLayout extends TopBarLayout<TopAppBarComponent> {
});
@override
TopAppBarComponent? child(BuildContext context) => context.components.appBar;
TopAppBarComponent? child(BuildContext context) =>
context.components.topAppBar;
}
/// A concrete implementation of [TopBarLayout] for a navigation bar.
@@ -102,5 +103,5 @@ class TopNavigationBarLayout extends TopBarLayout<TopNavigationBarComponent> {
@override
TopNavigationBarComponent? child(BuildContext context) =>
context.components.topNavigationBarComponent;
context.components.topNavigationBar;
}