chore: fix and format using melos
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
// 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:architecture_example/data/models/photo_model.dart';
|
||||
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
@@ -24,7 +24,6 @@ import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
import 'package:wyatt_type_utils/wyatt_type_utils.dart';
|
||||
|
||||
class PhotoRepositoryImpl extends PhotoRepository {
|
||||
|
||||
PhotoRepositoryImpl(
|
||||
this._photoRemoteDataSource,
|
||||
this._albumRemoteDataSource,
|
||||
|
||||
+3
-3
@@ -1,16 +1,16 @@
|
||||
// Copyright (C) 2022 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
+3
-3
@@ -1,16 +1,16 @@
|
||||
// Copyright (C) 2022 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
+3
-3
@@ -1,16 +1,16 @@
|
||||
// Copyright (C) 2022 WYATT GROUP
|
||||
// Please see the AUTHORS file for details.
|
||||
//
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// any later version.
|
||||
//
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
-1
@@ -21,7 +21,6 @@ import 'package:architecture_example/domain/repositories/photo_repository.dart';
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
|
||||
class AddPhotoToFavorites extends AsyncUseCase<Photo, List<Photo>> {
|
||||
|
||||
AddPhotoToFavorites(this._photoRepository);
|
||||
final PhotoRepository _photoRepository;
|
||||
|
||||
|
||||
-1
@@ -20,7 +20,6 @@ import 'package:architecture_example/domain/repositories/photo_repository.dart';
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
|
||||
class CheckIfPhotoIsInFavorites extends AsyncUseCase<int, bool> {
|
||||
|
||||
CheckIfPhotoIsInFavorites(this._photoRepository);
|
||||
final PhotoRepository _photoRepository;
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ import 'package:architecture_example/domain/repositories/photo_repository.dart';
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
|
||||
class DisplayFavorites extends AsyncUseCase<NoParam, List<Photo>> {
|
||||
|
||||
DisplayFavorites(this._photoRepository);
|
||||
final PhotoRepository _photoRepository;
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import 'package:architecture_example/domain/repositories/photo_repository.dart';
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
|
||||
class DisplayPhoto extends AsyncUseCase<int, Photo> {
|
||||
|
||||
DisplayPhoto(this._photoRepository);
|
||||
final PhotoRepository _photoRepository;
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ import 'package:architecture_example/domain/usecases/photos/params/query_paramet
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
|
||||
class OpenAlbum extends AsyncUseCase<QueryParameters, List<Photo>> {
|
||||
|
||||
OpenAlbum(this._photoRepository);
|
||||
final PhotoRepository _photoRepository;
|
||||
|
||||
|
||||
-1
@@ -15,7 +15,6 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
class QueryParameters {
|
||||
|
||||
QueryParameters(this.start, this.limit, {this.albumId = -1});
|
||||
final int albumId;
|
||||
final int? start;
|
||||
|
||||
-1
@@ -21,7 +21,6 @@ import 'package:architecture_example/domain/repositories/photo_repository.dart';
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
|
||||
class RemovePhotoFromFavorites extends AsyncUseCase<int, List<Photo>> {
|
||||
|
||||
RemovePhotoFromFavorites(this._photoRepository);
|
||||
final PhotoRepository _photoRepository;
|
||||
|
||||
|
||||
-1
@@ -22,7 +22,6 @@ import 'package:architecture_example/domain/usecases/photos/params/query_paramet
|
||||
import 'package:wyatt_architecture/wyatt_architecture.dart';
|
||||
|
||||
class RetrieveAllAlbums extends AsyncUseCase<QueryParameters, List<Album>> {
|
||||
|
||||
RetrieveAllAlbums(this._photoRepository);
|
||||
final PhotoRepository _photoRepository;
|
||||
|
||||
|
||||
-1
@@ -33,7 +33,6 @@ EventTransformer<E> throttleDroppable<E>(Duration duration) =>
|
||||
(events, mapper) => droppable<E>().call(events.throttle(duration), mapper);
|
||||
|
||||
class AlbumBloc extends Bloc<AlbumEvent, AlbumState> {
|
||||
|
||||
AlbumBloc(this._retrieveAllAlbums) : super(const AlbumState()) {
|
||||
on<AlbumFetched>(
|
||||
_onAlbumFetched,
|
||||
|
||||
+5
-2
@@ -22,8 +22,11 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
class AlbumsList extends StatefulWidget {
|
||||
const AlbumsList(
|
||||
{required this.albums, required this.hasReachedMax, super.key,});
|
||||
const AlbumsList({
|
||||
required this.albums,
|
||||
required this.hasReachedMax,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final List<Album> albums;
|
||||
final bool hasReachedMax;
|
||||
|
||||
-2
@@ -26,7 +26,6 @@ abstract class PhotoDetailsState extends Equatable {
|
||||
class PhotoDetailsInitial extends PhotoDetailsState {}
|
||||
|
||||
class PhotoDetailsSuccess extends PhotoDetailsState {
|
||||
|
||||
const PhotoDetailsSuccess(this.photo, {required this.isFavorite});
|
||||
final Photo photo;
|
||||
final bool isFavorite;
|
||||
@@ -36,7 +35,6 @@ class PhotoDetailsSuccess extends PhotoDetailsState {
|
||||
}
|
||||
|
||||
class PhotoDetailsFailure extends PhotoDetailsState {
|
||||
|
||||
const PhotoDetailsFailure(this.error);
|
||||
final String error;
|
||||
|
||||
|
||||
-1
@@ -23,7 +23,6 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
part 'favorite_checker_state.dart';
|
||||
|
||||
class FavoriteCheckerCubit extends Cubit<FavoriteCheckerState> {
|
||||
|
||||
FavoriteCheckerCubit(this._checkIfPhotoIsInFavorites)
|
||||
: super(FavoriteCheckerInitial());
|
||||
final CheckIfPhotoIsInFavorites _checkIfPhotoIsInFavorites;
|
||||
|
||||
-2
@@ -10,7 +10,6 @@ abstract class FavoriteCheckerState extends Equatable {
|
||||
class FavoriteCheckerInitial extends FavoriteCheckerState {}
|
||||
|
||||
class FavoriteCheckerSuccess extends FavoriteCheckerState {
|
||||
|
||||
const FavoriteCheckerSuccess(this.photoId, {required this.isFavorite});
|
||||
final int photoId;
|
||||
final bool isFavorite;
|
||||
@@ -20,7 +19,6 @@ class FavoriteCheckerSuccess extends FavoriteCheckerState {
|
||||
}
|
||||
|
||||
class FavoriteCheckerFailure extends FavoriteCheckerState {
|
||||
|
||||
const FavoriteCheckerFailure(this.error);
|
||||
final String error;
|
||||
|
||||
|
||||
-1
@@ -33,7 +33,6 @@ EventTransformer<E> throttleDroppable<E>(Duration duration) =>
|
||||
(events, mapper) => droppable<E>().call(events.throttle(duration), mapper);
|
||||
|
||||
class PhotoBloc extends Bloc<PhotoEvent, PhotoState> {
|
||||
|
||||
PhotoBloc(this._openAlbum) : super(const PhotoState()) {
|
||||
on<PhotoFetched>(
|
||||
_onPhotoFetched,
|
||||
|
||||
-1
@@ -24,7 +24,6 @@ abstract class PhotoEvent extends Equatable {
|
||||
}
|
||||
|
||||
class PhotoFetched extends PhotoEvent {
|
||||
|
||||
const PhotoFetched(this.albumId);
|
||||
final int albumId;
|
||||
}
|
||||
|
||||
+13
-13
@@ -71,17 +71,17 @@ class _PhotosGridState extends State<PhotosGrid> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => GridView.builder(
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisSpacing: 4,
|
||||
mainAxisSpacing: 4,
|
||||
crossAxisCount: 4,
|
||||
),
|
||||
itemCount: widget.hasReachedMax
|
||||
? widget.photos.length
|
||||
: widget.photos.length + 1,
|
||||
controller: _scrollController,
|
||||
itemBuilder: (context, index) => index >= widget.photos.length
|
||||
? const BottomLoader()
|
||||
: PhotosGridThumbnail(photo: widget.photos[index]),
|
||||
);
|
||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisSpacing: 4,
|
||||
mainAxisSpacing: 4,
|
||||
crossAxisCount: 4,
|
||||
),
|
||||
itemCount: widget.hasReachedMax
|
||||
? widget.photos.length
|
||||
: widget.photos.length + 1,
|
||||
controller: _scrollController,
|
||||
itemBuilder: (context, index) => index >= widget.photos.length
|
||||
? const BottomLoader()
|
||||
: PhotosGridThumbnail(photo: widget.photos[index]),
|
||||
);
|
||||
}
|
||||
|
||||
+4
-1
@@ -55,7 +55,10 @@ class PhotosGridThumbnail
|
||||
),
|
||||
if (state is FavoriteCheckerSuccess && state.isFavorite) ...[
|
||||
const Positioned(
|
||||
bottom: 10, right: 10, child: Icon(Icons.favorite),)
|
||||
bottom: 10,
|
||||
right: 10,
|
||||
child: Icon(Icons.favorite),
|
||||
)
|
||||
]
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user