diff --git a/packages/wyatt_architecture/example/lib/data/data_sources/remote/album_mock_data_source_impl.dart b/packages/wyatt_architecture/example/lib/data/data_sources/remote/album_mock_data_source_impl.dart index 56af64ad..d63875cb 100644 --- a/packages/wyatt_architecture/example/lib/data/data_sources/remote/album_mock_data_source_impl.dart +++ b/packages/wyatt_architecture/example/lib/data/data_sources/remote/album_mock_data_source_impl.dart @@ -25,7 +25,7 @@ class AlbumMockDataSourceImpl extends AlbumRemoteDataSource { id: 1, userId: 1, title: 'Album 1', - ) + ), }; @override diff --git a/packages/wyatt_architecture/example/lib/presentation/features/photos/state_management/widgets/photos_grid_thumbnail.dart b/packages/wyatt_architecture/example/lib/presentation/features/photos/state_management/widgets/photos_grid_thumbnail.dart index 021227ff..c11b52c0 100644 --- a/packages/wyatt_architecture/example/lib/presentation/features/photos/state_management/widgets/photos_grid_thumbnail.dart +++ b/packages/wyatt_architecture/example/lib/presentation/features/photos/state_management/widgets/photos_grid_thumbnail.dart @@ -58,8 +58,8 @@ class PhotosGridThumbnail bottom: 10, right: 10, child: Icon(Icons.favorite), - ) - ] + ), + ], ], ), ); diff --git a/packages/wyatt_authentication_bloc/example/lib/presentation/features/app/app.dart b/packages/wyatt_authentication_bloc/example/lib/presentation/features/app/app.dart index 51b038d9..634443c0 100644 --- a/packages/wyatt_authentication_bloc/example/lib/presentation/features/app/app.dart +++ b/packages/wyatt_authentication_bloc/example/lib/presentation/features/app/app.dart @@ -71,7 +71,8 @@ class App extends StatelessWidget { if (authState.status != previous?.status) { previous = authState; // Checking if current path is onboarding or not - final isOnboarding = AppRouter.publicRoutes.contains(state.subloc); + final isOnboarding = + AppRouter.publicRoutes.contains(state.matchedLocation); if (authState.status == AuthenticationStatus.unauthenticated) { debugPrint('Not logged'); if (!isOnboarding) { diff --git a/packages/wyatt_authentication_bloc/example/pubspec.yaml b/packages/wyatt_authentication_bloc/example/pubspec.yaml index b269e5d6..a83f46e2 100644 --- a/packages/wyatt_authentication_bloc/example/pubspec.yaml +++ b/packages/wyatt_authentication_bloc/example/pubspec.yaml @@ -30,11 +30,11 @@ dependencies: flutter: sdk: flutter - go_router: ^5.1.5 + go_router: ^10.1.0 firebase_core: ^2.1.1 flutter_bloc: ^8.1.1 firebase_auth: ^4.2.0 - google_sign_in: ^5.4.2 + google_sign_in: ^6.1.4 get_it: ^7.2.0 wyatt_authentication_bloc: diff --git a/packages/wyatt_authentication_bloc/lib/src/core/utils/forms.dart b/packages/wyatt_authentication_bloc/lib/src/core/utils/forms.dart index ec95768b..9eec9c65 100644 --- a/packages/wyatt_authentication_bloc/lib/src/core/utils/forms.dart +++ b/packages/wyatt_authentication_bloc/lib/src/core/utils/forms.dart @@ -33,7 +33,7 @@ abstract class Forms { FormInput( AuthFormField.password, customPasswordValidator ?? const Password.pure(), - ) + ), ], name: AuthFormName.signInForm, ); @@ -55,7 +55,7 @@ abstract class Forms { AuthFormField.password, customPasswordValidator ?? const Password.pure(), ), - ...extraSignUpInputs ?? [] + ...extraSignUpInputs ?? [], ], name: AuthFormName.signUpForm, ); @@ -93,7 +93,7 @@ abstract class Forms { customPasswordValidator ?? const Password.pure(), metadata: const FormInputMetadata(isRequired: false), ), - ...extraEditAccountInputs ?? [] + ...extraEditAccountInputs ?? [], ], validationStrategy: const OnlyRequiredInputValidator(), name: AuthFormName.editAccountForm, diff --git a/packages/wyatt_authentication_bloc/lib/src/data/data_sources/local/authentication_mock_cache_data_source_impl.dart b/packages/wyatt_authentication_bloc/lib/src/data/data_sources/local/authentication_mock_cache_data_source_impl.dart index 3c23a866..80b072c2 100644 --- a/packages/wyatt_authentication_bloc/lib/src/data/data_sources/local/authentication_mock_cache_data_source_impl.dart +++ b/packages/wyatt_authentication_bloc/lib/src/data/data_sources/local/authentication_mock_cache_data_source_impl.dart @@ -32,8 +32,8 @@ class AuthenticationMockCacheDataSourceImpl @override Future getCachedAccount() async { await Future.delayed(const Duration(milliseconds: 200)); - -return null; + + return null; } @override diff --git a/packages/wyatt_authentication_bloc/pubspec.yaml b/packages/wyatt_authentication_bloc/pubspec.yaml index 74ad5bce..952edc15 100644 --- a/packages/wyatt_authentication_bloc/pubspec.yaml +++ b/packages/wyatt_authentication_bloc/pubspec.yaml @@ -15,7 +15,7 @@ dependencies: flutter_bloc: ^8.1.1 equatable: ^2.0.5 firebase_auth: ^4.2.0 - google_sign_in: ^5.4.2 + google_sign_in: ^6.1.4 rxdart: ^0.27.7 wyatt_form_bloc: @@ -30,12 +30,12 @@ dependencies: hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/ version: ^0.0.5 flutter_secure_storage: ^8.0.0 - http: ^0.13.5 + http: ^1.1.0 dev_dependencies: flutter_test: { sdk: flutter } bloc_test: ^9.1.0 - mocktail: ^0.3.0 + mocktail: ^1.0.0 wyatt_analysis: hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub/ diff --git a/packages/wyatt_authentication_bloc/test/email_verification/email_verification_cubit_test.dart b/packages/wyatt_authentication_bloc/test/email_verification/email_verification_cubit_test.dart index 29e0c9b4..b7da3ae3 100644 --- a/packages/wyatt_authentication_bloc/test/email_verification/email_verification_cubit_test.dart +++ b/packages/wyatt_authentication_bloc/test/email_verification/email_verification_cubit_test.dart @@ -46,7 +46,7 @@ void main() { AuthenticationSession.fromEvent( SignedInFromCacheEvent(account: account), data: 10, - ) + ), ]), ); @@ -113,7 +113,7 @@ void main() { ), const EmailVerificationState( status: FormStatus.submissionSuccess, - ) + ), ], ); @@ -135,7 +135,7 @@ void main() { const EmailVerificationState( errorMessage: 'erreur', status: FormStatus.submissionFailure, - ) + ), ], ); }); @@ -192,7 +192,7 @@ void main() { const EmailVerificationState( isVerified: true, status: FormStatus.submissionSuccess, - ) + ), ], ); @@ -214,7 +214,7 @@ void main() { ), const EmailVerificationState( status: FormStatus.submissionSuccess, - ) + ), ], ); @@ -236,7 +236,7 @@ void main() { const EmailVerificationState( errorMessage: 'erreur', status: FormStatus.submissionFailure, - ) + ), ], ); }); diff --git a/packages/wyatt_authentication_bloc/test/password_reset/password_reset_cubit_test.dart b/packages/wyatt_authentication_bloc/test/password_reset/password_reset_cubit_test.dart index 11c98b59..704a816e 100644 --- a/packages/wyatt_authentication_bloc/test/password_reset/password_reset_cubit_test.dart +++ b/packages/wyatt_authentication_bloc/test/password_reset/password_reset_cubit_test.dart @@ -41,7 +41,7 @@ void main() { final WyattForm form = WyattFormImpl( [ FormInput(AuthFormField.email, const Email.pure()), - FormInput(AuthFormField.password, const Password.pure()) + FormInput(AuthFormField.password, const Password.pure()), ], name: AuthFormName.passwordResetForm, ); @@ -260,7 +260,7 @@ void main() { name: AuthFormName.passwordResetForm, ), status: FormStatus.submissionSuccess, - ) + ), ], ); @@ -327,7 +327,7 @@ void main() { name: AuthFormName.passwordResetForm, ), status: FormStatus.submissionFailure, - ) + ), ], ); }); diff --git a/packages/wyatt_authentication_bloc/test/sign_in/sign_in_cubit_test.dart b/packages/wyatt_authentication_bloc/test/sign_in/sign_in_cubit_test.dart index bc517187..739f7664 100644 --- a/packages/wyatt_authentication_bloc/test/sign_in/sign_in_cubit_test.dart +++ b/packages/wyatt_authentication_bloc/test/sign_in/sign_in_cubit_test.dart @@ -46,7 +46,7 @@ void main() { final WyattForm form = WyattFormImpl( [ FormInput(AuthFormField.email, const Email.pure()), - FormInput(AuthFormField.password, const Password.pure()) + FormInput(AuthFormField.password, const Password.pure()), ], name: AuthFormName.signInForm, ); @@ -102,7 +102,7 @@ void main() { AuthFormField.email, const Email.dirty(invalidEmailString), ), - FormInput(AuthFormField.password, const Password.pure()) + FormInput(AuthFormField.password, const Password.pure()), ], name: AuthFormName.signInForm, ), @@ -126,7 +126,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signInForm, ), @@ -145,7 +145,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signInForm, ), @@ -163,7 +163,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signInForm, ), @@ -191,7 +191,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(invalidPasswordString), - ) + ), ], name: AuthFormName.signInForm, ), @@ -215,7 +215,7 @@ void main() { FormInput( AuthFormField.password, const Password.pure(), - ) + ), ], name: AuthFormName.signInForm, ), @@ -234,7 +234,7 @@ void main() { FormInput( AuthFormField.password, const Password.pure(), - ) + ), ], name: AuthFormName.signInForm, ), @@ -252,7 +252,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signInForm, ), @@ -287,7 +287,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signInForm, ), @@ -312,7 +312,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signInForm, ), @@ -331,7 +331,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signInForm, ), @@ -364,7 +364,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signInForm, ), @@ -383,7 +383,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signInForm, ), @@ -401,7 +401,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signInForm, ), @@ -417,12 +417,12 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signInForm, ), status: FormStatus.submissionSuccess, - ) + ), ], ); @@ -448,7 +448,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signInForm, ), @@ -467,7 +467,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signInForm, ), @@ -485,7 +485,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signInForm, ), @@ -501,12 +501,12 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signInForm, ), status: FormStatus.submissionFailure, - ) + ), ], ); }); @@ -527,7 +527,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signInForm, ), @@ -566,7 +566,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signInForm, ), @@ -584,7 +584,7 @@ void main() { FormInput( AuthFormField.password, const Password.pure(), - ) + ), ], name: AuthFormName.signInForm, ), @@ -600,12 +600,12 @@ void main() { FormInput( AuthFormField.password, const Password.pure(), - ) + ), ], name: AuthFormName.signInForm, ), status: FormStatus.submissionSuccess, - ) + ), ], ); @@ -630,7 +630,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signInForm, ), @@ -648,7 +648,7 @@ void main() { FormInput( AuthFormField.password, const Password.pure(), - ) + ), ], name: AuthFormName.signInForm, ), @@ -664,12 +664,12 @@ void main() { FormInput( AuthFormField.password, const Password.pure(), - ) + ), ], name: AuthFormName.signInForm, ), status: FormStatus.submissionFailure, - ) + ), ], ); }); diff --git a/packages/wyatt_authentication_bloc/test/sign_in/sign_in_state_test.dart b/packages/wyatt_authentication_bloc/test/sign_in/sign_in_state_test.dart index 30f40cb7..218ea513 100644 --- a/packages/wyatt_authentication_bloc/test/sign_in/sign_in_state_test.dart +++ b/packages/wyatt_authentication_bloc/test/sign_in/sign_in_state_test.dart @@ -22,7 +22,7 @@ void main() { final WyattForm form = WyattFormImpl( [ FormInput(AuthFormField.email, const Email.pure()), - FormInput(AuthFormField.password, const Password.pure()) + FormInput(AuthFormField.password, const Password.pure()), ], name: AuthFormName.signInForm, ); diff --git a/packages/wyatt_authentication_bloc/test/sign_up/sign_up_cubit_test.dart b/packages/wyatt_authentication_bloc/test/sign_up/sign_up_cubit_test.dart index d437c339..0f266022 100644 --- a/packages/wyatt_authentication_bloc/test/sign_up/sign_up_cubit_test.dart +++ b/packages/wyatt_authentication_bloc/test/sign_up/sign_up_cubit_test.dart @@ -46,7 +46,7 @@ void main() { final WyattForm form = WyattFormImpl( [ FormInput(AuthFormField.email, const Email.pure()), - FormInput(AuthFormField.password, const Password.pure()) + FormInput(AuthFormField.password, const Password.pure()), ], name: AuthFormName.signUpForm, ); @@ -98,7 +98,7 @@ void main() { AuthFormField.email, const Email.dirty(invalidEmailString), ), - FormInput(AuthFormField.password, const Password.pure()) + FormInput(AuthFormField.password, const Password.pure()), ], name: AuthFormName.signUpForm, ), @@ -122,7 +122,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signUpForm, ), @@ -141,7 +141,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signUpForm, ), @@ -159,7 +159,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signUpForm, ), @@ -187,7 +187,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(invalidPasswordString), - ) + ), ], name: AuthFormName.signUpForm, ), @@ -211,7 +211,7 @@ void main() { FormInput( AuthFormField.password, const Password.pure(), - ) + ), ], name: AuthFormName.signUpForm, ), @@ -230,7 +230,7 @@ void main() { FormInput( AuthFormField.password, const Password.pure(), - ) + ), ], name: AuthFormName.signUpForm, ), @@ -248,7 +248,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signUpForm, ), @@ -283,7 +283,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signUpForm, ), @@ -302,7 +302,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signUpForm, ), @@ -335,7 +335,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signUpForm, ), @@ -354,7 +354,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signUpForm, ), @@ -372,7 +372,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signUpForm, ), @@ -388,12 +388,12 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signUpForm, ), status: FormStatus.submissionSuccess, - ) + ), ], ); @@ -419,7 +419,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signUpForm, ), @@ -438,7 +438,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signUpForm, ), @@ -456,7 +456,7 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signUpForm, ), @@ -472,12 +472,12 @@ void main() { FormInput( AuthFormField.password, const Password.dirty(validPasswordString), - ) + ), ], name: AuthFormName.signUpForm, ), status: FormStatus.submissionFailure, - ) + ), ], ); }); @@ -487,7 +487,7 @@ void main() { FormInput, dynamic>>[ FormInput(AuthFormField.email, const Email.pure()), - FormInput(AuthFormField.password, const Password.pure()) + FormInput(AuthFormField.password, const Password.pure()), ]; final inputsB = < diff --git a/packages/wyatt_authentication_bloc/test/sign_up/sign_up_state_test.dart b/packages/wyatt_authentication_bloc/test/sign_up/sign_up_state_test.dart index 89380d66..9bbc5d30 100644 --- a/packages/wyatt_authentication_bloc/test/sign_up/sign_up_state_test.dart +++ b/packages/wyatt_authentication_bloc/test/sign_up/sign_up_state_test.dart @@ -22,7 +22,7 @@ void main() { final WyattForm form = WyattFormImpl( [ FormInput(AuthFormField.email, const Email.pure()), - FormInput(AuthFormField.password, const Password.pure()) + FormInput(AuthFormField.password, const Password.pure()), ], name: AuthFormName.signInForm, ); diff --git a/packages/wyatt_bloc_layout/example/lib/bloc/example_cubit.dart b/packages/wyatt_bloc_layout/example/lib/bloc/example_cubit.dart index dd2275d4..9fc24ebc 100644 --- a/packages/wyatt_bloc_layout/example/lib/bloc/example_cubit.dart +++ b/packages/wyatt_bloc_layout/example/lib/bloc/example_cubit.dart @@ -31,7 +31,7 @@ class ExampleCubit extends Cubit { 'DATA LOADED 1', 'DATA LOADED 2', 'DATA LOADED 3', - 'DATA LOADED 4' + 'DATA LOADED 4', ]), ); await Future.delayed(const Duration(seconds: 1)); diff --git a/packages/wyatt_bloc_layout/example/lib/components/theme_components.dart b/packages/wyatt_bloc_layout/example/lib/components/theme_components.dart index 888522dd..0be4d529 100644 --- a/packages/wyatt_bloc_layout/example/lib/components/theme_components.dart +++ b/packages/wyatt_bloc_layout/example/lib/components/theme_components.dart @@ -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(), ); } diff --git a/packages/wyatt_bloc_layout/lib/src/core/crud_cubit_consumer_screen_mixin.dart b/packages/wyatt_bloc_layout/lib/src/core/crud_cubit_consumer_screen_mixin.dart index 7a083f3c..90e0df4e 100644 --- a/packages/wyatt_bloc_layout/lib/src/core/crud_cubit_consumer_screen_mixin.dart +++ b/packages/wyatt_bloc_layout/lib/src/core/crud_cubit_consumer_screen_mixin.dart @@ -22,13 +22,17 @@ import 'package:wyatt_ui_components/wyatt_ui_components.dart'; mixin CrudMixin, SuccessState extends CrudSuccess> { + String? get loaderId => null; + String? get erroId => null; + Widget errorBuilder(BuildContext context, CrudError state) => - context.components.errorComponent.call( - message: (state.message != null) ? TextWrapper(state.message!) : null, - ); + context.components.errorComponent(erroId).call( + message: + (state.message != null) ? TextWrapper(state.message!) : null, + ); Widget loadingBuilder(BuildContext context, CrudLoading state) => - context.components.loader ?? const SizedBox.shrink(); + context.components.loaderComponent(loaderId).call(); Widget initialBuilder(BuildContext context, CrudInitial state) => const SizedBox.shrink(); diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_grid_layout_cubit_screen_crud_list.dart b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_grid_layout_cubit_screen_crud_list.dart index 952a2c81..3bef8e64 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_grid_layout_cubit_screen_crud_list.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_grid_layout_cubit_screen_crud_list.dart @@ -24,7 +24,8 @@ abstract class BottomNavigationBarGridLayoutCubitScreenCrudList< with GridLayoutMixin { const BottomNavigationBarGridLayoutCubitScreenCrudList({ super.custom, - super.height = 60, + super.barId, + super.scaffoldFieldsWrapper, super.key, }); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen.dart b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen.dart index 0a02294f..ed0c7a82 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen.dart @@ -26,18 +26,21 @@ abstract class BottomNavigationBarLayoutCubitScreen< State extends Object> extends CubitScreenBase { const BottomNavigationBarLayoutCubitScreen({ this.custom, - this.height = 60, + this.barId, + this.scaffoldFieldsWrapper, super.key, }); - final double height; - final BottomNavigationBarComponent? Function(BottomNavigationBarComponent?)? - custom; + final ComponentCallBack? 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, ); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud.dart b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud.dart index c1cc938d..f6fcbad6 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud.dart @@ -26,7 +26,8 @@ abstract class BottomNavigationBarLayoutCubitScreenCrud< with CrudMixin { const BottomNavigationBarLayoutCubitScreenCrud({ super.custom, - super.height, + super.barId, + super.scaffoldFieldsWrapper, super.key, }); diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud_item.dart b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud_item.dart index 69ff4371..aa65e30a 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud_item.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud_item.dart @@ -24,7 +24,8 @@ abstract class BottomNavigationBarLayoutCubitScreenCrudItem< CrudLoaded> { const BottomNavigationBarLayoutCubitScreenCrudItem({ super.custom, - super.height = 60, + super.barId, + super.scaffoldFieldsWrapper, super.key, }); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud_list.dart b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud_list.dart index 7c6c5b21..2d884bfa 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud_list.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/bottom_navigation_bar_bloc_layout/bottom_navigation_bar_layout_cubit_screen_crud_list.dart @@ -24,7 +24,8 @@ abstract class BottomNavigationBarLayoutCubitScreenCrudList< CrudListLoaded> { const BottomNavigationBarLayoutCubitScreenCrudList({ super.custom, - super.height = 60, + super.barId, + super.scaffoldFieldsWrapper, super.key, }); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/cubit_screen_crud_item_base.dart b/packages/wyatt_bloc_layout/lib/src/presentation/cubit_screen_crud_item_base.dart index 3fe2becb..be09290c 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/cubit_screen_crud_item_base.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/cubit_screen_crud_item_base.dart @@ -20,5 +20,7 @@ import 'package:wyatt_crud_bloc/wyatt_crud_bloc.dart'; abstract class CubitScreenCrudItemBase, T extends Object?> extends CubitScreenCrudBase> { - const CubitScreenCrudItemBase({super.key}); + const CubitScreenCrudItemBase({ + super.key, + }); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_grid_layout_cubit_screen_crud_list.dart b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_grid_layout_cubit_screen_crud_list.dart index 044776d5..162464dc 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_grid_layout_cubit_screen_crud_list.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_grid_layout_cubit_screen_crud_list.dart @@ -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, }); diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen.dart b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen.dart index d5b6d415..2adc78c2 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen.dart @@ -26,21 +26,34 @@ abstract class FrameLayoutCubitScreen, 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? customAppBar; + final ComponentCallBack? customBottomNavBar; + final ComponentCallBack? + 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, diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud.dart b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud.dart index 0803c37e..f29a6afd 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud.dart @@ -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 diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud_item.dart b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud_item.dart index e3d9e965..ec3b37a4 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud_item.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud_item.dart @@ -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, }); diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud_list.dart b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud_list.dart index 7ff1910b..e6831695 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud_list.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/frame_bloc_layout/frame_layout_cubit_screen_crud_list.dart @@ -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, }); diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/structural_bloc_layout.dart b/packages/wyatt_bloc_layout/lib/src/presentation/structural_bloc_layout.dart new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/packages/wyatt_bloc_layout/lib/src/presentation/structural_bloc_layout.dart @@ -0,0 +1 @@ + diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_grid_layout_cubit_screen_crud_list.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_grid_layout_cubit_screen_crud_list.dart index e20a1842..d0bfcd07 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_grid_layout_cubit_screen_crud_list.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_grid_layout_cubit_screen_crud_list.dart @@ -25,6 +25,8 @@ abstract class TopAppBarGridLayoutCubitScreenCrudList< const TopAppBarGridLayoutCubitScreenCrudList({ super.custom, super.height = 60, + super.barId, + super.scaffoldFieldsWrapper, super.key, }); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen.dart index 48fe0abe..4f79e518 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen.dart @@ -25,17 +25,23 @@ abstract class TopAppBarLayoutCubitScreen, State extends Object> extends CubitScreenBase { const TopAppBarLayoutCubitScreen({ this.custom, + this.barId, + this.scaffoldFieldsWrapper, this.height = 60, super.key, }); final double height; - final TopAppBarComponent? Function(TopAppBarComponent?)? custom; + final ComponentCallBack? 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, ); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud.dart index efa82d3e..9a15513e 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud.dart @@ -27,6 +27,8 @@ abstract class TopAppBarLayoutCubitScreenCrud< const TopAppBarLayoutCubitScreenCrud({ super.custom, super.height, + super.barId, + super.scaffoldFieldsWrapper, super.key, }); diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud_item.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud_item.dart index dd7e2bb1..9011b564 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud_item.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud_item.dart @@ -24,6 +24,8 @@ abstract class TopAppBarLayoutCubitScreenCrudItem< const TopAppBarLayoutCubitScreenCrudItem({ super.custom, super.height = 60, + super.barId, + super.scaffoldFieldsWrapper, super.key, }); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud_list.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud_list.dart index 902ce24c..e4b36161 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud_list.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_app_bar_bloc_layout/top_app_bar_layout_cubit_screen_crud_list.dart @@ -24,6 +24,8 @@ abstract class TopAppBarLayoutCubitScreenCrudList< const TopAppBarLayoutCubitScreenCrudList({ super.custom, super.height = 60, + super.barId, + super.scaffoldFieldsWrapper, super.key, }); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_grid_layout_cubit_screen_crud_list.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_grid_layout_cubit_screen_crud_list.dart index b57d29cf..ff8f6bb8 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_grid_layout_cubit_screen_crud_list.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_grid_layout_cubit_screen_crud_list.dart @@ -25,6 +25,8 @@ abstract class TopNavigationBarGridLayoutCubitScreenCrudList< const TopNavigationBarGridLayoutCubitScreenCrudList({ super.custom, super.height = 60, + super.barId, + super.scaffoldFieldsWrapper, super.key, }); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen.dart index b1903cdc..71352ce3 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen.dart @@ -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? 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, ); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud.dart index 76bd6beb..4de19691 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud.dart @@ -27,6 +27,8 @@ abstract class TopNavigationBarLayoutCubitScreenCrud< const TopNavigationBarLayoutCubitScreenCrud({ super.custom, super.height, + super.barId, + super.scaffoldFieldsWrapper, super.key, }); diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud_item.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud_item.dart index 112b8844..d1fce340 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud_item.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud_item.dart @@ -25,6 +25,8 @@ abstract class TopNavigationBarLayoutCubitScreenCrudItem< const TopNavigationBarLayoutCubitScreenCrudItem({ super.custom, super.height = 60, + super.barId, + super.scaffoldFieldsWrapper, super.key, }); } diff --git a/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud_list.dart b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud_list.dart index 0f17b282..092fee71 100644 --- a/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud_list.dart +++ b/packages/wyatt_bloc_layout/lib/src/presentation/top_navigation_bar_bloc_layout/top_navigation_bar_layout_cubit_screen_crud_list.dart @@ -25,6 +25,8 @@ abstract class TopNavigationBarLayoutCubitScreenCrudList< const TopNavigationBarLayoutCubitScreenCrudList({ super.custom, super.height = 60, + super.barId, + super.scaffoldFieldsWrapper, super.key, }); } diff --git a/packages/wyatt_cloud_messaging_bloc_base/example/lib/firebase_options.dart b/packages/wyatt_cloud_messaging_bloc_base/example/lib/firebase_options.dart index 446a8685..e9a80b3c 100644 --- a/packages/wyatt_cloud_messaging_bloc_base/example/lib/firebase_options.dart +++ b/packages/wyatt_cloud_messaging_bloc_base/example/lib/firebase_options.dart @@ -53,7 +53,8 @@ class DefaultFirebaseOptions { messagingSenderId: '100151285458', projectId: 'wyatt-notification-example', storageBucket: 'wyatt-notification-example.appspot.com', - iosClientId: '100151285458-a9notq1k1padf0vk9ove8ll3amjgi7mn.apps.googleusercontent.com', + iosClientId: + '100151285458-a9notq1k1padf0vk9ove8ll3amjgi7mn.apps.googleusercontent.com', iosBundleId: 'com.example.notificationBlocExample', ); } diff --git a/packages/wyatt_cloud_messaging_bloc_base/lib/src/data/repositories/cloud_messaging_repository_impl.dart b/packages/wyatt_cloud_messaging_bloc_base/lib/src/data/repositories/cloud_messaging_repository_impl.dart index f5212d81..d7d467d9 100644 --- a/packages/wyatt_cloud_messaging_bloc_base/lib/src/data/repositories/cloud_messaging_repository_impl.dart +++ b/packages/wyatt_cloud_messaging_bloc_base/lib/src/data/repositories/cloud_messaging_repository_impl.dart @@ -22,11 +22,10 @@ import 'package:wyatt_cloud_messaging_bloc_base/src/domain/repositories/cloud_me import 'package:wyatt_type_utils/wyatt_type_utils.dart'; class CloudMessagingRepositoryImpl extends CloudMessagingRepository { - final CloudMessagingRemoteDataSource _notificationRemoteDataSource; - CloudMessagingRepositoryImpl({ required CloudMessagingRemoteDataSource notificationRemoteDataSource, }) : _notificationRemoteDataSource = notificationRemoteDataSource; + final CloudMessagingRemoteDataSource _notificationRemoteDataSource; @override FutureOrResult getToken() => Result.tryCatchAsync( diff --git a/packages/wyatt_cloud_messaging_bloc_base/lib/src/domain/usecases/get_cloud_messaging_token_use_case.dart b/packages/wyatt_cloud_messaging_bloc_base/lib/src/domain/usecases/get_cloud_messaging_token_use_case.dart index f951c154..b2fad136 100644 --- a/packages/wyatt_cloud_messaging_bloc_base/lib/src/domain/usecases/get_cloud_messaging_token_use_case.dart +++ b/packages/wyatt_cloud_messaging_bloc_base/lib/src/domain/usecases/get_cloud_messaging_token_use_case.dart @@ -18,11 +18,10 @@ import 'package:wyatt_architecture/wyatt_architecture.dart'; import 'package:wyatt_cloud_messaging_bloc_base/src/domain/repositories/cloud_messaging_repository.dart'; class GetCloudMessagingTokenUseCase extends AsyncUseCase { - final CloudMessagingRepository _notificationRepository; - GetCloudMessagingTokenUseCase({ required CloudMessagingRepository notificationRepository, }) : _notificationRepository = notificationRepository; + final CloudMessagingRepository _notificationRepository; @override FutureOrResult execute(void params) => diff --git a/packages/wyatt_cloud_messaging_bloc_base/lib/src/domain/usecases/init_cloud_messaging_use_case.dart b/packages/wyatt_cloud_messaging_bloc_base/lib/src/domain/usecases/init_cloud_messaging_use_case.dart index 6d1f9394..12632716 100644 --- a/packages/wyatt_cloud_messaging_bloc_base/lib/src/domain/usecases/init_cloud_messaging_use_case.dart +++ b/packages/wyatt_cloud_messaging_bloc_base/lib/src/domain/usecases/init_cloud_messaging_use_case.dart @@ -18,11 +18,10 @@ import 'package:wyatt_architecture/wyatt_architecture.dart'; import 'package:wyatt_cloud_messaging_bloc_base/src/domain/repositories/cloud_messaging_repository.dart'; class InitCloudmessagingUseCase extends AsyncUseCase { - final CloudMessagingRepository _notificationRepository; - InitCloudmessagingUseCase({ required CloudMessagingRepository notificationRepository, }) : _notificationRepository = notificationRepository; + final CloudMessagingRepository _notificationRepository; @override FutureOrResult execute(NoParam? params) => _notificationRepository.init(); diff --git a/packages/wyatt_cloud_messaging_bloc_base/lib/src/domain/usecases/listen_notification_use_case.dart b/packages/wyatt_cloud_messaging_bloc_base/lib/src/domain/usecases/listen_notification_use_case.dart index 7c434046..3d670f5d 100644 --- a/packages/wyatt_cloud_messaging_bloc_base/lib/src/domain/usecases/listen_notification_use_case.dart +++ b/packages/wyatt_cloud_messaging_bloc_base/lib/src/domain/usecases/listen_notification_use_case.dart @@ -25,11 +25,10 @@ import 'package:wyatt_type_utils/wyatt_type_utils.dart'; class ListenNotificationUseCase extends StreamUseCase { - final CloudMessagingRepository _notificationRepository; - ListenNotificationUseCase({ required CloudMessagingRepository notificationRepository, }) : _notificationRepository = notificationRepository; + final CloudMessagingRepository _notificationRepository; @override FutureOrResult> execute(NoParam? params) async { Stream? notificationStream; diff --git a/packages/wyatt_cloud_messaging_bloc_base/lib/src/domain/usecases/request_cloud_messaging_permission_use_case.dart b/packages/wyatt_cloud_messaging_bloc_base/lib/src/domain/usecases/request_cloud_messaging_permission_use_case.dart index 2e712cc9..45436321 100644 --- a/packages/wyatt_cloud_messaging_bloc_base/lib/src/domain/usecases/request_cloud_messaging_permission_use_case.dart +++ b/packages/wyatt_cloud_messaging_bloc_base/lib/src/domain/usecases/request_cloud_messaging_permission_use_case.dart @@ -18,11 +18,10 @@ import 'package:wyatt_architecture/wyatt_architecture.dart'; import 'package:wyatt_cloud_messaging_bloc_base/src/domain/repositories/cloud_messaging_repository.dart'; class RequestCloudMessagingPermissionUseCase extends AsyncUseCase { - final CloudMessagingRepository _notificationRepository; - RequestCloudMessagingPermissionUseCase({ required CloudMessagingRepository notificationRepository, }) : _notificationRepository = notificationRepository; + final CloudMessagingRepository _notificationRepository; @override FutureOrResult execute(void params) => diff --git a/packages/wyatt_cloud_messaging_bloc_base/lib/src/domain/usecases/subscribe_to_notification_topic_use_case.dart b/packages/wyatt_cloud_messaging_bloc_base/lib/src/domain/usecases/subscribe_to_notification_topic_use_case.dart index b3a364ca..f5efbbb7 100644 --- a/packages/wyatt_cloud_messaging_bloc_base/lib/src/domain/usecases/subscribe_to_notification_topic_use_case.dart +++ b/packages/wyatt_cloud_messaging_bloc_base/lib/src/domain/usecases/subscribe_to_notification_topic_use_case.dart @@ -20,11 +20,10 @@ import 'package:wyatt_architecture/wyatt_architecture.dart'; import 'package:wyatt_cloud_messaging_bloc_base/src/domain/repositories/cloud_messaging_repository.dart'; class SubscribeToNotificationTopicUseCase extends AsyncUseCase { - final CloudMessagingRepository _notificationRepository; - SubscribeToNotificationTopicUseCase({ required CloudMessagingRepository notificationRepository, }) : _notificationRepository = notificationRepository; + final CloudMessagingRepository _notificationRepository; @override FutureOr onStart(String? params) { diff --git a/packages/wyatt_cloud_messaging_bloc_base/lib/src/domain/usecases/unsubscribe_from_notification_topic_use_case.dart b/packages/wyatt_cloud_messaging_bloc_base/lib/src/domain/usecases/unsubscribe_from_notification_topic_use_case.dart index 1bd13f9c..d58fe4f2 100644 --- a/packages/wyatt_cloud_messaging_bloc_base/lib/src/domain/usecases/unsubscribe_from_notification_topic_use_case.dart +++ b/packages/wyatt_cloud_messaging_bloc_base/lib/src/domain/usecases/unsubscribe_from_notification_topic_use_case.dart @@ -21,11 +21,10 @@ import 'package:wyatt_cloud_messaging_bloc_base/src/domain/repositories/cloud_me class UnsubscribeFromNotificationTopicUseCase extends AsyncUseCase { - final CloudMessagingRepository _notificationRepository; - UnsubscribeFromNotificationTopicUseCase({ required CloudMessagingRepository notificationRepository, }) : _notificationRepository = notificationRepository; + final CloudMessagingRepository _notificationRepository; @override FutureOr onStart(String? params) { diff --git a/packages/wyatt_cloud_messaging_bloc_base/lib/src/features/notifications/bloc/cloud_messaging_cubit.dart b/packages/wyatt_cloud_messaging_bloc_base/lib/src/features/notifications/bloc/cloud_messaging_cubit.dart index 1c298478..ed8eb0f5 100644 --- a/packages/wyatt_cloud_messaging_bloc_base/lib/src/features/notifications/bloc/cloud_messaging_cubit.dart +++ b/packages/wyatt_cloud_messaging_bloc_base/lib/src/features/notifications/bloc/cloud_messaging_cubit.dart @@ -30,11 +30,6 @@ part 'cloud_messaging_state.dart'; typedef OnNotification = void Function(RemoteNotification); class CloudMessagingCubit extends Cubit { - final ListenNotificationUseCase _listenNotification; - final SubscribeToNotificationTopicUseCase? _subscribe; - final UnsubscribeFromNotificationTopicUseCase? _unsubscribe; - - final OnNotification? handleNotification; CloudMessagingCubit({ required ListenNotificationUseCase listenNotification, SubscribeToNotificationTopicUseCase? subscribe, @@ -44,6 +39,11 @@ class CloudMessagingCubit extends Cubit { _subscribe = subscribe, _unsubscribe = unsubscribe, super(const CloudmessagingState()); + final ListenNotificationUseCase _listenNotification; + final SubscribeToNotificationTopicUseCase? _subscribe; + final UnsubscribeFromNotificationTopicUseCase? _unsubscribe; + + final OnNotification? handleNotification; Future listenNotification() async { final notificaitons = await _listenNotification.execute(const NoParam()); diff --git a/packages/wyatt_cloud_messaging_bloc_base/lib/src/features/notifications/bloc/cloud_messaging_state.dart b/packages/wyatt_cloud_messaging_bloc_base/lib/src/features/notifications/bloc/cloud_messaging_state.dart index 4d2810d5..34311e4e 100644 --- a/packages/wyatt_cloud_messaging_bloc_base/lib/src/features/notifications/bloc/cloud_messaging_state.dart +++ b/packages/wyatt_cloud_messaging_bloc_base/lib/src/features/notifications/bloc/cloud_messaging_state.dart @@ -17,9 +17,8 @@ part of 'cloud_messaging_cubit.dart'; class CloudmessagingState extends Equatable { - final RemoteNotification? remoteNotification; - const CloudmessagingState([this.remoteNotification]); + final RemoteNotification? remoteNotification; @override List get props => [remoteNotification]; diff --git a/packages/wyatt_component_copy_with_gen/pubspec.yaml b/packages/wyatt_component_copy_with_gen/pubspec.yaml index e7e40745..f2c389a8 100644 --- a/packages/wyatt_component_copy_with_gen/pubspec.yaml +++ b/packages/wyatt_component_copy_with_gen/pubspec.yaml @@ -11,7 +11,7 @@ environment: dependencies: build: ^2.3.1 source_gen: ^1.2.7 - analyzer: ^5.4.0 + analyzer: ^6.2.0 wyatt_component_copy_with_extension: hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub diff --git a/packages/wyatt_crud_bloc/lib/src/data/data_sources/remote/crud_firestore_data_source_impl.dart b/packages/wyatt_crud_bloc/lib/src/data/data_sources/remote/crud_firestore_data_source_impl.dart index 2915f2e6..7b4f793a 100644 --- a/packages/wyatt_crud_bloc/lib/src/data/data_sources/remote/crud_firestore_data_source_impl.dart +++ b/packages/wyatt_crud_bloc/lib/src/data/data_sources/remote/crud_firestore_data_source_impl.dart @@ -33,8 +33,7 @@ class CrudFirestoreDataSourceImpl required Model Function( DocumentSnapshot>, SnapshotOptions?, - ) - fromFirestore, + ) fromFirestore, /// The function that converts a [Model] to a [Map]. required Map Function(Model, SetOptions?) toFirestore, diff --git a/packages/wyatt_crud_bloc/lib/src/features/crud/blocs/crud_advanced_cubit.dart b/packages/wyatt_crud_bloc/lib/src/features/crud/blocs/crud_advanced_cubit.dart index d41e35d9..85546422 100644 --- a/packages/wyatt_crud_bloc/lib/src/features/crud/blocs/crud_advanced_cubit.dart +++ b/packages/wyatt_crud_bloc/lib/src/features/crud/blocs/crud_advanced_cubit.dart @@ -289,7 +289,7 @@ abstract class CrudAdvancedCubit WhereQueryType.whereIn, 'id', ids, - ) + ), ]); if (result.isOk) { return CrudListLoaded(result.ok ?? []); diff --git a/packages/wyatt_crud_bloc/lib/src/features/crud/blocs/crud_cubit.dart b/packages/wyatt_crud_bloc/lib/src/features/crud/blocs/crud_cubit.dart index 5d18975f..97265465 100644 --- a/packages/wyatt_crud_bloc/lib/src/features/crud/blocs/crud_cubit.dart +++ b/packages/wyatt_crud_bloc/lib/src/features/crud/blocs/crud_cubit.dart @@ -353,7 +353,7 @@ abstract class CrudCubit extends CrudBaseCubit { WhereQueryType.whereIn, 'id', ids, - ) + ), ]); if (result.isOk) { return CrudListLoaded(result.ok ?? []); diff --git a/packages/wyatt_form_bloc/lib/src/data/form_operations/form_difference.dart b/packages/wyatt_form_bloc/lib/src/data/form_operations/form_difference.dart index ec77e957..bcee7fce 100644 --- a/packages/wyatt_form_bloc/lib/src/data/form_operations/form_difference.dart +++ b/packages/wyatt_form_bloc/lib/src/data/form_operations/form_difference.dart @@ -26,9 +26,8 @@ class FormDifference extends FormOperation { @override WyattForm call(WyattForm a, WyattForm b) { - final inputs = < - FormInput, - dynamic>>[]; + final inputs = , dynamic>>[]; for (final i in a.inputs) { if (!b.containsKey(i.key)) { diff --git a/packages/wyatt_form_bloc/lib/src/data/form_operations/form_intersection.dart b/packages/wyatt_form_bloc/lib/src/data/form_operations/form_intersection.dart index 332a7bd1..8986435d 100644 --- a/packages/wyatt_form_bloc/lib/src/data/form_operations/form_intersection.dart +++ b/packages/wyatt_form_bloc/lib/src/data/form_operations/form_intersection.dart @@ -26,9 +26,8 @@ class FormIntersection extends FormOperation { @override WyattForm call(WyattForm a, WyattForm b) { - final inputs = < - FormInput, - dynamic>>[]; + final inputs = , dynamic>>[]; for (final i in a.inputs) { if (b.containsKey(i.key)) { diff --git a/packages/wyatt_form_bloc/lib/src/data/form_operations/form_union.dart b/packages/wyatt_form_bloc/lib/src/data/form_operations/form_union.dart index 91725e13..edf4dbf6 100644 --- a/packages/wyatt_form_bloc/lib/src/data/form_operations/form_union.dart +++ b/packages/wyatt_form_bloc/lib/src/data/form_operations/form_union.dart @@ -26,9 +26,8 @@ class FormUnion extends FormOperation { @override WyattForm call(WyattForm a, WyattForm b) { - final inputs = < - FormInput, - dynamic>>[]; + final inputs = , dynamic>>[]; for (final i in a.inputs) { inputs.add(i); diff --git a/packages/wyatt_http_client/lib/src/utils/convert.dart b/packages/wyatt_http_client/lib/src/utils/convert.dart index 93c86d59..81808e91 100644 --- a/packages/wyatt_http_client/lib/src/utils/convert.dart +++ b/packages/wyatt_http_client/lib/src/utils/convert.dart @@ -46,7 +46,7 @@ abstract class Convert { map.forEach( (key, value) => pairs.add([ Uri.encodeQueryComponent(key, encoding: encoding ?? utf8), - Uri.encodeQueryComponent(value, encoding: encoding ?? utf8) + Uri.encodeQueryComponent(value, encoding: encoding ?? utf8), ]), ); return pairs.map((pair) => '${pair[0]}=${pair[1]}').join('&'); diff --git a/packages/wyatt_http_client/pubspec.yaml b/packages/wyatt_http_client/pubspec.yaml index 7e287156..335af5fc 100644 --- a/packages/wyatt_http_client/pubspec.yaml +++ b/packages/wyatt_http_client/pubspec.yaml @@ -10,7 +10,7 @@ environment: dependencies: crypto: ^3.0.2 - http: ^0.13.4 + http: ^1.1.0 dev_dependencies: wyatt_analysis: diff --git a/packages/wyatt_i18n/example/lib/main.dart b/packages/wyatt_i18n/example/lib/main.dart index fa13f3f7..1d9e1373 100644 --- a/packages/wyatt_i18n/example/lib/main.dart +++ b/packages/wyatt_i18n/example/lib/main.dart @@ -44,7 +44,7 @@ class App extends StatelessWidget { ), ), GlobalMaterialLocalizations.delegate, - GlobalWidgetsLocalizations.delegate + GlobalWidgetsLocalizations.delegate, ], home: Scaffold( appBar: AppBar( diff --git a/packages/wyatt_i18n/lib/src/core/utils/parsers/i18n_file_parser.dart b/packages/wyatt_i18n/lib/src/core/utils/parsers/i18n_file_parser.dart index 3cc371e1..a06b6a12 100644 --- a/packages/wyatt_i18n/lib/src/core/utils/parsers/i18n_file_parser.dart +++ b/packages/wyatt_i18n/lib/src/core/utils/parsers/i18n_file_parser.dart @@ -93,7 +93,7 @@ class I18nFileParser extends Parser { String selectToString(Select token) { final Map cases = { - for (var e in token.options.map( + for (final e in token.options.map( (o) => MapEntry( o.name, o.value.map(parsedElementToString).join(), diff --git a/packages/wyatt_type_utils/example/pubspec.yaml b/packages/wyatt_type_utils/example/pubspec.yaml index ffb81097..d5773668 100644 --- a/packages/wyatt_type_utils/example/pubspec.yaml +++ b/packages/wyatt_type_utils/example/pubspec.yaml @@ -27,7 +27,7 @@ environment: # the latest version available on pub.dev. To see which dependencies have newer # versions available, run `flutter pub outdated`. dependencies: - http: ^0.13.4 + http: ^1.1.0 wyatt_type_utils: path: "../" diff --git a/packages/wyatt_ui_components/README.md b/packages/wyatt_ui_components/README.md index dbff11f0..eeda4b32 100644 --- a/packages/wyatt_ui_components/README.md +++ b/packages/wyatt_ui_components/README.md @@ -43,7 +43,23 @@ First create all your custom components in `domain/entities` folder. For exemple > Run `flutter pub run build_runner build` to generate your components. -Then, add your components to `ComponentThemeData` class. +Then, add your components to `ComponentThemeData` class. You can utilize multiple components of the same type, such as having multiple top app bars or distinct cards. However, it's necessary to distinguish them using identifiers. Extensions are provided to make your life easier. Note that it's not obligatory to assign an identifier to a component if there's only one of its kind. Here's an example: + +```dart +class AppThemeComponent { + static ComponentThemeData get components => ComponentThemeData.raw( + topAppBars: const { + 'root': CustomRootAppBar(), + 'second': CustomSecondAppBar(), + }.registry(), + bottomNavigationBars: const CustomBottomNavigationBar().registry(), + errors: const CustomErrorWidget().registry(), + loaders: const CustomLoaderWidget().registry(), + ); +} +``` + +I've rephrased the sentence while maintaining the original meaning and intent. ### Provider @@ -82,21 +98,28 @@ context.components, For example : ```dart - @override - Widget build(BuildContext context) => Scaffold( - appBar: context.components.appBar, - body: ... - ) + context.components.topAppBarComponent()(), ``` -If you need specific settings, or pass parameters to your component, call `copyWith.call` method. +or ```dart - @override - Widget build(BuildContext context) => Scaffold( - appBar: context.components.appBar.copyWith.call({title: 'New Title !'}), - body: ... - ) + appBar: context.components.topAppBarComponent().call(), +``` + +If you require specific settings or want to pass parameters to your component, simply provide them when you call your component. + +```dart + context.components.loaderComponent()( + colors: const MultiColor.single(Colors.green), + ), +``` + +And if you have only one parameter to modify, you can directly call it as shown below: + +```dart + context.components.loaderComponent(). + colors(const MultiColor.single(Colors.green)), ``` ## Default implementation diff --git a/packages/wyatt_ui_components/example/lib/component_theme.dart b/packages/wyatt_ui_components/example/lib/component_theme.dart index 258dfd0e..3f3e38fb 100644 --- a/packages/wyatt_ui_components/example/lib/component_theme.dart +++ b/packages/wyatt_ui_components/example/lib/component_theme.dart @@ -1,14 +1,18 @@ import 'package:wyatt_ui_components/wyatt_ui_components.dart'; -import 'package:wyatt_ui_components_example/components/custom_app_bar.dart'; import 'package:wyatt_ui_components_example/components/custom_bottom_bar.dart'; import 'package:wyatt_ui_components_example/components/custom_error_widget.dart'; import 'package:wyatt_ui_components_example/components/custom_loader_widget.dart'; +import 'package:wyatt_ui_components_example/components/custom_root_app_bar.dart'; +import 'package:wyatt_ui_components_example/components/custom_second_app_bar.dart'; class AppThemeComponent { - static ComponentThemeData get components => const ComponentThemeData.raw( - topAppBar: CustomAppBar(), - bottomNavigationBar: CustomBottomNavigationBar(), - error: CustomErrorWidget(), - loader: CustomLoaderWidget(), + static ComponentThemeData get components => ComponentThemeData.raw( + topAppBars: const { + 'root': CustomRootAppBar(), + 'second': CustomSecondAppBar(), + }.registry(), + bottomNavigationBars: const CustomBottomNavigationBar().registry(), + errors: const CustomErrorWidget().registry(), + loaders: const CustomLoaderWidget().registry(), ); } diff --git a/packages/wyatt_ui_components/example/lib/components/custom_app_bar.g.dart b/packages/wyatt_ui_components/example/lib/components/custom_app_bar.g.dart deleted file mode 100644 index 125680d9..00000000 --- a/packages/wyatt_ui_components/example/lib/components/custom_app_bar.g.dart +++ /dev/null @@ -1,99 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'custom_app_bar.dart'; - -// ************************************************************************** -// ComponentCopyWithGenerator -// ************************************************************************** - -class $CustomAppBarCWProxyImpl implements $TopAppBarComponentCWProxy { - const $CustomAppBarCWProxyImpl(this._value); - final CustomAppBar _value; - @override - CustomAppBar title(TextWrapper? title) => this(title: title); - @override - CustomAppBar centerTitle(bool? centerTitle) => this(centerTitle: centerTitle); - @override - CustomAppBar shape(ShapeBorder? shape) => this(shape: shape); - @override - CustomAppBar systemOverlayStyle(SystemUiOverlayStyle? systemOverlayStyle) => - this(systemOverlayStyle: systemOverlayStyle); - @override - CustomAppBar automaticallyImplyLeading(bool? automaticallyImplyLeading) => - this(automaticallyImplyLeading: automaticallyImplyLeading); - @override - CustomAppBar flexibleSpace(Widget? flexibleSpace) => - this(flexibleSpace: flexibleSpace); - @override - CustomAppBar bottom(PreferredSizeWidget? bottom) => this(bottom: bottom); - @override - CustomAppBar elevation(double? elevation) => this(elevation: elevation); - @override - CustomAppBar scrolledUnderElevation(double? scrolledUnderElevation) => - this(scrolledUnderElevation: scrolledUnderElevation); - @override - CustomAppBar shadowColor(Color? shadowColor) => - this(shadowColor: shadowColor); - @override - CustomAppBar surfaceTintColor(Color? surfaceTintColor) => - this(surfaceTintColor: surfaceTintColor); - @override - CustomAppBar backgroundColor(MultiColor? backgroundColor) => - this(backgroundColor: backgroundColor); - @override - CustomAppBar iconTheme(IconThemeData? iconTheme) => - this(iconTheme: iconTheme); - @override - CustomAppBar primary(bool? primary) => this(primary: primary); - @override - CustomAppBar excludeHeaderSemantics(bool? excludeHeaderSemantics) => - this(excludeHeaderSemantics: excludeHeaderSemantics); - @override - CustomAppBar toolbarHeight(double? toolbarHeight) => - this(toolbarHeight: toolbarHeight); - @override - CustomAppBar leadingWidth(double? leadingWidth) => - this(leadingWidth: leadingWidth); - @override - CustomAppBar leading(Widget? leading) => this(leading: leading); - @override - CustomAppBar actions(List? actions) => this(actions: actions); - @override - CustomAppBar expandedWidget(List? expandedWidget) => - this(expandedWidget: expandedWidget); - @override - CustomAppBar key(Key? key) => this(key: key); - @override - CustomAppBar call({ - TextWrapper? title, - bool? centerTitle, - ShapeBorder? shape, - SystemUiOverlayStyle? systemOverlayStyle, - bool? automaticallyImplyLeading, - Widget? flexibleSpace, - PreferredSizeWidget? bottom, - double? elevation, - double? scrolledUnderElevation, - Color? shadowColor, - Color? surfaceTintColor, - MultiColor? backgroundColor, - IconThemeData? iconTheme, - bool? primary, - bool? excludeHeaderSemantics, - double? toolbarHeight, - double? leadingWidth, - Widget? leading, - List? actions, - List? expandedWidget, - Key? key, - }) => - CustomAppBar( - title: title ?? _value.title, - key: key ?? _value.key, - ); -} - -mixin $CustomAppBarCWMixin on Component { - $TopAppBarComponentCWProxy get copyWith => - $CustomAppBarCWProxyImpl(this as CustomAppBar); -} diff --git a/packages/wyatt_ui_components/example/lib/components/custom_app_bar.dart b/packages/wyatt_ui_components/example/lib/components/custom_root_app_bar.dart similarity index 63% rename from packages/wyatt_ui_components/example/lib/components/custom_app_bar.dart rename to packages/wyatt_ui_components/example/lib/components/custom_root_app_bar.dart index e14c228f..a096fe8f 100644 --- a/packages/wyatt_ui_components/example/lib/components/custom_app_bar.dart +++ b/packages/wyatt_ui_components/example/lib/components/custom_root_app_bar.dart @@ -1,12 +1,14 @@ import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:wyatt_component_copy_with_extension/wyatt_component_copy_with_extension.dart'; import 'package:wyatt_ui_components/wyatt_ui_components.dart'; -part 'custom_app_bar.g.dart'; +part 'custom_root_app_bar.g.dart'; @ComponentCopyWithExtension() -class CustomAppBar extends TopAppBarComponent with $CustomAppBarCWMixin { - const CustomAppBar({super.title, super.key}); +class CustomRootAppBar extends TopAppBarComponent + with $CustomRootAppBarCWMixin { + const CustomRootAppBar({super.title, super.key}); @override Widget build(BuildContext context) => AppBar( diff --git a/packages/wyatt_ui_components/example/lib/components/custom_root_app_bar.g.dart b/packages/wyatt_ui_components/example/lib/components/custom_root_app_bar.g.dart new file mode 100644 index 00000000..a276f16b --- /dev/null +++ b/packages/wyatt_ui_components/example/lib/components/custom_root_app_bar.g.dart @@ -0,0 +1,101 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'custom_root_app_bar.dart'; + +// ************************************************************************** +// ComponentCopyWithGenerator +// ************************************************************************** + +class $CustomRootAppBarCWProxyImpl implements $TopAppBarComponentCWProxy { + const $CustomRootAppBarCWProxyImpl(this._value); + final CustomRootAppBar _value; + @override + CustomRootAppBar title(TextWrapper? title) => this(title: title); + @override + CustomRootAppBar centerTitle(bool? centerTitle) => + this(centerTitle: centerTitle); + @override + CustomRootAppBar shape(ShapeBorder? shape) => this(shape: shape); + @override + CustomRootAppBar systemOverlayStyle( + SystemUiOverlayStyle? systemOverlayStyle) => + this(systemOverlayStyle: systemOverlayStyle); + @override + CustomRootAppBar automaticallyImplyLeading(bool? automaticallyImplyLeading) => + this(automaticallyImplyLeading: automaticallyImplyLeading); + @override + CustomRootAppBar flexibleSpace(Widget? flexibleSpace) => + this(flexibleSpace: flexibleSpace); + @override + CustomRootAppBar bottom(PreferredSizeWidget? bottom) => this(bottom: bottom); + @override + CustomRootAppBar elevation(double? elevation) => this(elevation: elevation); + @override + CustomRootAppBar scrolledUnderElevation(double? scrolledUnderElevation) => + this(scrolledUnderElevation: scrolledUnderElevation); + @override + CustomRootAppBar shadowColor(Color? shadowColor) => + this(shadowColor: shadowColor); + @override + CustomRootAppBar surfaceTintColor(Color? surfaceTintColor) => + this(surfaceTintColor: surfaceTintColor); + @override + CustomRootAppBar backgroundColor(MultiColor? backgroundColor) => + this(backgroundColor: backgroundColor); + @override + CustomRootAppBar iconTheme(IconThemeData? iconTheme) => + this(iconTheme: iconTheme); + @override + CustomRootAppBar primary(bool? primary) => this(primary: primary); + @override + CustomRootAppBar excludeHeaderSemantics(bool? excludeHeaderSemantics) => + this(excludeHeaderSemantics: excludeHeaderSemantics); + @override + CustomRootAppBar toolbarHeight(double? toolbarHeight) => + this(toolbarHeight: toolbarHeight); + @override + CustomRootAppBar leadingWidth(double? leadingWidth) => + this(leadingWidth: leadingWidth); + @override + CustomRootAppBar leading(Widget? leading) => this(leading: leading); + @override + CustomRootAppBar actions(List? actions) => this(actions: actions); + @override + CustomRootAppBar expandedWidget(List? expandedWidget) => + this(expandedWidget: expandedWidget); + @override + CustomRootAppBar key(Key? key) => this(key: key); + @override + CustomRootAppBar call({ + TextWrapper? title, + bool? centerTitle, + ShapeBorder? shape, + SystemUiOverlayStyle? systemOverlayStyle, + bool? automaticallyImplyLeading, + Widget? flexibleSpace, + PreferredSizeWidget? bottom, + double? elevation, + double? scrolledUnderElevation, + Color? shadowColor, + Color? surfaceTintColor, + MultiColor? backgroundColor, + IconThemeData? iconTheme, + bool? primary, + bool? excludeHeaderSemantics, + double? toolbarHeight, + double? leadingWidth, + Widget? leading, + List? actions, + List? expandedWidget, + Key? key, + }) => + CustomRootAppBar( + title: title ?? _value.title, + key: key ?? _value.key, + ); +} + +mixin $CustomRootAppBarCWMixin on Component { + $TopAppBarComponentCWProxy get copyWith => + $CustomRootAppBarCWProxyImpl(this as CustomRootAppBar); +} diff --git a/packages/wyatt_ui_components/example/lib/components/custom_second_app_bar.dart b/packages/wyatt_ui_components/example/lib/components/custom_second_app_bar.dart new file mode 100644 index 00000000..bc8303f7 --- /dev/null +++ b/packages/wyatt_ui_components/example/lib/components/custom_second_app_bar.dart @@ -0,0 +1,20 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:wyatt_component_copy_with_extension/wyatt_component_copy_with_extension.dart'; +import 'package:wyatt_ui_components/wyatt_ui_components.dart'; + +part 'custom_second_app_bar.g.dart'; + +@ComponentCopyWithExtension() +class CustomSecondAppBar extends TopAppBarComponent + with $CustomSecondAppBarCWMixin { + const CustomSecondAppBar({super.title, super.key}); + + @override + Widget build(BuildContext context) => AppBar( + backgroundColor: Colors.green, + title: Text( + super.title?.data ?? '', + ), + ); +} diff --git a/packages/wyatt_ui_components/example/lib/components/custom_second_app_bar.g.dart b/packages/wyatt_ui_components/example/lib/components/custom_second_app_bar.g.dart new file mode 100644 index 00000000..b2baf398 --- /dev/null +++ b/packages/wyatt_ui_components/example/lib/components/custom_second_app_bar.g.dart @@ -0,0 +1,103 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'custom_second_app_bar.dart'; + +// ************************************************************************** +// ComponentCopyWithGenerator +// ************************************************************************** + +class $CustomSecondAppBarCWProxyImpl implements $TopAppBarComponentCWProxy { + const $CustomSecondAppBarCWProxyImpl(this._value); + final CustomSecondAppBar _value; + @override + CustomSecondAppBar title(TextWrapper? title) => this(title: title); + @override + CustomSecondAppBar centerTitle(bool? centerTitle) => + this(centerTitle: centerTitle); + @override + CustomSecondAppBar shape(ShapeBorder? shape) => this(shape: shape); + @override + CustomSecondAppBar systemOverlayStyle( + SystemUiOverlayStyle? systemOverlayStyle) => + this(systemOverlayStyle: systemOverlayStyle); + @override + CustomSecondAppBar automaticallyImplyLeading( + bool? automaticallyImplyLeading) => + this(automaticallyImplyLeading: automaticallyImplyLeading); + @override + CustomSecondAppBar flexibleSpace(Widget? flexibleSpace) => + this(flexibleSpace: flexibleSpace); + @override + CustomSecondAppBar bottom(PreferredSizeWidget? bottom) => + this(bottom: bottom); + @override + CustomSecondAppBar elevation(double? elevation) => this(elevation: elevation); + @override + CustomSecondAppBar scrolledUnderElevation(double? scrolledUnderElevation) => + this(scrolledUnderElevation: scrolledUnderElevation); + @override + CustomSecondAppBar shadowColor(Color? shadowColor) => + this(shadowColor: shadowColor); + @override + CustomSecondAppBar surfaceTintColor(Color? surfaceTintColor) => + this(surfaceTintColor: surfaceTintColor); + @override + CustomSecondAppBar backgroundColor(MultiColor? backgroundColor) => + this(backgroundColor: backgroundColor); + @override + CustomSecondAppBar iconTheme(IconThemeData? iconTheme) => + this(iconTheme: iconTheme); + @override + CustomSecondAppBar primary(bool? primary) => this(primary: primary); + @override + CustomSecondAppBar excludeHeaderSemantics(bool? excludeHeaderSemantics) => + this(excludeHeaderSemantics: excludeHeaderSemantics); + @override + CustomSecondAppBar toolbarHeight(double? toolbarHeight) => + this(toolbarHeight: toolbarHeight); + @override + CustomSecondAppBar leadingWidth(double? leadingWidth) => + this(leadingWidth: leadingWidth); + @override + CustomSecondAppBar leading(Widget? leading) => this(leading: leading); + @override + CustomSecondAppBar actions(List? actions) => this(actions: actions); + @override + CustomSecondAppBar expandedWidget(List? expandedWidget) => + this(expandedWidget: expandedWidget); + @override + CustomSecondAppBar key(Key? key) => this(key: key); + @override + CustomSecondAppBar call({ + TextWrapper? title, + bool? centerTitle, + ShapeBorder? shape, + SystemUiOverlayStyle? systemOverlayStyle, + bool? automaticallyImplyLeading, + Widget? flexibleSpace, + PreferredSizeWidget? bottom, + double? elevation, + double? scrolledUnderElevation, + Color? shadowColor, + Color? surfaceTintColor, + MultiColor? backgroundColor, + IconThemeData? iconTheme, + bool? primary, + bool? excludeHeaderSemantics, + double? toolbarHeight, + double? leadingWidth, + Widget? leading, + List? actions, + List? expandedWidget, + Key? key, + }) => + CustomSecondAppBar( + title: title ?? _value.title, + key: key ?? _value.key, + ); +} + +mixin $CustomSecondAppBarCWMixin on Component { + $TopAppBarComponentCWProxy get copyWith => + $CustomSecondAppBarCWProxyImpl(this as CustomSecondAppBar); +} diff --git a/packages/wyatt_ui_components/example/lib/main.dart b/packages/wyatt_ui_components/example/lib/main.dart index be86f9b0..ac72753b 100644 --- a/packages/wyatt_ui_components/example/lib/main.dart +++ b/packages/wyatt_ui_components/example/lib/main.dart @@ -47,14 +47,22 @@ class Home extends StatelessWidget { @override Widget build(BuildContext context) => Scaffold( appBar: PreferredSize( - preferredSize: const Size.fromHeight(60), - child: context.components.topAppBarComponent - .title(const TextWrapper('Example title')), + preferredSize: const Size.fromHeight(120), + child: Column( + children: [ + context.components + .topAppBarComponent() + .title(const TextWrapper('Example title')), + context.components + .topAppBarComponent('second') + .title(const TextWrapper('Example title')), + ], + ), ), body: Column( children: [ Expanded( - child: context.components.errorComponent.call( + child: context.components.errorComponent()( message: const TextWrapper('Example error'), ), ), @@ -62,12 +70,13 @@ class Home extends StatelessWidget { height: 10, ), Expanded( - child: context.components.loaderComponent.call( + child: context.components.loaderComponent()( colors: const MultiColor.single(Colors.green), ), ), ], ), - bottomNavigationBar: context.components.bottomNavigationBar, + bottomNavigationBar: + context.components.bottomNavigationBarComponent()(), ); } diff --git a/packages/wyatt_ui_components/lib/src/core/core.dart b/packages/wyatt_ui_components/lib/src/core/core.dart index e4df47c7..b27375d2 100644 --- a/packages/wyatt_ui_components/lib/src/core/core.dart +++ b/packages/wyatt_ui_components/lib/src/core/core.dart @@ -16,5 +16,7 @@ export 'enums/enums.dart'; export 'extensions/build_context_extensions.dart'; +export 'extensions/component_extensions.dart'; export 'mixins/copy_with_mixin.dart'; +export 'utils/component_registry.dart'; export 'utils/utils.dart'; diff --git a/packages/wyatt_ui_components/lib/src/core/extensions/component_extensions.dart b/packages/wyatt_ui_components/lib/src/core/extensions/component_extensions.dart new file mode 100644 index 00000000..e649d9a3 --- /dev/null +++ b/packages/wyatt_ui_components/lib/src/core/extensions/component_extensions.dart @@ -0,0 +1,33 @@ +// Copyright (C) 2023 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import 'package:wyatt_ui_components/wyatt_ui_components.dart'; + +/// Extension on a map of components that creates a [ComponentRegistry] +/// using the map's content. +extension ComponentMapExtension on Map { + /// Creates and returns a [ComponentRegistry] based on the map's components. + ComponentRegistry registry() => ComponentRegistry(components: this); +} + +/// Extension on a single component that creates a [ComponentRegistry] +/// containing only that component. +extension ComponentExtension on T { + /// Creates and returns a [ComponentRegistry] containing + /// only this component. + // ignore: use_to_and_as_if_applicable + ComponentRegistry registry() => ComponentRegistry.solo(this); +} diff --git a/packages/wyatt_ui_components/lib/src/core/utils/component_registry.dart b/packages/wyatt_ui_components/lib/src/core/utils/component_registry.dart new file mode 100644 index 00000000..04dfee56 --- /dev/null +++ b/packages/wyatt_ui_components/lib/src/core/utils/component_registry.dart @@ -0,0 +1,59 @@ +// Copyright (C) 2023 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import 'package:wyatt_ui_components/wyatt_ui_components.dart'; + +/// A registry for components of type [T], providing easy access and management. +class ComponentRegistry { + /// Constructs a [ComponentRegistry] with the given [components]. + const ComponentRegistry({required Map components}) + : _components = components; + + /// Factory constructor to create a [ComponentRegistry] + /// containing only a single [component]. + factory ComponentRegistry.solo(T component) => ComponentRegistry( + components: { + 'solo': component, + }, + ); + + final Map _components; + + /// Returns a component by its [id], or the first + /// component if [id] is null or not found. + T? call([String? id]) => getComponent(id) ?? getFirstComponent(); + + /// Returns a component by its [id], or null if not found. + T? getComponent(String? id) => _components[id]; + + /// Returns the first component in the registry, or null + /// if the registry is empty. + T? getFirstComponent() => _components.values.firstOrNull; + + /// Checks if the registry contains a component with the given [id]. + bool containsComponent(String id) => _components.containsKey(id); + + /// Returns the count of components in the registry. + int get count => _components.length; + + /// Returns a list of all IDs of components in the registry. + List get ids => _components.keys.toList(); + + /// Returns a string representation of the registry, + /// showing the count and IDs. + @override + String toString() => '$count - $ids'; +} diff --git a/packages/wyatt_ui_components/lib/src/domain/entities/bars/bottom_navigation_bar_component.dart b/packages/wyatt_ui_components/lib/src/domain/entities/bars/bottom_navigation_bar_component.dart index b303351e..c3c39f4b 100644 --- a/packages/wyatt_ui_components/lib/src/domain/entities/bars/bottom_navigation_bar_component.dart +++ b/packages/wyatt_ui_components/lib/src/domain/entities/bars/bottom_navigation_bar_component.dart @@ -30,7 +30,7 @@ abstract class BottomNavigationBarComponent extends Component this.items = const [], super.key, }); - + final int currentIndex; final void Function(BuildContext, int)? onTap; final List items; diff --git a/packages/wyatt_ui_components/lib/src/features/component_theme_data.dart b/packages/wyatt_ui_components/lib/src/features/component_theme_data.dart index 0410e034..c085f226 100644 --- a/packages/wyatt_ui_components/lib/src/features/component_theme_data.dart +++ b/packages/wyatt_ui_components/lib/src/features/component_theme_data.dart @@ -16,6 +16,7 @@ import 'package:copy_with_extension/copy_with_extension.dart'; import 'package:flutter/material.dart'; +import 'package:wyatt_ui_components/src/core/utils/component_registry.dart'; import 'package:wyatt_ui_components/src/domain/entities/entities.dart'; part 'component_theme_data.g.dart'; @@ -26,64 +27,64 @@ part 'component_theme_data.g.dart'; class ComponentThemeData { /// {@macro component_theme_data} factory ComponentThemeData({ - TopAppBarComponent? topAppBar, - TopNavigationBarComponent? topNavigationBar, - BottomNavigationBarComponent? bottomNavigationBar, - ErrorComponent? error, - LoaderComponent? loader, - RichTextBuilderComponent? richTextBuilder, - TextInputComponent? textInput, - FileSelectionButtonComponent? fileSelectionButton, - FlatButtonComponent? flatButton, - SimpleIconButtonComponent? simpleIconButton, - SymbolButtonComponent? symbolButton, - InformationCardComponent? informationCard, - PortfolioCardComponent? portfolioCard, - QuoteCardComponent? quoteCard, - SkillCardComponent? skillCard, - PricingCardComponent? pricingCard, - FloatingActionButtonComponent? floatingActionButton, + ComponentRegistry? topAppBars, + ComponentRegistry? topNavigationBars, + ComponentRegistry? bottomNavigationBars, + ComponentRegistry? errors, + ComponentRegistry? loaders, + ComponentRegistry? richTextBuilders, + ComponentRegistry? textInputs, + ComponentRegistry? fileSelectionButtons, + ComponentRegistry? flatButtons, + ComponentRegistry? simpleIconButtons, + ComponentRegistry? symbolButtons, + ComponentRegistry? informationCards, + ComponentRegistry? portfolioCards, + ComponentRegistry? quoteCards, + ComponentRegistry? skillCards, + ComponentRegistry? pricingCards, + ComponentRegistry? floatingActionButtons, }) => ComponentThemeData.raw( - topAppBar: topAppBar, - topNavigationBar: topNavigationBar, - bottomNavigationBar: bottomNavigationBar, - error: error, - loader: loader, - richTextBuilder: richTextBuilder, - textInput: textInput, - fileSelectionButton: fileSelectionButton, - flatButton: flatButton, - simpleIconButton: simpleIconButton, - symbolButton: symbolButton, - informationCard: informationCard, - portfolioCard: portfolioCard, - quoteCard: quoteCard, - skillCard: skillCard, - pricingCard: pricingCard, - floatingActionButton: floatingActionButton, + topAppBars: topAppBars, + topNavigationBars: topNavigationBars, + bottomNavigationBars: bottomNavigationBars, + errors: errors, + loaders: loaders, + richTextBuilders: richTextBuilders, + textInputs: textInputs, + fileSelectionButtons: fileSelectionButtons, + flatButtons: flatButtons, + simpleIconButtons: simpleIconButtons, + symbolButtons: symbolButtons, + informationCards: informationCards, + portfolioCards: portfolioCards, + quoteCards: quoteCards, + skillCards: skillCards, + pricingCards: pricingCards, + floatingActionButtons: floatingActionButtons, ); - /// {@macro component_theme_data} + // /// {@macro component_theme_data} factory ComponentThemeData.fromOther(ComponentThemeData other) => ComponentThemeData( - topAppBar: other.topAppBar, - topNavigationBar: other.topNavigationBar, - bottomNavigationBar: other.bottomNavigationBar, - error: other.error, - loader: other.loader, - richTextBuilder: other.richTextBuilder, - textInput: other.textInput, - fileSelectionButton: other.fileSelectionButton, - flatButton: other.flatButton, - simpleIconButton: other.simpleIconButton, - symbolButton: other.symbolButton, - informationCard: other.informationCard, - portfolioCard: other.portfolioCard, - quoteCard: other.quoteCard, - skillCard: other.skillCard, - pricingCard: other.pricingCard, - floatingActionButton: other.floatingActionButton, + topAppBars: other._topAppBars, + topNavigationBars: other._topNavigationBars, + bottomNavigationBars: other._bottomNavigationBars, + errors: other._errors, + loaders: other._loaders, + richTextBuilders: other._richTextBuilders, + textInputs: other._textInputs, + fileSelectionButtons: other._fileSelectionButtons, + flatButtons: other._flatButtons, + simpleIconButtons: other._simpleIconButtons, + symbolButtons: other._symbolButtons, + informationCards: other._informationCards, + portfolioCards: other._portfolioCards, + quoteCards: other._quoteCards, + skillCards: other._skillCards, + pricingCards: other._pricingCards, + floatingActionButtons: other._floatingActionButtons, ); /// Create a [ComponentThemeData] given a set of exact values. Most values @@ -93,24 +94,40 @@ class ComponentThemeData { /// create intermediate themes based on two themes created with the /// [ComponentThemeData] constructor. const ComponentThemeData.raw({ - this.topAppBar, - this.topNavigationBar, - this.bottomNavigationBar, - this.error, - this.loader, - this.richTextBuilder, - this.textInput, - this.fileSelectionButton, - this.flatButton, - this.simpleIconButton, - this.symbolButton, - this.informationCard, - this.portfolioCard, - this.quoteCard, - this.skillCard, - this.pricingCard, - this.floatingActionButton, - }); + ComponentRegistry? topAppBars, + ComponentRegistry? topNavigationBars, + ComponentRegistry? bottomNavigationBars, + ComponentRegistry? errors, + ComponentRegistry? loaders, + ComponentRegistry? richTextBuilders, + ComponentRegistry? textInputs, + ComponentRegistry? fileSelectionButtons, + ComponentRegistry? flatButtons, + ComponentRegistry? simpleIconButtons, + ComponentRegistry? symbolButtons, + ComponentRegistry? informationCards, + ComponentRegistry? portfolioCards, + ComponentRegistry? quoteCards, + ComponentRegistry? skillCards, + ComponentRegistry? pricingCards, + ComponentRegistry? floatingActionButtons, + }) : _floatingActionButtons = floatingActionButtons, + _symbolButtons = symbolButtons, + _simpleIconButtons = simpleIconButtons, + _flatButtons = flatButtons, + _fileSelectionButtons = fileSelectionButtons, + _textInputs = textInputs, + _richTextBuilders = richTextBuilders, + _pricingCards = pricingCards, + _skillCards = skillCards, + _quoteCards = quoteCards, + _portfolioCards = portfolioCards, + _informationCards = informationCards, + _loaders = loaders, + _errors = errors, + _bottomNavigationBars = bottomNavigationBars, + _topNavigationBars = topNavigationBars, + _topAppBars = topAppBars; R _get(T? component, R? returned) { if (component == null) { @@ -128,64 +145,97 @@ class ComponentThemeData { } // Bars - final TopAppBarComponent? topAppBar; - $TopAppBarComponentCWProxy get topAppBarComponent => - _get(topAppBar, topAppBar?.copyWith); - final TopNavigationBarComponent? topNavigationBar; - $TopNavigationBarComponentCWProxy get topNavigationBarComponent => - _get(topNavigationBar, topNavigationBar?.copyWith); - final BottomNavigationBarComponent? bottomNavigationBar; - $BottomNavigationBarComponentCWProxy get bottomNavigationBarComponent => - _get(bottomNavigationBar, bottomNavigationBar?.copyWith); + final ComponentRegistry? _topAppBars; + $TopAppBarComponentCWProxy topAppBarComponent([String? id]) => + _get(_topAppBars?.call(id), _topAppBars?.call(id)?.copyWith); + + final ComponentRegistry? _topNavigationBars; + $TopNavigationBarComponentCWProxy topNavigationBarComponent([String? id]) => + _get( + _topNavigationBars?.call(id), + _topNavigationBars?.call(id)?.copyWith, + ); + + final ComponentRegistry? _bottomNavigationBars; + $BottomNavigationBarComponentCWProxy bottomNavigationBarComponent([ + String? id, + ]) => + _get( + _bottomNavigationBars?.call(id), + _bottomNavigationBars?.call(id)?.copyWith, + ); // CRUD Widgets - final ErrorComponent? error; - $ErrorComponentCWProxy get errorComponent => _get(error, error?.copyWith); - final LoaderComponent? loader; - $LoaderComponentCWProxy get loaderComponent => _get(loader, loader?.copyWith); + final ComponentRegistry? _errors; + $ErrorComponentCWProxy errorComponent([String? id]) => + _get(_errors?.call(id), _errors?.call(id)?.copyWith); + + final ComponentRegistry? _loaders; + $LoaderComponentCWProxy loaderComponent([String? id]) => + _get(_loaders?.call(id), _loaders?.call(id)?.copyWith); // Cards - final InformationCardComponent? informationCard; - $InformationCardComponentCWProxy get informationCardComponent => - _get(informationCard, informationCard?.copyWith); - final PortfolioCardComponent? portfolioCard; - $PortfolioCardComponentCWProxy get portfolioCardComponent => - _get(portfolioCard, portfolioCard?.copyWith); - final QuoteCardComponent? quoteCard; - $QuoteCardComponentCWProxy get quoteCardComponent => - _get(quoteCard, quoteCard?.copyWith); - final SkillCardComponent? skillCard; - $SkillCardComponentCWProxy get skillCardComponent => - _get(skillCard, skillCard?.copyWith); - final PricingCardComponent? pricingCard; - $PricingCardComponentCWProxy get pricingCardComponent => - _get(pricingCard, pricingCard?.copyWith); + final ComponentRegistry? _informationCards; + $InformationCardComponentCWProxy informationCardComponent([String? id]) => + _get(_informationCards?.call(id), _informationCards?.call(id)?.copyWith); + + final ComponentRegistry? _portfolioCards; + $PortfolioCardComponentCWProxy portfolioCardComponent([String? id]) => + _get(_portfolioCards?.call(id), _portfolioCards?.call(id)?.copyWith); + + final ComponentRegistry? _quoteCards; + $QuoteCardComponentCWProxy quoteCardComponent([String? id]) => + _get(_quoteCards?.call(id), _quoteCards?.call(id)?.copyWith); + + final ComponentRegistry? _skillCards; + $SkillCardComponentCWProxy skillCardComponent([String? id]) => + _get(_skillCards?.call(id), _skillCards?.call(id)?.copyWith); + final ComponentRegistry? _pricingCards; + $PricingCardComponentCWProxy pricingCardComponent([String? id]) => + _get(_pricingCards?.call(id), _pricingCards?.call(id)?.copyWith); // Rich Text - final RichTextBuilderComponent? richTextBuilder; - $RichTextBuilderComponentCWProxy get richTextBuilderComponent => - _get(richTextBuilder, richTextBuilder?.copyWith); + final ComponentRegistry? _richTextBuilders; + $RichTextBuilderComponentCWProxy richTextBuilderComponent([String? id]) => + _get(_richTextBuilders?.call(id), _richTextBuilders?.call(id)?.copyWith); // Text Inputs - final TextInputComponent? textInput; - $TextInputComponentCWProxy get textInputComponent => - _get(textInput, textInput?.copyWith); + final ComponentRegistry? _textInputs; + $TextInputComponentCWProxy textInputComponent([String? id]) => + _get(_textInputs?.call(id), _textInputs?.call(id)?.copyWith); // Buttons - final FileSelectionButtonComponent? fileSelectionButton; - $FileSelectionButtonComponentCWProxy get fileSelectionButtonComponent => - _get(fileSelectionButton, fileSelectionButton?.copyWith); - final FlatButtonComponent? flatButton; - $FlatButtonComponentCWProxy get flatButtonComponent => - _get(flatButton, flatButton?.copyWith); - final SimpleIconButtonComponent? simpleIconButton; - $SimpleIconButtonComponentCWProxy get simpleIconButtonComponent => - _get(simpleIconButton, simpleIconButton?.copyWith); - final SymbolButtonComponent? symbolButton; - $SymbolButtonComponentCWProxy get symbolButtonComponent => - _get(symbolButton, symbolButton?.copyWith); + final ComponentRegistry? _fileSelectionButtons; + $FileSelectionButtonComponentCWProxy fileSelectionButtonComponent([ + String? id, + ]) => + _get( + _fileSelectionButtons?.call(id), + _fileSelectionButtons?.call(id)?.copyWith, + ); - final FloatingActionButtonComponent? floatingActionButton; - $FloatingActionButtonComponentCWProxy get floatingActionButtonComponent => - _get(floatingActionButton, floatingActionButton?.copyWith); + final ComponentRegistry? _flatButtons; + $FlatButtonComponentCWProxy flatButtonComponent([String? id]) => + _get(_flatButtons?.call(id), _flatButtons?.call(id)?.copyWith); + + final ComponentRegistry? _simpleIconButtons; + $SimpleIconButtonComponentCWProxy simpleIconButtonComponent([String? id]) => + _get( + _simpleIconButtons?.call(id), + _simpleIconButtons?.call(id)?.copyWith, + ); + + final ComponentRegistry? _symbolButtons; + $SymbolButtonComponentCWProxy symbolButtonComponent([String? id]) => + _get(_symbolButtons?.call(id), _symbolButtons?.call(id)?.copyWith); + + final ComponentRegistry? + _floatingActionButtons; + $FloatingActionButtonComponentCWProxy floatingActionButtonComponent([ + String? id, + ]) => + _get( + _floatingActionButtons?.call(id), + _floatingActionButtons?.call(id)?.copyWith, + ); } diff --git a/packages/wyatt_ui_components/lib/src/features/component_theme_data.g.dart b/packages/wyatt_ui_components/lib/src/features/component_theme_data.g.dart index cd9b6bc5..dc03e692 100644 --- a/packages/wyatt_ui_components/lib/src/features/component_theme_data.g.dart +++ b/packages/wyatt_ui_components/lib/src/features/component_theme_data.g.dart @@ -7,44 +7,54 @@ part of 'component_theme_data.dart'; // ************************************************************************** abstract class _$ComponentThemeDataCWProxy { - ComponentThemeData topAppBar(TopAppBarComponent? topAppBar); + ComponentThemeData topAppBars( + ComponentRegistry? topAppBars); - ComponentThemeData topNavigationBar( - TopNavigationBarComponent? topNavigationBar); + ComponentThemeData topNavigationBars( + ComponentRegistry? topNavigationBars); - ComponentThemeData bottomNavigationBar( - BottomNavigationBarComponent? bottomNavigationBar); + ComponentThemeData bottomNavigationBars( + ComponentRegistry? bottomNavigationBars); - ComponentThemeData error(ErrorComponent? error); + ComponentThemeData errors(ComponentRegistry? errors); - ComponentThemeData loader(LoaderComponent? loader); + ComponentThemeData loaders(ComponentRegistry? loaders); - ComponentThemeData richTextBuilder(RichTextBuilderComponent? richTextBuilder); + ComponentThemeData richTextBuilders( + ComponentRegistry? richTextBuilders); - ComponentThemeData textInput(TextInputComponent? textInput); + ComponentThemeData textInputs( + ComponentRegistry? textInputs); - ComponentThemeData fileSelectionButton( - FileSelectionButtonComponent? fileSelectionButton); + ComponentThemeData fileSelectionButtons( + ComponentRegistry? fileSelectionButtons); - ComponentThemeData flatButton(FlatButtonComponent? flatButton); + ComponentThemeData flatButtons( + ComponentRegistry? flatButtons); - ComponentThemeData simpleIconButton( - SimpleIconButtonComponent? simpleIconButton); + ComponentThemeData simpleIconButtons( + ComponentRegistry? simpleIconButtons); - ComponentThemeData symbolButton(SymbolButtonComponent? symbolButton); + ComponentThemeData symbolButtons( + ComponentRegistry? symbolButtons); - ComponentThemeData informationCard(InformationCardComponent? informationCard); + ComponentThemeData informationCards( + ComponentRegistry? informationCards); - ComponentThemeData portfolioCard(PortfolioCardComponent? portfolioCard); + ComponentThemeData portfolioCards( + ComponentRegistry? portfolioCards); - ComponentThemeData quoteCard(QuoteCardComponent? quoteCard); + ComponentThemeData quoteCards( + ComponentRegistry? quoteCards); - ComponentThemeData skillCard(SkillCardComponent? skillCard); + ComponentThemeData skillCards( + ComponentRegistry? skillCards); - ComponentThemeData pricingCard(PricingCardComponent? pricingCard); + ComponentThemeData pricingCards( + ComponentRegistry? pricingCards); - ComponentThemeData floatingActionButton( - FloatingActionButtonComponent? floatingActionButton); + ComponentThemeData floatingActionButtons( + ComponentRegistry? floatingActionButtons); /// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `ComponentThemeData(...).copyWith.fieldName(...)` to override fields one at a time with nullification support. /// @@ -53,23 +63,23 @@ abstract class _$ComponentThemeDataCWProxy { /// ComponentThemeData(...).copyWith(id: 12, name: "My name") /// ```` ComponentThemeData call({ - TopAppBarComponent? topAppBar, - TopNavigationBarComponent? topNavigationBar, - BottomNavigationBarComponent? bottomNavigationBar, - ErrorComponent? error, - LoaderComponent? loader, - RichTextBuilderComponent? richTextBuilder, - TextInputComponent? textInput, - FileSelectionButtonComponent? fileSelectionButton, - FlatButtonComponent? flatButton, - SimpleIconButtonComponent? simpleIconButton, - SymbolButtonComponent? symbolButton, - InformationCardComponent? informationCard, - PortfolioCardComponent? portfolioCard, - QuoteCardComponent? quoteCard, - SkillCardComponent? skillCard, - PricingCardComponent? pricingCard, - FloatingActionButtonComponent? floatingActionButton, + ComponentRegistry? topAppBars, + ComponentRegistry? topNavigationBars, + ComponentRegistry? bottomNavigationBars, + ComponentRegistry? errors, + ComponentRegistry? loaders, + ComponentRegistry? richTextBuilders, + ComponentRegistry? textInputs, + ComponentRegistry? fileSelectionButtons, + ComponentRegistry? flatButtons, + ComponentRegistry? simpleIconButtons, + ComponentRegistry? symbolButtons, + ComponentRegistry? informationCards, + ComponentRegistry? portfolioCards, + ComponentRegistry? quoteCards, + ComponentRegistry? skillCards, + ComponentRegistry? pricingCards, + ComponentRegistry? floatingActionButtons, }); } @@ -80,77 +90,90 @@ class _$ComponentThemeDataCWProxyImpl implements _$ComponentThemeDataCWProxy { final ComponentThemeData _value; @override - ComponentThemeData topAppBar(TopAppBarComponent? topAppBar) => - this(topAppBar: topAppBar); + ComponentThemeData topAppBars( + ComponentRegistry? topAppBars) => + this(topAppBars: topAppBars); @override - ComponentThemeData topNavigationBar( - TopNavigationBarComponent? topNavigationBar) => - this(topNavigationBar: topNavigationBar); + ComponentThemeData topNavigationBars( + ComponentRegistry? topNavigationBars) => + this(topNavigationBars: topNavigationBars); @override - ComponentThemeData bottomNavigationBar( - BottomNavigationBarComponent? bottomNavigationBar) => - this(bottomNavigationBar: bottomNavigationBar); + ComponentThemeData bottomNavigationBars( + ComponentRegistry? + bottomNavigationBars) => + this(bottomNavigationBars: bottomNavigationBars); @override - ComponentThemeData error(ErrorComponent? error) => this(error: error); + ComponentThemeData errors(ComponentRegistry? errors) => + this(errors: errors); @override - ComponentThemeData loader(LoaderComponent? loader) => this(loader: loader); + ComponentThemeData loaders(ComponentRegistry? loaders) => + this(loaders: loaders); @override - ComponentThemeData richTextBuilder( - RichTextBuilderComponent? richTextBuilder) => - this(richTextBuilder: richTextBuilder); + ComponentThemeData richTextBuilders( + ComponentRegistry? richTextBuilders) => + this(richTextBuilders: richTextBuilders); @override - ComponentThemeData textInput(TextInputComponent? textInput) => - this(textInput: textInput); + ComponentThemeData textInputs( + ComponentRegistry? textInputs) => + this(textInputs: textInputs); @override - ComponentThemeData fileSelectionButton( - FileSelectionButtonComponent? fileSelectionButton) => - this(fileSelectionButton: fileSelectionButton); + ComponentThemeData fileSelectionButtons( + ComponentRegistry? + fileSelectionButtons) => + this(fileSelectionButtons: fileSelectionButtons); @override - ComponentThemeData flatButton(FlatButtonComponent? flatButton) => - this(flatButton: flatButton); + ComponentThemeData flatButtons( + ComponentRegistry? flatButtons) => + this(flatButtons: flatButtons); @override - ComponentThemeData simpleIconButton( - SimpleIconButtonComponent? simpleIconButton) => - this(simpleIconButton: simpleIconButton); + ComponentThemeData simpleIconButtons( + ComponentRegistry? simpleIconButtons) => + this(simpleIconButtons: simpleIconButtons); @override - ComponentThemeData symbolButton(SymbolButtonComponent? symbolButton) => - this(symbolButton: symbolButton); + ComponentThemeData symbolButtons( + ComponentRegistry? symbolButtons) => + this(symbolButtons: symbolButtons); @override - ComponentThemeData informationCard( - InformationCardComponent? informationCard) => - this(informationCard: informationCard); + ComponentThemeData informationCards( + ComponentRegistry? informationCards) => + this(informationCards: informationCards); @override - ComponentThemeData portfolioCard(PortfolioCardComponent? portfolioCard) => - this(portfolioCard: portfolioCard); + ComponentThemeData portfolioCards( + ComponentRegistry? portfolioCards) => + this(portfolioCards: portfolioCards); @override - ComponentThemeData quoteCard(QuoteCardComponent? quoteCard) => - this(quoteCard: quoteCard); + ComponentThemeData quoteCards( + ComponentRegistry? quoteCards) => + this(quoteCards: quoteCards); @override - ComponentThemeData skillCard(SkillCardComponent? skillCard) => - this(skillCard: skillCard); + ComponentThemeData skillCards( + ComponentRegistry? skillCards) => + this(skillCards: skillCards); @override - ComponentThemeData pricingCard(PricingCardComponent? pricingCard) => - this(pricingCard: pricingCard); + ComponentThemeData pricingCards( + ComponentRegistry? pricingCards) => + this(pricingCards: pricingCards); @override - ComponentThemeData floatingActionButton( - FloatingActionButtonComponent? floatingActionButton) => - this(floatingActionButton: floatingActionButton); + ComponentThemeData floatingActionButtons( + ComponentRegistry? + floatingActionButtons) => + this(floatingActionButtons: floatingActionButtons); @override @@ -161,93 +184,97 @@ class _$ComponentThemeDataCWProxyImpl implements _$ComponentThemeDataCWProxy { /// ComponentThemeData(...).copyWith(id: 12, name: "My name") /// ```` ComponentThemeData call({ - Object? topAppBar = const $CopyWithPlaceholder(), - Object? topNavigationBar = const $CopyWithPlaceholder(), - Object? bottomNavigationBar = const $CopyWithPlaceholder(), - Object? error = const $CopyWithPlaceholder(), - Object? loader = const $CopyWithPlaceholder(), - Object? richTextBuilder = const $CopyWithPlaceholder(), - Object? textInput = const $CopyWithPlaceholder(), - Object? fileSelectionButton = const $CopyWithPlaceholder(), - Object? flatButton = const $CopyWithPlaceholder(), - Object? simpleIconButton = const $CopyWithPlaceholder(), - Object? symbolButton = const $CopyWithPlaceholder(), - Object? informationCard = const $CopyWithPlaceholder(), - Object? portfolioCard = const $CopyWithPlaceholder(), - Object? quoteCard = const $CopyWithPlaceholder(), - Object? skillCard = const $CopyWithPlaceholder(), - Object? pricingCard = const $CopyWithPlaceholder(), - Object? floatingActionButton = const $CopyWithPlaceholder(), + Object? topAppBars = const $CopyWithPlaceholder(), + Object? topNavigationBars = const $CopyWithPlaceholder(), + Object? bottomNavigationBars = const $CopyWithPlaceholder(), + Object? errors = const $CopyWithPlaceholder(), + Object? loaders = const $CopyWithPlaceholder(), + Object? richTextBuilders = const $CopyWithPlaceholder(), + Object? textInputs = const $CopyWithPlaceholder(), + Object? fileSelectionButtons = const $CopyWithPlaceholder(), + Object? flatButtons = const $CopyWithPlaceholder(), + Object? simpleIconButtons = const $CopyWithPlaceholder(), + Object? symbolButtons = const $CopyWithPlaceholder(), + Object? informationCards = const $CopyWithPlaceholder(), + Object? portfolioCards = const $CopyWithPlaceholder(), + Object? quoteCards = const $CopyWithPlaceholder(), + Object? skillCards = const $CopyWithPlaceholder(), + Object? pricingCards = const $CopyWithPlaceholder(), + Object? floatingActionButtons = const $CopyWithPlaceholder(), }) { return ComponentThemeData( - topAppBar: topAppBar == const $CopyWithPlaceholder() - ? _value.topAppBar + topAppBars: topAppBars == const $CopyWithPlaceholder() + ? _value.topAppBars // ignore: cast_nullable_to_non_nullable - : topAppBar as TopAppBarComponent?, - topNavigationBar: topNavigationBar == const $CopyWithPlaceholder() - ? _value.topNavigationBar + : topAppBars as ComponentRegistry?, + topNavigationBars: topNavigationBars == const $CopyWithPlaceholder() + ? _value.topNavigationBars // ignore: cast_nullable_to_non_nullable - : topNavigationBar as TopNavigationBarComponent?, - bottomNavigationBar: bottomNavigationBar == const $CopyWithPlaceholder() - ? _value.bottomNavigationBar + : topNavigationBars as ComponentRegistry?, + bottomNavigationBars: bottomNavigationBars == const $CopyWithPlaceholder() + ? _value.bottomNavigationBars // ignore: cast_nullable_to_non_nullable - : bottomNavigationBar as BottomNavigationBarComponent?, - error: error == const $CopyWithPlaceholder() - ? _value.error + : bottomNavigationBars + as ComponentRegistry?, + errors: errors == const $CopyWithPlaceholder() + ? _value.errors // ignore: cast_nullable_to_non_nullable - : error as ErrorComponent?, - loader: loader == const $CopyWithPlaceholder() - ? _value.loader + : errors as ComponentRegistry?, + loaders: loaders == const $CopyWithPlaceholder() + ? _value.loaders // ignore: cast_nullable_to_non_nullable - : loader as LoaderComponent?, - richTextBuilder: richTextBuilder == const $CopyWithPlaceholder() - ? _value.richTextBuilder + : loaders as ComponentRegistry?, + richTextBuilders: richTextBuilders == const $CopyWithPlaceholder() + ? _value.richTextBuilders // ignore: cast_nullable_to_non_nullable - : richTextBuilder as RichTextBuilderComponent?, - textInput: textInput == const $CopyWithPlaceholder() - ? _value.textInput + : richTextBuilders as ComponentRegistry?, + textInputs: textInputs == const $CopyWithPlaceholder() + ? _value.textInputs // ignore: cast_nullable_to_non_nullable - : textInput as TextInputComponent?, - fileSelectionButton: fileSelectionButton == const $CopyWithPlaceholder() - ? _value.fileSelectionButton + : textInputs as ComponentRegistry?, + fileSelectionButtons: fileSelectionButtons == const $CopyWithPlaceholder() + ? _value.fileSelectionButtons // ignore: cast_nullable_to_non_nullable - : fileSelectionButton as FileSelectionButtonComponent?, - flatButton: flatButton == const $CopyWithPlaceholder() - ? _value.flatButton + : fileSelectionButtons + as ComponentRegistry?, + flatButtons: flatButtons == const $CopyWithPlaceholder() + ? _value.flatButtons // ignore: cast_nullable_to_non_nullable - : flatButton as FlatButtonComponent?, - simpleIconButton: simpleIconButton == const $CopyWithPlaceholder() - ? _value.simpleIconButton + : flatButtons as ComponentRegistry?, + simpleIconButtons: simpleIconButtons == const $CopyWithPlaceholder() + ? _value.simpleIconButtons // ignore: cast_nullable_to_non_nullable - : simpleIconButton as SimpleIconButtonComponent?, - symbolButton: symbolButton == const $CopyWithPlaceholder() - ? _value.symbolButton + : simpleIconButtons as ComponentRegistry?, + symbolButtons: symbolButtons == const $CopyWithPlaceholder() + ? _value.symbolButtons // ignore: cast_nullable_to_non_nullable - : symbolButton as SymbolButtonComponent?, - informationCard: informationCard == const $CopyWithPlaceholder() - ? _value.informationCard + : symbolButtons as ComponentRegistry?, + informationCards: informationCards == const $CopyWithPlaceholder() + ? _value.informationCards // ignore: cast_nullable_to_non_nullable - : informationCard as InformationCardComponent?, - portfolioCard: portfolioCard == const $CopyWithPlaceholder() - ? _value.portfolioCard + : informationCards as ComponentRegistry?, + portfolioCards: portfolioCards == const $CopyWithPlaceholder() + ? _value.portfolioCards // ignore: cast_nullable_to_non_nullable - : portfolioCard as PortfolioCardComponent?, - quoteCard: quoteCard == const $CopyWithPlaceholder() - ? _value.quoteCard + : portfolioCards as ComponentRegistry?, + quoteCards: quoteCards == const $CopyWithPlaceholder() + ? _value.quoteCards // ignore: cast_nullable_to_non_nullable - : quoteCard as QuoteCardComponent?, - skillCard: skillCard == const $CopyWithPlaceholder() - ? _value.skillCard + : quoteCards as ComponentRegistry?, + skillCards: skillCards == const $CopyWithPlaceholder() + ? _value.skillCards // ignore: cast_nullable_to_non_nullable - : skillCard as SkillCardComponent?, - pricingCard: pricingCard == const $CopyWithPlaceholder() - ? _value.pricingCard + : skillCards as ComponentRegistry?, + pricingCards: pricingCards == const $CopyWithPlaceholder() + ? _value.pricingCards // ignore: cast_nullable_to_non_nullable - : pricingCard as PricingCardComponent?, - floatingActionButton: floatingActionButton == const $CopyWithPlaceholder() - ? _value.floatingActionButton - // ignore: cast_nullable_to_non_nullable - : floatingActionButton as FloatingActionButtonComponent?, + : pricingCards as ComponentRegistry?, + floatingActionButtons: + floatingActionButtons == const $CopyWithPlaceholder() + ? _value.floatingActionButtons + // ignore: cast_nullable_to_non_nullable + : floatingActionButtons + as ComponentRegistry?, ); } } diff --git a/packages/wyatt_ui_components/pubspec.yaml b/packages/wyatt_ui_components/pubspec.yaml index e515686e..23655e08 100644 --- a/packages/wyatt_ui_components/pubspec.yaml +++ b/packages/wyatt_ui_components/pubspec.yaml @@ -6,7 +6,7 @@ version: 0.2.2 publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub environment: - sdk: ">=2.19.0 <3.0.0" + sdk: ">=3.0.0 <4.0.0" dependencies: flutter: { sdk: flutter } diff --git a/packages/wyatt_ui_kit/example/lib/bars/bars.dart b/packages/wyatt_ui_kit/example/lib/bars/bars.dart index 9f3300f6..95f2d205 100644 --- a/packages/wyatt_ui_kit/example/lib/bars/bars.dart +++ b/packages/wyatt_ui_kit/example/lib/bars/bars.dart @@ -27,7 +27,7 @@ class Bars extends DemoPage { ), ), actions: [ - IconButton(onPressed: () {}, icon: const Icon(Icons.menu)) + IconButton(onPressed: () {}, icon: const Icon(Icons.menu)), ], ), const Gap(20), @@ -54,13 +54,13 @@ class Bars extends DemoPage { ), ListTile( title: Text('Votre programme'), - ) + ), ], actions: [ IconButton( onPressed: () {}, icon: const Icon(Icons.clear), - ) + ), ], ), const Gap(20), @@ -81,7 +81,7 @@ class Bars extends DemoPage { TextWrapper('ACCUEIL'), TextWrapper('VOTRE PROGRAMME'), TextWrapper('LE STUDIO'), - TextWrapper('SAVOIR FAIRE') + TextWrapper('SAVOIR FAIRE'), ], ), ], diff --git a/packages/wyatt_ui_kit/example/lib/buttons/buttons.dart b/packages/wyatt_ui_kit/example/lib/buttons/buttons.dart index dfbb9f3e..9a8be9c0 100644 --- a/packages/wyatt_ui_kit/example/lib/buttons/buttons.dart +++ b/packages/wyatt_ui_kit/example/lib/buttons/buttons.dart @@ -50,7 +50,7 @@ class Buttons extends DemoPage { Gap(20), SimpleIconButtons(), Gap(20), - FileSelectionButtons() + FileSelectionButtons(), ], ), ], diff --git a/packages/wyatt_ui_kit/example/lib/cards/portfolio_card/portfolio_cards.dart b/packages/wyatt_ui_kit/example/lib/cards/portfolio_card/portfolio_cards.dart index f467143a..60df8268 100644 --- a/packages/wyatt_ui_kit/example/lib/cards/portfolio_card/portfolio_cards.dart +++ b/packages/wyatt_ui_kit/example/lib/cards/portfolio_card/portfolio_cards.dart @@ -30,25 +30,25 @@ class PortfolioCards extends StatelessWidget { 'quis elit ut amet velit. Incididunt fugiat proident ' 'proident deserunt tempor Lorem cillum qui do '), ctas: [ - context.components.flatButtonComponent.call( - label: const TextWrapper('En savoir plus'), - suffix: const Icon( - Icons.arrow_forward_ios, - size: 15, - ), - ), + context.components.flatButtonComponent().call( + label: const TextWrapper('En savoir plus'), + suffix: const Icon( + Icons.arrow_forward_ios, + size: 15, + ), + ), ], assets: [ Image.asset( 'assets/images/mockup_1.png', alignment: Alignment.topCenter, fit: BoxFit.cover, - ) + ), ], keywords: const [ TextWrapper('UI Design'), TextWrapper('Developpement'), - TextWrapper('Deploiement') + TextWrapper('Deploiement'), ], ), const Gap(20), @@ -65,22 +65,22 @@ class PortfolioCards extends StatelessWidget { 'quis elit ut amet velit. Incididunt fugiat proident ' 'proident deserunt tempor Lorem cillum qui do '), ctas: [ - context.components.flatButtonComponent.call( - label: const TextWrapper('En savoir plus'), - suffix: const Icon( - Icons.arrow_forward_ios, - size: 15, - ), - ), + context.components.flatButtonComponent().call( + label: const TextWrapper('En savoir plus'), + suffix: const Icon( + Icons.arrow_forward_ios, + size: 15, + ), + ), ], assets: [ Image.asset( 'assets/images/mockup_1.png', alignment: Alignment.topCenter, fit: BoxFit.cover, - ) + ), ], - ) + ), ], ), const Gap(20), @@ -100,13 +100,13 @@ class PortfolioCards extends StatelessWidget { 'quis elit ut amet velit. Incididunt fugiat proident ' 'proident deserunt tempor Lorem cillum qui do '), ctas: [ - context.components.flatButtonComponent.call( - label: const TextWrapper('En savoir plus'), - suffix: const Icon( - Icons.arrow_forward_ios, - size: 15, - ), - ), + context.components.flatButtonComponent().call( + label: const TextWrapper('En savoir plus'), + suffix: const Icon( + Icons.arrow_forward_ios, + size: 15, + ), + ), ], assets: [ Image.asset( @@ -118,12 +118,12 @@ class PortfolioCards extends StatelessWidget { 'assets/images/mockup_1.png', alignment: Alignment.topCenter, fit: BoxFit.cover, - ) + ), ], keywords: const [ TextWrapper('UI Design'), TextWrapper('Developpement'), - TextWrapper('Deploiement') + TextWrapper('Deploiement'), ], ), const Gap(20), @@ -145,13 +145,13 @@ class PortfolioCards extends StatelessWidget { 'quis elit ut amet velit. Incididunt fugiat proident ' 'proident deserunt tempor Lorem cillum qui do '), ctas: [ - context.components.flatButtonComponent.call( - label: const TextWrapper('En savoir plus'), - suffix: const Icon( - Icons.arrow_forward_ios, - size: 15, - ), - ), + context.components.flatButtonComponent().call( + label: const TextWrapper('En savoir plus'), + suffix: const Icon( + Icons.arrow_forward_ios, + size: 15, + ), + ), ], assets: [ Image.asset( @@ -168,12 +168,12 @@ class PortfolioCards extends StatelessWidget { 'assets/images/mockup_1.png', alignment: Alignment.topCenter, fit: BoxFit.cover, - ) + ), ], keywords: const [ TextWrapper('UI Design'), TextWrapper('Developpement'), - TextWrapper('Deploiement') + TextWrapper('Deploiement'), ], ), ], diff --git a/packages/wyatt_ui_kit/example/lib/cards/pricing_card/pricing_cards.dart b/packages/wyatt_ui_kit/example/lib/cards/pricing_card/pricing_cards.dart index f2c67a31..35c46db5 100644 --- a/packages/wyatt_ui_kit/example/lib/cards/pricing_card/pricing_cards.dart +++ b/packages/wyatt_ui_kit/example/lib/cards/pricing_card/pricing_cards.dart @@ -73,20 +73,20 @@ class PricingCards extends StatelessWidget { ), ), ], - cta: context.components.flatButtonComponent.call( - label: const TextWrapper( - 'Contactez-nous', - style: TextStyle(color: Colors.white), - ), - normalStyle: FlatButtonThemeExtensionImpl.dark( - theme: Theme.of(context), - ).normalStyle?.copyWith( - backgroundColors: - const MultiColor(Constants.blueBtnGradient), - borderColors: - const MultiColor(Constants.blueBtnGradient), + cta: context.components.flatButtonComponent().call( + label: const TextWrapper( + 'Contactez-nous', + style: TextStyle(color: Colors.white), ), - ), + normalStyle: FlatButtonThemeExtensionImpl.dark( + theme: Theme.of(context), + ).normalStyle?.copyWith( + backgroundColors: + const MultiColor(Constants.blueBtnGradient), + borderColors: + const MultiColor(Constants.blueBtnGradient), + ), + ), ), const Gap(20), PricingCard( @@ -130,20 +130,20 @@ class PricingCards extends StatelessWidget { ), ), ], - cta: context.components.flatButtonComponent.call( - label: const TextWrapper( - 'Contactez-nous', - style: TextStyle(color: Colors.white), - ), - normalStyle: FlatButtonThemeExtensionImpl.dark( - theme: Theme.of(context), - ).normalStyle?.copyWith( - backgroundColors: - const MultiColor(Constants.purpleGradient), - borderColors: - const MultiColor(Constants.purpleGradient), + cta: context.components.flatButtonComponent().call( + label: const TextWrapper( + 'Contactez-nous', + style: TextStyle(color: Colors.white), ), - ), + normalStyle: FlatButtonThemeExtensionImpl.dark( + theme: Theme.of(context), + ).normalStyle?.copyWith( + backgroundColors: + const MultiColor(Constants.purpleGradient), + borderColors: + const MultiColor(Constants.purpleGradient), + ), + ), ), ], ), diff --git a/packages/wyatt_ui_kit/example/lib/cards/skill_card/skill_cards.dart b/packages/wyatt_ui_kit/example/lib/cards/skill_card/skill_cards.dart index 2bcb72d2..9c4ff6f5 100644 --- a/packages/wyatt_ui_kit/example/lib/cards/skill_card/skill_cards.dart +++ b/packages/wyatt_ui_kit/example/lib/cards/skill_card/skill_cards.dart @@ -47,7 +47,7 @@ class SkillCards extends StatelessWidget { gradientColors: const MultiColor([Colors.red, Colors.orange]), ), - ) + ), ], bulletColors: const MultiColor([Colors.red, Colors.orange]), title: const TextWrapper('Lorem Ipsum'), @@ -78,7 +78,7 @@ class SkillCards extends StatelessWidget { gradientColors: const MultiColor([Colors.blue, Colors.green]), ), - ) + ), ], bulletColors: const MultiColor([Colors.blue, Colors.green]), title: const TextWrapper('Lorem Ipsum'), diff --git a/packages/wyatt_ui_kit/example/pubspec.yaml b/packages/wyatt_ui_kit/example/pubspec.yaml index f641bc51..75a34a1d 100644 --- a/packages/wyatt_ui_kit/example/pubspec.yaml +++ b/packages/wyatt_ui_kit/example/pubspec.yaml @@ -15,8 +15,8 @@ dependencies: flutter_bloc: ^8.1.2 flutter_localizations: { sdk: flutter } - gap: ^2.0.1 - google_fonts: ^4.0.3 + gap: ^3.0.1 + google_fonts: ^5.1.0 wyatt_ui_components: hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub diff --git a/packages/wyatt_ui_kit/lib/src/components/bars/widgets/navigation_item.dart b/packages/wyatt_ui_kit/lib/src/components/bars/widgets/navigation_item.dart index a89c9f1e..710375dd 100644 --- a/packages/wyatt_ui_kit/lib/src/components/bars/widgets/navigation_item.dart +++ b/packages/wyatt_ui_kit/lib/src/components/bars/widgets/navigation_item.dart @@ -63,7 +63,7 @@ class NavigationItem extends StatelessWidget { .themeExtension() ?.selectedIndicatorColors, TopBarThemeExtensionDefault.from(Theme.of(context)) - .selectedIndicatorColors + .selectedIndicatorColors, ], valueValidator: (value) => value?.isGradient, transform: (value) => @@ -75,7 +75,7 @@ class NavigationItem extends StatelessWidget { .themeExtension() ?.selectedIndicatorColors, TopBarThemeExtensionDefault.from(Theme.of(context)) - .selectedIndicatorColors + .selectedIndicatorColors, ], valueValidator: (value) => value?.isColor, transform: (value) => value?.color, diff --git a/packages/wyatt_ui_kit/lib/src/components/buttons/file_selection_button/file_selection_button_screen.dart b/packages/wyatt_ui_kit/lib/src/components/buttons/file_selection_button/file_selection_button_screen.dart index fb3597a2..e96cd569 100644 --- a/packages/wyatt_ui_kit/lib/src/components/buttons/file_selection_button/file_selection_button_screen.dart +++ b/packages/wyatt_ui_kit/lib/src/components/buttons/file_selection_button/file_selection_button_screen.dart @@ -177,7 +177,7 @@ class FileSelectionButtonScreen ) : null, boxShadow: [ - if (style.shadow != null) ...[style.shadow!] + if (style.shadow != null) ...[style.shadow!], ], borderRadius: style.radius, ), @@ -214,7 +214,7 @@ class FileSelectionButtonScreen GradientText.fromWrapper( title!, gradientColors: style.foregroundColors, - ) + ), ], /// Choose color diff --git a/packages/wyatt_ui_kit/lib/src/components/buttons/flat_button/flat_button_screen.dart b/packages/wyatt_ui_kit/lib/src/components/buttons/flat_button/flat_button_screen.dart index 39613f62..c3119e0c 100644 --- a/packages/wyatt_ui_kit/lib/src/components/buttons/flat_button/flat_button_screen.dart +++ b/packages/wyatt_ui_kit/lib/src/components/buttons/flat_button/flat_button_screen.dart @@ -156,7 +156,7 @@ class FlatButtonScreen extends CubitScreen { : null, boxShadow: [ - if (style.shadow != null) ...[style.shadow!] + if (style.shadow != null) ...[style.shadow!], ], borderRadius: style.radius, ), @@ -174,7 +174,7 @@ class FlatButtonScreen extends CubitScreen { if (prefix != null && (prefix is Icon?) && ((prefix as Icon?)?.color != null)) ...[ - prefix! + prefix!, ] else if (style.foregroundColors?.color != null && prefix != null) ...[ ColorFiltered( @@ -183,9 +183,9 @@ class FlatButtonScreen extends CubitScreen { BlendMode.srcIn, ), child: prefix, - ) + ), ] else ...[ - prefix ?? const SizedBox.shrink() + prefix ?? const SizedBox.shrink(), ], Gap(style.padding?.vertical ?? 10), @@ -204,13 +204,13 @@ class FlatButtonScreen extends CubitScreen { label!, style: style.labelStyle, gradientColors: style.foregroundColors, - ) + ), ], Gap(style.padding?.vertical ?? 10), if (suffix != null && (suffix is Icon?) && ((suffix as Icon?)?.color != null)) ...[ - suffix! + suffix!, ] else if (style.foregroundColors?.colors != null && style.foregroundColors!.colors.isNotEmpty && suffix != null) ...[ @@ -220,7 +220,7 @@ class FlatButtonScreen extends CubitScreen { BlendMode.srcIn, ), child: suffix, - ) + ), ] else if (style.foregroundColors?.color != null && suffix != null) ...[ ColorFiltered( @@ -229,9 +229,9 @@ class FlatButtonScreen extends CubitScreen { BlendMode.srcIn, ), child: suffix, - ) + ), ] else ...[ - suffix ?? const SizedBox.shrink() + suffix ?? const SizedBox.shrink(), ], ], ), diff --git a/packages/wyatt_ui_kit/lib/src/components/buttons/simple_icon_button/simple_icon_screen.dart b/packages/wyatt_ui_kit/lib/src/components/buttons/simple_icon_button/simple_icon_screen.dart index ecf5378b..2b2241a0 100644 --- a/packages/wyatt_ui_kit/lib/src/components/buttons/simple_icon_button/simple_icon_screen.dart +++ b/packages/wyatt_ui_kit/lib/src/components/buttons/simple_icon_button/simple_icon_screen.dart @@ -152,7 +152,7 @@ class SimpleIconButtonScreen extends CubitScreen { ) : null, boxShadow: [ - if (style.shadow != null) ...[style.shadow!] + if (style.shadow != null) ...[style.shadow!], ], borderRadius: style.radius, ), diff --git a/packages/wyatt_ui_kit/lib/src/components/buttons/symbol_button/symbol_button_screen.dart b/packages/wyatt_ui_kit/lib/src/components/buttons/symbol_button/symbol_button_screen.dart index d98afec7..e36a92a8 100644 --- a/packages/wyatt_ui_kit/lib/src/components/buttons/symbol_button/symbol_button_screen.dart +++ b/packages/wyatt_ui_kit/lib/src/components/buttons/symbol_button/symbol_button_screen.dart @@ -181,7 +181,7 @@ class SymbolButtonScreen ) : null, boxShadow: [ - if (style.shadow != null) ...[style.shadow!] + if (style.shadow != null) ...[style.shadow!], ], borderRadius: style.radius, ), diff --git a/packages/wyatt_ui_kit/lib/src/components/cards/pricing_card/widgets/pricing_card_titles.dart b/packages/wyatt_ui_kit/lib/src/components/cards/pricing_card/widgets/pricing_card_titles.dart index 13dfb2bf..311f18fa 100644 --- a/packages/wyatt_ui_kit/lib/src/components/cards/pricing_card/widgets/pricing_card_titles.dart +++ b/packages/wyatt_ui_kit/lib/src/components/cards/pricing_card/widgets/pricing_card_titles.dart @@ -102,7 +102,7 @@ class PricingCardTitles extends StatelessWidget { ], ), const Gap(_bodyTopSpacing), - ] + ], ], RichText( text: TextSpan( @@ -111,7 +111,7 @@ class PricingCardTitles extends StatelessWidget { TextSpan( text: price.text.data, style: price.text.style, - ) + ), ], if (pricing?.hasAsterisk ?? false) ...[ WidgetSpan( @@ -128,7 +128,7 @@ class PricingCardTitles extends StatelessWidget { TextSpan( text: period.text.data, style: period.text.style, - ) + ), ], ], ), diff --git a/packages/wyatt_ui_kit/lib/src/components/cards/quote_card/quote_card.dart b/packages/wyatt_ui_kit/lib/src/components/cards/quote_card/quote_card.dart index 8e233aea..57c23c0a 100644 --- a/packages/wyatt_ui_kit/lib/src/components/cards/quote_card/quote_card.dart +++ b/packages/wyatt_ui_kit/lib/src/components/cards/quote_card/quote_card.dart @@ -134,7 +134,7 @@ class QuoteCard extends QuoteCardComponent with $QuoteCardCWMixin { ], ], ), - ) + ), ], ), ], diff --git a/packages/wyatt_ui_kit/lib/src/components/cards/widgets/card_wrapper.dart b/packages/wyatt_ui_kit/lib/src/components/cards/widgets/card_wrapper.dart index bf9dbd55..4f2477b6 100644 --- a/packages/wyatt_ui_kit/lib/src/components/cards/widgets/card_wrapper.dart +++ b/packages/wyatt_ui_kit/lib/src/components/cards/widgets/card_wrapper.dart @@ -147,7 +147,7 @@ class CardWrapper extends StatelessWidget { [ radius, Theme.of(context).extension()?.radius, - CardThemeExtensionDefault.from(Theme.of(context)).radius + CardThemeExtensionDefault.from(Theme.of(context)).radius, ], ); @@ -155,7 +155,7 @@ class CardWrapper extends StatelessWidget { [ minSize, Theme.of(context).extension()?.minSize, - CardThemeExtensionDefault.from(Theme.of(context)).minSize + CardThemeExtensionDefault.from(Theme.of(context)).minSize, ], ); @@ -163,7 +163,7 @@ class CardWrapper extends StatelessWidget { [ maxSize, Theme.of(context).extension()?.maxSize, - CardThemeExtensionDefault.from(Theme.of(context)).maxSize + CardThemeExtensionDefault.from(Theme.of(context)).maxSize, ], ); @@ -178,7 +178,8 @@ class CardWrapper extends StatelessWidget { Theme.of(context) .extension() ?.backgroundColors, - CardThemeExtensionDefault.from(Theme.of(context)).backgroundColors + CardThemeExtensionDefault.from(Theme.of(context)) + .backgroundColors, ], valueValidator: (multiColor) => multiColor?.isGradient, transform: (multiColor) => diff --git a/packages/wyatt_ui_kit/lib/src/features/wyatt_component_theme_data.dart b/packages/wyatt_ui_kit/lib/src/features/wyatt_component_theme_data.dart index cc809d17..e521bc80 100644 --- a/packages/wyatt_ui_kit/lib/src/features/wyatt_component_theme_data.dart +++ b/packages/wyatt_ui_kit/lib/src/features/wyatt_component_theme_data.dart @@ -22,23 +22,22 @@ import 'package:wyatt_ui_kit/wyatt_ui_kit.dart'; /// {@endtemplate} abstract class WyattComponentThemeData { /// {@macro wyatt_component_theme_data} - static const ComponentThemeData wyattComponentThemeData = - ComponentThemeData.raw( - topAppBar: TopAppBar(), - topNavigationBar: TopNavigationBar(), - // bottomNavigationBar: , - // error: , - loader: Loader(), - richTextBuilder: RichTextBuilder(), - textInput: TextInput(), - fileSelectionButton: FileSelectionButton(), - flatButton: FlatButton(), - simpleIconButton: SimpleIconButton(), - symbolButton: SymbolButton(), - informationCard: InformationCard(), - portfolioCard: PortfolioCard(), - quoteCard: QuoteCard(), - skillCard: SkillCard(), - pricingCard: PricingCard(), + static ComponentThemeData wyattComponentThemeData = ComponentThemeData.raw( + topAppBars: const TopAppBar().registry(), + topNavigationBars: const TopNavigationBar().registry(), + // bottomNavigationBars: , + // errors: , + loaders: const Loader().registry(), + richTextBuilders: const RichTextBuilder().registry(), + textInputs: const TextInput().registry(), + fileSelectionButtons: const FileSelectionButton().registry(), + flatButtons: const FlatButton().registry(), + simpleIconButtons: const SimpleIconButton().registry(), + symbolButtons: const SymbolButton().registry(), + informationCards: const InformationCard().registry(), + portfolioCards: const PortfolioCard().registry(), + quoteCards: const QuoteCard().registry(), + skillCards: const SkillCard().registry(), + pricingCards: const PricingCard().registry(), ); } diff --git a/packages/wyatt_ui_kit/pubspec.yaml b/packages/wyatt_ui_kit/pubspec.yaml index 9df5a07b..19aafef5 100644 --- a/packages/wyatt_ui_kit/pubspec.yaml +++ b/packages/wyatt_ui_kit/pubspec.yaml @@ -12,9 +12,9 @@ dependencies: dotted_border: ^2.0.0+3 equatable: ^2.0.5 flutter: { sdk: flutter } - flutter_animate: ^3.0.0 + flutter_animate: ^4.2.0+1 flutter_bloc: ^8.1.2 - gap: ^2.0.1 + gap: ^3.0.1 meta: ^1.8.0 wyatt_bloc_helper: hosted: diff --git a/packages/wyatt_ui_layout/example/lib/components/custom_bottom_navigation_bar.g.dart b/packages/wyatt_ui_layout/example/lib/components/custom_bottom_navigation_bar.g.dart index fc15f676..2602e144 100644 --- a/packages/wyatt_ui_layout/example/lib/components/custom_bottom_navigation_bar.g.dart +++ b/packages/wyatt_ui_layout/example/lib/components/custom_bottom_navigation_bar.g.dart @@ -17,11 +17,15 @@ class $CustomBottomNavigationBarCWProxyImpl CustomBottomNavigationBar currentIndex(int? currentIndex) => this(currentIndex: currentIndex); @override + CustomBottomNavigationBar items(List? items) => + this(items: items); + @override CustomBottomNavigationBar key(Key? key) => this(key: key); @override CustomBottomNavigationBar call({ void Function(BuildContext, int)? onTap, int? currentIndex, + List? items, Key? key, }) => CustomBottomNavigationBar( diff --git a/packages/wyatt_ui_layout/example/lib/components/custom_desktop_app_bar.dart b/packages/wyatt_ui_layout/example/lib/components/custom_desktop_app_bar.dart new file mode 100644 index 00000000..d250eb2d --- /dev/null +++ b/packages/wyatt_ui_layout/example/lib/components/custom_desktop_app_bar.dart @@ -0,0 +1,21 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:wyatt_component_copy_with_extension/wyatt_component_copy_with_extension.dart'; +import 'package:wyatt_ui_components/wyatt_ui_components.dart'; + +part 'custom_desktop_app_bar.g.dart'; + +@ComponentCopyWithExtension() +class CustomDesktopAppBar extends TopAppBarComponent + with $CustomDesktopAppBarCWMixin { + const CustomDesktopAppBar({ + super.title, + super.key, + }); + + @override + Widget build(BuildContext context) => AppBar( + backgroundColor: Colors.green, + title: Text(title?.data ?? ''), + ); +} diff --git a/packages/wyatt_ui_layout/example/lib/components/custom_desktop_app_bar.g.dart b/packages/wyatt_ui_layout/example/lib/components/custom_desktop_app_bar.g.dart new file mode 100644 index 00000000..809792c0 --- /dev/null +++ b/packages/wyatt_ui_layout/example/lib/components/custom_desktop_app_bar.g.dart @@ -0,0 +1,104 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'custom_desktop_app_bar.dart'; + +// ************************************************************************** +// ComponentCopyWithGenerator +// ************************************************************************** + +class $CustomDesktopAppBarCWProxyImpl implements $TopAppBarComponentCWProxy { + const $CustomDesktopAppBarCWProxyImpl(this._value); + final CustomDesktopAppBar _value; + @override + CustomDesktopAppBar title(TextWrapper? title) => this(title: title); + @override + CustomDesktopAppBar centerTitle(bool? centerTitle) => + this(centerTitle: centerTitle); + @override + CustomDesktopAppBar shape(ShapeBorder? shape) => this(shape: shape); + @override + CustomDesktopAppBar systemOverlayStyle( + SystemUiOverlayStyle? systemOverlayStyle) => + this(systemOverlayStyle: systemOverlayStyle); + @override + CustomDesktopAppBar automaticallyImplyLeading( + bool? automaticallyImplyLeading) => + this(automaticallyImplyLeading: automaticallyImplyLeading); + @override + CustomDesktopAppBar flexibleSpace(Widget? flexibleSpace) => + this(flexibleSpace: flexibleSpace); + @override + CustomDesktopAppBar bottom(PreferredSizeWidget? bottom) => + this(bottom: bottom); + @override + CustomDesktopAppBar elevation(double? elevation) => + this(elevation: elevation); + @override + CustomDesktopAppBar scrolledUnderElevation(double? scrolledUnderElevation) => + this(scrolledUnderElevation: scrolledUnderElevation); + @override + CustomDesktopAppBar shadowColor(Color? shadowColor) => + this(shadowColor: shadowColor); + @override + CustomDesktopAppBar surfaceTintColor(Color? surfaceTintColor) => + this(surfaceTintColor: surfaceTintColor); + @override + CustomDesktopAppBar backgroundColor(MultiColor? backgroundColor) => + this(backgroundColor: backgroundColor); + @override + CustomDesktopAppBar iconTheme(IconThemeData? iconTheme) => + this(iconTheme: iconTheme); + @override + CustomDesktopAppBar primary(bool? primary) => this(primary: primary); + @override + CustomDesktopAppBar excludeHeaderSemantics(bool? excludeHeaderSemantics) => + this(excludeHeaderSemantics: excludeHeaderSemantics); + @override + CustomDesktopAppBar toolbarHeight(double? toolbarHeight) => + this(toolbarHeight: toolbarHeight); + @override + CustomDesktopAppBar leadingWidth(double? leadingWidth) => + this(leadingWidth: leadingWidth); + @override + CustomDesktopAppBar leading(Widget? leading) => this(leading: leading); + @override + CustomDesktopAppBar actions(List? actions) => this(actions: actions); + @override + CustomDesktopAppBar expandedWidget(List? expandedWidget) => + this(expandedWidget: expandedWidget); + @override + CustomDesktopAppBar key(Key? key) => this(key: key); + @override + CustomDesktopAppBar call({ + TextWrapper? title, + bool? centerTitle, + ShapeBorder? shape, + SystemUiOverlayStyle? systemOverlayStyle, + bool? automaticallyImplyLeading, + Widget? flexibleSpace, + PreferredSizeWidget? bottom, + double? elevation, + double? scrolledUnderElevation, + Color? shadowColor, + Color? surfaceTintColor, + MultiColor? backgroundColor, + IconThemeData? iconTheme, + bool? primary, + bool? excludeHeaderSemantics, + double? toolbarHeight, + double? leadingWidth, + Widget? leading, + List? actions, + List? expandedWidget, + Key? key, + }) => + CustomDesktopAppBar( + title: title ?? _value.title, + key: key ?? _value.key, + ); +} + +mixin $CustomDesktopAppBarCWMixin on Component { + $TopAppBarComponentCWProxy get copyWith => + $CustomDesktopAppBarCWProxyImpl(this as CustomDesktopAppBar); +} diff --git a/packages/wyatt_ui_layout/example/lib/components/custom_app_bar.dart b/packages/wyatt_ui_layout/example/lib/components/custom_mobile_app_bar.dart similarity index 68% rename from packages/wyatt_ui_layout/example/lib/components/custom_app_bar.dart rename to packages/wyatt_ui_layout/example/lib/components/custom_mobile_app_bar.dart index 9c7da189..bac09e22 100644 --- a/packages/wyatt_ui_layout/example/lib/components/custom_app_bar.dart +++ b/packages/wyatt_ui_layout/example/lib/components/custom_mobile_app_bar.dart @@ -3,17 +3,19 @@ import 'package:flutter/services.dart'; import 'package:wyatt_component_copy_with_extension/wyatt_component_copy_with_extension.dart'; import 'package:wyatt_ui_components/wyatt_ui_components.dart'; -part 'custom_app_bar.g.dart'; +part 'custom_mobile_app_bar.g.dart'; @ComponentCopyWithExtension() -class CustomAppBar extends TopAppBarComponent with $CustomAppBarCWMixin { - const CustomAppBar({ +class CustomMobileAppBar extends TopAppBarComponent + with $CustomMobileAppBarCWMixin { + const CustomMobileAppBar({ super.title, super.key, }); @override Widget build(BuildContext context) => AppBar( + backgroundColor: Colors.red, title: Text(title?.data ?? ''), ); } diff --git a/packages/wyatt_ui_layout/example/lib/components/custom_mobile_app_bar.g.dart b/packages/wyatt_ui_layout/example/lib/components/custom_mobile_app_bar.g.dart new file mode 100644 index 00000000..f825797a --- /dev/null +++ b/packages/wyatt_ui_layout/example/lib/components/custom_mobile_app_bar.g.dart @@ -0,0 +1,103 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'custom_mobile_app_bar.dart'; + +// ************************************************************************** +// ComponentCopyWithGenerator +// ************************************************************************** + +class $CustomMobileAppBarCWProxyImpl implements $TopAppBarComponentCWProxy { + const $CustomMobileAppBarCWProxyImpl(this._value); + final CustomMobileAppBar _value; + @override + CustomMobileAppBar title(TextWrapper? title) => this(title: title); + @override + CustomMobileAppBar centerTitle(bool? centerTitle) => + this(centerTitle: centerTitle); + @override + CustomMobileAppBar shape(ShapeBorder? shape) => this(shape: shape); + @override + CustomMobileAppBar systemOverlayStyle( + SystemUiOverlayStyle? systemOverlayStyle) => + this(systemOverlayStyle: systemOverlayStyle); + @override + CustomMobileAppBar automaticallyImplyLeading( + bool? automaticallyImplyLeading) => + this(automaticallyImplyLeading: automaticallyImplyLeading); + @override + CustomMobileAppBar flexibleSpace(Widget? flexibleSpace) => + this(flexibleSpace: flexibleSpace); + @override + CustomMobileAppBar bottom(PreferredSizeWidget? bottom) => + this(bottom: bottom); + @override + CustomMobileAppBar elevation(double? elevation) => this(elevation: elevation); + @override + CustomMobileAppBar scrolledUnderElevation(double? scrolledUnderElevation) => + this(scrolledUnderElevation: scrolledUnderElevation); + @override + CustomMobileAppBar shadowColor(Color? shadowColor) => + this(shadowColor: shadowColor); + @override + CustomMobileAppBar surfaceTintColor(Color? surfaceTintColor) => + this(surfaceTintColor: surfaceTintColor); + @override + CustomMobileAppBar backgroundColor(MultiColor? backgroundColor) => + this(backgroundColor: backgroundColor); + @override + CustomMobileAppBar iconTheme(IconThemeData? iconTheme) => + this(iconTheme: iconTheme); + @override + CustomMobileAppBar primary(bool? primary) => this(primary: primary); + @override + CustomMobileAppBar excludeHeaderSemantics(bool? excludeHeaderSemantics) => + this(excludeHeaderSemantics: excludeHeaderSemantics); + @override + CustomMobileAppBar toolbarHeight(double? toolbarHeight) => + this(toolbarHeight: toolbarHeight); + @override + CustomMobileAppBar leadingWidth(double? leadingWidth) => + this(leadingWidth: leadingWidth); + @override + CustomMobileAppBar leading(Widget? leading) => this(leading: leading); + @override + CustomMobileAppBar actions(List? actions) => this(actions: actions); + @override + CustomMobileAppBar expandedWidget(List? expandedWidget) => + this(expandedWidget: expandedWidget); + @override + CustomMobileAppBar key(Key? key) => this(key: key); + @override + CustomMobileAppBar call({ + TextWrapper? title, + bool? centerTitle, + ShapeBorder? shape, + SystemUiOverlayStyle? systemOverlayStyle, + bool? automaticallyImplyLeading, + Widget? flexibleSpace, + PreferredSizeWidget? bottom, + double? elevation, + double? scrolledUnderElevation, + Color? shadowColor, + Color? surfaceTintColor, + MultiColor? backgroundColor, + IconThemeData? iconTheme, + bool? primary, + bool? excludeHeaderSemantics, + double? toolbarHeight, + double? leadingWidth, + Widget? leading, + List? actions, + List? expandedWidget, + Key? key, + }) => + CustomMobileAppBar( + title: title ?? _value.title, + key: key ?? _value.key, + ); +} + +mixin $CustomMobileAppBarCWMixin on Component { + $TopAppBarComponentCWProxy get copyWith => + $CustomMobileAppBarCWProxyImpl(this as CustomMobileAppBar); +} diff --git a/packages/wyatt_ui_layout/example/lib/core/app_theme_component.dart b/packages/wyatt_ui_layout/example/lib/core/app_theme_component.dart index 3df937d1..a4cb8695 100644 --- a/packages/wyatt_ui_layout/example/lib/core/app_theme_component.dart +++ b/packages/wyatt_ui_layout/example/lib/core/app_theme_component.dart @@ -1,14 +1,18 @@ import 'package:flutter/material.dart'; import 'package:wyatt_ui_components/wyatt_ui_components.dart'; -import 'package:wyatt_ui_layout_example/components/custom_app_bar.dart'; import 'package:wyatt_ui_layout_example/components/custom_bottom_navigation_bar.dart'; +import 'package:wyatt_ui_layout_example/components/custom_desktop_app_bar.dart'; +import 'package:wyatt_ui_layout_example/components/custom_mobile_app_bar.dart'; import 'package:wyatt_ui_layout_example/pages/bottom_navigation_bar_layout_page_1.dart'; import 'package:wyatt_ui_layout_example/pages/bottom_navigation_bar_layout_page_2.dart'; class AppThemeComponent { static ComponentThemeData get components => ComponentThemeData.raw( - topAppBar: const CustomAppBar(), - bottomNavigationBar: CustomBottomNavigationBar( + topAppBars: { + 'mobile': const CustomMobileAppBar(), + 'desktop': const CustomDesktopAppBar(), + }.registry(), + bottomNavigationBars: CustomBottomNavigationBar( onTap: (context, index) { switch (index) { case 0: @@ -37,6 +41,6 @@ class AppThemeComponent { break; } }, - ), + ).registry(), ); } diff --git a/packages/wyatt_ui_layout/example/lib/pages/app_bar_layout_page.dart b/packages/wyatt_ui_layout/example/lib/pages/app_bar_layout_page.dart index 4b3177e2..cfbb747d 100644 --- a/packages/wyatt_ui_layout/example/lib/pages/app_bar_layout_page.dart +++ b/packages/wyatt_ui_layout/example/lib/pages/app_bar_layout_page.dart @@ -6,12 +6,15 @@ class AppBarLayoutPage extends StatelessWidget { const AppBarLayoutPage({super.key}); @override - Widget build(BuildContext context) => TopAppBarLayout( - custom: (topBar) => - topBar?.copyWith.title(const TextWrapper('New Title')), - body: const Center( - child: Text( - 'Body', + Widget build(BuildContext context) => LayoutBuilder( + builder: (context, constraint) => StructuralLayout.withTopAppBar( + barId: constraint.maxWidth < 600 ? 'mobile' : 'desktop', + custom: (topBar) => + topBar?.copyWith.title(const TextWrapper('New Title')), + body: const Center( + child: Text( + 'Body', + ), ), ), ); diff --git a/packages/wyatt_ui_layout/example/lib/pages/bottom_navigation_bar_layout_page_1.dart b/packages/wyatt_ui_layout/example/lib/pages/bottom_navigation_bar_layout_page_1.dart index 84c3d95d..0ffd8ea4 100644 --- a/packages/wyatt_ui_layout/example/lib/pages/bottom_navigation_bar_layout_page_1.dart +++ b/packages/wyatt_ui_layout/example/lib/pages/bottom_navigation_bar_layout_page_1.dart @@ -5,7 +5,7 @@ class BottomNavigationBarLayoutPage1 extends StatelessWidget { const BottomNavigationBarLayoutPage1({super.key}); @override - Widget build(BuildContext context) => BottomNavigationBarLayout( + Widget build(BuildContext context) => StructuralLayout.withBottomNavBar( custom: (p0) => p0?.copyWith.call(currentIndex: 0), body: const TopAppBarLayout( body: Center( diff --git a/packages/wyatt_ui_layout/example/lib/pages/bottom_navigation_bar_layout_page_2.dart b/packages/wyatt_ui_layout/example/lib/pages/bottom_navigation_bar_layout_page_2.dart index fbd6b13a..ae4d9880 100644 --- a/packages/wyatt_ui_layout/example/lib/pages/bottom_navigation_bar_layout_page_2.dart +++ b/packages/wyatt_ui_layout/example/lib/pages/bottom_navigation_bar_layout_page_2.dart @@ -5,7 +5,7 @@ class BottomNavigationBarLayoutPage2 extends StatelessWidget { const BottomNavigationBarLayoutPage2({super.key}); @override - Widget build(BuildContext context) => BottomNavigationBarLayout( + Widget build(BuildContext context) => StructuralLayout.withBottomNavBar( custom: (p0) => p0?.copyWith.currentIndex(1), body: const TopAppBarLayout( body: Center( diff --git a/packages/wyatt_ui_layout/example/macos/Flutter/ephemeral/Flutter-Generated.xcconfig b/packages/wyatt_ui_layout/example/macos/Flutter/ephemeral/Flutter-Generated.xcconfig index a59a9b7e..80a67b61 100644 --- a/packages/wyatt_ui_layout/example/macos/Flutter/ephemeral/Flutter-Generated.xcconfig +++ b/packages/wyatt_ui_layout/example/macos/Flutter/ephemeral/Flutter-Generated.xcconfig @@ -2,10 +2,12 @@ FLUTTER_ROOT=/Users/maloleon/Library/flutter FLUTTER_APPLICATION_PATH=/Users/maloleon/Studio/wyatt-packages/packages/wyatt_ui_layout/example COCOAPODS_PARALLEL_CODE_SIGN=true +FLUTTER_TARGET=/Users/maloleon/Studio/wyatt-packages/packages/wyatt_ui_layout/example/lib/main.dart FLUTTER_BUILD_DIR=build FLUTTER_BUILD_NAME=1.0.0 FLUTTER_BUILD_NUMBER=1 +DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==,RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC9iMjAxODNlMDQwOTYwOTRiY2MzN2Q5Y2RlMmE0Yjk2ZjVjYzY4NGNmLw== DART_OBFUSCATION=false TRACK_WIDGET_CREATION=true TREE_SHAKE_ICONS=false -PACKAGE_CONFIG=.dart_tool/package_config.json +PACKAGE_CONFIG=/Users/maloleon/Studio/wyatt-packages/packages/wyatt_ui_layout/example/.dart_tool/package_config.json diff --git a/packages/wyatt_ui_layout/example/macos/Flutter/ephemeral/flutter_export_environment.sh b/packages/wyatt_ui_layout/example/macos/Flutter/ephemeral/flutter_export_environment.sh index 4883d2d9..51db70ad 100755 --- a/packages/wyatt_ui_layout/example/macos/Flutter/ephemeral/flutter_export_environment.sh +++ b/packages/wyatt_ui_layout/example/macos/Flutter/ephemeral/flutter_export_environment.sh @@ -3,10 +3,12 @@ export "FLUTTER_ROOT=/Users/maloleon/Library/flutter" export "FLUTTER_APPLICATION_PATH=/Users/maloleon/Studio/wyatt-packages/packages/wyatt_ui_layout/example" export "COCOAPODS_PARALLEL_CODE_SIGN=true" +export "FLUTTER_TARGET=/Users/maloleon/Studio/wyatt-packages/packages/wyatt_ui_layout/example/lib/main.dart" export "FLUTTER_BUILD_DIR=build" export "FLUTTER_BUILD_NAME=1.0.0" export "FLUTTER_BUILD_NUMBER=1" +export "DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==,RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC9iMjAxODNlMDQwOTYwOTRiY2MzN2Q5Y2RlMmE0Yjk2ZjVjYzY4NGNmLw==" export "DART_OBFUSCATION=false" export "TRACK_WIDGET_CREATION=true" export "TREE_SHAKE_ICONS=false" -export "PACKAGE_CONFIG=.dart_tool/package_config.json" +export "PACKAGE_CONFIG=/Users/maloleon/Studio/wyatt-packages/packages/wyatt_ui_layout/example/.dart_tool/package_config.json" diff --git a/packages/wyatt_ui_layout/example/macos/Runner.xcodeproj/project.pbxproj b/packages/wyatt_ui_layout/example/macos/Runner.xcodeproj/project.pbxproj index d9333e47..c5fd5489 100644 --- a/packages/wyatt_ui_layout/example/macos/Runner.xcodeproj/project.pbxproj +++ b/packages/wyatt_ui_layout/example/macos/Runner.xcodeproj/project.pbxproj @@ -182,7 +182,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 1300; + LastUpgradeCheck = 1430; ORGANIZATIONNAME = ""; TargetAttributes = { 33CC10EC2044A3C60003C045 = { diff --git a/packages/wyatt_ui_layout/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/packages/wyatt_ui_layout/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index fb7259e1..83d88728 100644 --- a/packages/wyatt_ui_layout/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/packages/wyatt_ui_layout/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ =2.17.0 <3.0.0" + sdk: ">=3.0.0 <4.0.0" # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions @@ -32,7 +32,7 @@ dependencies: wyatt_ui_layout: path: "../" - go_router: ^5.0.1 + go_router: ^10.1.0 wyatt_ui_components: hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub diff --git a/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/content_layout.dart b/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/content_layout.dart new file mode 100644 index 00000000..f2f88eba --- /dev/null +++ b/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/content_layout.dart @@ -0,0 +1,39 @@ +// Copyright (C) 2022 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import 'package:flutter/material.dart'; +import 'package:wyatt_ui_layout/src/presentation/layouts/layout.dart'; +import 'package:wyatt_ui_layout/wyatt_ui_layout.dart'; + +/// {@template content_layout} +/// An abstract class that provides a base for creating custom content layout +/// widgets. +/// {@endtemplate} +abstract class ContentLayout extends Layout { + /// {@macro content_layout} + const ContentLayout({super.key}); + + factory ContentLayout.withGrid({ + required List children, + double verticalGap = 30, + double horizontalGap = 30, + }) => + GridLayout( + verticalGap: verticalGap, + horizontalGap: horizontalGap, + children: children, + ); +} diff --git a/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/content_layouts.dart b/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/content_layouts.dart index e5215b69..6d33cfcd 100644 --- a/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/content_layouts.dart +++ b/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/content_layouts.dart @@ -14,4 +14,5 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +export './content_layout.dart'; export './grid_layout.dart'; diff --git a/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/grid_layout.dart b/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/grid_layout.dart index 04c9a7a0..86d4b0ef 100644 --- a/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/grid_layout.dart +++ b/packages/wyatt_ui_layout/lib/src/presentation/layouts/content_layouts/grid_layout.dart @@ -16,7 +16,7 @@ import 'package:flutter/material.dart'; import 'package:gap/gap.dart'; -import 'package:wyatt_ui_layout/src/presentation/layouts/layout.dart'; +import 'package:wyatt_ui_layout/src/presentation/layouts/content_layouts/content_layout.dart'; /// {@template grid_layout} /// A concrete implementation of the [ContentLayout] abstract class for a layout diff --git a/packages/wyatt_ui_layout/lib/src/presentation/layouts/layout.dart b/packages/wyatt_ui_layout/lib/src/presentation/layouts/layout.dart index 28068913..fd618d81 100644 --- a/packages/wyatt_ui_layout/lib/src/presentation/layouts/layout.dart +++ b/packages/wyatt_ui_layout/lib/src/presentation/layouts/layout.dart @@ -28,21 +28,3 @@ abstract class Layout extends StatelessWidget { /// {@macro layout} const Layout({super.key}); } - -/// {@template structural_layout} -/// An abstract class that provides a base for creating custom structural layout -/// widgets. -/// {@endtemplate} -abstract class StructuralLayout extends Layout { - /// {@macro structural_layout} - const StructuralLayout({super.key}); -} - -/// {@template content_layout} -/// An abstract class that provides a base for creating custom content layout -/// widgets. -/// {@endtemplate} -abstract class ContentLayout extends Layout { - /// {@macro content_layout} - const ContentLayout({super.key}); -} diff --git a/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/bottom_navigation_bar_layout.dart b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/bottom_navigation_bar_layout.dart index 3c72ffcf..8746fc0c 100644 --- a/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/bottom_navigation_bar_layout.dart +++ b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/bottom_navigation_bar_layout.dart @@ -19,6 +19,7 @@ import 'package:flutter/material.dart'; import 'package:wyatt_ui_components/wyatt_ui_components.dart'; import 'package:wyatt_ui_layout/src/core/scaffold_fields_wrapper.dart'; import 'package:wyatt_ui_layout/src/presentation/layouts/layout.dart'; +import 'package:wyatt_ui_layout/src/presentation/layouts/structural_layouts/structural_layout.dart'; /// {@template bottom_navigation_bar_layout} /// A concrete implementation of the [Layout] abstract class for a layout which @@ -29,6 +30,7 @@ class BottomNavigationBarLayout extends StructuralLayout { const BottomNavigationBarLayout({ required this.body, this.custom, + this.barId, this.scaffoldFieldsWrapper, super.key, }); @@ -41,15 +43,23 @@ class BottomNavigationBarLayout extends StructuralLayout { final BottomNavigationBarComponent? Function(BottomNavigationBarComponent?)? custom; + /// The parameter [barId] enables to specify the particular + /// bottom bar to utilize. + final String? barId; + + /// The [scaffoldFieldsWrapper] is a final variable that serves as a wrapper + /// for customizing the scaffold. + /// It allows for tailored modifications and enhancements to the standard + /// scaffold functionality. final ScaffoldFieldsWrapper? scaffoldFieldsWrapper; @override Widget build(BuildContext context) => Scaffold( body: body, bottomNavigationBar: custom?.call( - context.components.bottomNavigationBar, + context.components.bottomNavigationBarComponent(barId).call(), ) ?? - context.components.bottomNavigationBar, + context.components.bottomNavigationBarComponent(barId).call(), floatingActionButtonLocation: scaffoldFieldsWrapper?.floatingActionButtonLocation, floatingActionButtonAnimator: diff --git a/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/frame_layout.dart b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/frame_layout.dart index e44a8163..5b1a8879 100644 --- a/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/frame_layout.dart +++ b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/frame_layout.dart @@ -18,7 +18,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:wyatt_ui_components/wyatt_ui_components.dart'; import 'package:wyatt_ui_layout/src/core/scaffold_fields_wrapper.dart'; -import 'package:wyatt_ui_layout/src/presentation/layouts/layout.dart'; +import 'package:wyatt_ui_layout/src/presentation/layouts/structural_layouts/structural_layout.dart'; /// {@template frame_layout} /// A layout that contains a top app bar, a body and a bottom navigation bar. @@ -36,6 +36,9 @@ class FrameLayout extends StructuralLayout { this.customAppBar, this.customBottomNavBar, this.customFloatingActionButton, + this.appBarId, + this.bottomNavBarId, + this.floatingActionButtonId, this.height = 60, this.scaffoldFieldsWrapper, super.key, @@ -53,6 +56,18 @@ class FrameLayout extends StructuralLayout { final FloatingActionButtonComponent? Function(FloatingActionButtonComponent?)? customFloatingActionButton; + /// The parameter [appBarId] enables to specify the particular + /// app bar to utilize. + final String? appBarId; + + /// The parameter [bottomNavBarId] enables to specify the particular + /// bottom bar to utilize. + final String? bottomNavBarId; + + /// The parameter [floatingActionButtonId] enables to specify + /// the particular floating action button to utilize. + final String? floatingActionButtonId; + /// The main content of the layout. final Widget body; @@ -63,20 +78,27 @@ class FrameLayout extends StructuralLayout { @override Widget build(BuildContext context) => Scaffold( - appBar: (customAppBar?.call(context.components.topAppBar) != null || - context.components.topAppBar != null) + appBar: (customAppBar + ?.call(context.components.topAppBarComponent(appBarId)()) != + null) ? PreferredSize( preferredSize: Size.fromHeight(height), - child: customAppBar?.call(context.components.topAppBar) ?? - context.components.topAppBar!, + child: customAppBar?.call( + context.components.topAppBarComponent(appBarId)(), + ) ?? + context.components.topAppBarComponent(appBarId)(), ) : null, - floatingActionButton: customFloatingActionButton - ?.call(context.components.floatingActionButton) ?? - context.components.floatingActionButton, - bottomNavigationBar: - customBottomNavBar?.call(context.components.bottomNavigationBar) ?? - context.components.bottomNavigationBar, + floatingActionButton: customFloatingActionButton?.call( + context.components + .floatingActionButtonComponent(floatingActionButtonId)(), + ) ?? + context.components + .floatingActionButtonComponent(floatingActionButtonId)(), + bottomNavigationBar: customBottomNavBar?.call( + context.components.bottomNavigationBarComponent(bottomNavBarId)(), + ) ?? + context.components.bottomNavigationBarComponent(bottomNavBarId)(), body: body, floatingActionButtonLocation: scaffoldFieldsWrapper?.floatingActionButtonLocation, diff --git a/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/structural_layout.dart b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/structural_layout.dart new file mode 100644 index 00000000..78bcdde9 --- /dev/null +++ b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/structural_layout.dart @@ -0,0 +1,99 @@ +// Copyright (C) 2022 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import 'package:flutter/widgets.dart'; +import 'package:wyatt_ui_components/wyatt_ui_components.dart'; +import 'package:wyatt_ui_layout/src/presentation/layouts/layout.dart'; +import 'package:wyatt_ui_layout/wyatt_ui_layout.dart'; + +typedef ComponentCallBack = T? Function(T? component); + +/// {@template structural_layout} +/// An abstract class that provides a base for creating custom structural layout +/// widgets. +/// {@endtemplate} +abstract class StructuralLayout extends Layout { + /// {@macro structural_layout} + const StructuralLayout({super.key}); + + factory StructuralLayout.withTopAppBar({ + required Widget body, + ComponentCallBack? custom, + String? barId, + double height = 60, + ScaffoldFieldsWrapper? scaffoldFieldsWrapper, + }) => + TopAppBarLayout( + body: body, + barId: barId, + custom: custom, + height: height, + scaffoldFieldsWrapper: scaffoldFieldsWrapper, + ); + + factory StructuralLayout.withTopNavigationBar({ + required Widget body, + ComponentCallBack? custom, + String? barId, + double height = 60, + ScaffoldFieldsWrapper? scaffoldFieldsWrapper, + }) => + TopNavigationBarLayout( + body: body, + barId: barId, + custom: custom, + height: height, + scaffoldFieldsWrapper: scaffoldFieldsWrapper, + ); + + factory StructuralLayout.withFrame({ + required Widget body, + ComponentCallBack? customAppBar, + ComponentCallBack? customBottomNavBar, + ComponentCallBack? + customFloatingActionButton, + String? appBarId, + String? bottomNavBarId, + String? floatingActionButtonId, + double height = 60, + ScaffoldFieldsWrapper? scaffoldFieldsWrapper, + }) => + FrameLayout( + body: body, + customAppBar: customAppBar, + customBottomNavBar: customBottomNavBar, + customFloatingActionButton: customFloatingActionButton, + appBarId: appBarId, + bottomNavBarId: bottomNavBarId, + floatingActionButtonId: floatingActionButtonId, + height: height, + scaffoldFieldsWrapper: scaffoldFieldsWrapper, + ); + + factory StructuralLayout.withBottomNavBar({ + required Widget? body, + BottomNavigationBarComponent? Function(BottomNavigationBarComponent?)? + custom, + String? barId, + ScaffoldFieldsWrapper? scaffoldFieldsWrapper, + }) => + BottomNavigationBarLayout( + body: body, + custom: custom, + barId: barId, + scaffoldFieldsWrapper: scaffoldFieldsWrapper, + ); +} diff --git a/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/structural_layouts.dart b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/structural_layouts.dart index e22f407c..9ac4e11f 100644 --- a/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/structural_layouts.dart +++ b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/structural_layouts.dart @@ -16,4 +16,5 @@ export './bottom_navigation_bar_layout.dart'; export './frame_layout.dart'; +export './structural_layout.dart'; export './top_app_bar_layout.dart'; diff --git a/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/top_app_bar_layout.dart b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/top_app_bar_layout.dart index 0f9acc41..89322fa7 100644 --- a/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/top_app_bar_layout.dart +++ b/packages/wyatt_ui_layout/lib/src/presentation/layouts/structural_layouts/top_app_bar_layout.dart @@ -18,7 +18,7 @@ import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:wyatt_ui_components/wyatt_ui_components.dart'; import 'package:wyatt_ui_layout/src/core/scaffold_fields_wrapper.dart'; -import 'package:wyatt_ui_layout/src/presentation/layouts/layout.dart'; +import 'package:wyatt_ui_layout/src/presentation/layouts/structural_layouts/structural_layout.dart'; /// {@template top_bar_layout} /// An abstract class for creating layouts with a top bar component. @@ -27,7 +27,7 @@ import 'package:wyatt_ui_layout/src/presentation/layouts/layout.dart'; /// component, such as an app bar or navigation bar. /// /// Implementations of this class must provide a concrete implementation of -/// the [child] method, which returns the specific top bar component for the +/// the [appBar] method, which returns the specific top bar component for the /// given [BuildContext]. /// /// [T] represents the type of the top bar component. @@ -38,6 +38,7 @@ abstract class TopBarLayout const TopBarLayout({ required this.body, this.custom, + this.barId, this.height = 60, this.scaffoldFieldsWrapper, super.key, @@ -51,20 +52,31 @@ abstract class TopBarLayout /// a customized top bar component. final T? Function(T?)? custom; + /// The parameter [barId] enables to specify the particular app bar to use. + final String? barId; + /// The height of the top bar. final double height; /// Returns the top bar component for the given [BuildContext]. - T? child(BuildContext context); + T appBar(BuildContext context, String? barId); + /// The [scaffoldFieldsWrapper] is a final variable that serves as a wrapper + /// for customizing the scaffold. + /// It allows for tailored modifications and enhancements to the standard + /// scaffold functionality. final ScaffoldFieldsWrapper? scaffoldFieldsWrapper; @override Widget build(BuildContext context) => Scaffold( - appBar: (custom?.call(child(context)) != null || child(context) != null) + appBar: (custom?.call( + appBar(context, barId), + ) != + null) ? PreferredSize( preferredSize: Size.fromHeight(height), - child: custom?.call(child(context)) ?? child(context)!, + child: custom?.call(appBar(context, barId)) ?? + appBar(context, barId), ) : null, body: body, @@ -111,14 +123,16 @@ class TopAppBarLayout extends TopBarLayout { /// [height] represents the height of the top bar. const TopAppBarLayout({ required super.body, + super.barId, super.custom, super.height, + super.scaffoldFieldsWrapper, super.key, }); @override - TopAppBarComponent? child(BuildContext context) => - context.components.topAppBar; + TopAppBarComponent appBar(BuildContext context, String? barId) => + context.components.topAppBarComponent(barId).call(); } /// A concrete implementation of [TopBarLayout] for a navigation bar. @@ -131,12 +145,14 @@ class TopNavigationBarLayout extends TopBarLayout { /// [height] represents the height of the top bar. const TopNavigationBarLayout({ required super.body, + super.barId, super.custom, super.height, + super.scaffoldFieldsWrapper, super.key, }); @override - TopNavigationBarComponent? child(BuildContext context) => - context.components.topNavigationBar; + TopNavigationBarComponent appBar(BuildContext context, String? barId) => + context.components.topNavigationBarComponent(barId).call(); } diff --git a/packages/wyatt_ui_layout/pubspec.yaml b/packages/wyatt_ui_layout/pubspec.yaml index 11315aab..4f01b1ea 100644 --- a/packages/wyatt_ui_layout/pubspec.yaml +++ b/packages/wyatt_ui_layout/pubspec.yaml @@ -6,11 +6,11 @@ version: 0.1.1 publish_to: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub environment: - sdk: ">=2.17.0 <3.0.0" + sdk: ">=3.0.0 <4.0.0" dependencies: flutter: { sdk: flutter } - gap: ^2.0.1 + gap: ^3.0.1 wyatt_ui_components: hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub