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
@@ -88,6 +88,7 @@ class $CustomAppBarCWProxyImpl implements $TopAppBarComponentCWProxy {
Key? key,
}) =>
CustomAppBar(
key: key ?? _value.key,
title: title ?? _value.title,
);
}
@@ -24,7 +24,9 @@ class $CustomBottomBarCWProxyImpl
int? currentIndex,
Key? key,
}) =>
CustomBottomBar();
CustomBottomBar(
key: key ?? _value.key,
);
}
mixin $CustomBottomBarCWMixin on Component {
@@ -5,13 +5,12 @@ import 'package:wyatt_ui_components/wyatt_ui_components.dart';
part 'custom_error_widget.g.dart';
@ComponentCopyWithExtension()
class CustomErrorWidget extends ErrorWidgetComponent
with $CustomErrorWidgetCWMixin {
CustomErrorWidget({super.key, super.error});
class CustomErrorWidget extends ErrorComponent with $CustomErrorWidgetCWMixin {
const CustomErrorWidget({super.key, super.details});
@override
Widget build(BuildContext context) => ColoredBox(
color: Colors.red,
child: Center(child: Text(error?.data ?? 'Error')),
child: Center(child: Text(details?.data ?? 'Error')),
);
}
@@ -6,24 +6,36 @@ part of 'custom_error_widget.dart';
// ComponentCopyWithGenerator
// **************************************************************************
class $CustomErrorWidgetCWProxyImpl implements $ErrorWidgetComponentCWProxy {
class $CustomErrorWidgetCWProxyImpl implements $ErrorComponentCWProxy {
const $CustomErrorWidgetCWProxyImpl(this._value);
final CustomErrorWidget _value;
@override
CustomErrorWidget error(TextWrapper? error) => this(error: error);
CustomErrorWidget colors(MultiColor? colors) => this(colors: colors);
@override
CustomErrorWidget message(TextWrapper? message) => this(message: message);
@override
CustomErrorWidget details(TextWrapper? details) => this(details: details);
@override
CustomErrorWidget themeResolver(
ThemeResolver<dynamic, dynamic, dynamic>? themeResolver) =>
this(themeResolver: themeResolver);
@override
CustomErrorWidget key(Key? key) => this(key: key);
@override
CustomErrorWidget call({
TextWrapper? error,
MultiColor? colors,
TextWrapper? message,
TextWrapper? details,
ThemeResolver<dynamic, dynamic, dynamic>? themeResolver,
Key? key,
}) =>
CustomErrorWidget(
error: error ?? _value.error,
key: key ?? _value.key,
details: details ?? _value.details,
);
}
mixin $CustomErrorWidgetCWMixin on Component {
$ErrorWidgetComponentCWProxy get copyWith =>
$ErrorComponentCWProxy get copyWith =>
$CustomErrorWidgetCWProxyImpl(this as CustomErrorWidget);
}
@@ -5,11 +5,14 @@ import 'package:wyatt_ui_components/wyatt_ui_components.dart';
part 'custom_loading_widget.g.dart';
@ComponentCopyWithExtension()
class CustomLoadingWidget extends LoadingWidgetComponent
class CustomLoadingWidget extends LoaderComponent
with $CustomLoadingWidgetCWMixin {
CustomLoadingWidget({super.key, super.color});
const CustomLoadingWidget({super.key, super.colors});
@override
Widget build(BuildContext context) =>
Center(child: CircularProgressIndicator(color: color));
Widget build(BuildContext context) => Center(
child: CircularProgressIndicator(
color: (colors?.isColor ?? false) ? colors!.color : Colors.blue,
),
);
}
@@ -6,25 +6,42 @@ part of 'custom_loading_widget.dart';
// ComponentCopyWithGenerator
// **************************************************************************
class $CustomLoadingWidgetCWProxyImpl
implements $LoadingWidgetComponentCWProxy {
class $CustomLoadingWidgetCWProxyImpl implements $LoaderComponentCWProxy {
const $CustomLoadingWidgetCWProxyImpl(this._value);
final CustomLoadingWidget _value;
@override
CustomLoadingWidget color(Color? color) => this(color: color);
CustomLoadingWidget colors(MultiColor? colors) => this(colors: colors);
@override
CustomLoadingWidget radius(double? radius) => this(radius: radius);
@override
CustomLoadingWidget stroke(double? stroke) => this(stroke: stroke);
@override
CustomLoadingWidget duration(Duration? duration) => this(duration: duration);
@override
CustomLoadingWidget flip(bool? flip) => this(flip: flip);
@override
CustomLoadingWidget themeResolver(
ThemeResolver<dynamic, dynamic, dynamic>? themeResolver) =>
this(themeResolver: themeResolver);
@override
CustomLoadingWidget key(Key? key) => this(key: key);
@override
CustomLoadingWidget call({
Color? color,
MultiColor? colors,
double? radius,
double? stroke,
Duration? duration,
bool? flip,
ThemeResolver<dynamic, dynamic, dynamic>? themeResolver,
Key? key,
}) =>
CustomLoadingWidget(
color: color ?? _value.color,
key: key ?? _value.key,
colors: colors ?? _value.colors,
);
}
mixin $CustomLoadingWidgetCWMixin on Component {
$LoadingWidgetComponentCWProxy get copyWith =>
$LoaderComponentCWProxy get copyWith =>
$CustomLoadingWidgetCWProxyImpl(this as CustomLoadingWidget);
}
@@ -4,11 +4,11 @@ import 'package:bloc_layout_example/components/custom_error_widget.dart';
import 'package:bloc_layout_example/components/custom_loading_widget.dart';
import 'package:wyatt_ui_components/wyatt_ui_components.dart';
class AppThemeComponent {
static ComponentThemeData get components => ComponentThemeData.raw(
appBar: const CustomAppBar(),
bottomNavigationBar: const CustomBottomBar(),
loadingWidget: CustomLoadingWidget(),
errorWidget: CustomErrorWidget(),
);
abstract class AppThemeComponent {
static const ComponentThemeData components = ComponentThemeData.raw(
topAppBar: CustomAppBar(),
bottomNavigationBar: CustomBottomBar(),
loader: CustomLoadingWidget(),
error: CustomErrorWidget(),
);
}
@@ -32,7 +32,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: 'Bloc Layout Example',
theme: ThemeData(
@@ -122,7 +122,7 @@ class ExampleFrameLayoutCrudConsumer
ExampleFrameLayoutCrudConsumer({super.key})
: super(
customAppBar: (bar) => bar?.copyWith.title(
'Example Title'.wrap(),
const TextWrapper('Example Title'),
),
);
@@ -139,7 +139,7 @@ class ExampleFrameLayoutCrudListConsumer
ExampleFrameLayoutCrudListConsumer({super.key})
: super(
customAppBar: (bar) => bar?.copyWith.title(
'Example Title'.wrap(),
const TextWrapper('Example Title'),
),
);