CollageBloc constructor
CollageBloc({
- required BuildContext context,
- required CollageType collageType,
- required String path,
- List<
Images> ? listOfImages,
Implementation
CollageBloc(
{required this.context,
required this.collageType,
required this.path,
this.listOfImages})
: super(InitialState()) {
on<CheckPermissionEvent>((event, emit) =>
checkPermission(event.isFromPicker, event.permissionType, event.index));
on<AllowPermissionEvent>((event, emit) {
if (event.isFromPicker) {
openPicker(event.permissionType, event.index);
} else {
emit(LoadImageState());
loadImages(path, getImageCount());
}
});
on<AskPermissionEvent>((event, emit) =>
askPermission(event.isFromPicker, event.permissionType, event.index));
on<DenyPermissionEvent>((event, emit) {
showSnackBar();
if (!event.isFromPicker) {
emit(PermissionDeniedState());
}
});
on<ImageListEvent>((event, emit) {
emit(LoadImageState());
emit(ImageListState(images: event.imageList));
});
}