chore: fix and format using melos
This commit is contained in:
-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