feat(layout): modify some layout files to utilize ScaffoldFieldWrapper class

This commit is contained in:
Malo Léon 2023-05-18 16:34:04 +02:00
parent 9713d1ec29
commit 80dffdb986
7 changed files with 18 additions and 4 deletions

View File

@ -23,12 +23,17 @@ import 'package:wyatt_ui_components/wyatt_ui_components.dart';
mixin CrudMixin<Cubit extends bloc_base.Cubit<dynamic>, mixin CrudMixin<Cubit extends bloc_base.Cubit<dynamic>,
SuccessState extends CrudSuccess> { SuccessState extends CrudSuccess> {
Widget errorBuilder(BuildContext context, CrudError state) => Widget errorBuilder(BuildContext context, CrudError state) =>
context.components.errorComponent.call( context.components.error != null
message: (state.message != null) ? TextWrapper(state.message!) : null, ? context.components.errorComponent.call(
); message:
(state.message != null) ? TextWrapper(state.message!) : null,
)
: const SizedBox.shrink();
Widget loadingBuilder(BuildContext context, CrudLoading state) => Widget loadingBuilder(BuildContext context, CrudLoading state) =>
context.components.loader ?? const SizedBox.shrink(); context.components.loader != null
? context.components.loaderComponent.call()
: const CircularProgressIndicator();
Widget initialBuilder(BuildContext context, CrudInitial state) => Widget initialBuilder(BuildContext context, CrudInitial state) =>
const SizedBox.shrink(); const SizedBox.shrink();

View File

@ -25,6 +25,7 @@ abstract class TopAppBarGridLayoutCubitScreenCrudList<
const TopAppBarGridLayoutCubitScreenCrudList({ const TopAppBarGridLayoutCubitScreenCrudList({
super.custom, super.custom,
super.height = 60, super.height = 60,
super.scaffoldFieldsWrapper,
super.key, super.key,
}); });
} }

View File

@ -26,16 +26,19 @@ abstract class TopAppBarLayoutCubitScreen<Cubit extends bloc_base.Cubit<State>,
const TopAppBarLayoutCubitScreen({ const TopAppBarLayoutCubitScreen({
this.custom, this.custom,
this.height = 60, this.height = 60,
this.scaffoldFieldsWrapper,
super.key, super.key,
}); });
final double height; final double height;
final TopAppBarComponent? Function(TopAppBarComponent?)? custom; final TopAppBarComponent? Function(TopAppBarComponent?)? custom;
final ScaffoldFieldsWrapper? scaffoldFieldsWrapper;
@override @override
Widget parent(BuildContext context, Widget child) => TopAppBarLayout( Widget parent(BuildContext context, Widget child) => TopAppBarLayout(
height: height, height: height,
custom: custom, custom: custom,
scaffoldFieldsWrapper: scaffoldFieldsWrapper,
body: child, body: child,
); );
} }

View File

@ -27,6 +27,7 @@ abstract class TopAppBarLayoutCubitScreenCrud<
const TopAppBarLayoutCubitScreenCrud({ const TopAppBarLayoutCubitScreenCrud({
super.custom, super.custom,
super.height, super.height,
super.scaffoldFieldsWrapper,
super.key, super.key,
}); });

View File

@ -24,6 +24,7 @@ abstract class TopAppBarLayoutCubitScreenCrudItem<
const TopAppBarLayoutCubitScreenCrudItem({ const TopAppBarLayoutCubitScreenCrudItem({
super.custom, super.custom,
super.height = 60, super.height = 60,
super.scaffoldFieldsWrapper,
super.key, super.key,
}); });
} }

View File

@ -24,6 +24,7 @@ abstract class TopAppBarLayoutCubitScreenCrudList<
const TopAppBarLayoutCubitScreenCrudList({ const TopAppBarLayoutCubitScreenCrudList({
super.custom, super.custom,
super.height = 60, super.height = 60,
super.scaffoldFieldsWrapper,
super.key, super.key,
}); });
} }

View File

@ -113,6 +113,7 @@ class TopAppBarLayout extends TopBarLayout<TopAppBarComponent> {
required super.body, required super.body,
super.custom, super.custom,
super.height, super.height,
super.scaffoldFieldsWrapper,
super.key, super.key,
}); });
@ -133,6 +134,7 @@ class TopNavigationBarLayout extends TopBarLayout<TopNavigationBarComponent> {
required super.body, required super.body,
super.custom, super.custom,
super.height, super.height,
super.scaffoldFieldsWrapper,
super.key, super.key,
}); });