Compare commits

...

7 Commits

Author SHA1 Message Date
a6903ae432 feat(ui_components)!: available same type component usage (#200)
All checks were successful
continuous-integration/drone/pr Build is passing
2023-08-28 12:36:58 +00:00
a4c73421d2 fix(authentication_bloc): upgrade google sign to his major v
Some checks failed
continuous-integration/drone/pr Build is failing
2023-08-28 09:00:59 +00:00
227158725d fix: apply dart format 2023-08-28 09:00:59 +00:00
cc41b7b589 fix: apply dart fix --apply 2023-08-28 09:00:59 +00:00
e74346b655 fix(authentication_bloc): go router version refactoring 2023-08-28 09:00:59 +00:00
54bd147e87 chore: upgrade deps to major versions 2023-08-28 09:00:59 +00:00
543b9421ca docs(cloud_messaging_bloc): add reamde
Some checks failed
continuous-integration/drone/pr Build is failing
2023-08-28 08:37:23 +00:00
69 changed files with 973 additions and 590 deletions

View File

@ -25,7 +25,7 @@ class AlbumMockDataSourceImpl extends AlbumRemoteDataSource {
id: 1,
userId: 1,
title: 'Album 1',
)
),
};
@override

View File

@ -58,8 +58,8 @@ class PhotosGridThumbnail
bottom: 10,
right: 10,
child: Icon(Icons.favorite),
)
]
),
],
],
),
);

View File

@ -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) {

View File

@ -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:

View File

@ -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,

View File

@ -32,8 +32,8 @@ class AuthenticationMockCacheDataSourceImpl<Data>
@override
Future<Account?> getCachedAccount() async {
await Future<void>.delayed(const Duration(milliseconds: 200));
return null;
return null;
}
@override

View File

@ -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/

View File

@ -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,
)
),
],
);
});

View File

@ -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,
)
),
],
);
});

View File

@ -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,
)
),
],
);
});

View File

@ -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,
);

View File

@ -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, FormInputValidator<dynamic, ValidationError>,
dynamic>>[
FormInput(AuthFormField.email, const Email.pure()),
FormInput(AuthFormField.password, const Password.pure())
FormInput(AuthFormField.password, const Password.pure()),
];
final inputsB = <

View File

@ -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,
);

View File

@ -31,7 +31,7 @@ class ExampleCubit extends Cubit<CrudState> {
'DATA LOADED 1',
'DATA LOADED 2',
'DATA LOADED 3',
'DATA LOADED 4'
'DATA LOADED 4',
]),
);
await Future<void>.delayed(const Duration(seconds: 1));

View File

@ -11,29 +11,124 @@ and the Flutter guide for
[developing packages and plugins](https://flutter.dev/developing-packages).
-->
TODO: Put a short description of the package here that helps potential users
know whether this package might be useful for them.
# Cloud Messaging BLoC Base
<p align="left">
<a href="https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_analysis"><img src="https://img.shields.io/badge/Style-Wyatt%20Analysis-blue.svg?style=flat-square" alt="Style: Wyatt Analysis" /></a>
<img src="https://img.shields.io/badge/SDK-Flutter-blue?style=flat-square" alt="SDK: Flutter" />
</p>
This package serves as an abstraction for managing notifications within Flutter applications. It does not include a built-in data source implementation. Therefore, it is essential to provide your own implementation or utilize one of our various implementations listed below:
- [Firebase Cloud Messaging ](https://git.wyatt-studio.fr/Wyatt-FOSS/-/packages/pub/wyatt_cloud_messaging_bloc_base/0.1.1+1)
This package enables you to easily integrate your data source, allowing the package to handle business logic, error management, and state logic seamlessly.
## Features
TODO: List what your package can do. Maybe include images, gifs, or videos.
* 🧐 Wyatt Architecture
* 🧱 Entities
- `RemoteNotification` -> Contains notification innformations
* 🧊 Cubits, why make it complicated when you can make it simple?
- Goes to the essential
* 📐 Consistent
- Every class have same naming convention
## Getting started
TODO: List prerequisites and provide or point to information on how to
start using the package.
Simply add `wyatt_cloud_messaging_bloc_base` in `pubspec.yaml` , then
```dart
import 'package:wyatt_cloud_messaging_bloc_base/wyatt_cloud_messaging_bloc_base.dart';
```
## Usage
TODO: Include short and useful examples for package users. Add longer examples
to `/example` folder.
### Data source
The initial step involves furnishing a data source, presenting you with two options:
- You can select from our provided implementations, which are listed above.
- Alternatively, you can craft a custom implementation by extending the `CloudMessagingRemoteDataSource` class and implementing all of its methods.
In this example, we will use the Firebase Cloud Messaging implementation.
```dart
const like = 'sample';
getIt.registerLazySingleton<CloudMessagingRemoteDataSource>(
() => CloudMessagingFirebaseDataSource())
```
> Here we use GetIt.
### Repository
Do the same for the repository. This one is already developed, you just need to inject it.
```dart
getIt.registerLazySingleton<CloudMessagingRepository>(
() => CloudMessagingRepositoryImpl(
notificationRemoteDataSource: getIt(),
),
)
```
### Use cases
Do the same for use cases. Select an inject the ones you need in your app. Here are avalaible use cases:
- `GetCloudMessagingTokenUsCase`
- `InitCloudmessagingUseCase`
- `ListenCloudMessagingUseCase`
- `RequestCloudMessagingPermissionUseCase`
- `SubscribeToNotificationTopicUseCase`
- `UnsubscribeFromNotificationTopicUseCase`
Here is an example with some usecase.
```dart
getIt
..registerLazySingleton<ListenNotificationUseCase>(
() => ListenNotificationUseCase(
notificationRepository: getIt(),
),
)
..registerLazySingleton<GetCloudMessagingTokenUseCase>(
() => GetCloudMessagingTokenUseCase(
notificationRepository: getIt(),
),
)
..registerLazySingleton<RequestCloudMessagingPermissionUseCase>(
() => RequestCloudMessagingPermissionUseCase(
notificationRepository: getIt(),
),
);
```
### Widgets
From this point onward, your task simply involves enveloping your app within the `CloudMessagingWrapperScreen`. Subsequently, you can proceed to implement your desired actions for handling incoming notifications.
## Additional information
TODO: Tell users more about the package: where to find more information, how to
contribute to the package, how to file issues, what response they can expect
from the package authors, and more.
If necessary, you can access data sources, repositories, and use cases through `getIt`. Here's a helpful example:
```dart
abstract class CloudMessagingHelper {
static Future<void> initMessaging() async {
await getIt<RequestCloudMessagingPermissionUseCase>().call(null);
final token = await getIt<GetCloudMessagingTokenUseCase>().call(null);
if (token.isOk) {
await notifLocalDataSource.storeToken(token: token.ok!);
}
}
static dataProcess(String? path) {
if (PageEnum.values.where((element) => (element.path == path)).isNotEmpty) {
AppRouter.goRouterNavigatorKey.currentState?.context.push(path!);
}
}
}
```

View File

@ -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',
);
}

View File

@ -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<String?> getToken() => Result.tryCatchAsync(

View File

@ -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<void, String?> {
final CloudMessagingRepository _notificationRepository;
GetCloudMessagingTokenUseCase({
required CloudMessagingRepository notificationRepository,
}) : _notificationRepository = notificationRepository;
final CloudMessagingRepository _notificationRepository;
@override
FutureOrResult<String?> execute(void params) =>

View File

@ -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<NoParam, void> {
final CloudMessagingRepository _notificationRepository;
InitCloudmessagingUseCase({
required CloudMessagingRepository notificationRepository,
}) : _notificationRepository = notificationRepository;
final CloudMessagingRepository _notificationRepository;
@override
FutureOrResult<void> execute(NoParam? params) =>
_notificationRepository.init();

View File

@ -25,11 +25,10 @@ import 'package:wyatt_type_utils/wyatt_type_utils.dart';
class ListenNotificationUseCase
extends StreamUseCase<NoParam, RemoteNotification> {
final CloudMessagingRepository _notificationRepository;
ListenNotificationUseCase({
required CloudMessagingRepository notificationRepository,
}) : _notificationRepository = notificationRepository;
final CloudMessagingRepository _notificationRepository;
@override
FutureOrResult<Stream<RemoteNotification>> execute(NoParam? params) async {
Stream<RemoteNotification>? notificationStream;

View File

@ -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<void, void> {
final CloudMessagingRepository _notificationRepository;
RequestCloudMessagingPermissionUseCase({
required CloudMessagingRepository notificationRepository,
}) : _notificationRepository = notificationRepository;
final CloudMessagingRepository _notificationRepository;
@override
FutureOrResult<void> execute(void params) =>

View File

@ -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<String, void> {
final CloudMessagingRepository _notificationRepository;
SubscribeToNotificationTopicUseCase({
required CloudMessagingRepository notificationRepository,
}) : _notificationRepository = notificationRepository;
final CloudMessagingRepository _notificationRepository;
@override
FutureOr<void> onStart(String? params) {

View File

@ -21,11 +21,10 @@ import 'package:wyatt_cloud_messaging_bloc_base/src/domain/repositories/cloud_me
class UnsubscribeFromNotificationTopicUseCase
extends AsyncUseCase<String, void> {
final CloudMessagingRepository _notificationRepository;
UnsubscribeFromNotificationTopicUseCase({
required CloudMessagingRepository notificationRepository,
}) : _notificationRepository = notificationRepository;
final CloudMessagingRepository _notificationRepository;
@override
FutureOr<void> onStart(String? params) {

View File

@ -30,11 +30,6 @@ part 'cloud_messaging_state.dart';
typedef OnNotification = void Function(RemoteNotification);
class CloudMessagingCubit extends Cubit<CloudmessagingState> {
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<CloudmessagingState> {
_subscribe = subscribe,
_unsubscribe = unsubscribe,
super(const CloudmessagingState());
final ListenNotificationUseCase _listenNotification;
final SubscribeToNotificationTopicUseCase? _subscribe;
final UnsubscribeFromNotificationTopicUseCase? _unsubscribe;
final OnNotification? handleNotification;
Future<void> listenNotification() async {
final notificaitons = await _listenNotification.execute(const NoParam());

View File

@ -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<Object?> get props => [remoteNotification];

View File

@ -18,39 +18,25 @@
# Flutter - Cloud Messaging Bloc Firebase
# Cloud Messaging Bloc Firebase Implementation
<p align="left">
<a href="https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_analysis"><img src="https://img.shields.io/badge/Style-Wyatt%20Analysis-blue.svg?style=flat-square" alt="Style: Wyatt Analysis" /></a>
<img src="https://img.shields.io/badge/SDK-Flutter-blue?style=flat-square" alt="SDK: Flutter" />
</p>
A
## Features
TODO: List what your package can do. Maybe include images, gifs, or videos.
## Getting started
TODO: List prerequisites and provide or point to information on how to
start using the package.
## Usage
TODO: Include short and useful examples for package users. Add longer examples
to `/example` folder.
Simply add `wyatt_cloud_messaging_bloc_firebase` in `pubspec.yaml` , then
```dart
const like = 'sample';
import 'package:wyatt_cloud_messaging_bloc_firebase/wyatt_cloud_messaging_bloc_fiebase.dart';
```
## Additional information
TODO: Tell users more about the package: where to find more information, how to
contribute to the package, how to file issues, what response they can expect
from the package authors, and more.
- This package includes the implementation of the `CloudMessagingRemoteDataSource` found in the [Wyatt Cloud Messaging Bloc Base](https://git.wyatt-studio.fr/Wyatt-FOSS/-/packages/pub/wyatt_cloud_messaging_bloc_base) package, enabling the utilization of Firebase Cloud Messaging.
- It's worth noting that this package exports [Wyatt Cloud Messaging Bloc Base](https://git.wyatt-studio.fr/Wyatt-FOSS/-/packages/pub/wyatt_cloud_messaging_bloc_base), so there's no need to import both packages.
- This implementation is kept separate from the package to enhance dependency management efficiency.
- All the instructions for using this package are provided in the [Wyatt Cloud Messaging Bloc Base](https://git.wyatt-studio.fr/Wyatt-FOSS/-/packages/pub/wyatt_cloud_messaging_bloc_base) package's readme.

View File

@ -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

View File

@ -33,8 +33,7 @@ class CrudFirestoreDataSourceImpl<Model extends ObjectModel, Entity>
required Model Function(
DocumentSnapshot<Map<String, dynamic>>,
SnapshotOptions?,
)
fromFirestore,
) fromFirestore,
/// The function that converts a [Model] to a [Map<String, Object?>].
required Map<String, Object?> Function(Model, SetOptions?) toFirestore,

View File

@ -289,7 +289,7 @@ abstract class CrudAdvancedCubit<Model extends ObjectModel>
WhereQueryType.whereIn,
'id',
ids,
)
),
]);
if (result.isOk) {
return CrudListLoaded<Model?>(result.ok ?? []);

View File

@ -353,7 +353,7 @@ abstract class CrudCubit<Model extends ObjectModel> extends CrudBaseCubit {
WhereQueryType.whereIn,
'id',
ids,
)
),
]);
if (result.isOk) {
return CrudListLoaded<Model?>(result.ok ?? []);

View File

@ -26,9 +26,8 @@ class FormDifference extends FormOperation {
@override
WyattForm call(WyattForm a, WyattForm b) {
final inputs = <
FormInput<dynamic, FormInputValidator<dynamic, ValidationError>,
dynamic>>[];
final inputs = <FormInput<dynamic,
FormInputValidator<dynamic, ValidationError>, dynamic>>[];
for (final i in a.inputs) {
if (!b.containsKey(i.key)) {

View File

@ -26,9 +26,8 @@ class FormIntersection extends FormOperation {
@override
WyattForm call(WyattForm a, WyattForm b) {
final inputs = <
FormInput<dynamic, FormInputValidator<dynamic, ValidationError>,
dynamic>>[];
final inputs = <FormInput<dynamic,
FormInputValidator<dynamic, ValidationError>, dynamic>>[];
for (final i in a.inputs) {
if (b.containsKey(i.key)) {

View File

@ -26,9 +26,8 @@ class FormUnion extends FormOperation {
@override
WyattForm call(WyattForm a, WyattForm b) {
final inputs = <
FormInput<dynamic, FormInputValidator<dynamic, ValidationError>,
dynamic>>[];
final inputs = <FormInput<dynamic,
FormInputValidator<dynamic, ValidationError>, dynamic>>[];
for (final i in a.inputs) {
inputs.add(i);

View File

@ -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('&');

View File

@ -10,7 +10,7 @@ environment:
dependencies:
crypto: ^3.0.2
http: ^0.13.4
http: ^1.1.0
dev_dependencies:
wyatt_analysis:

View File

@ -44,7 +44,7 @@ class App extends StatelessWidget {
),
),
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate
GlobalWidgetsLocalizations.delegate,
],
home: Scaffold(
appBar: AppBar(

View File

@ -93,7 +93,7 @@ class I18nFileParser extends Parser<String, String> {
String selectToString(Select token) {
final Map<Object, String> cases = {
for (var e in token.options.map(
for (final e in token.options.map(
(o) => MapEntry(
o.name,
o.value.map(parsedElementToString).join(),

View File

@ -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: "../"

View File

@ -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

View File

@ -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(),
);
}

View File

@ -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<Widget>? actions) => this(actions: actions);
@override
CustomAppBar expandedWidget(List<Widget>? 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<Widget>? actions,
List<Widget>? expandedWidget,
Key? key,
}) =>
CustomAppBar(
title: title ?? _value.title,
key: key ?? _value.key,
);
}
mixin $CustomAppBarCWMixin on Component {
$TopAppBarComponentCWProxy get copyWith =>
$CustomAppBarCWProxyImpl(this as CustomAppBar);
}

View File

@ -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(

View File

@ -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<Widget>? actions) => this(actions: actions);
@override
CustomRootAppBar expandedWidget(List<Widget>? 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<Widget>? actions,
List<Widget>? expandedWidget,
Key? key,
}) =>
CustomRootAppBar(
title: title ?? _value.title,
key: key ?? _value.key,
);
}
mixin $CustomRootAppBarCWMixin on Component {
$TopAppBarComponentCWProxy get copyWith =>
$CustomRootAppBarCWProxyImpl(this as CustomRootAppBar);
}

View File

@ -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 ?? '',
),
);
}

View File

@ -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<Widget>? actions) => this(actions: actions);
@override
CustomSecondAppBar expandedWidget(List<Widget>? 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<Widget>? actions,
List<Widget>? expandedWidget,
Key? key,
}) =>
CustomSecondAppBar(
title: title ?? _value.title,
key: key ?? _value.key,
);
}
mixin $CustomSecondAppBarCWMixin on Component {
$TopAppBarComponentCWProxy get copyWith =>
$CustomSecondAppBarCWProxyImpl(this as CustomSecondAppBar);
}

View File

@ -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()(),
);
}

View File

@ -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';

View File

@ -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 <https://www.gnu.org/licenses/>.
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<T extends Component> on Map<String, T> {
/// Creates and returns a [ComponentRegistry] based on the map's components.
ComponentRegistry<T> registry() => ComponentRegistry(components: this);
}
/// Extension on a single component that creates a [ComponentRegistry]
/// containing only that component.
extension ComponentExtension<T extends Component> on T {
/// Creates and returns a [ComponentRegistry] containing
/// only this component.
// ignore: use_to_and_as_if_applicable
ComponentRegistry<T> registry() => ComponentRegistry.solo(this);
}

View File

@ -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 <https://www.gnu.org/licenses/>.
import 'package:wyatt_ui_components/wyatt_ui_components.dart';
/// A registry for components of type [T], providing easy access and management.
class ComponentRegistry<T extends Component> {
/// Constructs a [ComponentRegistry] with the given [components].
const ComponentRegistry({required Map<String, T> 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<String, T> _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<String> get ids => _components.keys.toList();
/// Returns a string representation of the registry,
/// showing the count and IDs.
@override
String toString() => '$count - $ids';
}

View File

@ -30,7 +30,7 @@ abstract class BottomNavigationBarComponent extends Component
this.items = const <BottomNavigationBarItem>[],
super.key,
});
final int currentIndex;
final void Function(BuildContext, int)? onTap;
final List<BottomNavigationBarItem> items;

View File

@ -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<TopAppBarComponent>? topAppBars,
ComponentRegistry<TopNavigationBarComponent>? topNavigationBars,
ComponentRegistry<BottomNavigationBarComponent>? bottomNavigationBars,
ComponentRegistry<ErrorComponent>? errors,
ComponentRegistry<LoaderComponent>? loaders,
ComponentRegistry<RichTextBuilderComponent>? richTextBuilders,
ComponentRegistry<TextInputComponent>? textInputs,
ComponentRegistry<FileSelectionButtonComponent>? fileSelectionButtons,
ComponentRegistry<FlatButtonComponent>? flatButtons,
ComponentRegistry<SimpleIconButtonComponent>? simpleIconButtons,
ComponentRegistry<SymbolButtonComponent>? symbolButtons,
ComponentRegistry<InformationCardComponent>? informationCards,
ComponentRegistry<PortfolioCardComponent>? portfolioCards,
ComponentRegistry<QuoteCardComponent>? quoteCards,
ComponentRegistry<SkillCardComponent>? skillCards,
ComponentRegistry<PricingCardComponent>? pricingCards,
ComponentRegistry<FloatingActionButtonComponent>? 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,23 +94,23 @@ 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,
this.topAppBars,
this.topNavigationBars,
this.bottomNavigationBars,
this.errors,
this.loaders,
this.richTextBuilders,
this.textInputs,
this.fileSelectionButtons,
this.flatButtons,
this.simpleIconButtons,
this.symbolButtons,
this.informationCards,
this.portfolioCards,
this.quoteCards,
this.skillCards,
this.pricingCards,
this.floatingActionButtons,
});
R _get<T extends Component, R>(T? component, R? returned) {
@ -128,64 +129,90 @@ 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<TopAppBarComponent>? topAppBars;
$TopAppBarComponentCWProxy topAppBarComponent([String? id]) =>
_get(topAppBars?.call(id), topAppBars?.call(id)?.copyWith);
final ComponentRegistry<TopNavigationBarComponent>? topNavigationBars;
$TopNavigationBarComponentCWProxy topNavigationBarComponent([String? id]) =>
_get(topNavigationBars?.call(id), topNavigationBars?.call(id)?.copyWith);
final ComponentRegistry<BottomNavigationBarComponent>? 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<ErrorComponent>? errors;
$ErrorComponentCWProxy errorComponent([String? id]) =>
_get(errors?.call(id), errors?.call(id)?.copyWith);
final ComponentRegistry<LoaderComponent>? 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<InformationCardComponent>? informationCards;
$InformationCardComponentCWProxy informationCardComponent([String? id]) =>
_get(informationCards?.call(id), informationCards?.call(id)?.copyWith);
final ComponentRegistry<PortfolioCardComponent>? portfolioCards;
$PortfolioCardComponentCWProxy portfolioCardComponent([String? id]) =>
_get(portfolioCards?.call(id), portfolioCards?.call(id)?.copyWith);
final ComponentRegistry<QuoteCardComponent>? quoteCards;
$QuoteCardComponentCWProxy quoteCardComponent([String? id]) =>
_get(quoteCards?.call(id), quoteCards?.call(id)?.copyWith);
final ComponentRegistry<SkillCardComponent>? skillCards;
$SkillCardComponentCWProxy skillCardComponent([String? id]) =>
_get(skillCards?.call(id), skillCards?.call(id)?.copyWith);
final ComponentRegistry<PricingCardComponent>? 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<RichTextBuilderComponent>? 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<TextInputComponent>? 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<FileSelectionButtonComponent>? 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<FlatButtonComponent>? flatButtons;
$FlatButtonComponentCWProxy flatButtonComponent([String? id]) =>
_get(flatButtons?.call(id), flatButtons?.call(id)?.copyWith);
final ComponentRegistry<SimpleIconButtonComponent>? simpleIconButtons;
$SimpleIconButtonComponentCWProxy simpleIconButtonComponent([String? id]) =>
_get(simpleIconButtons?.call(id), simpleIconButtons?.call(id)?.copyWith);
final ComponentRegistry<SymbolButtonComponent>? symbolButtons;
$SymbolButtonComponentCWProxy symbolButtonComponent([String? id]) =>
_get(symbolButtons?.call(id), symbolButtons?.call(id)?.copyWith);
final ComponentRegistry<FloatingActionButtonComponent>? floatingActionButtons;
$FloatingActionButtonComponentCWProxy floatingActionButtonComponent([
String? id,
]) =>
_get(
floatingActionButtons?.call(id),
floatingActionButtons?.call(id)?.copyWith,
);
}

View File

@ -7,44 +7,54 @@ part of 'component_theme_data.dart';
// **************************************************************************
abstract class _$ComponentThemeDataCWProxy {
ComponentThemeData topAppBar(TopAppBarComponent? topAppBar);
ComponentThemeData topAppBars(
ComponentRegistry<TopAppBarComponent>? topAppBars);
ComponentThemeData topNavigationBar(
TopNavigationBarComponent? topNavigationBar);
ComponentThemeData topNavigationBars(
ComponentRegistry<TopNavigationBarComponent>? topNavigationBars);
ComponentThemeData bottomNavigationBar(
BottomNavigationBarComponent? bottomNavigationBar);
ComponentThemeData bottomNavigationBars(
ComponentRegistry<BottomNavigationBarComponent>? bottomNavigationBars);
ComponentThemeData error(ErrorComponent? error);
ComponentThemeData errors(ComponentRegistry<ErrorComponent>? errors);
ComponentThemeData loader(LoaderComponent? loader);
ComponentThemeData loaders(ComponentRegistry<LoaderComponent>? loaders);
ComponentThemeData richTextBuilder(RichTextBuilderComponent? richTextBuilder);
ComponentThemeData richTextBuilders(
ComponentRegistry<RichTextBuilderComponent>? richTextBuilders);
ComponentThemeData textInput(TextInputComponent? textInput);
ComponentThemeData textInputs(
ComponentRegistry<TextInputComponent>? textInputs);
ComponentThemeData fileSelectionButton(
FileSelectionButtonComponent? fileSelectionButton);
ComponentThemeData fileSelectionButtons(
ComponentRegistry<FileSelectionButtonComponent>? fileSelectionButtons);
ComponentThemeData flatButton(FlatButtonComponent? flatButton);
ComponentThemeData flatButtons(
ComponentRegistry<FlatButtonComponent>? flatButtons);
ComponentThemeData simpleIconButton(
SimpleIconButtonComponent? simpleIconButton);
ComponentThemeData simpleIconButtons(
ComponentRegistry<SimpleIconButtonComponent>? simpleIconButtons);
ComponentThemeData symbolButton(SymbolButtonComponent? symbolButton);
ComponentThemeData symbolButtons(
ComponentRegistry<SymbolButtonComponent>? symbolButtons);
ComponentThemeData informationCard(InformationCardComponent? informationCard);
ComponentThemeData informationCards(
ComponentRegistry<InformationCardComponent>? informationCards);
ComponentThemeData portfolioCard(PortfolioCardComponent? portfolioCard);
ComponentThemeData portfolioCards(
ComponentRegistry<PortfolioCardComponent>? portfolioCards);
ComponentThemeData quoteCard(QuoteCardComponent? quoteCard);
ComponentThemeData quoteCards(
ComponentRegistry<QuoteCardComponent>? quoteCards);
ComponentThemeData skillCard(SkillCardComponent? skillCard);
ComponentThemeData skillCards(
ComponentRegistry<SkillCardComponent>? skillCards);
ComponentThemeData pricingCard(PricingCardComponent? pricingCard);
ComponentThemeData pricingCards(
ComponentRegistry<PricingCardComponent>? pricingCards);
ComponentThemeData floatingActionButton(
FloatingActionButtonComponent? floatingActionButton);
ComponentThemeData floatingActionButtons(
ComponentRegistry<FloatingActionButtonComponent>? 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<TopAppBarComponent>? topAppBars,
ComponentRegistry<TopNavigationBarComponent>? topNavigationBars,
ComponentRegistry<BottomNavigationBarComponent>? bottomNavigationBars,
ComponentRegistry<ErrorComponent>? errors,
ComponentRegistry<LoaderComponent>? loaders,
ComponentRegistry<RichTextBuilderComponent>? richTextBuilders,
ComponentRegistry<TextInputComponent>? textInputs,
ComponentRegistry<FileSelectionButtonComponent>? fileSelectionButtons,
ComponentRegistry<FlatButtonComponent>? flatButtons,
ComponentRegistry<SimpleIconButtonComponent>? simpleIconButtons,
ComponentRegistry<SymbolButtonComponent>? symbolButtons,
ComponentRegistry<InformationCardComponent>? informationCards,
ComponentRegistry<PortfolioCardComponent>? portfolioCards,
ComponentRegistry<QuoteCardComponent>? quoteCards,
ComponentRegistry<SkillCardComponent>? skillCards,
ComponentRegistry<PricingCardComponent>? pricingCards,
ComponentRegistry<FloatingActionButtonComponent>? floatingActionButtons,
});
}
@ -80,77 +90,90 @@ class _$ComponentThemeDataCWProxyImpl implements _$ComponentThemeDataCWProxy {
final ComponentThemeData _value;
@override
ComponentThemeData topAppBar(TopAppBarComponent? topAppBar) =>
this(topAppBar: topAppBar);
ComponentThemeData topAppBars(
ComponentRegistry<TopAppBarComponent>? topAppBars) =>
this(topAppBars: topAppBars);
@override
ComponentThemeData topNavigationBar(
TopNavigationBarComponent? topNavigationBar) =>
this(topNavigationBar: topNavigationBar);
ComponentThemeData topNavigationBars(
ComponentRegistry<TopNavigationBarComponent>? topNavigationBars) =>
this(topNavigationBars: topNavigationBars);
@override
ComponentThemeData bottomNavigationBar(
BottomNavigationBarComponent? bottomNavigationBar) =>
this(bottomNavigationBar: bottomNavigationBar);
ComponentThemeData bottomNavigationBars(
ComponentRegistry<BottomNavigationBarComponent>?
bottomNavigationBars) =>
this(bottomNavigationBars: bottomNavigationBars);
@override
ComponentThemeData error(ErrorComponent? error) => this(error: error);
ComponentThemeData errors(ComponentRegistry<ErrorComponent>? errors) =>
this(errors: errors);
@override
ComponentThemeData loader(LoaderComponent? loader) => this(loader: loader);
ComponentThemeData loaders(ComponentRegistry<LoaderComponent>? loaders) =>
this(loaders: loaders);
@override
ComponentThemeData richTextBuilder(
RichTextBuilderComponent? richTextBuilder) =>
this(richTextBuilder: richTextBuilder);
ComponentThemeData richTextBuilders(
ComponentRegistry<RichTextBuilderComponent>? richTextBuilders) =>
this(richTextBuilders: richTextBuilders);
@override
ComponentThemeData textInput(TextInputComponent? textInput) =>
this(textInput: textInput);
ComponentThemeData textInputs(
ComponentRegistry<TextInputComponent>? textInputs) =>
this(textInputs: textInputs);
@override
ComponentThemeData fileSelectionButton(
FileSelectionButtonComponent? fileSelectionButton) =>
this(fileSelectionButton: fileSelectionButton);
ComponentThemeData fileSelectionButtons(
ComponentRegistry<FileSelectionButtonComponent>?
fileSelectionButtons) =>
this(fileSelectionButtons: fileSelectionButtons);
@override
ComponentThemeData flatButton(FlatButtonComponent? flatButton) =>
this(flatButton: flatButton);
ComponentThemeData flatButtons(
ComponentRegistry<FlatButtonComponent>? flatButtons) =>
this(flatButtons: flatButtons);
@override
ComponentThemeData simpleIconButton(
SimpleIconButtonComponent? simpleIconButton) =>
this(simpleIconButton: simpleIconButton);
ComponentThemeData simpleIconButtons(
ComponentRegistry<SimpleIconButtonComponent>? simpleIconButtons) =>
this(simpleIconButtons: simpleIconButtons);
@override
ComponentThemeData symbolButton(SymbolButtonComponent? symbolButton) =>
this(symbolButton: symbolButton);
ComponentThemeData symbolButtons(
ComponentRegistry<SymbolButtonComponent>? symbolButtons) =>
this(symbolButtons: symbolButtons);
@override
ComponentThemeData informationCard(
InformationCardComponent? informationCard) =>
this(informationCard: informationCard);
ComponentThemeData informationCards(
ComponentRegistry<InformationCardComponent>? informationCards) =>
this(informationCards: informationCards);
@override
ComponentThemeData portfolioCard(PortfolioCardComponent? portfolioCard) =>
this(portfolioCard: portfolioCard);
ComponentThemeData portfolioCards(
ComponentRegistry<PortfolioCardComponent>? portfolioCards) =>
this(portfolioCards: portfolioCards);
@override
ComponentThemeData quoteCard(QuoteCardComponent? quoteCard) =>
this(quoteCard: quoteCard);
ComponentThemeData quoteCards(
ComponentRegistry<QuoteCardComponent>? quoteCards) =>
this(quoteCards: quoteCards);
@override
ComponentThemeData skillCard(SkillCardComponent? skillCard) =>
this(skillCard: skillCard);
ComponentThemeData skillCards(
ComponentRegistry<SkillCardComponent>? skillCards) =>
this(skillCards: skillCards);
@override
ComponentThemeData pricingCard(PricingCardComponent? pricingCard) =>
this(pricingCard: pricingCard);
ComponentThemeData pricingCards(
ComponentRegistry<PricingCardComponent>? pricingCards) =>
this(pricingCards: pricingCards);
@override
ComponentThemeData floatingActionButton(
FloatingActionButtonComponent? floatingActionButton) =>
this(floatingActionButton: floatingActionButton);
ComponentThemeData floatingActionButtons(
ComponentRegistry<FloatingActionButtonComponent>?
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<TopAppBarComponent>?,
topNavigationBars: topNavigationBars == const $CopyWithPlaceholder()
? _value.topNavigationBars
// ignore: cast_nullable_to_non_nullable
: topNavigationBar as TopNavigationBarComponent?,
bottomNavigationBar: bottomNavigationBar == const $CopyWithPlaceholder()
? _value.bottomNavigationBar
: topNavigationBars as ComponentRegistry<TopNavigationBarComponent>?,
bottomNavigationBars: bottomNavigationBars == const $CopyWithPlaceholder()
? _value.bottomNavigationBars
// ignore: cast_nullable_to_non_nullable
: bottomNavigationBar as BottomNavigationBarComponent?,
error: error == const $CopyWithPlaceholder()
? _value.error
: bottomNavigationBars
as ComponentRegistry<BottomNavigationBarComponent>?,
errors: errors == const $CopyWithPlaceholder()
? _value.errors
// ignore: cast_nullable_to_non_nullable
: error as ErrorComponent?,
loader: loader == const $CopyWithPlaceholder()
? _value.loader
: errors as ComponentRegistry<ErrorComponent>?,
loaders: loaders == const $CopyWithPlaceholder()
? _value.loaders
// ignore: cast_nullable_to_non_nullable
: loader as LoaderComponent?,
richTextBuilder: richTextBuilder == const $CopyWithPlaceholder()
? _value.richTextBuilder
: loaders as ComponentRegistry<LoaderComponent>?,
richTextBuilders: richTextBuilders == const $CopyWithPlaceholder()
? _value.richTextBuilders
// ignore: cast_nullable_to_non_nullable
: richTextBuilder as RichTextBuilderComponent?,
textInput: textInput == const $CopyWithPlaceholder()
? _value.textInput
: richTextBuilders as ComponentRegistry<RichTextBuilderComponent>?,
textInputs: textInputs == const $CopyWithPlaceholder()
? _value.textInputs
// ignore: cast_nullable_to_non_nullable
: textInput as TextInputComponent?,
fileSelectionButton: fileSelectionButton == const $CopyWithPlaceholder()
? _value.fileSelectionButton
: textInputs as ComponentRegistry<TextInputComponent>?,
fileSelectionButtons: fileSelectionButtons == const $CopyWithPlaceholder()
? _value.fileSelectionButtons
// ignore: cast_nullable_to_non_nullable
: fileSelectionButton as FileSelectionButtonComponent?,
flatButton: flatButton == const $CopyWithPlaceholder()
? _value.flatButton
: fileSelectionButtons
as ComponentRegistry<FileSelectionButtonComponent>?,
flatButtons: flatButtons == const $CopyWithPlaceholder()
? _value.flatButtons
// ignore: cast_nullable_to_non_nullable
: flatButton as FlatButtonComponent?,
simpleIconButton: simpleIconButton == const $CopyWithPlaceholder()
? _value.simpleIconButton
: flatButtons as ComponentRegistry<FlatButtonComponent>?,
simpleIconButtons: simpleIconButtons == const $CopyWithPlaceholder()
? _value.simpleIconButtons
// ignore: cast_nullable_to_non_nullable
: simpleIconButton as SimpleIconButtonComponent?,
symbolButton: symbolButton == const $CopyWithPlaceholder()
? _value.symbolButton
: simpleIconButtons as ComponentRegistry<SimpleIconButtonComponent>?,
symbolButtons: symbolButtons == const $CopyWithPlaceholder()
? _value.symbolButtons
// ignore: cast_nullable_to_non_nullable
: symbolButton as SymbolButtonComponent?,
informationCard: informationCard == const $CopyWithPlaceholder()
? _value.informationCard
: symbolButtons as ComponentRegistry<SymbolButtonComponent>?,
informationCards: informationCards == const $CopyWithPlaceholder()
? _value.informationCards
// ignore: cast_nullable_to_non_nullable
: informationCard as InformationCardComponent?,
portfolioCard: portfolioCard == const $CopyWithPlaceholder()
? _value.portfolioCard
: informationCards as ComponentRegistry<InformationCardComponent>?,
portfolioCards: portfolioCards == const $CopyWithPlaceholder()
? _value.portfolioCards
// ignore: cast_nullable_to_non_nullable
: portfolioCard as PortfolioCardComponent?,
quoteCard: quoteCard == const $CopyWithPlaceholder()
? _value.quoteCard
: portfolioCards as ComponentRegistry<PortfolioCardComponent>?,
quoteCards: quoteCards == const $CopyWithPlaceholder()
? _value.quoteCards
// ignore: cast_nullable_to_non_nullable
: quoteCard as QuoteCardComponent?,
skillCard: skillCard == const $CopyWithPlaceholder()
? _value.skillCard
: quoteCards as ComponentRegistry<QuoteCardComponent>?,
skillCards: skillCards == const $CopyWithPlaceholder()
? _value.skillCards
// ignore: cast_nullable_to_non_nullable
: skillCard as SkillCardComponent?,
pricingCard: pricingCard == const $CopyWithPlaceholder()
? _value.pricingCard
: skillCards as ComponentRegistry<SkillCardComponent>?,
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<PricingCardComponent>?,
floatingActionButtons:
floatingActionButtons == const $CopyWithPlaceholder()
? _value.floatingActionButtons
// ignore: cast_nullable_to_non_nullable
: floatingActionButtons
as ComponentRegistry<FloatingActionButtonComponent>?,
);
}
}

View File

@ -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 }

View File

@ -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'),
],
),
],

View File

@ -50,7 +50,7 @@ class Buttons extends DemoPage {
Gap(20),
SimpleIconButtons(),
Gap(20),
FileSelectionButtons()
FileSelectionButtons(),
],
),
],

View File

@ -43,12 +43,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),
@ -78,9 +78,9 @@ class PortfolioCards extends StatelessWidget {
'assets/images/mockup_1.png',
alignment: Alignment.topCenter,
fit: BoxFit.cover,
)
),
],
)
),
],
),
const Gap(20),
@ -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),
@ -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'),
],
),
],

View File

@ -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'),

View File

@ -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

View File

@ -63,7 +63,7 @@ class NavigationItem extends StatelessWidget {
.themeExtension<TopBarThemeExtension>()
?.selectedIndicatorColors,
TopBarThemeExtensionDefault.from(Theme.of(context))
.selectedIndicatorColors
.selectedIndicatorColors,
],
valueValidator: (value) => value?.isGradient,
transform: (value) =>
@ -75,7 +75,7 @@ class NavigationItem extends StatelessWidget {
.themeExtension<TopBarThemeExtension>()
?.selectedIndicatorColors,
TopBarThemeExtensionDefault.from(Theme.of(context))
.selectedIndicatorColors
.selectedIndicatorColors,
],
valueValidator: (value) => value?.isColor,
transform: (value) => value?.color,

View File

@ -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

View File

@ -156,7 +156,7 @@ class FlatButtonScreen extends CubitScreen<ButtonCubit, ButtonState> {
: 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<ButtonCubit, ButtonState> {
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<ButtonCubit, ButtonState> {
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<ButtonCubit, ButtonState> {
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<ButtonCubit, ButtonState> {
BlendMode.srcIn,
),
child: suffix,
)
),
] else if (style.foregroundColors?.color != null &&
suffix != null) ...[
ColorFiltered(
@ -229,9 +229,9 @@ class FlatButtonScreen extends CubitScreen<ButtonCubit, ButtonState> {
BlendMode.srcIn,
),
child: suffix,
)
),
] else ...[
suffix ?? const SizedBox.shrink()
suffix ?? const SizedBox.shrink(),
],
],
),

View File

@ -152,7 +152,7 @@ class SimpleIconButtonScreen extends CubitScreen<ButtonCubit, ButtonState> {
)
: null,
boxShadow: [
if (style.shadow != null) ...[style.shadow!]
if (style.shadow != null) ...[style.shadow!],
],
borderRadius: style.radius,
),

View File

@ -181,7 +181,7 @@ class SymbolButtonScreen
)
: null,
boxShadow: [
if (style.shadow != null) ...[style.shadow!]
if (style.shadow != null) ...[style.shadow!],
],
borderRadius: style.radius,
),

View File

@ -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,
)
),
],
],
),

View File

@ -134,7 +134,7 @@ class QuoteCard extends QuoteCardComponent with $QuoteCardCWMixin {
],
],
),
)
),
],
),
],

View File

@ -147,7 +147,7 @@ class CardWrapper extends StatelessWidget {
[
radius,
Theme.of(context).extension<CardThemeExtension>()?.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<CardThemeExtension>()?.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<CardThemeExtension>()?.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<CardThemeExtension>()
?.backgroundColors,
CardThemeExtensionDefault.from(Theme.of(context)).backgroundColors
CardThemeExtensionDefault.from(Theme.of(context))
.backgroundColors,
],
valueValidator: (multiColor) => multiColor?.isGradient,
transform: (multiColor) =>

View File

@ -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:

View File

@ -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

View File

@ -10,7 +10,7 @@ environment:
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