I am using Flutter Custom Carousel Slider Package Link, I have a issue in CarouselItem(...)
section where I cannot put Image.file(...)
I want a image to be fit: BoxFit.cover
but in FileImage there is no fit property and because of that my image get streched. How can I fix this issue? I tried putting Image.file instead of FileImage but it didnot work.
CustomCarouselSlider(
items: List.generate(
images.length,
(index) => CarouselItem(
image: FileImage(
File(images[index].path),
),
boxDecoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
),
),
),
height: size.height * 0.5,
width: size.width,
autoplay: false,
showText: false,
showSubBackground: false,
indicatorShape: BoxShape.circle,
indicatorPosition: IndicatorPosition.insidePicture,
selectedDotColor: const Color(0XFFF9622E),
unselectedDotColor: Colors.white,
),
This package doesn't have the option to change the fit
property by default it is set to fit: BoxFit.fill,
. You'll have to use any other package.
You can use other packages like carousel_slider or flutter_carousel_widget to achieve same functionality.