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>,
SuccessState extends CrudSuccess> {
Widget errorBuilder(BuildContext context, CrudError state) =>
context.components.errorComponent.call(
message: (state.message != null) ? TextWrapper(state.message!) : null,
);
context.components.error != null
? context.components.errorComponent.call(
message:
(state.message != null) ? TextWrapper(state.message!) : null,
)
: const SizedBox.shrink();
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) =>
const SizedBox.shrink();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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