refactor/update-packages-with-new-component-version #217

Merged
hugo merged 8 commits from refactor/update-packages-with-new-component-version into master 2023-08-28 13:16:55 +00:00
23 changed files with 97 additions and 30 deletions
Showing only changes of commit 1c47fa8e94 - Show all commits

View File

@ -5,10 +5,10 @@ import 'package:bloc_layout_example/components/custom_loading_widget.dart';
import 'package:wyatt_ui_components/wyatt_ui_components.dart'; import 'package:wyatt_ui_components/wyatt_ui_components.dart';
abstract class AppThemeComponent { abstract class AppThemeComponent {
static const ComponentThemeData components = ComponentThemeData.raw( static ComponentThemeData components = ComponentThemeData.raw(
topAppBar: CustomAppBar(), topAppBars: const CustomAppBar().registry(),
bottomNavigationBar: CustomBottomBar(), bottomNavigationBars: const CustomBottomBar().registry(),
loader: CustomLoadingWidget(), loaders: const CustomLoadingWidget().registry(),
error: CustomErrorWidget(), errors: const CustomErrorWidget().registry(),
); );
} }

View File

@ -23,12 +23,13 @@ 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.errorComponent().call(
malo marked this conversation as resolved Outdated
Outdated
Review

errorId ?

erro**r**Id ?
message: (state.message != null) ? TextWrapper(state.message!) : null, message:
(state.message != null) ? TextWrapper(state.message!) : null,
); );
Widget loadingBuilder(BuildContext context, CrudLoading state) => Widget loadingBuilder(BuildContext context, CrudLoading state) =>
context.components.loader ?? const SizedBox.shrink(); context.components.loaderComponent()();
Widget initialBuilder(BuildContext context, CrudInitial state) => Widget initialBuilder(BuildContext context, CrudInitial state) =>
const SizedBox.shrink(); const SizedBox.shrink();

View File

@ -24,7 +24,8 @@ abstract class BottomNavigationBarGridLayoutCubitScreenCrudList<
with GridLayoutMixin<SuccessType> { with GridLayoutMixin<SuccessType> {
const BottomNavigationBarGridLayoutCubitScreenCrudList({ const BottomNavigationBarGridLayoutCubitScreenCrudList({
super.custom, super.custom,
super.height = 60, super.barId,
super.scaffoldFieldsWrapper,
super.key, super.key,
}); });
} }

View File

@ -26,18 +26,21 @@ abstract class BottomNavigationBarLayoutCubitScreen<
State extends Object> extends CubitScreenBase<Cubit, State> { State extends Object> extends CubitScreenBase<Cubit, State> {
const BottomNavigationBarLayoutCubitScreen({ const BottomNavigationBarLayoutCubitScreen({
this.custom, this.custom,
this.height = 60, this.barId,
this.scaffoldFieldsWrapper,
super.key, super.key,
}); });
final double height; final ComponentCallBack<BottomNavigationBarComponent>? custom;
final BottomNavigationBarComponent? Function(BottomNavigationBarComponent?)? final ScaffoldFieldsWrapper? scaffoldFieldsWrapper;
custom; final String? barId;
@override @override
Widget parent(BuildContext context, Widget child) => Widget parent(BuildContext context, Widget child) =>
BottomNavigationBarLayout( StructuralLayout.withBottomNavBar(
custom: custom, custom: custom,
barId: barId,
scaffoldFieldsWrapper: scaffoldFieldsWrapper,
body: child, body: child,
); );
} }

View File

@ -26,7 +26,8 @@ abstract class BottomNavigationBarLayoutCubitScreenCrud<
with CrudMixin<Cubit, CrudSuccessState> { with CrudMixin<Cubit, CrudSuccessState> {
const BottomNavigationBarLayoutCubitScreenCrud({ const BottomNavigationBarLayoutCubitScreenCrud({
super.custom, super.custom,
super.height, super.barId,
super.scaffoldFieldsWrapper,
super.key, super.key,
}); });

View File

@ -24,7 +24,8 @@ abstract class BottomNavigationBarLayoutCubitScreenCrudItem<
CrudLoaded<SuccessType>> { CrudLoaded<SuccessType>> {
const BottomNavigationBarLayoutCubitScreenCrudItem({ const BottomNavigationBarLayoutCubitScreenCrudItem({
super.custom, super.custom,
super.height = 60, super.barId,
super.scaffoldFieldsWrapper,
super.key, super.key,
}); });
} }

View File

@ -24,7 +24,8 @@ abstract class BottomNavigationBarLayoutCubitScreenCrudList<
CrudListLoaded<SuccessType>> { CrudListLoaded<SuccessType>> {
const BottomNavigationBarLayoutCubitScreenCrudList({ const BottomNavigationBarLayoutCubitScreenCrudList({
super.custom, super.custom,
super.height = 60, super.barId,
super.scaffoldFieldsWrapper,
super.key, super.key,
}); });
} }

View File

@ -25,7 +25,11 @@ abstract class FrameLayoutGridCubitScreenCrudList<
const FrameLayoutGridCubitScreenCrudList({ const FrameLayoutGridCubitScreenCrudList({
super.customAppBar, super.customAppBar,
super.customBottomNavBar, super.customBottomNavBar,
super.height = 60, super.floatingActionButtonId,
super.height,
super.appBarId,
super.bottomNavBarId,
super.customFloatingActionButton,
super.scaffoldFieldsWrapper, super.scaffoldFieldsWrapper,
super.key, super.key,
}); });

View File

@ -26,21 +26,34 @@ abstract class FrameLayoutCubitScreen<Cubit extends bloc_base.Cubit<State>,
const FrameLayoutCubitScreen({ const FrameLayoutCubitScreen({
this.customAppBar, this.customAppBar,
this.customBottomNavBar, this.customBottomNavBar,
this.customFloatingActionButton,
this.appBarId,
this.bottomNavBarId,
this.floatingActionButtonId,
this.scaffoldFieldsWrapper, this.scaffoldFieldsWrapper,
this.height = 60, this.height = 60,
super.key, super.key,
}); });
final TopAppBarComponent? Function(TopAppBarComponent?)? customAppBar; final ComponentCallBack<TopAppBarComponent>? customAppBar;
final BottomNavigationBarComponent? Function(BottomNavigationBarComponent?)? final ComponentCallBack<BottomNavigationBarComponent>? customBottomNavBar;
customBottomNavBar; final ComponentCallBack<FloatingActionButtonComponent>?
customFloatingActionButton;
final String? appBarId;
final String? bottomNavBarId;
final String? floatingActionButtonId;
final double height; final double height;
final ScaffoldFieldsWrapper? scaffoldFieldsWrapper; final ScaffoldFieldsWrapper? scaffoldFieldsWrapper;
@override @override
Widget parent(BuildContext context, Widget child) => FrameLayout( Widget parent(BuildContext context, Widget child) =>
StructuralLayout.withFrame(
customAppBar: customAppBar, customAppBar: customAppBar,
customBottomNavBar: customBottomNavBar, customBottomNavBar: customBottomNavBar,
customFloatingActionButton: customFloatingActionButton,
appBarId: appBarId,
bottomNavBarId: bottomNavBarId,
floatingActionButtonId: floatingActionButtonId,
height: height, height: height,
scaffoldFieldsWrapper: scaffoldFieldsWrapper, scaffoldFieldsWrapper: scaffoldFieldsWrapper,
body: child, body: child,

View File

@ -27,9 +27,13 @@ abstract class FrameLayoutCubitScreenCrud<
const FrameLayoutCubitScreenCrud({ const FrameLayoutCubitScreenCrud({
super.customAppBar, super.customAppBar,
super.customBottomNavBar, super.customBottomNavBar,
super.floatingActionButtonId,
super.height, super.height,
super.key, super.appBarId,
super.bottomNavBarId,
super.customFloatingActionButton,
super.scaffoldFieldsWrapper, super.scaffoldFieldsWrapper,
super.key,
}); });
@override @override

View File

@ -24,7 +24,11 @@ abstract class FrameLayoutCubitScreenCrudItem<
const FrameLayoutCubitScreenCrudItem({ const FrameLayoutCubitScreenCrudItem({
super.customAppBar, super.customAppBar,
super.customBottomNavBar, super.customBottomNavBar,
super.height = 60, super.floatingActionButtonId,
super.height,
super.appBarId,
super.bottomNavBarId,
super.customFloatingActionButton,
super.scaffoldFieldsWrapper, super.scaffoldFieldsWrapper,
super.key, super.key,
}); });

View File

@ -24,7 +24,11 @@ abstract class FrameLayoutCubitScreenCrudList<
const FrameLayoutCubitScreenCrudList({ const FrameLayoutCubitScreenCrudList({
super.customAppBar, super.customAppBar,
super.customBottomNavBar, super.customBottomNavBar,
super.height = 60, super.floatingActionButtonId,
super.height,
super.appBarId,
super.bottomNavBarId,
super.customFloatingActionButton,
super.scaffoldFieldsWrapper, super.scaffoldFieldsWrapper,
super.key, super.key,
}); });

View File

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

View File

@ -25,17 +25,23 @@ abstract class TopAppBarLayoutCubitScreen<Cubit extends bloc_base.Cubit<State>,
State extends Object> extends CubitScreenBase<Cubit, State> { State extends Object> extends CubitScreenBase<Cubit, State> {
const TopAppBarLayoutCubitScreen({ const TopAppBarLayoutCubitScreen({
this.custom, this.custom,
this.barId,
this.scaffoldFieldsWrapper,
this.height = 60, this.height = 60,
super.key, super.key,
}); });
final double height; final double height;
final TopAppBarComponent? Function(TopAppBarComponent?)? custom; final ComponentCallBack<TopAppBarComponent>? custom;
final String? barId;
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,
barId: barId,
scaffoldFieldsWrapper: scaffoldFieldsWrapper,
body: child, body: child,
); );
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -27,16 +27,23 @@ abstract class TopNavigationBarLayoutCubitScreen<
const TopNavigationBarLayoutCubitScreen({ const TopNavigationBarLayoutCubitScreen({
this.custom, this.custom,
this.height = 60, this.height = 60,
this.barId,
this.scaffoldFieldsWrapper,
super.key, super.key,
}); });
final double height; final double height;
final TopNavigationBarComponent? Function(TopNavigationBarComponent?)? custom; final ComponentCallBack<TopNavigationBarComponent>? custom;
final String? barId;
final ScaffoldFieldsWrapper? scaffoldFieldsWrapper;
@override @override
Widget parent(BuildContext context, Widget child) => TopNavigationBarLayout( Widget parent(BuildContext context, Widget child) =>
height: height, StructuralLayout.withTopNavigationBar(
barId: barId,
custom: custom, custom: custom,
height: height,
scaffoldFieldsWrapper: scaffoldFieldsWrapper,
body: child, body: child,
); );
} }

View File

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

View File

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

View File

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