initial commit (migrated)
This commit is contained in:
commit
b594facb51
143 changed files with 11057 additions and 0 deletions
28
lib/features/quote/domain/entities/background_photos.dart
Normal file
28
lib/features/quote/domain/entities/background_photos.dart
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:kuwot/features/quote/data/models/photo_list_model.dart';
|
||||
|
||||
part 'background_photos.freezed.dart';
|
||||
|
||||
@freezed
|
||||
abstract class BackgroundPhotos with _$BackgroundPhotos {
|
||||
const factory BackgroundPhotos({required List<Photo> photos}) =
|
||||
_BackgroundPhotos;
|
||||
|
||||
static BackgroundPhotos fromModel(PhotoListModel model) => BackgroundPhotos(
|
||||
photos: model.photos.map<Photo>((e) {
|
||||
return Photo(
|
||||
url: buildPortraitImageUrl(e.src.original),
|
||||
avgColor: e.avgColor,
|
||||
);
|
||||
}).toList(),
|
||||
);
|
||||
|
||||
static String buildPortraitImageUrl(String originalUrl) =>
|
||||
'$originalUrl?auto=compress&cs=tinysrgb&fit=crop&h=2400&w=1200';
|
||||
}
|
||||
|
||||
@freezed
|
||||
abstract class Photo with _$Photo {
|
||||
const factory Photo({required String url, required String avgColor}) =
|
||||
_BackgroundImage;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue