This commit is contained in:
kodjomoustapha 2023-10-21 15:23:49 +01:00
parent ed61c815d5
commit cf5ae4afcb
3 changed files with 31 additions and 24 deletions

View file

@ -1730,7 +1730,7 @@ _importLocal(BuildContext context, bool isManga) {
MainAxisAlignment.spaceEvenly,
children: [
const Icon(Icons.archive_outlined),
Text(l10n.import_files,
Text("${l10n.import_files} ( ${isManga?".zip, .cbz":".mp4, .mkv, .avi, and more"} )",
style: TextStyle(
color: Theme.of(context)
.textTheme

View file

@ -28,17 +28,20 @@ class ImageViewCenter extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
return StreamBuilder<Uint8List?>(
stream: ref
.watch(cropBordersProvider(datas: datas, cropBorder: cropBorders)
.future)
.asStream(),
builder: (context, snapshot) {
final hasData = snapshot.hasData && snapshot.data != null;
return _imageView(hasData ? hasData : datas.isLocale!,
hasData ? snapshot.data : datas.archiveImage, ref);
});
final image =
ref.watch(cropBordersProvider(datas: datas, cropBorder: cropBorders));
final defaultWidget = _imageView(datas.isLocale!, datas.archiveImage, ref);
return image.when(
data: (data) {
if (data == null && !datas.isLocale!) {
ref.invalidate(cropBordersProvider(datas: datas, cropBorder: true));
}
return _imageView(data != null ? true : datas.isLocale!,
data ?? datas.archiveImage, ref);
},
error: (_, __) => defaultWidget,
loading: () => defaultWidget,
);
}
Widget _imageView(bool isLocale, Uint8List? archiveImage, WidgetRef ref) {

View file

@ -28,20 +28,24 @@ class ImageViewVertical extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final image =
ref.watch(cropBordersProvider(datas: datas, cropBorder: cropBorders));
final defaultWidget =
_imageView(datas.isLocale!, datas.archiveImage, context, ref);
return Container(
color: Colors.black,
child: StreamBuilder<Uint8List?>(
stream: ref
.watch(
cropBordersProvider(datas: datas, cropBorder: cropBorders)
.future)
.asStream(),
builder: (context, snapshot) {
final hasData = snapshot.hasData && snapshot.data != null;
return _imageView(hasData ? hasData : datas.isLocale!,
hasData ? snapshot.data : datas.archiveImage, context, ref);
}));
child: image.when(
data: (data) {
if (data == null && !datas.isLocale!) {
ref.invalidate(
cropBordersProvider(datas: datas, cropBorder: true));
}
return _imageView(data != null ? true : datas.isLocale!,
data ?? datas.archiveImage, context, ref);
},
error: (_, __) => defaultWidget,
loading: () => defaultWidget,
));
}
Widget _imageView(bool isLocale, Uint8List? archiveImage,