formatting

This commit is contained in:
mertalev 2025-07-26 14:22:22 -04:00
parent ce1585255e
commit 39e4f2b4c3
No known key found for this signature in database
GPG Key ID: DF6ABC77AAD98C95
10 changed files with 28 additions and 48 deletions

View File

@ -23,8 +23,7 @@ class AssetMediaRepository {
final actualSize = actualWidth * actualHeight * 4; final actualSize = actualWidth * actualHeight * 4;
try { try {
final buffer = final buffer = await ImmutableBuffer.fromUint8List(pointer.asTypedList(actualSize));
await ImmutableBuffer.fromUint8List(pointer.asTypedList(actualSize));
final descriptor = ui.ImageDescriptor.raw( final descriptor = ui.ImageDescriptor.raw(
buffer, buffer,
width: actualWidth, width: actualWidth,

View File

@ -69,8 +69,7 @@ Future<void> initApp() async {
} }
} }
PaintingBinding.instance.imageCache.maximumSizeBytes = PaintingBinding.instance.imageCache.maximumSizeBytes = kTimelineImageCacheMemory;
kTimelineImageCacheMemory;
await DynamicTheme.fetchSystemPalette(); await DynamicTheme.fetchSystemPalette();

View File

@ -588,10 +588,7 @@ class _AssetViewerState extends ConsumerState<AssetViewer> {
// Using multiple selectors to avoid unnecessary rebuilds for other state changes // Using multiple selectors to avoid unnecessary rebuilds for other state changes
ref.watch( ref.watch(
assetViewerProvider.select( assetViewerProvider.select(
(s) => (s) => s.showingBottomSheet.hashCode ^ s.backgroundOpacity.hashCode ^ s.stackIndex.hashCode,
s.showingBottomSheet.hashCode ^
s.backgroundOpacity.hashCode ^
s.stackIndex.hashCode,
), ),
); );
ref.watch(isPlayingMotionVideoProvider); ref.watch(isPlayingMotionVideoProvider);

View File

@ -40,8 +40,7 @@ class LocalThumbProvider extends ImageProvider<LocalThumbProvider> {
} }
Future<ImageInfo> _codec(LocalThumbProvider key) async { Future<ImageInfo> _codec(LocalThumbProvider key) async {
final codec = final codec = await _assetMediaRepository.getLocalThumbnail(key.id, key.size);
await _assetMediaRepository.getLocalThumbnail(key.id, key.size);
return ImageInfo(image: (await codec.getNextFrame()).image, scale: 1.0); return ImageInfo(image: (await codec.getNextFrame()).image, scale: 1.0);
} }
@ -49,9 +48,7 @@ class LocalThumbProvider extends ImageProvider<LocalThumbProvider> {
bool operator ==(Object other) { bool operator ==(Object other) {
if (identical(this, other)) return true; if (identical(this, other)) return true;
if (other is LocalThumbProvider) { if (other is LocalThumbProvider) {
return id == other.id && return id == other.id && size == other.size && updatedAt == other.updatedAt;
size == other.size &&
updatedAt == other.updatedAt;
} }
return false; return false;
} }
@ -82,8 +79,7 @@ class LocalFullImageProvider extends ImageProvider<LocalFullImageProvider> {
} }
Future<ImageInfo> _codec(LocalFullImageProvider key) async { Future<ImageInfo> _codec(LocalFullImageProvider key) async {
final devicePixelRatio = final devicePixelRatio = PlatformDispatcher.instance.views.first.devicePixelRatio;
PlatformDispatcher.instance.views.first.devicePixelRatio;
final codec = await _assetMediaRepository.getLocalThumbnail( final codec = await _assetMediaRepository.getLocalThumbnail(
key.id, key.id,
Size(size.width * devicePixelRatio, size.height * devicePixelRatio), Size(size.width * devicePixelRatio, size.height * devicePixelRatio),

View File

@ -106,8 +106,7 @@ class _ThumbnailState extends State<Thumbnail> {
super.didUpdateWidget(oldWidget); super.didUpdateWidget(oldWidget);
if (oldWidget.imageProvider != widget.imageProvider || if (oldWidget.imageProvider != widget.imageProvider ||
oldWidget.blurhash != widget.blurhash || oldWidget.blurhash != widget.blurhash ||
(oldWidget.thumbhashMode == ThumbhashMode.disabled && (oldWidget.thumbhashMode == ThumbhashMode.disabled && oldWidget.thumbhashMode != ThumbhashMode.disabled)) {
oldWidget.thumbhashMode != ThumbhashMode.disabled)) {
_loadImage(); _loadImage();
} }
} }
@ -120,13 +119,11 @@ class _ThumbnailState extends State<Thumbnail> {
void _loadImage() { void _loadImage() {
_stopListeningToStream(); _stopListeningToStream();
if (widget.thumbhashMode != ThumbhashMode.disabled && if (widget.thumbhashMode != ThumbhashMode.disabled && widget.blurhash != null) {
widget.blurhash != null) {
_decodeThumbhash(); _decodeThumbhash();
} }
if (widget.thumbhashMode != ThumbhashMode.only && if (widget.thumbhashMode != ThumbhashMode.only && widget.imageProvider != null) {
widget.imageProvider != null) {
_loadFromProvider(); _loadFromProvider();
} }
} }
@ -298,9 +295,7 @@ class _ThumbnailRenderBox extends RenderBox {
if (_fadeStartTime != null) { if (_fadeStartTime != null) {
final elapsed = DateTime.now().difference(_fadeStartTime!); final elapsed = DateTime.now().difference(_fadeStartTime!);
_crossFadeProgress = _crossFadeProgress = (elapsed.inMilliseconds / _fadeDuration.inMilliseconds).clamp(0.0, 1.0);
(elapsed.inMilliseconds / _fadeDuration.inMilliseconds)
.clamp(0.0, 1.0);
if (_crossFadeProgress < 1.0) { if (_crossFadeProgress < 1.0) {
SchedulerBinding.instance.scheduleFrameCallback((_) { SchedulerBinding.instance.scheduleFrameCallback((_) {

View File

@ -40,8 +40,7 @@ class ThumbnailTile extends ConsumerWidget {
final isSelected = ref.watch( final isSelected = ref.watch(
multiSelectProvider.select((multiselect) => multiselect.selectedAssets.contains(asset)), multiSelectProvider.select((multiselect) => multiselect.selectedAssets.contains(asset)),
); );
final isScrubbing = final isScrubbing = ref.watch(timelineStateProvider.select((state) => state.isScrubbing));
ref.watch(timelineStateProvider.select((state) => state.isScrubbing));
final borderStyle = lockSelection final borderStyle = lockSelection
? BoxDecoration( ? BoxDecoration(
@ -74,9 +73,7 @@ class ThumbnailTile extends ConsumerWidget {
tag: '${asset?.heroTag ?? ''}_$heroIndex', tag: '${asset?.heroTag ?? ''}_$heroIndex',
child: Thumbnail.fromBaseAsset( child: Thumbnail.fromBaseAsset(
asset: asset, asset: asset,
thumbhashMode: isScrubbing thumbhashMode: isScrubbing ? ThumbhashMode.only : ThumbhashMode.enabled,
? ThumbhashMode.only
: ThumbhashMode.enabled,
), ),
), ),
), ),

View File

@ -61,11 +61,11 @@ class DriftMemoryCard extends ConsumerWidget {
Colors.black.withValues(alpha: 0.2), Colors.black.withValues(alpha: 0.2),
BlendMode.darken, BlendMode.darken,
), ),
child: SizedBox( child: SizedBox(
width: 205, width: 205,
height: 200, height: 200,
child: Thumbnail.fromBaseAsset(asset: memory.assets[0]), child: Thumbnail.fromBaseAsset(asset: memory.assets[0]),
), ),
), ),
Positioned( Positioned(
bottom: 16, bottom: 16,

View File

@ -130,8 +130,8 @@ class _FixedSegmentRow extends ConsumerWidget {
future: timelineService.loadAssets(assetIndex, assetCount), future: timelineService.loadAssets(assetIndex, assetCount),
builder: (context, snapshot) { builder: (context, snapshot) {
return _buildAssetRow(context, snapshot.data, timelineService); return _buildAssetRow(context, snapshot.data, timelineService);
}, },
); );
} }
} }
@ -212,14 +212,12 @@ class _AssetTileWidget extends ConsumerWidget {
return GestureDetector( return GestureDetector(
onTap: () => lockSelection || asset == null ? null : _handleOnTap(context, ref, assetIndex, asset, heroOffset), onTap: () => lockSelection || asset == null ? null : _handleOnTap(context, ref, assetIndex, asset, heroOffset),
onLongPress: () => lockSelection || asset == null onLongPress: () => lockSelection || asset == null ? null : _handleOnLongPress(ref, asset),
? null child: ThumbnailTile(
: _handleOnLongPress(ref, asset), asset,
child: ThumbnailTile( lockSelection: lockSelection,
asset, showStorageIndicator: showStorageIndicator,
lockSelection: lockSelection, heroOffset: heroOffset,
showStorageIndicator: showStorageIndicator,
heroOffset: heroOffset,
), ),
); );
} }

View File

@ -68,8 +68,7 @@ class ImmichThumbnail extends HookConsumerWidget {
fadeInDuration: Duration.zero, fadeInDuration: Duration.zero,
fadeOutDuration: const Duration(milliseconds: 100), fadeOutDuration: const Duration(milliseconds: 100),
octoSet: OctoSet( octoSet: OctoSet(
placeholderBuilder: placeholderBuilder: blurHashPlaceholderBuilder(asset?.thumbhash, fit: fit),
blurHashPlaceholderBuilder(asset?.thumbhash, fit: fit),
errorBuilder: customErrorBuilder, errorBuilder: customErrorBuilder,
), ),
image: thumbnailProviderInstance, image: thumbnailProviderInstance,