initial commit (migrated)

This commit is contained in:
fiatcode 2025-10-20 16:43:59 +07:00
commit b594facb51
143 changed files with 11057 additions and 0 deletions

View 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;
}