Compare commits

..

No commits in common. "25cf9518f9761d450245538dd7e2f5e539d8f1cb" and "d098d9a6bf518a5a23208f30914a9b2f5e42bba0" have entirely different histories.

160 changed files with 506 additions and 479 deletions

View File

@ -24,17 +24,13 @@ scripts:
melos exec -c 1 -- flutter analyze --fatal-infos melos exec -c 1 -- flutter analyze --fatal-infos
description: Run `flutter analyze` for all packages. description: Run `flutter analyze` for all packages.
fix:
run: melos exec dart fix . --apply
description: Run `dart fix` for all packages.
format: format:
run: melos exec dart format . run: melos exec flutter format . --fix
description: Run `dart format` for all packages. description: Run `flutter format` for all packages.
format-check: format-check:
run: melos exec dart fix . --set-exit-if-changed run: melos exec flutter format . --set-exit-if-changed
description: Run `dart fix` checks for all packages. description: Run `flutter format` checks for all packages.
clean:deep: clean:deep:
run: git clean -x -d -f -q run: git clean -x -d -f -q

View File

@ -15,6 +15,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:architecture_example/data/models/photo_model.dart'; import 'package:architecture_example/data/models/photo_model.dart';
import 'package:freezed_annotation/freezed_annotation.dart'; import 'package:freezed_annotation/freezed_annotation.dart';

View File

@ -24,6 +24,7 @@ import 'package:wyatt_architecture/wyatt_architecture.dart';
import 'package:wyatt_type_utils/wyatt_type_utils.dart'; import 'package:wyatt_type_utils/wyatt_type_utils.dart';
class PhotoRepositoryImpl extends PhotoRepository { class PhotoRepositoryImpl extends PhotoRepository {
PhotoRepositoryImpl( PhotoRepositoryImpl(
this._photoRemoteDataSource, this._photoRemoteDataSource,
this._albumRemoteDataSource, this._albumRemoteDataSource,

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.

View File

@ -21,6 +21,7 @@ import 'package:architecture_example/domain/repositories/photo_repository.dart';
import 'package:wyatt_architecture/wyatt_architecture.dart'; import 'package:wyatt_architecture/wyatt_architecture.dart';
class AddPhotoToFavorites extends AsyncUseCase<Photo, List<Photo>> { class AddPhotoToFavorites extends AsyncUseCase<Photo, List<Photo>> {
AddPhotoToFavorites(this._photoRepository); AddPhotoToFavorites(this._photoRepository);
final PhotoRepository _photoRepository; final PhotoRepository _photoRepository;

View File

@ -20,6 +20,7 @@ import 'package:architecture_example/domain/repositories/photo_repository.dart';
import 'package:wyatt_architecture/wyatt_architecture.dart'; import 'package:wyatt_architecture/wyatt_architecture.dart';
class CheckIfPhotoIsInFavorites extends AsyncUseCase<int, bool> { class CheckIfPhotoIsInFavorites extends AsyncUseCase<int, bool> {
CheckIfPhotoIsInFavorites(this._photoRepository); CheckIfPhotoIsInFavorites(this._photoRepository);
final PhotoRepository _photoRepository; final PhotoRepository _photoRepository;

View File

@ -19,6 +19,7 @@ import 'package:architecture_example/domain/repositories/photo_repository.dart';
import 'package:wyatt_architecture/wyatt_architecture.dart'; import 'package:wyatt_architecture/wyatt_architecture.dart';
class DisplayFavorites extends AsyncUseCase<NoParam, List<Photo>> { class DisplayFavorites extends AsyncUseCase<NoParam, List<Photo>> {
DisplayFavorites(this._photoRepository); DisplayFavorites(this._photoRepository);
final PhotoRepository _photoRepository; final PhotoRepository _photoRepository;

View File

@ -21,6 +21,7 @@ import 'package:architecture_example/domain/repositories/photo_repository.dart';
import 'package:wyatt_architecture/wyatt_architecture.dart'; import 'package:wyatt_architecture/wyatt_architecture.dart';
class DisplayPhoto extends AsyncUseCase<int, Photo> { class DisplayPhoto extends AsyncUseCase<int, Photo> {
DisplayPhoto(this._photoRepository); DisplayPhoto(this._photoRepository);
final PhotoRepository _photoRepository; final PhotoRepository _photoRepository;

View File

@ -22,6 +22,7 @@ import 'package:architecture_example/domain/usecases/photos/params/query_paramet
import 'package:wyatt_architecture/wyatt_architecture.dart'; import 'package:wyatt_architecture/wyatt_architecture.dart';
class OpenAlbum extends AsyncUseCase<QueryParameters, List<Photo>> { class OpenAlbum extends AsyncUseCase<QueryParameters, List<Photo>> {
OpenAlbum(this._photoRepository); OpenAlbum(this._photoRepository);
final PhotoRepository _photoRepository; final PhotoRepository _photoRepository;

View File

@ -15,6 +15,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
class QueryParameters { class QueryParameters {
QueryParameters(this.start, this.limit, {this.albumId = -1}); QueryParameters(this.start, this.limit, {this.albumId = -1});
final int albumId; final int albumId;
final int? start; final int? start;

View File

@ -21,6 +21,7 @@ import 'package:architecture_example/domain/repositories/photo_repository.dart';
import 'package:wyatt_architecture/wyatt_architecture.dart'; import 'package:wyatt_architecture/wyatt_architecture.dart';
class RemovePhotoFromFavorites extends AsyncUseCase<int, List<Photo>> { class RemovePhotoFromFavorites extends AsyncUseCase<int, List<Photo>> {
RemovePhotoFromFavorites(this._photoRepository); RemovePhotoFromFavorites(this._photoRepository);
final PhotoRepository _photoRepository; final PhotoRepository _photoRepository;

View File

@ -22,6 +22,7 @@ import 'package:architecture_example/domain/usecases/photos/params/query_paramet
import 'package:wyatt_architecture/wyatt_architecture.dart'; import 'package:wyatt_architecture/wyatt_architecture.dart';
class RetrieveAllAlbums extends AsyncUseCase<QueryParameters, List<Album>> { class RetrieveAllAlbums extends AsyncUseCase<QueryParameters, List<Album>> {
RetrieveAllAlbums(this._photoRepository); RetrieveAllAlbums(this._photoRepository);
final PhotoRepository _photoRepository; final PhotoRepository _photoRepository;

View File

@ -33,6 +33,7 @@ EventTransformer<E> throttleDroppable<E>(Duration duration) =>
(events, mapper) => droppable<E>().call(events.throttle(duration), mapper); (events, mapper) => droppable<E>().call(events.throttle(duration), mapper);
class AlbumBloc extends Bloc<AlbumEvent, AlbumState> { class AlbumBloc extends Bloc<AlbumEvent, AlbumState> {
AlbumBloc(this._retrieveAllAlbums) : super(const AlbumState()) { AlbumBloc(this._retrieveAllAlbums) : super(const AlbumState()) {
on<AlbumFetched>( on<AlbumFetched>(
_onAlbumFetched, _onAlbumFetched,

View File

@ -35,7 +35,7 @@ class AlbumsScreen extends BlocScreen<AlbumBloc, AlbumEvent, AlbumState> {
bloc..add(AlbumFetched()); bloc..add(AlbumFetched());
@override @override
Widget parent(BuildContext context, Widget child) => AlbumsWrapperWidget( Widget onWrap(BuildContext context, Widget child) => AlbumsWrapperWidget(
child: child, child: child,
); );

View File

@ -22,11 +22,8 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
class AlbumsList extends StatefulWidget { class AlbumsList extends StatefulWidget {
const AlbumsList({ const AlbumsList(
required this.albums, {required this.albums, required this.hasReachedMax, super.key,});
required this.hasReachedMax,
super.key,
});
final List<Album> albums; final List<Album> albums;
final bool hasReachedMax; final bool hasReachedMax;

View File

@ -26,6 +26,7 @@ abstract class PhotoDetailsState extends Equatable {
class PhotoDetailsInitial extends PhotoDetailsState {} class PhotoDetailsInitial extends PhotoDetailsState {}
class PhotoDetailsSuccess extends PhotoDetailsState { class PhotoDetailsSuccess extends PhotoDetailsState {
const PhotoDetailsSuccess(this.photo, {required this.isFavorite}); const PhotoDetailsSuccess(this.photo, {required this.isFavorite});
final Photo photo; final Photo photo;
final bool isFavorite; final bool isFavorite;
@ -35,6 +36,7 @@ class PhotoDetailsSuccess extends PhotoDetailsState {
} }
class PhotoDetailsFailure extends PhotoDetailsState { class PhotoDetailsFailure extends PhotoDetailsState {
const PhotoDetailsFailure(this.error); const PhotoDetailsFailure(this.error);
final String error; final String error;

View File

@ -43,7 +43,7 @@ class PhotoDetailsScreen
bloc..load(photoId); bloc..load(photoId);
@override @override
Widget parent(BuildContext context, Widget child) => Widget onWrap(BuildContext context, Widget child) =>
PhotoDetailsWrapperWidget(child: child); PhotoDetailsWrapperWidget(child: child);
@override @override

View File

@ -23,6 +23,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
part 'favorite_checker_state.dart'; part 'favorite_checker_state.dart';
class FavoriteCheckerCubit extends Cubit<FavoriteCheckerState> { class FavoriteCheckerCubit extends Cubit<FavoriteCheckerState> {
FavoriteCheckerCubit(this._checkIfPhotoIsInFavorites) FavoriteCheckerCubit(this._checkIfPhotoIsInFavorites)
: super(FavoriteCheckerInitial()); : super(FavoriteCheckerInitial());
final CheckIfPhotoIsInFavorites _checkIfPhotoIsInFavorites; final CheckIfPhotoIsInFavorites _checkIfPhotoIsInFavorites;

View File

@ -10,6 +10,7 @@ abstract class FavoriteCheckerState extends Equatable {
class FavoriteCheckerInitial extends FavoriteCheckerState {} class FavoriteCheckerInitial extends FavoriteCheckerState {}
class FavoriteCheckerSuccess extends FavoriteCheckerState { class FavoriteCheckerSuccess extends FavoriteCheckerState {
const FavoriteCheckerSuccess(this.photoId, {required this.isFavorite}); const FavoriteCheckerSuccess(this.photoId, {required this.isFavorite});
final int photoId; final int photoId;
final bool isFavorite; final bool isFavorite;
@ -19,6 +20,7 @@ class FavoriteCheckerSuccess extends FavoriteCheckerState {
} }
class FavoriteCheckerFailure extends FavoriteCheckerState { class FavoriteCheckerFailure extends FavoriteCheckerState {
const FavoriteCheckerFailure(this.error); const FavoriteCheckerFailure(this.error);
final String error; final String error;

View File

@ -33,6 +33,7 @@ EventTransformer<E> throttleDroppable<E>(Duration duration) =>
(events, mapper) => droppable<E>().call(events.throttle(duration), mapper); (events, mapper) => droppable<E>().call(events.throttle(duration), mapper);
class PhotoBloc extends Bloc<PhotoEvent, PhotoState> { class PhotoBloc extends Bloc<PhotoEvent, PhotoState> {
PhotoBloc(this._openAlbum) : super(const PhotoState()) { PhotoBloc(this._openAlbum) : super(const PhotoState()) {
on<PhotoFetched>( on<PhotoFetched>(
_onPhotoFetched, _onPhotoFetched,

View File

@ -24,6 +24,7 @@ abstract class PhotoEvent extends Equatable {
} }
class PhotoFetched extends PhotoEvent { class PhotoFetched extends PhotoEvent {
const PhotoFetched(this.albumId); const PhotoFetched(this.albumId);
final int albumId; final int albumId;
} }

View File

@ -37,7 +37,7 @@ class PhotosScreen extends BlocScreen<PhotoBloc, PhotoEvent, PhotoState> {
bloc..add(PhotoFetched(albumId)); bloc..add(PhotoFetched(albumId));
@override @override
Widget parent(BuildContext context, Widget child) => PhotosWrapperWidget( Widget onWrap(BuildContext context, Widget child) => PhotosWrapperWidget(
child: child, child: child,
); );

View File

@ -71,17 +71,17 @@ class _PhotosGridState extends State<PhotosGrid> {
@override @override
Widget build(BuildContext context) => GridView.builder( Widget build(BuildContext context) => GridView.builder(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisSpacing: 4, crossAxisSpacing: 4,
mainAxisSpacing: 4, mainAxisSpacing: 4,
crossAxisCount: 4, crossAxisCount: 4,
), ),
itemCount: widget.hasReachedMax itemCount: widget.hasReachedMax
? widget.photos.length ? widget.photos.length
: widget.photos.length + 1, : widget.photos.length + 1,
controller: _scrollController, controller: _scrollController,
itemBuilder: (context, index) => index >= widget.photos.length itemBuilder: (context, index) => index >= widget.photos.length
? const BottomLoader() ? const BottomLoader()
: PhotosGridThumbnail(photo: widget.photos[index]), : PhotosGridThumbnail(photo: widget.photos[index]),
); );
} }

View File

@ -55,10 +55,7 @@ class PhotosGridThumbnail
), ),
if (state is FavoriteCheckerSuccess && state.isFavorite) ...[ if (state is FavoriteCheckerSuccess && state.isFavorite) ...[
const Positioned( const Positioned(
bottom: 10, bottom: 10, right: 10, child: Icon(Icons.favorite),)
right: 10,
child: Icon(Icons.favorite),
)
] ]
], ],
), ),

View File

@ -17,6 +17,7 @@
import 'package:wyatt_type_utils/wyatt_type_utils.dart'; import 'package:wyatt_type_utils/wyatt_type_utils.dart';
abstract class AppException implements Exception { abstract class AppException implements Exception {
AppException([this.message]); AppException([this.message]);
final String? message; final String? message;

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.

View File

@ -35,7 +35,7 @@ class EditProfileCubit extends FormDataCubitImpl {
status: FormStatus.submissionInProgress, status: FormStatus.submissionInProgress,
), ),
); );
// final user = (await authenticationRepository.getAccount()).ok; final user = (await authenticationRepository.getAccount()).ok;
final form = state.form; final form = state.form;
final email = form.valueOf<String?>(AuthFormField.email); final email = form.valueOf<String?>(AuthFormField.email);

View File

@ -25,8 +25,8 @@ import 'package:wyatt_type_utils/wyatt_type_utils.dart';
class MockAuthenticationRepository extends Mock class MockAuthenticationRepository extends Mock
implements AuthenticationRepository<int> {} implements AuthenticationRepository<int> {}
class MockAuthenticationCubit extends Mock class MockAuthenticationCubit extends Mock implements AuthenticationCubit<int> {
implements AuthenticationCubit<int> {} }
class MockAccount extends Mock implements Account {} class MockAccount extends Mock implements Account {}

View File

@ -25,8 +25,8 @@ import 'package:wyatt_type_utils/wyatt_type_utils.dart';
class MockAuthenticationRepository extends Mock class MockAuthenticationRepository extends Mock
implements AuthenticationRepository<int> {} implements AuthenticationRepository<int> {}
class MockAuthenticationCubit extends Mock class MockAuthenticationCubit extends Mock implements AuthenticationCubit<int> {
implements AuthenticationCubit<int> {} }
class MockAccount extends Mock implements Account {} class MockAccount extends Mock implements Account {}

View File

@ -25,8 +25,8 @@ import 'package:wyatt_type_utils/wyatt_type_utils.dart';
class MockAuthenticationRepository extends Mock class MockAuthenticationRepository extends Mock
implements AuthenticationRepository<int> {} implements AuthenticationRepository<int> {}
class MockAuthenticationCubit extends Mock class MockAuthenticationCubit extends Mock implements AuthenticationCubit<int> {
implements AuthenticationCubit<int> {} }
class MockAccount extends Mock implements Account {} class MockAccount extends Mock implements Account {}

View File

@ -25,8 +25,8 @@ import 'package:wyatt_type_utils/wyatt_type_utils.dart';
class MockAuthenticationRepository extends Mock class MockAuthenticationRepository extends Mock
implements AuthenticationRepository<int> {} implements AuthenticationRepository<int> {}
class MockAuthenticationCubit extends Mock class MockAuthenticationCubit extends Mock implements AuthenticationCubit<int> {
implements AuthenticationCubit<int> {} }
class MockAccount extends Mock implements Account {} class MockAccount extends Mock implements Account {}

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
@ -25,6 +25,7 @@ class CounterBloc extends Bloc<CounterEvent, CounterState> {
final CounterRepository counterRepository; final CounterRepository counterRepository;
CounterBloc(this.counterRepository) : super(const CounterInitial()) { CounterBloc(this.counterRepository) : super(const CounterInitial()) {
on<CounterIncrement>((event, emit) { on<CounterIncrement>((event, emit) {
emit(CounterModified(counterRepository.increment(state.count))); emit(CounterModified(counterRepository.increment(state.count)));
}); });

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
@ -32,3 +32,4 @@ class CounterInitial extends CounterState {
class CounterModified extends CounterState { class CounterModified extends CounterState {
const CounterModified(super.count); const CounterModified(super.count);
} }

View File

@ -24,16 +24,14 @@ class CounterBlocPage
const CounterBlocPage({super.key}); const CounterBlocPage({super.key});
@override @override
CounterBloc create(BuildContext context) => CounterBloc create(BuildContext context) => CounterBloc(repo<CounterRepository>(context));
CounterBloc(repo<CounterRepository>(context));
@override @override
Widget onBuild(BuildContext context, CounterState state) { Widget onBuild(BuildContext context, CounterState state) {
final textTheme = Theme.of(context).textTheme; final textTheme = Theme.of(context).textTheme;
return Scaffold( return Scaffold(
appBar: AppBar(title: const Text('Counter with Bloc')), appBar: AppBar(title: const Text('Counter with Bloc')),
body: body: Center(child: Text('${state.count}', style: textTheme.headline2)),
Center(child: Text('${state.count}', style: textTheme.displayMedium)),
floatingActionButton: Column( floatingActionButton: Column(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,

View File

@ -28,8 +28,7 @@ class CounterConsumerPage
final textTheme = Theme.of(context).textTheme; final textTheme = Theme.of(context).textTheme;
return Scaffold( return Scaffold(
appBar: AppBar(title: const Text('Counter with Consumer')), appBar: AppBar(title: const Text('Counter with Consumer')),
body: body: Center(child: Text('${state.count}', style: textTheme.headline2)),
Center(child: Text('${state.count}', style: textTheme.displayMedium)),
floatingActionButton: Column( floatingActionButton: Column(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
@ -19,20 +19,19 @@ import 'package:bloc_helper_example/counter/repository/counter_repository.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:wyatt_bloc_helper/wyatt_bloc_helper.dart'; import 'package:wyatt_bloc_helper/wyatt_bloc_helper.dart';
class CounterCubitPage extends CubitScreen<CounterCubit, CounterState> { class CounterCubitPage
extends CubitScreen<CounterCubit, CounterState> {
const CounterCubitPage({super.key}); const CounterCubitPage({super.key});
@override @override
CounterCubit create(BuildContext context) => CounterCubit create(BuildContext context) => CounterCubit(repo<CounterRepository>(context));
CounterCubit(repo<CounterRepository>(context));
@override @override
Widget onBuild(BuildContext context, CounterState state) { Widget onBuild(BuildContext context, CounterState state) {
final textTheme = Theme.of(context).textTheme; final textTheme = Theme.of(context).textTheme;
return Scaffold( return Scaffold(
appBar: AppBar(title: const Text('Counter with Cubit')), appBar: AppBar(title: const Text('Counter with Cubit')),
body: body: Center(child: Text('${state.count}', style: textTheme.headline2)),
Center(child: Text('${state.count}', style: textTheme.displayMedium)),
floatingActionButton: Column( floatingActionButton: Column(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
@ -54,4 +53,4 @@ class CounterCubitPage extends CubitScreen<CounterCubit, CounterState> {
), ),
); );
} }
} }

View File

@ -35,7 +35,7 @@ class CounterProviderPage
appBar: AppBar(title: const Text('Counter with Provider')), appBar: AppBar(title: const Text('Counter with Provider')),
body: Center(child: BlocBuilder<CounterBloc, CounterState>( body: Center(child: BlocBuilder<CounterBloc, CounterState>(
builder: (context, state) { builder: (context, state) {
return Text('${state.count}', style: textTheme.displayMedium); return Text('${state.count}', style: textTheme.headline2);
}, },
)), )),
floatingActionButton: Column( floatingActionButton: Column(

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
@ -32,3 +32,4 @@ class CounterInitial extends CounterState {
class CounterModified extends CounterState { class CounterModified extends CounterState {
const CounterModified(super.count); const CounterModified(super.count);
} }

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
@ -23,4 +23,4 @@ class CounterObserver extends BlocObserver {
super.onChange(bloc, change); super.onChange(bloc, change);
debugPrint('${bloc.runtimeType} $change'); debugPrint('${bloc.runtimeType} $change');
} }
} }

View File

@ -20,6 +20,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
void main() { void main() {
Bloc.observer = CounterObserver(); BlocOverrides.runZoned(() => runApp(const CounterRepositoryProviderPage()),
runApp(const CounterRepositoryProviderPage()); blocObserver: CounterObserver());
} }

View File

@ -56,8 +56,7 @@ class MainPage extends StatelessWidget {
onPressed: () => Navigator.of(context) onPressed: () => Navigator.of(context)
.push(MaterialPageRoute(builder: (context) { .push(MaterialPageRoute(builder: (context) {
return BlocProvider<CounterCubit>( return BlocProvider<CounterCubit>(
create: (context) => create: (context) => CounterCubit(context.read<CounterRepository>()),
CounterCubit(context.read<CounterRepository>()),
child: const CounterConsumerPage(), child: const CounterConsumerPage(),
); );
})), })),

View File

@ -25,7 +25,7 @@ mixin BlocBaseProviderMixin<Bloc extends BlocBase<Object>> {
/// Returns another [BlocBase] **not** used by this [BlocBaseProviderMixin]. /// Returns another [BlocBase] **not** used by this [BlocBaseProviderMixin].
/// Short hand for `context.read<AnotherBloc>();` /// Short hand for `context.read<AnotherBloc>();`
/// ///
/// To get [BlocBase] used by by this [BlocBaseProviderMixin] see `bloc()` /// To get [BlocBase] used by by this [BlocBaseProviderMixin] see `bloc()`
AnotherBloc anotherBloc<AnotherBloc>(BuildContext context) => AnotherBloc anotherBloc<AnotherBloc>(BuildContext context) =>
context.read<AnotherBloc>(); context.read<AnotherBloc>();

View File

@ -21,7 +21,7 @@ import 'package:flutter_bloc/flutter_bloc.dart' as blocbase;
/// of helper methods for events. /// of helper methods for events.
mixin BlocProviderMixin<Bloc extends blocbase.Bloc<Event, Object>, Event> { mixin BlocProviderMixin<Bloc extends blocbase.Bloc<Event, Object>, Event> {
/// Add an event to the [Bloc]. /// Add an event to the [Bloc].
/// ///
/// Short hand for `context.read<Bloc>().add(event)`. /// Short hand for `context.read<Bloc>().add(event)`.
void add(BuildContext context, Event event) => void add(BuildContext context, Event event) =>
context.read<Bloc>().add(event); context.read<Bloc>().add(event);

View File

@ -18,14 +18,14 @@ import 'package:flutter/widgets.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
/// {@template multi_provider} /// {@template multi_provider}
/// Merges [MultiRepositoryProvider] and [MultiBlocProvider] widgets into /// Merges [MultiRepositoryProvider] and [MultiBlocProvider] widgets into
/// one widget tree. /// one widget tree.
/// ///
/// [MultiProvider] improves the readability and eliminates the need /// [MultiProvider] improves the readability and eliminates the need
/// to nest multiple providers. /// to nest multiple providers.
/// ///
/// By using [MultiProvider] we can go from: /// By using [MultiProvider] we can go from:
/// ///
/// ```dart /// ```dart
/// MultiRepositoryProvider( /// MultiRepositoryProvider(
/// providers: [ /// providers: [
@ -69,7 +69,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
/// ) /// )
/// ``` /// ```
/// ///
/// [MultiProvider] converts the [RepositoryProvider] and [BlocProvider] lists /// [MultiProvider] converts the [RepositoryProvider] and [BlocProvider] lists
/// into a tree of nested provider widgets. /// into a tree of nested provider widgets.
/// As a result, the only advantage of using [MultiProvider] is /// As a result, the only advantage of using [MultiProvider] is
/// improved readability due to the reduction in nesting and boilerplate. /// improved readability due to the reduction in nesting and boilerplate.

View File

@ -1,4 +1,4 @@
# Copyright (C) 2023 WYATT GROUP # Copyright (C) 2022 WYATT GROUP
# Please see the AUTHORS file for details. # Please see the AUTHORS file for details.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
@ -14,4 +14,6 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
include: package:wyatt_analysis/analysis_options.flutter.yaml
include: package:wyatt_analysis/analysis_options.flutter.experimental.yaml

View File

@ -7,33 +7,31 @@ class ExampleCubit extends Cubit<CrudState> {
FutureOr<void> run() async { FutureOr<void> run() async {
while (true) { while (true) {
await Future<void>.delayed(const Duration(seconds: 1)); await Future.delayed(const Duration(seconds: 1));
emit(CrudLoading()); emit(CrudLoading());
await Future<void>.delayed(const Duration(seconds: 1)); await Future.delayed(const Duration(seconds: 1));
emit(const CrudError('Cubit Error')); emit(CrudError('Cubit Error'));
await Future<void>.delayed(const Duration(seconds: 1)); await Future.delayed(const Duration(seconds: 1));
emit(const CrudLoaded<String>('DATA LOADED')); emit(CrudLoaded<String>('DATA LOADED'));
await Future<void>.delayed(const Duration(seconds: 1)); await Future.delayed(const Duration(seconds: 1));
emit(CrudInitial()); emit(CrudInitial());
} }
} }
FutureOr<void> runList() async { FutureOr<void> runList() async {
while (true) { while (true) {
await Future<void>.delayed(const Duration(seconds: 1)); await Future.delayed(const Duration(seconds: 1));
emit(CrudLoading()); emit(CrudLoading());
await Future<void>.delayed(const Duration(seconds: 1)); await Future.delayed(const Duration(seconds: 1));
emit(const CrudError('Cubit Error')); emit(CrudError('Cubit Error'));
await Future<void>.delayed(const Duration(seconds: 1)); await Future.delayed(const Duration(seconds: 1));
emit( emit(CrudListLoaded<String>([
const CrudListLoaded<String>([ 'DATA LOADED 1',
'DATA LOADED 1', 'DATA LOADED 2',
'DATA LOADED 2', 'DATA LOADED 3',
'DATA LOADED 3', 'DATA LOADED 4'
'DATA LOADED 4' ]));
]), await Future.delayed(const Duration(seconds: 1));
);
await Future<void>.delayed(const Duration(seconds: 1));
emit(CrudInitial()); emit(CrudInitial());
} }
} }

View File

@ -7,7 +7,7 @@ part 'custom_app_bar.g.dart';
@ComponentCopyWithExtension() @ComponentCopyWithExtension()
class CustomAppBar extends TopAppBarComponent with $CustomAppBarCWMixin { class CustomAppBar extends TopAppBarComponent with $CustomAppBarCWMixin {
const CustomAppBar({super.key, super.title}); const CustomAppBar({super.title});
@override @override
Widget build(BuildContext context) => AppBar( Widget build(BuildContext context) => AppBar(
title: Text(title?.data ?? 'Title'), title: Text(title?.data ?? 'Title'),

View File

@ -7,23 +7,19 @@ part 'custom_bottom_bar.g.dart';
@ComponentCopyWithExtension() @ComponentCopyWithExtension()
class CustomBottomBar extends BottomNavigationBarComponent class CustomBottomBar extends BottomNavigationBarComponent
with $CustomBottomBarCWMixin { with $CustomBottomBarCWMixin {
const CustomBottomBar({super.key});
@override @override
Widget build(BuildContext context) => BottomNavigationBar( Widget build(BuildContext context) => BottomNavigationBar(
items: const [ items: [
BottomNavigationBarItem( BottomNavigationBarItem(
icon: Icon( icon: Icon(
Icons.e_mobiledata, Icons.e_mobiledata,
), ),
label: 'Icon 1', label: 'Icon 1'),
),
BottomNavigationBarItem( BottomNavigationBarItem(
icon: Icon( icon: Icon(
Icons.do_not_disturb_off, Icons.do_not_disturb_off,
), ),
label: 'Icon 2', label: 'Icon 2'),
),
], ],
backgroundColor: Colors.blue, backgroundColor: Colors.blue,
); );

View File

@ -7,7 +7,7 @@ part 'custom_error_widget.g.dart';
@ComponentCopyWithExtension() @ComponentCopyWithExtension()
class CustomErrorWidget extends ErrorWidgetComponent class CustomErrorWidget extends ErrorWidgetComponent
with $CustomErrorWidgetCWMixin { with $CustomErrorWidgetCWMixin {
CustomErrorWidget({super.key, super.error}); CustomErrorWidget({super.error});
@override @override
Widget build(BuildContext context) => ColoredBox( Widget build(BuildContext context) => ColoredBox(

View File

@ -7,7 +7,7 @@ part 'custom_loading_widget.g.dart';
@ComponentCopyWithExtension() @ComponentCopyWithExtension()
class CustomLoadingWidget extends LoadingWidgetComponent class CustomLoadingWidget extends LoadingWidgetComponent
with $CustomLoadingWidgetCWMixin { with $CustomLoadingWidgetCWMixin {
CustomLoadingWidget({super.key, super.color}); CustomLoadingWidget({super.color});
@override @override
Widget build(BuildContext context) => Widget build(BuildContext context) =>

View File

@ -6,8 +6,8 @@ import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
class AppThemeComponent { class AppThemeComponent {
static ComponentThemeData get components => ComponentThemeData.raw( static ComponentThemeData get components => ComponentThemeData.raw(
appBar: const CustomAppBar(), appBar: CustomAppBar(),
bottomNavigationBar: const CustomBottomBar(), bottomNavigationBar: CustomBottomBar(),
loadingWidget: CustomLoadingWidget(), loadingWidget: CustomLoadingWidget(),
errorWidget: CustomErrorWidget(), errorWidget: CustomErrorWidget(),
); );

View File

@ -28,63 +28,61 @@ class MyApp extends StatelessWidget {
// This widget is the root of your application. // This widget is the root of your application.
@override @override
Widget build(BuildContext context) => ComponentTheme( Widget build(BuildContext context) {
componentThemeWidget: AppThemeComponent.components, return ComponentTheme(
child: MaterialApp( componentThemeWidget: AppThemeComponent.components,
title: 'Bloc Layout Example', child: MaterialApp(
theme: ThemeData( title: 'Bloc Layout Example',
primarySwatch: Colors.blue, theme: ThemeData(
), primarySwatch: Colors.blue,
home: Scaffold( ),
body: Column( home: Scaffold(
children: [ body: Column(
Expanded( children: [
child: Row( Expanded(
children: [ child: Row(
Expanded( children: [
child: BlocProvider( Expanded(
create: (_) => ExampleCubit()..run(), child: BlocProvider(
child: const ExampleCrudStateManagement(), create: (_) => ExampleCubit()..run(),
), child: ExampleCrudStateManagement(),
), ),
Expanded( ),
child: BlocProvider( Expanded(
create: (_) => ExampleCubit()..runList(), child: BlocProvider(
child: const ExampleListCrudStateManagement(), create: (_) => ExampleCubit()..runList(),
), child: ExampleListCrudStateManagement(),
), ),
], ),
), ],
), ),
Expanded( ),
child: Row( Expanded(
children: [ child: Row(
Expanded( children: [
child: BlocProvider( Expanded(
child: BlocProvider(
create: (_) => ExampleCubit()..run(), create: (_) => ExampleCubit()..run(),
child: const ExampleFrameLayoutCrudConsumer(), child: ExampleFrameLayoutCrudConsumer()),
), ),
), Expanded(
Expanded( child: BlocProvider(
child: BlocProvider(
create: (_) => ExampleCubit()..runList(), create: (_) => ExampleCubit()..runList(),
child: const ExampleFrameLayoutCrudListConsumer(), child: ExampleFrameLayoutCrudListConsumer()),
), ),
), ],
],
),
), ),
], ),
), ],
), ),
), ),
); ),
);
}
} }
class ExampleCrudStateManagement class ExampleCrudStateManagement
extends CrudCubitConsumerScreen<ExampleCubit, String> { extends CrudCubitConsumerScreen<ExampleCubit, String> {
const ExampleCrudStateManagement({super.key});
@override @override
Widget initialBuilder(BuildContext context, CrudInitial state) => Widget initialBuilder(BuildContext context, CrudInitial state) =>
Container(color: Colors.yellow); Container(color: Colors.yellow);
@ -95,8 +93,6 @@ class ExampleCrudStateManagement
class ExampleListCrudStateManagement class ExampleListCrudStateManagement
extends CrudListCubitConsumerScreen<ExampleCubit, String> { extends CrudListCubitConsumerScreen<ExampleCubit, String> {
const ExampleListCrudStateManagement({super.key});
@override @override
Widget initialBuilder(BuildContext context, CrudInitial state) => Widget initialBuilder(BuildContext context, CrudInitial state) =>
Container(color: Colors.green); Container(color: Colors.green);
@ -110,7 +106,7 @@ class ExampleListCrudStateManagement
class ExampleFrameLayoutCrudConsumer class ExampleFrameLayoutCrudConsumer
extends FrameLayoutCrudCubitConsumerScreen<ExampleCubit, String> { extends FrameLayoutCrudCubitConsumerScreen<ExampleCubit, String> {
const ExampleFrameLayoutCrudConsumer({super.key}) const ExampleFrameLayoutCrudConsumer()
: super( : super(
title: 'Example Title', title: 'Example Title',
currentIndex: 0, currentIndex: 0,
@ -123,7 +119,7 @@ class ExampleFrameLayoutCrudConsumer
class ExampleFrameLayoutCrudListConsumer class ExampleFrameLayoutCrudListConsumer
extends FrameLayoutCrudListCubitConsumerScreen<ExampleCubit, String> { extends FrameLayoutCrudListCubitConsumerScreen<ExampleCubit, String> {
const ExampleFrameLayoutCrudListConsumer({super.key}) const ExampleFrameLayoutCrudListConsumer()
: super( : super(
title: 'Example Title', title: 'Example Title',
currentIndex: 0, currentIndex: 0,

View File

@ -12,4 +12,4 @@
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.

View File

@ -20,7 +20,7 @@ import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base;
import 'package:wyatt_crud_bloc/wyatt_crud_bloc.dart'; import 'package:wyatt_crud_bloc/wyatt_crud_bloc.dart';
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart'; import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
mixin CrudMixin<Cubit extends bloc_base.Cubit<dynamic>, mixin CrudMixin<Cubit extends bloc_base.Cubit,
SuccessState extends CrudSuccess> { SuccessState extends CrudSuccess> {
Widget errorBuilder(BuildContext context, CrudError state) => Widget errorBuilder(BuildContext context, CrudError state) =>
context.components.errorWidget?.copyWith(error: state.message.wrap()) ?? context.components.errorWidget?.copyWith(error: state.message.wrap()) ??

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:flutter/widgets.dart'; import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base; import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base;
import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';

View File

@ -16,5 +16,5 @@
export './app_bar_layout_crud_cubit_consumer_screen.dart'; export './app_bar_layout_crud_cubit_consumer_screen.dart';
export './bottom_bar_layout_crud_cubit_consumer_screen.dart'; export './bottom_bar_layout_crud_cubit_consumer_screen.dart';
export './crud_cubit_consumer_screen.dart';
export './frame_layout_crud_cubit_consumer_screen.dart'; export './frame_layout_crud_cubit_consumer_screen.dart';
export './crud_cubit_consumer_screen.dart';

View File

@ -15,8 +15,8 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base;
import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base;
abstract class CrudCubitConsumerScreen<Cubit extends bloc_base.Cubit<CrudState>, abstract class CrudCubitConsumerScreen<Cubit extends bloc_base.Cubit<CrudState>,
T extends Object?> extends CubitConsumerScreen<Cubit, CrudState> T extends Object?> extends CubitConsumerScreen<Cubit, CrudState>

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
export './crud_cubit_screen.dart';
export 'app_bar_layout_crud_cubit_screen.dart'; export 'app_bar_layout_crud_cubit_screen.dart';
export 'bottom_bar_layout_crud_cubit_screen.dart'; export 'bottom_bar_layout_crud_cubit_screen.dart';
export 'frame_layout_crud_cubit_screen.dart'; export 'frame_layout_crud_cubit_screen.dart';
export './crud_cubit_screen.dart';

View File

@ -15,8 +15,8 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base;
import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart'; import 'package:wyatt_bloc_layout/wyatt_bloc_layout.dart';
import 'package:flutter_bloc/flutter_bloc.dart' as bloc_base;
abstract class CrudCubitScreen<Cubit extends bloc_base.Cubit<CrudState>, abstract class CrudCubitScreen<Cubit extends bloc_base.Cubit<CrudState>,
T extends Object?> extends CubitScreen<Cubit, CrudState> T extends Object?> extends CubitScreen<Cubit, CrudState>

View File

@ -14,11 +14,11 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
export 'package:flutter_bloc/flutter_bloc.dart';
export 'package:wyatt_bloc_helper/wyatt_bloc_helper.dart';
export 'package:wyatt_crud_bloc/wyatt_crud_bloc.dart';
export 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
export 'package:wyatt_ui_layout/wyatt_wyatt_ui_layout.dart';
export 'core/core.dart';
export 'presentation/presentation.dart'; export 'presentation/presentation.dart';
export 'core/core.dart';
export 'package:flutter_bloc/flutter_bloc.dart';
export 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
export 'package:wyatt_crud_bloc/wyatt_crud_bloc.dart';
export 'package:wyatt_ui_layout/wyatt_wyatt_ui_layout.dart';
export 'package:wyatt_bloc_helper/wyatt_bloc_helper.dart';

View File

@ -3,17 +3,14 @@ description: Layouts based on bloc helper library
repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_bloc_layout repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/wyatt_bloc_layout
version: 0.0.1 version: 0.0.1
publish_to: "none"
environment: environment:
sdk: ">=2.17.0 <3.0.0" sdk: '>=2.17.0 <3.0.0'
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
flutter_bloc: ^8.1.2
wyatt_bloc_helper: wyatt_bloc_helper:
git: git:
url: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages url: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages
@ -35,11 +32,13 @@ dependencies:
path: packages/wyatt_ui_components path: packages/wyatt_ui_components
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
wyatt_analysis: wyatt_analysis:
git: git:
url: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages url: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages
ref: wyatt_analysis-v2.4.0 ref: wyatt_analysis-v2.4.0
path: packages/wyatt_analysis path: packages/wyatt_analysis

View File

@ -1 +1,7 @@
include: package:wyatt_analysis/analysis_options.yaml include: package:wyatt_analysis/analysis_options.yaml

View File

@ -3,8 +3,6 @@ description: Generator for copywith method for components.
repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/component_copy_with_gen repository: https://git.wyatt-studio.fr/Wyatt-FOSS/wyatt-packages/src/branch/master/packages/component_copy_with_gen
version: 1.0.0 version: 1.0.0
publish_to: "none"
environment: environment:
sdk: ">=2.19.0 <3.0.0" sdk: ">=2.19.0 <3.0.0"

View File

@ -92,6 +92,7 @@ class MyHomePage extends StatelessWidget {
); );
}, },
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
ElevatedButton( ElevatedButton(
onPressed: () { onPressed: () {
@ -120,7 +121,9 @@ class MyHomePage extends StatelessWidget {
), ),
ElevatedButton( ElevatedButton(
onPressed: () { onPressed: () {
context.read<UserCubit>().query([LimitQuery(2)]); context
.read<UserCubit>()
.query([LimitQuery(2)]);
}, },
child: const Text("Query"), child: const Text("Query"),
), ),

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.

View File

@ -24,6 +24,7 @@ import 'package:wyatt_crud_bloc/src/domain/entities/query.dart';
class CrudInMemoryDataSourceImpl<Model extends ObjectModel> class CrudInMemoryDataSourceImpl<Model extends ObjectModel>
extends CrudDataSource<Model> { extends CrudDataSource<Model> {
CrudInMemoryDataSourceImpl({required this.toMap, Map<String, Model>? data}) CrudInMemoryDataSourceImpl({required this.toMap, Map<String, Model>? data})
: _data = data ?? {}; : _data = data ?? {};
final Map<String, Model> _data; final Map<String, Model> _data;

View File

@ -22,6 +22,7 @@ import 'package:wyatt_crud_bloc/src/domain/entities/query.dart';
class CrudFirestoreDataSourceImpl<Model extends ObjectModel, Entity> class CrudFirestoreDataSourceImpl<Model extends ObjectModel, Entity>
extends CrudDataSource<Model> { extends CrudDataSource<Model> {
CrudFirestoreDataSourceImpl( CrudFirestoreDataSourceImpl(
String collection, { String collection, {
required Model Function( required Model Function(

View File

@ -23,6 +23,7 @@ import 'package:wyatt_type_utils/wyatt_type_utils.dart';
class CrudRepositoryImpl<Model extends ObjectModel> class CrudRepositoryImpl<Model extends ObjectModel>
extends CrudRepository<Model> { extends CrudRepository<Model> {
CrudRepositoryImpl({ CrudRepositoryImpl({
required CrudDataSource<Model> crudDataSource, required CrudDataSource<Model> crudDataSource,
}) : _crudDataSource = crudDataSource; }) : _crudDataSource = crudDataSource;

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.

View File

@ -25,6 +25,7 @@ abstract class QueryParser<Q> {
abstract class QueryInterface extends Entity {} abstract class QueryInterface extends Entity {}
class WhereQuery<Value> extends QueryInterface { class WhereQuery<Value> extends QueryInterface {
WhereQuery(this.type, this.field, this.value); WhereQuery(this.type, this.field, this.value);
final WhereQueryType type; final WhereQueryType type;
final String field; final String field;
@ -32,11 +33,13 @@ class WhereQuery<Value> extends QueryInterface {
} }
class LimitQuery extends QueryInterface { class LimitQuery extends QueryInterface {
LimitQuery(this.limit); LimitQuery(this.limit);
final int limit; final int limit;
} }
class OrderByQuery extends QueryInterface { class OrderByQuery extends QueryInterface {
OrderByQuery(this.field, {this.ascending = true}); OrderByQuery(this.field, {this.ascending = true});
final String field; final String field;
final bool ascending; final bool ascending;

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.

View File

@ -21,6 +21,7 @@ import 'package:wyatt_crud_bloc/src/domain/entities/object_model.dart';
import 'package:wyatt_crud_bloc/src/domain/repositories/crud_repository.dart'; import 'package:wyatt_crud_bloc/src/domain/repositories/crud_repository.dart';
class Delete<Model extends ObjectModel> extends AsyncUseCase<String, void> { class Delete<Model extends ObjectModel> extends AsyncUseCase<String, void> {
Delete(this._crudRepository); Delete(this._crudRepository);
final CrudRepository<Model> _crudRepository; final CrudRepository<Model> _crudRepository;

View File

@ -19,6 +19,7 @@ import 'package:wyatt_crud_bloc/src/domain/entities/object_model.dart';
import 'package:wyatt_crud_bloc/src/domain/repositories/crud_repository.dart'; import 'package:wyatt_crud_bloc/src/domain/repositories/crud_repository.dart';
class DeleteAll<Model extends ObjectModel> extends AsyncUseCase<void, void> { class DeleteAll<Model extends ObjectModel> extends AsyncUseCase<void, void> {
DeleteAll(this._crudRepository); DeleteAll(this._crudRepository);
final CrudRepository<Model> _crudRepository; final CrudRepository<Model> _crudRepository;

View File

@ -21,6 +21,7 @@ import 'package:wyatt_crud_bloc/src/domain/entities/object_model.dart';
import 'package:wyatt_crud_bloc/src/domain/repositories/crud_repository.dart'; import 'package:wyatt_crud_bloc/src/domain/repositories/crud_repository.dart';
class Get<Model extends ObjectModel> extends AsyncUseCase<String, Model?> { class Get<Model extends ObjectModel> extends AsyncUseCase<String, Model?> {
Get(this._crudRepository); Get(this._crudRepository);
final CrudRepository<Model> _crudRepository; final CrudRepository<Model> _crudRepository;

View File

@ -20,6 +20,7 @@ import 'package:wyatt_crud_bloc/src/domain/repositories/crud_repository.dart';
class GetAll<Model extends ObjectModel> class GetAll<Model extends ObjectModel>
extends AsyncUseCase<void, List<Model?>> { extends AsyncUseCase<void, List<Model?>> {
GetAll(this._crudRepository); GetAll(this._crudRepository);
final CrudRepository<Model> _crudRepository; final CrudRepository<Model> _crudRepository;

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.

View File

@ -20,7 +20,7 @@ import 'package:wyatt_crud_bloc/src/domain/entities/query.dart';
class StreamParameters { class StreamParameters {
final String? id; final String? id;
final List<QueryInterface>? conditions; final List<QueryInterface>? conditions;
StreamParameters({ StreamParameters({
this.id, this.id,
this.conditions, this.conditions,

View File

@ -19,7 +19,7 @@ class UpdateParameters<Model> {
final String id; final String id;
final Model? object; final Model? object;
final Map<String, dynamic>? raw; final Map<String, dynamic>? raw;
UpdateParameters({ UpdateParameters({
required this.id, required this.id,
this.object, this.object,

View File

@ -23,6 +23,7 @@ import 'package:wyatt_crud_bloc/src/domain/repositories/crud_repository.dart';
class Query<Model extends ObjectModel> class Query<Model extends ObjectModel>
extends AsyncUseCase<List<QueryInterface>, List<Model?>> { extends AsyncUseCase<List<QueryInterface>, List<Model?>> {
Query(this._crudRepository); Query(this._crudRepository);
final CrudRepository<Model> _crudRepository; final CrudRepository<Model> _crudRepository;

View File

@ -14,8 +14,9 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
// class Stream<Model extends ObjectModel> extends UseCase<StreamParameters,
//List<Model?>> {
// class Stream<Model extends ObjectModel> extends UseCase<StreamParameters, List<Model?>> {
// final CrudRepository<Model> _crudRepository; // final CrudRepository<Model> _crudRepository;
// Stream(this._crudRepository); // Stream(this._crudRepository);
@ -37,8 +38,7 @@
// throw ClientException('Stream parameters cannot be null.'); // throw ClientException('Stream parameters cannot be null.');
// } // }
// } // }
// @override // @override
// FutureOrResult<Stream<List<Model?>>> call(StreamParameters? params) => // FutureOrResult<Stream<List<Model?>>> call(StreamParameters? params) => _crudRepository.stream();
// _crudRepository.stream();
// } // }

View File

@ -23,6 +23,7 @@ import 'package:wyatt_crud_bloc/src/domain/usecases/params/update_parameters.dar
class Update<Model extends ObjectModel> class Update<Model extends ObjectModel>
extends AsyncUseCase<UpdateParameters<Model>, void> { extends AsyncUseCase<UpdateParameters<Model>, void> {
Update(this._crudRepository); Update(this._crudRepository);
final CrudRepository<Model> _crudRepository; final CrudRepository<Model> _crudRepository;

View File

@ -22,6 +22,7 @@ import 'package:wyatt_crud_bloc/src/domain/repositories/crud_repository.dart';
class UpdateAll<Model extends ObjectModel> class UpdateAll<Model extends ObjectModel>
extends AsyncUseCase<Map<String, Object?>, void> { extends AsyncUseCase<Map<String, Object?>, void> {
UpdateAll(this._crudRepository); UpdateAll(this._crudRepository);
final CrudRepository<Model> _crudRepository; final CrudRepository<Model> _crudRepository;

View File

@ -1,16 +1,16 @@
// Copyright (C) 2022 WYATT GROUP // Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details. // Please see the AUTHORS file for details.
// //
// This program is free software: you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.

Some files were not shown because too many files have changed in this diff Show More