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';
abstract class AppThemeComponent {
static const ComponentThemeData components = ComponentThemeData.raw(
topAppBar: CustomAppBar(),
bottomNavigationBar: CustomBottomBar(),
loader: CustomLoadingWidget(),
error: CustomErrorWidget(),
static ComponentThemeData components = ComponentThemeData.raw(
topAppBars: const CustomAppBar().registry(),
bottomNavigationBars: const CustomBottomBar().registry(),
loaders: const CustomLoadingWidget().registry(),
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>,
SuccessState extends CrudSuccess> {
Widget errorBuilder(BuildContext context, CrudError state) =>
context.components.errorComponent.call(
message: (state.message != null) ? TextWrapper(state.message!) : null,
);
context.components.errorComponent().call(
message:
(state.message != null) ? TextWrapper(state.message!) : null,
);
Widget loadingBuilder(BuildContext context, CrudLoading state) =>
context.components.loader ?? const SizedBox.shrink();
context.components.loaderComponent()();
Widget initialBuilder(BuildContext context, CrudInitial state) =>
const SizedBox.shrink();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -25,17 +25,23 @@ abstract class TopAppBarLayoutCubitScreen<Cubit extends bloc_base.Cubit<State>,
State extends Object> extends CubitScreenBase<Cubit, State> {
const TopAppBarLayoutCubitScreen({
this.custom,
this.barId,
this.scaffoldFieldsWrapper,
this.height = 60,
super.key,
});
final double height;
final TopAppBarComponent? Function(TopAppBarComponent?)? custom;
final ComponentCallBack<TopAppBarComponent>? custom;
final String? barId;
final ScaffoldFieldsWrapper? scaffoldFieldsWrapper;
@override
Widget parent(BuildContext context, Widget child) => TopAppBarLayout(
height: height,
custom: custom,
barId: barId,
scaffoldFieldsWrapper: scaffoldFieldsWrapper,
body: child,
);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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