Compare commits
	
		
			7 Commits
		
	
	
		
			45c7bd6fca
			...
			4f49f4931c
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 4f49f4931c | ||
|   | e8172004a3 | ||
|   | c6d8ca37fe | ||
|   | e01f47d41a | ||
|   | 7a24a36af0 | ||
|   | 244a286509 | ||
|   | 81a7ca5a1f | 
| @ -18,7 +18,7 @@ class CustomAppBar extends AppBarComponent { | ||||
|       ); | ||||
| 
 | ||||
|   @override | ||||
|   AppBarComponent configure( | ||||
|   AppBarComponent? configure( | ||||
|           {String? title, Widget? leading, List<Widget>? actions}) => | ||||
|       CustomAppBar( | ||||
|         title: title ?? this.title, | ||||
| @ -44,7 +44,7 @@ class CustomBottomBar extends BottomNavigationBarComponent { | ||||
|       ); | ||||
| 
 | ||||
|   @override | ||||
|   BottomNavigationBarComponent configure( | ||||
|   BottomNavigationBarComponent? configure( | ||||
|           {void Function(BuildContext p1, int p2)? onTap, | ||||
|           int currentIndex = 0}) => | ||||
|       this; | ||||
| @ -58,7 +58,7 @@ class CustomLoadingWidget extends LoadingWidgetComponent { | ||||
|       Center(child: CircularProgressIndicator(color: color)); | ||||
| 
 | ||||
|   @override | ||||
|   LoadingWidgetComponent configure({Color? color}) => CustomLoadingWidget( | ||||
|   LoadingWidgetComponent? configure({Color? color}) => CustomLoadingWidget( | ||||
|         color: color ?? this.color, | ||||
|       ); | ||||
| } | ||||
| @ -73,7 +73,7 @@ class CustomErrorWidget extends ErrorWidgetComponent { | ||||
|       ); | ||||
| 
 | ||||
|   @override | ||||
|   ErrorWidgetComponent configure({String? error}) => CustomErrorWidget( | ||||
|   ErrorWidgetComponent? configure({String? error}) => CustomErrorWidget( | ||||
|         error: error ?? this.error, | ||||
|       ); | ||||
| } | ||||
|  | ||||
| @ -27,10 +27,11 @@ abstract class CrudCubitConsumerScreenBase< | ||||
|   const CrudCubitConsumerScreenBase({super.key}); | ||||
| 
 | ||||
|   Widget errorBuilder(BuildContext context, CrudError state) => | ||||
|       context.components.errorWidget.configure(error: state.message); | ||||
|       context.components.errorWidget?.configure(error: state.message) ?? | ||||
|       const SizedBox.shrink(); | ||||
| 
 | ||||
|   Widget loadingBuilder(BuildContext context, CrudLoading state) => | ||||
|       context.components.loadingWidget; | ||||
|       context.components.loadingWidget ?? const SizedBox.shrink(); | ||||
| 
 | ||||
|   Widget initialBuilder(BuildContext context, CrudInitial state) => | ||||
|       const SizedBox.shrink(); | ||||
|  | ||||
| @ -16,17 +16,17 @@ | ||||
| 
 | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base; | ||||
| import 'package:wyatt_bloc_helper/wyatt_bloc_helper.dart'; | ||||
| import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; | ||||
| 
 | ||||
| abstract class CrudCubitScreenBase<Cubit extends bloc_base.Cubit<CrudState>, | ||||
|     SuccessState extends CrudSuccess> extends CubitScreen<Cubit, CrudState> { | ||||
|   const CrudCubitScreenBase(); | ||||
|   Widget errorBuilder(BuildContext context, CrudError state) => | ||||
|       context.components.errorWidget; | ||||
|       context.components.errorWidget?.configure(error: state.message) ?? | ||||
|       const SizedBox.shrink(); | ||||
| 
 | ||||
|   Widget loadingBuilder(BuildContext context, CrudLoading state) => | ||||
|       context.components.loadingWidget; | ||||
|       context.components.loadingWidget ?? const SizedBox.shrink(); | ||||
| 
 | ||||
|   Widget initialBuilder(BuildContext context, CrudInitial state) => | ||||
|       const SizedBox.shrink(); | ||||
|  | ||||
| @ -10,7 +10,7 @@ class CustomAppBar extends AppBarComponent { | ||||
|       ); | ||||
| 
 | ||||
|   @override | ||||
|   AppBarComponent configure( | ||||
|   AppBarComponent? configure( | ||||
|           {String? title, Widget? leading, List<Widget>? actions}) => | ||||
|       CustomAppBar( | ||||
|         title: title ?? this.title, | ||||
|  | ||||
| @ -29,7 +29,7 @@ class CustomBottomNavigationBar extends BottomNavigationBarComponent { | ||||
|       ); | ||||
| 
 | ||||
|   @override | ||||
|   CustomBottomNavigationBar configure({ | ||||
|   CustomBottomNavigationBar? configure({ | ||||
|     void Function(BuildContext, int)? onTap, | ||||
|     int currentIndex = 0, | ||||
|   }) => | ||||
|  | ||||
| @ -11,6 +11,6 @@ class CustomErrorWidget extends ErrorWidgetComponent { | ||||
|       ); | ||||
| 
 | ||||
|   @override | ||||
|   ErrorWidgetComponent configure({String? error}) => | ||||
|   ErrorWidgetComponent? configure({String? error}) => | ||||
|       CustomErrorWidget(error: error ?? this.error); | ||||
| } | ||||
|  | ||||
| @ -12,7 +12,7 @@ class CustomLoadingWidget extends LoadingWidgetComponent { | ||||
|       ); | ||||
| 
 | ||||
|   @override | ||||
|   CustomLoadingWidget configure({Color? color}) => CustomLoadingWidget( | ||||
|   CustomLoadingWidget? configure({Color? color}) => CustomLoadingWidget( | ||||
|         color: color ?? this.color, | ||||
|       ); | ||||
| } | ||||
|  | ||||
| @ -50,20 +50,23 @@ class Home extends StatelessWidget { | ||||
|   Widget build(BuildContext context) => Scaffold( | ||||
|         appBar: PreferredSize( | ||||
|           preferredSize: const Size.fromHeight(60), | ||||
|           child: context.components.appBar.configure(title: 'Example title'), | ||||
|           child: context.components.appBar?.configure(title: 'Example title') ?? | ||||
|               const SizedBox.shrink(), | ||||
|         ), | ||||
|         body: Column( | ||||
|           children: [ | ||||
|             Expanded( | ||||
|               child: context.components.errorWidget | ||||
|                   .configure(error: 'Example erreur'), | ||||
|                       ?.configure(error: 'Example erreur') ?? | ||||
|                   const SizedBox.shrink(), | ||||
|             ), | ||||
|             const SizedBox( | ||||
|               height: 10, | ||||
|             ), | ||||
|             Expanded( | ||||
|               child: context.components.loadingWidget | ||||
|                   .configure(color: Colors.green), | ||||
|                       ?.configure(color: Colors.green) ?? | ||||
|                   const SizedBox.shrink(), | ||||
|             ), | ||||
|           ], | ||||
|         ), | ||||
|  | ||||
| @ -19,5 +19,5 @@ import 'package:flutter/material.dart'; | ||||
| abstract class Component extends StatelessWidget { | ||||
|   const Component({super.key}); | ||||
| 
 | ||||
|   Component configure(); | ||||
|   Component? configure(); | ||||
| } | ||||
|  | ||||
| @ -29,7 +29,7 @@ abstract class AppBarComponent extends Component { | ||||
|   }); | ||||
| 
 | ||||
|   @override | ||||
|   AppBarComponent configure({ | ||||
|   AppBarComponent? configure({ | ||||
|     String? title, | ||||
|     Widget? leading, | ||||
|     List<Widget>? actions, | ||||
| @ -46,7 +46,7 @@ abstract class BottomNavigationBarComponent extends Component { | ||||
|   }); | ||||
| 
 | ||||
|   @override | ||||
|   BottomNavigationBarComponent configure({ | ||||
|   BottomNavigationBarComponent? configure({ | ||||
|     void Function(BuildContext, int)? onTap, | ||||
|     int currentIndex = 0, | ||||
|   }); | ||||
| @ -57,7 +57,7 @@ abstract class ErrorWidgetComponent extends Component { | ||||
|   const ErrorWidgetComponent({required this.error, super.key}); | ||||
| 
 | ||||
|   @override | ||||
|   ErrorWidgetComponent configure({String? error}); | ||||
|   ErrorWidgetComponent? configure({String? error}); | ||||
| } | ||||
| 
 | ||||
| abstract class LoadingWidgetComponent extends Component { | ||||
| @ -65,5 +65,5 @@ abstract class LoadingWidgetComponent extends Component { | ||||
|   const LoadingWidgetComponent({required this.color, super.key}); | ||||
| 
 | ||||
|   @override | ||||
|   LoadingWidgetComponent configure({Color? color}); | ||||
|   LoadingWidgetComponent? configure({Color? color}); | ||||
| } | ||||
|  | ||||
| @ -17,15 +17,15 @@ | ||||
| import 'package:wyatt_ui_components/src/domain/entities/components.dart'; | ||||
| 
 | ||||
| class ComponentThemeData { | ||||
|   final AppBarComponent appBar; | ||||
|   final BottomNavigationBarComponent bottomNavigationBar; | ||||
|   final ErrorWidgetComponent errorWidget; | ||||
|   final LoadingWidgetComponent loadingWidget; | ||||
|   final AppBarComponent? appBar; | ||||
|   final BottomNavigationBarComponent? bottomNavigationBar; | ||||
|   final ErrorWidgetComponent? errorWidget; | ||||
|   final LoadingWidgetComponent? loadingWidget; | ||||
| 
 | ||||
|   const ComponentThemeData.raw({ | ||||
|     required this.appBar, | ||||
|     required this.bottomNavigationBar, | ||||
|     required this.errorWidget, | ||||
|     required this.loadingWidget, | ||||
|     this.appBar, | ||||
|     this.bottomNavigationBar, | ||||
|     this.errorWidget, | ||||
|     this.loadingWidget, | ||||
|   }); | ||||
| } | ||||
|  | ||||
| @ -13,7 +13,7 @@ class CustomAppBar extends AppBarComponent { | ||||
|       ); | ||||
| 
 | ||||
|   @override | ||||
|   AppBarComponent configure({ | ||||
|   AppBarComponent? configure({ | ||||
|     String? title, | ||||
|     Widget? leading, | ||||
|     List<Widget>? actions, | ||||
|  | ||||
| @ -29,7 +29,7 @@ class CustomBottomNavigationBar extends BottomNavigationBarComponent { | ||||
|       ); | ||||
| 
 | ||||
|   @override | ||||
|   CustomBottomNavigationBar configure({ | ||||
|   CustomBottomNavigationBar? configure({ | ||||
|     void Function(BuildContext, int)? onTap, | ||||
|     int currentIndex = 0, | ||||
|   }) => | ||||
|  | ||||
| @ -31,7 +31,8 @@ class AppBarLayout extends Layout { | ||||
|   Widget build(BuildContext context) => Scaffold( | ||||
|         appBar: PreferredSize( | ||||
|           preferredSize: const Size.fromHeight(60), | ||||
|           child: context.components.appBar.configure(title: title), | ||||
|           child: context.components.appBar?.configure(title: title) ?? | ||||
|               const SizedBox.shrink(), | ||||
|         ), | ||||
|         body: body, | ||||
|       ); | ||||
|  | ||||
| @ -14,7 +14,7 @@ class BottomNavigationBarLayout extends Layout { | ||||
|   @override | ||||
|   Widget build(BuildContext context) => Scaffold( | ||||
|         body: body, | ||||
|         bottomNavigationBar: context.components.bottomNavigationBar.configure( | ||||
|         bottomNavigationBar: context.components.bottomNavigationBar?.configure( | ||||
|           currentIndex: currentIndex, | ||||
|         ), | ||||
|       ); | ||||
|  | ||||
| @ -34,10 +34,11 @@ class FrameLayout extends Layout { | ||||
|   Widget build(BuildContext context) => Scaffold( | ||||
|         appBar: PreferredSize( | ||||
|           preferredSize: const Size.fromHeight(60), | ||||
|           child: context.components.appBar.configure(title: title), | ||||
|           child: context.components.appBar?.configure(title: title) ?? | ||||
|               const SizedBox.shrink(), | ||||
|         ), | ||||
|         body: body, | ||||
|         bottomNavigationBar: context.components.bottomNavigationBar.configure( | ||||
|         bottomNavigationBar: context.components.bottomNavigationBar?.configure( | ||||
|           currentIndex: currentIndex, | ||||
|         ), | ||||
|       ); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user