mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 15:57:25 +00:00
Fix invalid space when using Galley mode with multiple images on screen. Close #277
This commit is contained in:
@@ -228,8 +228,43 @@ class _GalleryModeState extends State<_GalleryMode>
|
|||||||
: Axis.horizontal;
|
: Axis.horizontal;
|
||||||
|
|
||||||
bool reverse = reader.mode == ReaderMode.galleryRightToLeft;
|
bool reverse = reader.mode == ReaderMode.galleryRightToLeft;
|
||||||
|
if (reverse) {
|
||||||
|
images = images.reversed.toList();
|
||||||
|
}
|
||||||
|
|
||||||
List<Widget> imageWidgets = images.map((imageKey) {
|
List<Widget> imageWidgets;
|
||||||
|
|
||||||
|
if (images.length == 2) {
|
||||||
|
imageWidgets = [
|
||||||
|
Expanded(
|
||||||
|
child: ComicImage(
|
||||||
|
width: double.infinity,
|
||||||
|
height: double.infinity,
|
||||||
|
image: _createImageProviderFromKey(images[0], context),
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
alignment: axis == Axis.vertical
|
||||||
|
? Alignment.bottomCenter
|
||||||
|
: Alignment.centerRight,
|
||||||
|
onInit: (state) => imageStates.add(state),
|
||||||
|
onDispose: (state) => imageStates.remove(state),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: ComicImage(
|
||||||
|
width: double.infinity,
|
||||||
|
height: double.infinity,
|
||||||
|
image: _createImageProviderFromKey(images[1], context),
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
alignment: axis == Axis.vertical
|
||||||
|
? Alignment.topCenter
|
||||||
|
: Alignment.centerLeft,
|
||||||
|
onInit: (state) => imageStates.add(state),
|
||||||
|
onDispose: (state) => imageStates.remove(state),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
];
|
||||||
|
} else {
|
||||||
|
imageWidgets = images.map((imageKey) {
|
||||||
ImageProvider imageProvider =
|
ImageProvider imageProvider =
|
||||||
_createImageProviderFromKey(imageKey, context);
|
_createImageProviderFromKey(imageKey, context);
|
||||||
return Expanded(
|
return Expanded(
|
||||||
@@ -241,9 +276,6 @@ class _GalleryModeState extends State<_GalleryMode>
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}).toList();
|
}).toList();
|
||||||
|
|
||||||
if (reverse) {
|
|
||||||
imageWidgets = imageWidgets.reversed.toList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return axis == Axis.vertical
|
return axis == Axis.vertical
|
||||||
@@ -671,8 +703,7 @@ class _ContinuousModeState extends State<_ContinuousMode>
|
|||||||
}
|
}
|
||||||
Offset offset;
|
Offset offset;
|
||||||
var sp = scrollController.position;
|
var sp = scrollController.position;
|
||||||
if (sp.pixels < sp.minScrollExtent
|
if (sp.pixels < sp.minScrollExtent || sp.pixels > sp.maxScrollExtent) {
|
||||||
|| sp.pixels > sp.maxScrollExtent) {
|
|
||||||
offset = Offset(value.dx, value.dy);
|
offset = Offset(value.dx, value.dy);
|
||||||
} else {
|
} else {
|
||||||
if (reader.mode == ReaderMode.continuousTopToBottom) {
|
if (reader.mode == ReaderMode.continuousTopToBottom) {
|
||||||
|
Reference in New Issue
Block a user