mirror of
https://github.com/immich-app/immich.git
synced 2025-07-31 15:08:44 -04:00
top 10 worst rebases of all time, 0/10
This commit is contained in:
parent
d670ed18af
commit
e154240335
@ -36,11 +36,7 @@ class AssetMediaRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Uint8List?> getThumbnail(
|
Future<Uint8List?> getThumbnail(String id, {int quality = 80, ui.Size size = const ui.Size.square(256)}) =>
|
||||||
String id, {
|
|
||||||
int quality = 80,
|
|
||||||
ui.Size size = const ui.Size.square(256),
|
|
||||||
}) =>
|
|
||||||
AssetEntity(
|
AssetEntity(
|
||||||
id: id,
|
id: id,
|
||||||
// The below fields are not used in thumbnailDataWithSize but are required
|
// The below fields are not used in thumbnailDataWithSize but are required
|
||||||
@ -49,8 +45,5 @@ class AssetMediaRepository {
|
|||||||
typeInt: AssetType.image.index,
|
typeInt: AssetType.image.index,
|
||||||
width: size.width.toInt(),
|
width: size.width.toInt(),
|
||||||
height: size.height.toInt(),
|
height: size.height.toInt(),
|
||||||
).thumbnailDataWithSize(
|
).thumbnailDataWithSize(ThumbnailSize(size.width.toInt(), size.height.toInt()), quality: quality);
|
||||||
ThumbnailSize(size.width.toInt(), size.height.toInt()),
|
|
||||||
quality: quality,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
@ -164,9 +164,7 @@ class _PlaceTile extends StatelessWidget {
|
|||||||
onTap: () => context.pushRoute(DriftPlaceDetailRoute(place: place.$1)),
|
onTap: () => context.pushRoute(DriftPlaceDetailRoute(place: place.$1)),
|
||||||
title: Text(place.$1, style: context.textTheme.titleMedium?.copyWith(fontWeight: FontWeight.w500)),
|
title: Text(place.$1, style: context.textTheme.titleMedium?.copyWith(fontWeight: FontWeight.w500)),
|
||||||
leading: ClipRRect(
|
leading: ClipRRect(
|
||||||
borderRadius: const BorderRadius.all(
|
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||||
Radius.circular(20),
|
|
||||||
),
|
|
||||||
child: Thumbnail(
|
child: Thumbnail(
|
||||||
imageProvider: RemoteThumbProvider(assetId: place.$2),
|
imageProvider: RemoteThumbProvider(assetId: place.$2),
|
||||||
size: const Size(80, 80),
|
size: const Size(80, 80),
|
||||||
|
@ -436,7 +436,11 @@ class _AlbumList extends ConsumerWidget {
|
|||||||
leading: album.thumbnailAssetId != null
|
leading: album.thumbnailAssetId != null
|
||||||
? ClipRRect(
|
? ClipRRect(
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(15)),
|
borderRadius: const BorderRadius.all(Radius.circular(15)),
|
||||||
child: SizedBox(width: 80, height: 80, child: Thumbnail(imageProvider: RemoteThumbProvider(assetId: album.thumbnailAssetId!))),
|
child: SizedBox(
|
||||||
|
width: 80,
|
||||||
|
height: 80,
|
||||||
|
child: Thumbnail(imageProvider: RemoteThumbProvider(assetId: album.thumbnailAssetId!)),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
: SizedBox(
|
: SizedBox(
|
||||||
width: 80,
|
width: 80,
|
||||||
|
@ -147,11 +147,7 @@ class _AssetViewerState extends ConsumerState<AssetViewer> {
|
|||||||
// Precache both thumbnail and full image for smooth transitions
|
// Precache both thumbnail and full image for smooth transitions
|
||||||
unawaited(
|
unawaited(
|
||||||
Future.wait([
|
Future.wait([
|
||||||
precacheImage(
|
precacheImage(getThumbnailImageProvider(asset: asset), context, onError: (_, __) {}),
|
||||||
getThumbnailImageProvider(asset: asset),
|
|
||||||
context,
|
|
||||||
onError: (_, __) {},
|
|
||||||
),
|
|
||||||
precacheImage(getFullImageProvider(asset, size: screenSize), context, onError: (_, __) {}),
|
precacheImage(getFullImageProvider(asset, size: screenSize), context, onError: (_, __) {}),
|
||||||
]),
|
]),
|
||||||
);
|
);
|
||||||
@ -481,10 +477,7 @@ class _AssetViewerState extends ConsumerState<AssetViewer> {
|
|||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: double.infinity,
|
height: double.infinity,
|
||||||
color: backgroundColor,
|
color: backgroundColor,
|
||||||
child: Thumbnail.fromBaseAsset(
|
child: Thumbnail.fromBaseAsset(asset: asset, fit: BoxFit.contain),
|
||||||
asset: asset,
|
|
||||||
fit: BoxFit.contain,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -534,10 +527,7 @@ class _AssetViewerState extends ConsumerState<AssetViewer> {
|
|||||||
width: ctx.width,
|
width: ctx.width,
|
||||||
height: ctx.height,
|
height: ctx.height,
|
||||||
color: backgroundColor,
|
color: backgroundColor,
|
||||||
child: Thumbnail.fromBaseAsset(
|
child: Thumbnail.fromBaseAsset(asset: asset, fit: BoxFit.contain),
|
||||||
asset: asset,
|
|
||||||
fit: BoxFit.contain,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -93,10 +93,7 @@ class AssetViewerStateNotifier extends AutoDisposeNotifier<AssetViewerState> {
|
|||||||
if (showing == state.showingBottomSheet) {
|
if (showing == state.showingBottomSheet) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state = state.copyWith(
|
state = state.copyWith(showingBottomSheet: showing, showingControls: showing || state.showingControls);
|
||||||
showingBottomSheet: showing,
|
|
||||||
showingControls: showing || state.showingControls,
|
|
||||||
);
|
|
||||||
if (showing) {
|
if (showing) {
|
||||||
ref.read(videoPlayerControlsProvider.notifier).pause();
|
ref.read(videoPlayerControlsProvider.notifier).pause();
|
||||||
}
|
}
|
||||||
|
@ -32,10 +32,7 @@ ImageProvider getThumbnailImageProvider({
|
|||||||
String? remoteId,
|
String? remoteId,
|
||||||
Size size = const Size.square(kTimelineThumbnailSize),
|
Size size = const Size.square(kTimelineThumbnailSize),
|
||||||
}) {
|
}) {
|
||||||
assert(
|
assert(asset != null || remoteId != null, 'Either asset or remoteId must be provided');
|
||||||
asset != null || remoteId != null,
|
|
||||||
'Either asset or remoteId must be provided',
|
|
||||||
);
|
|
||||||
|
|
||||||
if (remoteId != null) {
|
if (remoteId != null) {
|
||||||
return RemoteThumbProvider(assetId: remoteId);
|
return RemoteThumbProvider(assetId: remoteId);
|
||||||
|
@ -12,11 +12,7 @@ class LocalThumbProvider extends ImageProvider<LocalThumbProvider> {
|
|||||||
final Size size;
|
final Size size;
|
||||||
final DateTime? updatedAt;
|
final DateTime? updatedAt;
|
||||||
|
|
||||||
const LocalThumbProvider({
|
const LocalThumbProvider({required this.id, required this.size, this.updatedAt});
|
||||||
required this.id,
|
|
||||||
required this.size,
|
|
||||||
this.updatedAt,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<LocalThumbProvider> obtainKey(ImageConfiguration configuration) {
|
Future<LocalThumbProvider> obtainKey(ImageConfiguration configuration) {
|
||||||
@ -24,10 +20,7 @@ class LocalThumbProvider extends ImageProvider<LocalThumbProvider> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ImageStreamCompleter loadImage(
|
ImageStreamCompleter loadImage(LocalThumbProvider key, ImageDecoderCallback decode) {
|
||||||
LocalThumbProvider key,
|
|
||||||
ImageDecoderCallback decode,
|
|
||||||
) {
|
|
||||||
return OneFrameImageStreamCompleter(
|
return OneFrameImageStreamCompleter(
|
||||||
_codec(key),
|
_codec(key),
|
||||||
informationCollector: () => <DiagnosticsNode>[
|
informationCollector: () => <DiagnosticsNode>[
|
||||||
@ -71,10 +64,7 @@ class LocalFullImageProvider extends ImageProvider<LocalFullImageProvider> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ImageStreamCompleter loadImage(
|
ImageStreamCompleter loadImage(LocalFullImageProvider key, ImageDecoderCallback decode) {
|
||||||
LocalFullImageProvider key,
|
|
||||||
ImageDecoderCallback decode,
|
|
||||||
) {
|
|
||||||
return OneFrameImageStreamCompleter(_codec(key));
|
return OneFrameImageStreamCompleter(_codec(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,8 +41,8 @@ class Thumbnail extends StatefulWidget {
|
|||||||
this.size = const ui.Size.square(kTimelineThumbnailSize),
|
this.size = const ui.Size.square(kTimelineThumbnailSize),
|
||||||
this.thumbhashMode = ThumbhashMode.enabled,
|
this.thumbhashMode = ThumbhashMode.enabled,
|
||||||
super.key,
|
super.key,
|
||||||
}) : blurhash = asset.thumbhash,
|
}) : blurhash = asset.thumbhash,
|
||||||
imageProvider = _getImageProviderFromAsset(asset, size);
|
imageProvider = _getImageProviderFromAsset(asset, size);
|
||||||
|
|
||||||
Thumbnail.fromBaseAsset({
|
Thumbnail.fromBaseAsset({
|
||||||
required BaseAsset? asset,
|
required BaseAsset? asset,
|
||||||
@ -50,11 +50,11 @@ class Thumbnail extends StatefulWidget {
|
|||||||
this.size = const ui.Size.square(kTimelineThumbnailSize),
|
this.size = const ui.Size.square(kTimelineThumbnailSize),
|
||||||
this.thumbhashMode = ThumbhashMode.enabled,
|
this.thumbhashMode = ThumbhashMode.enabled,
|
||||||
super.key,
|
super.key,
|
||||||
}) : blurhash = switch (asset) {
|
}) : blurhash = switch (asset) {
|
||||||
RemoteAsset() => asset.thumbHash,
|
RemoteAsset() => asset.thumbHash,
|
||||||
_ => null,
|
_ => null,
|
||||||
},
|
},
|
||||||
imageProvider = _getImageProviderFromBaseAsset(asset, size);
|
imageProvider = _getImageProviderFromBaseAsset(asset, size);
|
||||||
|
|
||||||
static ImageProvider? _getImageProviderFromAsset(Asset asset, ui.Size size) {
|
static ImageProvider? _getImageProviderFromAsset(Asset asset, ui.Size size) {
|
||||||
if (asset.localId != null) {
|
if (asset.localId != null) {
|
||||||
@ -65,10 +65,7 @@ class Thumbnail extends StatefulWidget {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ImageProvider? _getImageProviderFromBaseAsset(
|
static ImageProvider? _getImageProviderFromBaseAsset(BaseAsset? asset, ui.Size size) {
|
||||||
BaseAsset? asset,
|
|
||||||
ui.Size size,
|
|
||||||
) {
|
|
||||||
switch (asset) {
|
switch (asset) {
|
||||||
case RemoteAsset():
|
case RemoteAsset():
|
||||||
if (asset.localId != null) {
|
if (asset.localId != null) {
|
||||||
@ -217,19 +214,12 @@ class _ThumbnailState extends State<Thumbnail> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final colorScheme = context.colorScheme;
|
final colorScheme = context.colorScheme;
|
||||||
final gradient = _gradientCache[colorScheme] ??= LinearGradient(
|
final gradient = _gradientCache[colorScheme] ??= LinearGradient(
|
||||||
colors: [
|
colors: [colorScheme.surfaceContainer, colorScheme.surfaceContainer.darken(amount: .1)],
|
||||||
colorScheme.surfaceContainer,
|
|
||||||
colorScheme.surfaceContainer.darken(amount: .1),
|
|
||||||
],
|
|
||||||
begin: Alignment.topCenter,
|
begin: Alignment.topCenter,
|
||||||
end: Alignment.bottomCenter,
|
end: Alignment.bottomCenter,
|
||||||
);
|
);
|
||||||
|
|
||||||
return _ThumbnailLeaf(
|
return _ThumbnailLeaf(image: _providerImage, fit: widget.fit, placeholderGradient: gradient);
|
||||||
image: _providerImage,
|
|
||||||
fit: widget.fit,
|
|
||||||
placeholderGradient: gradient,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -245,26 +235,15 @@ class _ThumbnailLeaf extends LeafRenderObjectWidget {
|
|||||||
final BoxFit fit;
|
final BoxFit fit;
|
||||||
final Gradient placeholderGradient;
|
final Gradient placeholderGradient;
|
||||||
|
|
||||||
const _ThumbnailLeaf({
|
const _ThumbnailLeaf({required this.image, required this.fit, required this.placeholderGradient});
|
||||||
required this.image,
|
|
||||||
required this.fit,
|
|
||||||
required this.placeholderGradient,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
RenderObject createRenderObject(BuildContext context) {
|
RenderObject createRenderObject(BuildContext context) {
|
||||||
return _ThumbnailRenderBox(
|
return _ThumbnailRenderBox(image: image, fit: fit, placeholderGradient: placeholderGradient);
|
||||||
image: image,
|
|
||||||
fit: fit,
|
|
||||||
placeholderGradient: placeholderGradient,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void updateRenderObject(
|
void updateRenderObject(BuildContext context, _ThumbnailRenderBox renderObject) {
|
||||||
BuildContext context,
|
|
||||||
_ThumbnailRenderBox renderObject,
|
|
||||||
) {
|
|
||||||
renderObject.fit = fit;
|
renderObject.fit = fit;
|
||||||
renderObject.image = image;
|
renderObject.image = image;
|
||||||
renderObject.placeholderGradient = placeholderGradient;
|
renderObject.placeholderGradient = placeholderGradient;
|
||||||
@ -285,14 +264,11 @@ class _ThumbnailRenderBox extends RenderBox {
|
|||||||
@override
|
@override
|
||||||
bool isRepaintBoundary = true;
|
bool isRepaintBoundary = true;
|
||||||
|
|
||||||
_ThumbnailRenderBox({
|
_ThumbnailRenderBox({required ui.Image? image, required BoxFit fit, required Gradient placeholderGradient})
|
||||||
required ui.Image? image,
|
: _image = image,
|
||||||
required BoxFit fit,
|
_fit = fit,
|
||||||
required Gradient placeholderGradient,
|
_placeholderGradient = placeholderGradient,
|
||||||
}) : _image = image,
|
_lastImageRequest = DateTime.now();
|
||||||
_fit = fit,
|
|
||||||
_placeholderGradient = placeholderGradient,
|
|
||||||
_lastImageRequest = DateTime.now();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void paint(PaintingContext context, Offset offset) {
|
void paint(PaintingContext context, Offset offset) {
|
||||||
|
@ -74,10 +74,10 @@ class ThumbnailTile extends ConsumerWidget {
|
|||||||
child: Thumbnail.fromBaseAsset(
|
child: Thumbnail.fromBaseAsset(
|
||||||
asset: asset,
|
asset: asset,
|
||||||
thumbhashMode: isScrubbing
|
thumbhashMode: isScrubbing
|
||||||
? ThumbhashMode.only
|
? ThumbhashMode.only
|
||||||
: asset != null && asset.hasLocal
|
: asset != null && asset.hasLocal
|
||||||
? ThumbhashMode.disabled
|
? ThumbhashMode.disabled
|
||||||
: ThumbhashMode.enabled,
|
: ThumbhashMode.enabled,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -86,23 +86,17 @@ class ThumbnailTile extends ConsumerWidget {
|
|||||||
? const Align(
|
? const Align(
|
||||||
alignment: Alignment.topRight,
|
alignment: Alignment.topRight,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(right: 10.0, top: 24.0),
|
||||||
right: 10.0,
|
|
||||||
top: 24.0,
|
|
||||||
),
|
|
||||||
child: _TileOverlayIcon(Icons.burst_mode_rounded),
|
child: _TileOverlayIcon(Icons.burst_mode_rounded),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: const Align(
|
: const Align(
|
||||||
alignment: Alignment.topRight,
|
alignment: Alignment.topRight,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(right: 10.0, top: 6.0),
|
||||||
right: 10.0,
|
|
||||||
top: 6.0,
|
|
||||||
),
|
|
||||||
child: _TileOverlayIcon(Icons.burst_mode_rounded),
|
child: _TileOverlayIcon(Icons.burst_mode_rounded),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (asset != null && asset.isVideo)
|
if (asset != null && asset.isVideo)
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.topRight,
|
alignment: Alignment.topRight,
|
||||||
|
@ -102,10 +102,7 @@ class _BlurredBackdrop extends HookWidget {
|
|||||||
child: DecoratedBox(
|
child: DecoratedBox(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
image: getFullImageProvider(
|
image: getFullImageProvider(asset, size: Size(context.width, context.height)),
|
||||||
asset,
|
|
||||||
size: Size(context.width, context.height),
|
|
||||||
),
|
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -57,15 +57,8 @@ class DriftMemoryCard extends ConsumerWidget {
|
|||||||
child: Stack(
|
child: Stack(
|
||||||
children: [
|
children: [
|
||||||
ColorFiltered(
|
ColorFiltered(
|
||||||
colorFilter: ColorFilter.mode(
|
colorFilter: ColorFilter.mode(Colors.black.withValues(alpha: 0.2), BlendMode.darken),
|
||||||
Colors.black.withValues(alpha: 0.2),
|
child: SizedBox(width: 205, height: 200, child: Thumbnail.fromBaseAsset(asset: memory.assets[0])),
|
||||||
BlendMode.darken,
|
|
||||||
),
|
|
||||||
child: SizedBox(
|
|
||||||
width: 205,
|
|
||||||
height: 200,
|
|
||||||
child: Thumbnail.fromBaseAsset(asset: memory.assets[0]),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Positioned(
|
Positioned(
|
||||||
bottom: 16,
|
bottom: 16,
|
||||||
|
@ -80,19 +80,19 @@ class FixedSegment extends Segment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const FixedSegment.empty()
|
const FixedSegment.empty()
|
||||||
: this(
|
: this(
|
||||||
firstIndex: 0,
|
firstIndex: 0,
|
||||||
lastIndex: 0,
|
lastIndex: 0,
|
||||||
startOffset: 0,
|
startOffset: 0,
|
||||||
endOffset: 0,
|
endOffset: 0,
|
||||||
firstAssetIndex: 0,
|
firstAssetIndex: 0,
|
||||||
bucket: const Bucket(assetCount: 0),
|
bucket: const Bucket(assetCount: 0),
|
||||||
tileHeight: 1,
|
tileHeight: 1,
|
||||||
columnCount: 0,
|
columnCount: 0,
|
||||||
headerExtent: 0,
|
headerExtent: 0,
|
||||||
spacing: 0,
|
spacing: 0,
|
||||||
header: HeaderType.none,
|
header: HeaderType.none,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
class _FixedSegmentRow extends ConsumerWidget {
|
class _FixedSegmentRow extends ConsumerWidget {
|
||||||
|
@ -41,7 +41,10 @@ class ImmichAppBar extends ConsumerWidget implements PreferredSizeWidget {
|
|||||||
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
||||||
child: Badge(
|
child: Badge(
|
||||||
label: const DecoratedBox(
|
label: const DecoratedBox(
|
||||||
decoration: BoxDecoration(color: Colors.black, borderRadius: BorderRadius.all(Radius.circular(widgetSize / 2))),
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.black,
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(widgetSize / 2)),
|
||||||
|
),
|
||||||
child: Icon(Icons.info, color: Color.fromARGB(255, 243, 188, 106), size: widgetSize / 2),
|
child: Icon(Icons.info, color: Color.fromARGB(255, 243, 188, 106), size: widgetSize / 2),
|
||||||
),
|
),
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
|
@ -101,11 +101,7 @@ class _BlurredBackdrop extends HookWidget {
|
|||||||
child: DecoratedBox(
|
child: DecoratedBox(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
image: ImmichImage.imageProvider(
|
image: ImmichImage.imageProvider(asset: asset, height: context.height, width: context.width),
|
||||||
asset: asset,
|
|
||||||
height: context.height,
|
|
||||||
width: context.width,
|
|
||||||
),
|
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user