Compare commits
	
		
			No commits in common. "e76857f1186a29c6ce91148607eecc10081a43a7" and "635bb329ea0d8ec589e926741d94a350926b3572" have entirely different histories.
		
	
	
		
			e76857f118
			...
			635bb329ea
		
	
		
@ -88,7 +88,6 @@ class $CustomAppBarCWProxyImpl implements $TopAppBarComponentCWProxy {
 | 
			
		||||
    Key? key,
 | 
			
		||||
  }) =>
 | 
			
		||||
      CustomAppBar(
 | 
			
		||||
        key: key ?? _value.key,
 | 
			
		||||
        title: title ?? _value.title,
 | 
			
		||||
      );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -24,9 +24,7 @@ class $CustomBottomBarCWProxyImpl
 | 
			
		||||
    int? currentIndex,
 | 
			
		||||
    Key? key,
 | 
			
		||||
  }) =>
 | 
			
		||||
      CustomBottomBar(
 | 
			
		||||
        key: key ?? _value.key,
 | 
			
		||||
      );
 | 
			
		||||
      CustomBottomBar();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
mixin $CustomBottomBarCWMixin on Component {
 | 
			
		||||
 | 
			
		||||
@ -5,12 +5,13 @@ import 'package:wyatt_ui_components/wyatt_ui_components.dart';
 | 
			
		||||
part 'custom_error_widget.g.dart';
 | 
			
		||||
 | 
			
		||||
@ComponentCopyWithExtension()
 | 
			
		||||
class CustomErrorWidget extends ErrorComponent with $CustomErrorWidgetCWMixin {
 | 
			
		||||
  const CustomErrorWidget({super.key, super.details});
 | 
			
		||||
class CustomErrorWidget extends ErrorWidgetComponent
 | 
			
		||||
    with $CustomErrorWidgetCWMixin {
 | 
			
		||||
  CustomErrorWidget({super.key, super.error});
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  Widget build(BuildContext context) => ColoredBox(
 | 
			
		||||
        color: Colors.red,
 | 
			
		||||
        child: Center(child: Text(details?.data ?? 'Error')),
 | 
			
		||||
        child: Center(child: Text(error?.data ?? 'Error')),
 | 
			
		||||
      );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -6,36 +6,24 @@ part of 'custom_error_widget.dart';
 | 
			
		||||
// ComponentCopyWithGenerator
 | 
			
		||||
// **************************************************************************
 | 
			
		||||
 | 
			
		||||
class $CustomErrorWidgetCWProxyImpl implements $ErrorComponentCWProxy {
 | 
			
		||||
class $CustomErrorWidgetCWProxyImpl implements $ErrorWidgetComponentCWProxy {
 | 
			
		||||
  const $CustomErrorWidgetCWProxyImpl(this._value);
 | 
			
		||||
  final CustomErrorWidget _value;
 | 
			
		||||
  @override
 | 
			
		||||
  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);
 | 
			
		||||
  CustomErrorWidget error(TextWrapper? error) => this(error: error);
 | 
			
		||||
  @override
 | 
			
		||||
  CustomErrorWidget key(Key? key) => this(key: key);
 | 
			
		||||
  @override
 | 
			
		||||
  CustomErrorWidget call({
 | 
			
		||||
    MultiColor? colors,
 | 
			
		||||
    TextWrapper? message,
 | 
			
		||||
    TextWrapper? details,
 | 
			
		||||
    ThemeResolver<dynamic, dynamic, dynamic>? themeResolver,
 | 
			
		||||
    TextWrapper? error,
 | 
			
		||||
    Key? key,
 | 
			
		||||
  }) =>
 | 
			
		||||
      CustomErrorWidget(
 | 
			
		||||
        key: key ?? _value.key,
 | 
			
		||||
        details: details ?? _value.details,
 | 
			
		||||
        error: error ?? _value.error,
 | 
			
		||||
      );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
mixin $CustomErrorWidgetCWMixin on Component {
 | 
			
		||||
  $ErrorComponentCWProxy get copyWith =>
 | 
			
		||||
  $ErrorWidgetComponentCWProxy get copyWith =>
 | 
			
		||||
      $CustomErrorWidgetCWProxyImpl(this as CustomErrorWidget);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -5,14 +5,11 @@ import 'package:wyatt_ui_components/wyatt_ui_components.dart';
 | 
			
		||||
part 'custom_loading_widget.g.dart';
 | 
			
		||||
 | 
			
		||||
@ComponentCopyWithExtension()
 | 
			
		||||
class CustomLoadingWidget extends LoaderComponent
 | 
			
		||||
class CustomLoadingWidget extends LoadingWidgetComponent
 | 
			
		||||
    with $CustomLoadingWidgetCWMixin {
 | 
			
		||||
  const CustomLoadingWidget({super.key, super.colors});
 | 
			
		||||
  CustomLoadingWidget({super.key, super.color});
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  Widget build(BuildContext context) => Center(
 | 
			
		||||
        child: CircularProgressIndicator(
 | 
			
		||||
          color: (colors?.isColor ?? false) ? colors!.color : Colors.blue,
 | 
			
		||||
        ),
 | 
			
		||||
      );
 | 
			
		||||
  Widget build(BuildContext context) =>
 | 
			
		||||
      Center(child: CircularProgressIndicator(color: color));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -6,42 +6,25 @@ part of 'custom_loading_widget.dart';
 | 
			
		||||
// ComponentCopyWithGenerator
 | 
			
		||||
// **************************************************************************
 | 
			
		||||
 | 
			
		||||
class $CustomLoadingWidgetCWProxyImpl implements $LoaderComponentCWProxy {
 | 
			
		||||
class $CustomLoadingWidgetCWProxyImpl
 | 
			
		||||
    implements $LoadingWidgetComponentCWProxy {
 | 
			
		||||
  const $CustomLoadingWidgetCWProxyImpl(this._value);
 | 
			
		||||
  final CustomLoadingWidget _value;
 | 
			
		||||
  @override
 | 
			
		||||
  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);
 | 
			
		||||
  CustomLoadingWidget color(Color? color) => this(color: color);
 | 
			
		||||
  @override
 | 
			
		||||
  CustomLoadingWidget key(Key? key) => this(key: key);
 | 
			
		||||
  @override
 | 
			
		||||
  CustomLoadingWidget call({
 | 
			
		||||
    MultiColor? colors,
 | 
			
		||||
    double? radius,
 | 
			
		||||
    double? stroke,
 | 
			
		||||
    Duration? duration,
 | 
			
		||||
    bool? flip,
 | 
			
		||||
    ThemeResolver<dynamic, dynamic, dynamic>? themeResolver,
 | 
			
		||||
    Color? color,
 | 
			
		||||
    Key? key,
 | 
			
		||||
  }) =>
 | 
			
		||||
      CustomLoadingWidget(
 | 
			
		||||
        key: key ?? _value.key,
 | 
			
		||||
        colors: colors ?? _value.colors,
 | 
			
		||||
        color: color ?? _value.color,
 | 
			
		||||
      );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
mixin $CustomLoadingWidgetCWMixin on Component {
 | 
			
		||||
  $LoaderComponentCWProxy get copyWith =>
 | 
			
		||||
  $LoadingWidgetComponentCWProxy 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';
 | 
			
		||||
 | 
			
		||||
abstract class AppThemeComponent {
 | 
			
		||||
  static const ComponentThemeData components = ComponentThemeData.raw(
 | 
			
		||||
    topAppBar: CustomAppBar(),
 | 
			
		||||
    bottomNavigationBar: CustomBottomBar(),
 | 
			
		||||
    loader: CustomLoadingWidget(),
 | 
			
		||||
    error: CustomErrorWidget(),
 | 
			
		||||
class AppThemeComponent {
 | 
			
		||||
  static ComponentThemeData get components => ComponentThemeData.raw(
 | 
			
		||||
        appBar: const CustomAppBar(),
 | 
			
		||||
        bottomNavigationBar: const CustomBottomBar(),
 | 
			
		||||
        loadingWidget: CustomLoadingWidget(),
 | 
			
		||||
        errorWidget: CustomErrorWidget(),
 | 
			
		||||
      );
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -32,7 +32,7 @@ class MyApp extends StatelessWidget {
 | 
			
		||||
  // This widget is the root of your application.
 | 
			
		||||
  @override
 | 
			
		||||
  Widget build(BuildContext context) => ComponentTheme(
 | 
			
		||||
        data: AppThemeComponent.components,
 | 
			
		||||
        componentThemeWidget: 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(
 | 
			
		||||
            const TextWrapper('Example Title'),
 | 
			
		||||
            'Example Title'.wrap(),
 | 
			
		||||
          ),
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
@ -139,7 +139,7 @@ class ExampleFrameLayoutCrudListConsumer
 | 
			
		||||
  ExampleFrameLayoutCrudListConsumer({super.key})
 | 
			
		||||
      : super(
 | 
			
		||||
          customAppBar: (bar) => bar?.copyWith.title(
 | 
			
		||||
            const TextWrapper('Example Title'),
 | 
			
		||||
            'Example Title'.wrap(),
 | 
			
		||||
          ),
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -23,12 +23,11 @@ import 'package:wyatt_ui_components/wyatt_ui_components.dart';
 | 
			
		||||
mixin CrudMixin<Cubit extends bloc_base.Cubit<dynamic>,
 | 
			
		||||
    SuccessState extends CrudSuccess> {
 | 
			
		||||
  Widget errorBuilder(BuildContext context, CrudError state) =>
 | 
			
		||||
      context.components.errorComponent.call(
 | 
			
		||||
        message: (state.message != null) ? TextWrapper(state.message!) : null,
 | 
			
		||||
      );
 | 
			
		||||
      context.components.errorWidget?.copyWith(error: state.message.wrap()) ??
 | 
			
		||||
      const SizedBox.shrink();
 | 
			
		||||
 | 
			
		||||
  Widget loadingBuilder(BuildContext context, CrudLoading state) =>
 | 
			
		||||
      context.components.loader ?? const SizedBox.shrink();
 | 
			
		||||
      context.components.loadingWidget ?? const SizedBox.shrink();
 | 
			
		||||
 | 
			
		||||
  Widget initialBuilder(BuildContext context, CrudInitial state) =>
 | 
			
		||||
      const SizedBox.shrink();
 | 
			
		||||
 | 
			
		||||
@ -123,5 +123,9 @@ class TextWrapper {
 | 
			
		||||
  final Color? selectionColor;
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  String toString() => data;
 | 
			
		||||
  String toString() => 'TextWrapper(data: $data, style: $style, '
 | 
			
		||||
      'gradientColors: $gradientColors, textAlign: $textAlign, '
 | 
			
		||||
      'textDirection: $textDirection, softWrap: $softWrap, '
 | 
			
		||||
      'overflow: $overflow, maxLines: $maxLines, '
 | 
			
		||||
      'selectionColor: $selectionColor)';
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -7,7 +7,7 @@ import 'package:wyatt_ui_layout_example/pages/bottom_navigation_bar_layout_page_
 | 
			
		||||
 | 
			
		||||
class AppThemeComponent {
 | 
			
		||||
  static ComponentThemeData get components => ComponentThemeData.raw(
 | 
			
		||||
        topAppBar: const CustomAppBar(),
 | 
			
		||||
        appBar: 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(
 | 
			
		||||
        data: AppThemeComponent.components,
 | 
			
		||||
        componentThemeWidget: AppThemeComponent.components,
 | 
			
		||||
        child: MaterialApp(
 | 
			
		||||
          title: 'Wyatt Ui Layout Example',
 | 
			
		||||
          theme: ThemeData(
 | 
			
		||||
 | 
			
		||||
@ -7,8 +7,7 @@ class AppBarLayoutPage extends StatelessWidget {
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  Widget build(BuildContext context) => TopAppBarLayout(
 | 
			
		||||
        custom: (topBar) =>
 | 
			
		||||
            topBar?.copyWith.title(const TextWrapper('New Title')),
 | 
			
		||||
        custom: (p0) => p0?.copyWith.title('New Title'.wrap()),
 | 
			
		||||
        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.topAppBar) != null ||
 | 
			
		||||
                context.components.topAppBar != null)
 | 
			
		||||
        appBar: (customAppBar?.call(context.components.appBar) != null ||
 | 
			
		||||
                context.components.appBar != null)
 | 
			
		||||
            ? PreferredSize(
 | 
			
		||||
                preferredSize: Size.fromHeight(height),
 | 
			
		||||
                child: customAppBar?.call(context.components.topAppBar) ??
 | 
			
		||||
                    context.components.topAppBar!,
 | 
			
		||||
                child: customAppBar?.call(context.components.appBar) ??
 | 
			
		||||
                    context.components.appBar!,
 | 
			
		||||
              )
 | 
			
		||||
            : null,
 | 
			
		||||
        body: body,
 | 
			
		||||
 | 
			
		||||
@ -82,8 +82,7 @@ class TopAppBarLayout extends TopBarLayout<TopAppBarComponent> {
 | 
			
		||||
  });
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  TopAppBarComponent? child(BuildContext context) =>
 | 
			
		||||
      context.components.topAppBar;
 | 
			
		||||
  TopAppBarComponent? child(BuildContext context) => context.components.appBar;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// A concrete implementation of [TopBarLayout] for a navigation bar.
 | 
			
		||||
@ -103,5 +102,5 @@ class TopNavigationBarLayout extends TopBarLayout<TopNavigationBarComponent> {
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  TopNavigationBarComponent? child(BuildContext context) =>
 | 
			
		||||
      context.components.topNavigationBar;
 | 
			
		||||
      context.components.topNavigationBarComponent;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user