Skip to content

Portrait images do not fill the available space on iPad #29

Open
@lupusyon

Description

@lupusyon

Contact Details

lupusyon@gmail.com

What happened?

I'm not sure this is a bug, perhaps is me missing something about the way this widget works, but I thought I'd ask after several unsuccessful attempts at fixing it, I hope it's ok.

I'm using the carousel to display a gallery of images I fetch from the web via a backend service. I set the viewportFraction to 1.0, so the "slides" are expected to fill the available horizontal space, and that's what happens on iPhone, check the following screenshot (some parts are edited for privacy and NDA):

iphone14pro

On the left you see a landscape gallery picture, on the right a portrait one. As you can see they both fit the whole screen horizontally, the latter simply expands the carousel area downwards to accomodate the different aspect ratio, which is perfect for me.

But here's what happens when I run the app on an iPad Pro (6gen):

iPadpro6th

As you can see, the landscape picture fits perfectly, while the portrait one gets those weird paddings (you can also see the spinner loading animation I put in an underneath container of the same stack because the gallery image doesn't cover it anymore).

Here is the code I use:

ExpandableCarousel(
options: CarouselOptions(
autoPlay: false,
viewportFraction: 1.0, //full width
),
items: imgGallery.map((i) {
return Builder(
builder: (BuildContext context) {
var noimg = AssetImage(//default placeholder
'assets/images/noimg.png');
var img;
if (i != '') {
img = NetworkImage(i);
}
return Image(
image: i != '' ? img : noimg,
);
},
);
}).toList(),
),

Any suggestions? Thanks in advance

Version

2.1.0

What devices are you seeing the problem on?

iPhone

OS

iOS 16.4

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions