mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-07 07:15:47 -06:00
47 lines
1.3 KiB
Dart
47 lines
1.3 KiB
Dart
import 'package:cached_network_image/cached_network_image.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
|
import 'package:paperless_api/paperless_api.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:shimmer/shimmer.dart';
|
|
|
|
class DocumentPreview extends StatelessWidget {
|
|
final int id;
|
|
final BoxFit fit;
|
|
final Alignment alignment;
|
|
final double borderRadius;
|
|
|
|
const DocumentPreview({
|
|
Key? key,
|
|
required this.id,
|
|
this.fit = BoxFit.cover,
|
|
this.alignment = Alignment.center,
|
|
this.borderRadius = 8.0,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return
|
|
// Hero(
|
|
// tag: "document_$id",child:
|
|
ClipRRect(
|
|
borderRadius: BorderRadius.circular(borderRadius),
|
|
child: CachedNetworkImage(
|
|
fit: fit,
|
|
alignment: Alignment.topCenter,
|
|
cacheKey: "thumb_$id",
|
|
imageUrl:
|
|
Provider.of<PaperlessDocumentsApi>(context).getThumbnailUrl(id),
|
|
errorWidget: (ctxt, msg, __) => Text(msg),
|
|
placeholder: (context, value) => Shimmer.fromColors(
|
|
baseColor: Colors.grey[300]!,
|
|
highlightColor: Colors.grey[100]!,
|
|
child: const SizedBox(height: 100, width: 100),
|
|
),
|
|
cacheManager: context.watch(),
|
|
),
|
|
// ),
|
|
);
|
|
}
|
|
}
|