mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 07:47:24 +00:00
fix selecting image
This commit is contained in:
@@ -456,58 +456,63 @@ class _ReaderScaffoldState extends State<_ReaderScaffold> {
|
|||||||
var imagesOnScreen =
|
var imagesOnScreen =
|
||||||
continuesState.itemPositionsListener.itemPositions.value;
|
continuesState.itemPositionsListener.itemPositions.value;
|
||||||
var images = imagesOnScreen
|
var images = imagesOnScreen
|
||||||
.map((e) => context.reader.images![e.index - 1])
|
.map((e) => context.reader.images!.elementAtOrNull(e.index - 1))
|
||||||
|
.whereType<String>()
|
||||||
.toList();
|
.toList();
|
||||||
String? selected;
|
String? selected;
|
||||||
await showPopUpWidget(
|
if (images.length > 1) {
|
||||||
context,
|
await showPopUpWidget(
|
||||||
PopUpWidgetScaffold(
|
context,
|
||||||
title: "Select an image on screen".tl,
|
PopUpWidgetScaffold(
|
||||||
body: GridView.builder(
|
title: "Select an image on screen".tl,
|
||||||
itemCount: images.length,
|
body: GridView.builder(
|
||||||
itemBuilder: (context, index) {
|
itemCount: images.length,
|
||||||
ImageProvider image;
|
itemBuilder: (context, index) {
|
||||||
var imageKey = images[index];
|
ImageProvider image;
|
||||||
if (imageKey.startsWith('file://')) {
|
var imageKey = images[index];
|
||||||
image = FileImage(File(imageKey.replaceFirst("file://", '')));
|
if (imageKey.startsWith('file://')) {
|
||||||
} else {
|
image = FileImage(File(imageKey.replaceFirst("file://", '')));
|
||||||
image = ReaderImageProvider(
|
} else {
|
||||||
imageKey,
|
image = ReaderImageProvider(
|
||||||
reader.type.comicSource!.key,
|
imageKey,
|
||||||
reader.cid,
|
reader.type.comicSource!.key,
|
||||||
reader.eid,
|
reader.cid,
|
||||||
);
|
reader.eid,
|
||||||
}
|
);
|
||||||
return InkWell(
|
}
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
return InkWell(
|
||||||
onTap: () {
|
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
||||||
selected = images[index];
|
onTap: () {
|
||||||
App.rootContext.pop();
|
selected = images[index];
|
||||||
},
|
App.rootContext.pop();
|
||||||
child: Container(
|
},
|
||||||
decoration: BoxDecoration(
|
child: Container(
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
decoration: BoxDecoration(
|
||||||
border: Border.all(
|
borderRadius: const BorderRadius.all(Radius.circular(16)),
|
||||||
color: Theme.of(context).colorScheme.outline,
|
border: Border.all(
|
||||||
|
color: Theme.of(context).colorScheme.outline,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
width: double.infinity,
|
|
||||||
height: double.infinity,
|
|
||||||
child: Image(
|
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: double.infinity,
|
height: double.infinity,
|
||||||
image: image,
|
child: Image(
|
||||||
|
width: double.infinity,
|
||||||
|
height: double.infinity,
|
||||||
|
image: image,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
).padding(const EdgeInsets.all(8));
|
||||||
).padding(const EdgeInsets.all(8));
|
},
|
||||||
},
|
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
|
||||||
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
|
maxCrossAxisExtent: 200,
|
||||||
maxCrossAxisExtent: 200,
|
childAspectRatio: 0.7,
|
||||||
childAspectRatio: 0.7,
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
} else {
|
||||||
|
selected = images.first;
|
||||||
|
}
|
||||||
if (selected == null) {
|
if (selected == null) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user