A customizable carousel slider for Flutter. Supports infinite sliding, custom indicators, and custom animations with many pre-built indicators and animations.
description: when CarouselSlider contains more than 1 image, everything goes correctly. but when only contains 1 image, the container only shows half of the image, the other half is blank.
issue details:
Exception caught by rendering library
The following assertion was thrown during paint():
Offset argument contained a NaN value.
'dart:ui/painting.dart':
Failed assertion: line 43: ''
The relevant error-causing widget was:
CarouselSlider-[LabeledGlobalKey#04485] file:///D:/flutter/abangate/lib/gallery_page.dart:84:39
When the exception was thrown, this was the stack:
...
The following RenderObject was being processed when the exception was fired: RenderCustomPaint#5f0dc
... parentData: (can use size)
... constraints: BoxConstraints(w=10.0, h=6.0)
... size: Size(10.0, 6.0)
RenderObject: RenderCustomPaint#5f0dc
parentData: (can use size)
constraints: BoxConstraints(w=10.0, h=6.0)
size: Size(10.0, 6.0)
description: when CarouselSlider contains more than 1 image, everything goes correctly. but when only contains 1 image, the container only shows half of the image, the other half is blank.
issue details: Exception caught by rendering library The following assertion was thrown during paint(): Offset argument contained a NaN value. 'dart:ui/painting.dart': Failed assertion: line 43: ''
The relevant error-causing widget was: CarouselSlider-[LabeledGlobalKey#04485] file:///D:/flutter/abangate/lib/gallery_page.dart:84:39
When the exception was thrown, this was the stack:
2 _offsetIsValid (dart:ui/painting.dart:43:10)
3 Canvas.drawCircle (dart:ui/painting.dart:3787:12)
4 CircularWaveIndicatorPainter.paint (package:flutter_carousel_slider/carousel_slider_indicators.dart:190:12)
5 RenderCustomPaint._paintWithPainter (package:flutter/src/rendering/custom_paint.dart:531:13)
6 RenderCustomPaint.paint (package:flutter/src/rendering/custom_paint.dart:572:7)
... The following RenderObject was being processed when the exception was fired: RenderCustomPaint#5f0dc ... parentData: (can use size)
... constraints: BoxConstraints(w=10.0, h=6.0)
... size: Size(10.0, 6.0)
RenderObject: RenderCustomPaint#5f0dc
parentData: (can use size)
constraints: BoxConstraints(w=10.0, h=6.0)
size: Size(10.0, 6.0)
FlutterCarouselSlider Version: 1.0.2
My code: Container( height: screenSize.height, width: screenSize.width, child: CarouselSlider.builder( key: _sliderKey, unlimitedMode: true, slideBuilder: (index) { return Container( color: Colors.black, alignment: Alignment.center, child: GestureDetector( child: Image.file( File(widget.myContents[widget.contentIndex].images[index]), ), onTap: () { showDetails = !showDetails; setState(() {}); }, ), ); }, slideTransform: ParallaxTransform(), slideIndicator: CircularWaveSlideIndicator( currentIndicatorColor: Colors.white38, indicatorBackgroundColor: Colors.white24, padding: EdgeInsets.only(bottom: 32), indicatorRadius: 3, itemSpacing: 10, ), itemCount: widget.myContents[widget.contentIndex].images.length), ),