jlouage / flutter-carousel-pro Goto Github PK
View Code? Open in Web Editor NEWFlutter Carousel Pro
License: MIT License
Flutter Carousel Pro
License: MIT License
Please add able to change image background color.
I got the following error message, I just add 1 Carousel widget into my page, nothing else. Please take a look and tell me how to fix it.
E/flutter (13647): [ERROR:flutter/shell/common/shell.cc(181)] Dart Error: Unhandled exception:
E/flutter (13647): 'package:flutter/src/widgets/page_view.dart': Failed assertion: line 96 pos 7: 'positions.isNotEmpty': PageController.page cannot be accessed before a PageView is built with it.
E/flutter (13647): #0 _AssertionError._doThrowNew (dart:core/runtime/liberrors_patch.dart:40:39)
E/flutter (13647): #1 _AssertionError._throwNew (dart:core/runtime/liberrors_patch.dart:36:5)
E/flutter (13647): #2 PageController.page (package:flutter/src/widgets/page_view.dart:96:7)
E/flutter (13647): #3 CarouselState.initState.<anonymous closure> (package:carousel_pro/src/carousel_pro.dart:110:24)
E/flutter (13647): #4 _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
E/flutter (13647): #5 _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
E/flutter (13647): #6 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
everything works good in ios but in android when the last image loaded then it does not rotate to the first image.
When you swipe the dots indicators only animate the size - color is set directly. This looks bad especially when you have all the dots of the same size and just depend on the color animation.
Scaffold(
body: Stack(
children: [
BackgroundImageInContainer(),
Align(
child: Container(
// color: Colors.cyan,
height: getPercentSize(70, true, context),
child: Carousel(
images: [
intro1(context),
intro2(context),
intro3(context),
intro4(context),
],
dotSize: 4.0,
dotSpacing: 15.0,
dotColor: Colors.blueAccent,
indicatorBgPadding: 5.0,
dotBgColor: Colors.purple.withOpacity(0),
borderRadius: false,
moveIndicatorFromBottom: 180.0,
noRadiusForIndicator: true,
animationDuration: Duration(seconds: 2),
autoplayDuration: Duration(seconds: 5),
animationCurve: Curves.decelerate,
),
),
),
'package:flutter/src/rendering/sliver_fixed_extent_list.dart': Failed assertion: line 276 pos 12: 'firstIndex == 0 || childScrollOffset(firstChild) - scrollOffset <= precisionErrorTolerance': is not true.
I need an alignment property like this : "alignment: FractionalOffset.topCenter". How can I handle this?
I can't see any documentation on whether images can me fitted with box fit cover, this is very important for an image package, I think.. Am I missing something?
I was excited to test out this repo until I saw the license.
I'm not sure how other people are legally using your repo including the 15 forks
since it's "All rights reserved."
Maybe I'm just mis-understanding copy right law
Thanks for the hard work you did creating this project!
I've got autoplay set to 'false', and the images still autoplay.... Using Android Studio and iOS simulator on MacOS Mojave.
I think that:
onPressed(int count)
are necessary.
Hope you can implement, thanks~
(Or just close this issue, never mind.)
When autoplay = false and page is changed manually, dot color changes slowly.
How is OnImageTap used to retrieve the index of the tapped image?
Wanted an option to change the color of the selected indicator to any color. How can I do that?
how to reduce dotBg size ?
Having problem above?
Just find if(_controller.page == widget.images.length-1) {
replace it to if(_controller.page.round() == widget.images.length-1) {
I don't know if this is permanent fix, but somehow _controller.page return double, so it needs to be rounded
@jlouage Also if you don't mind please change image argument not just ImageProvider, because I need widget children, if that's possible.. thanks
When using FadeInImage, borderReadius is required because it uses ClipRRect and when borderRadius is set to false, a borderradius of null is supplied which is not allowed. Workaround: borderRadius: true, radius: Radius.zero
I would like to always start the carousel with the last image the user saw in the last time he used the app. Would be nice to expose the initial index for doing it
Is there any way to add gestures to the images like onTap?
This slider is great but is there any way we can add a video in the slider?
Line 140 of carousel_pro.dart:
fit: BoxFit.cover,
It seems to be forced on cover, instead it should be like:
fit: widget.boxFit,
Is it possibe to stop sliding when the user tap on the screen ?
I tried to solve this issue by changing the autoplay to false ontap.. but still stuck.
This is a request to add support for null safety to package:carousel_pro
.
We depend on your awesome package, so would be great to have null safety enabled.
The Dart/Flutter team already encourages publishing the migrated packages: See this blog post.
See the migration guide for details about enabling null safety.
please can you check on the package... i keep getting this error, base on research i notices is from the package.
thanks.
I have multiple Carousels on my page, horizontal swiping one, makes them all go to the next / previous image, whilst it should only be the one being swiped on.
Please update the package for null safety
If I put too many images in the carousel, the dots go beyond the screen causing an overflow. Can we find a way to limit the number of dots, overriding itemCount: listImages.length
?
I have seen many just keep three dots and keep remaining on the middle one until the carousel reaches the end
Animation gets stuck at last item, doesn't return to first element. Also items are aggressively going to next slide while sliding back to previous slide.
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, v0.5.6-pre.26, on Microsoft Windows [Version 10.0.17134.112], locale en-IN)
[√] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[√] Android Studio (version 3.1)
[!] VS Code, 64-bit edition (version 1.25.0)
[√] Connected devices (1 available)
Recent update to Flutter deprecated use of FlatButton.
The argument type 'TextButton' can't be assigned to the parameter type 'FlatButton';
Hi, i am using it inside a flexibale space bare 'bacground',when space bare collabsed i get the following error, Advice please.
#2 is it ok not specifying the width and let it adjust to the parent width?
E/flutter (20377): [ERROR:flutter/shell/common/shell.cc(181)] Dart Error: Unhandled exception:
E/flutter (20377): 'package:flutter/src/widgets/page_view.dart': Failed assertion: line 96 pos 7: 'positions.isNotEmpty': PageController.page cannot be accessed before a PageView is built with it.
E/flutter (20377): #0 _AssertionError._doThrowNew (dart:core/runtime/liberrors_patch.dart:40:39)
E/flutter (20377): #1 _AssertionError._throwNew (dart:core/runtime/liberrors_patch.dart:36:5)
E/flutter (20377): #2 PageController.page (package:flutter/src/widgets/page_view.dart:96:7)
E/flutter (20377): #3 CarouselState.initState.<anonymous closure> (package:carousel_pro/src/carousel_pro.dart:110:24)
E/flutter (20377): #4 _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
E/flutter (20377): #5 _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
E/flutter (20377): #6 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
In Android device, when you set the autoplay
to true
, the Carousel works like a charm but stops at the last image. I couldn't find any setting in properties for infinite looping or sth. like this, Is it possible to do that ?
hello, I search to add custon widget in carousel. Currently all carousel use only image. But if "children[ my widgets] " can be add , it will be perfect. thank you
E/flutter ( 7048): NoSuchMethodError: The method 'round' was called on null.
E/flutter ( 7048): Receiver: null
E/flutter ( 7048): Tried calling: round()
E/flutter ( 7048): #0 Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:46:5)
E/flutter ( 7048): #1 PageController.nextPage (package:flutter/src/widgets/page_view.dart:142:31)
E/flutter ( 7048): #2 CarouselState.initState. (package:carousel_pro/src/carousel_pro.dart:117:23)
E/flutter ( 7048): #3 _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
E/flutter ( 7048): #4 _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
E/flutter ( 7048): #5 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:165:12)
D/ ( 7048): HostConnection::get() New Host Connection established 0xa8508440, tid 7205
D/EGL_emulation( 7048): eglMakeCurrent: 0x9ae32820: ver 2 0 (tinfo 0xa85031f0)
The carousel is working fine but the following error is thrown at equal intervals. There is a long error that comes at startup.
Error that comes when app is loaded
I/flutter (29371): The following assertion was thrown during performLayout():
I/flutter (29371): 'package:flutter/src/rendering/sliver_fixed_extent_list.dart': Failed assertion: line 276 pos 12:
I/flutter (29371): 'firstIndex == 0 || childScrollOffset(firstChild) - scrollOffset <= precisionErrorTolerance': is not
I/flutter (29371): true.
I/flutter (29371):
I/flutter (29371): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter (29371): more information in this error message to help you determine and fix the underlying cause.
I/flutter (29371): In either case, please report this assertion by filing a bug on GitHub:
I/flutter (29371): https://github.com/flutter/flutter/issues/new?template=BUG.md
I/flutter (29371):
I/flutter (29371): The relevant error-causing widget was:
I/flutter (29371): PageView
I/flutter (29371): file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/carousel_pro-1.0.0/lib/src/carousel_pro.dart:314:33
I/flutter (29371):
I/flutter (29371): When the exception was thrown, this was the stack:
I/flutter (29371): #2 RenderSliverFixedExtentBoxAdaptor.performLayout (package:flutter/src/rendering/sliver_fixed_extent_list.dart:276:12)
I/flutter (29371): #3 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter (29371): #4 RenderSliverEdgeInsetsPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:135:11)
I/flutter (29371): #5 _RenderSliverFractionalPadding.performLayout (package:flutter/src/widgets/sliver_fill.dart:168:11)
I/flutter (29371): #6 RenderObject.layout (package:flutter/src/rendering/object.dart:1767:7)
I/flutter (29371): #7 RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:452:13)
I/flutter (29371): #8 RenderViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1444:12)
I/flutter (29371): #9 RenderViewport.performLayout (package:flutter/src/rendering/viewport.dart:1353:20)
I/flutter (29371): #10 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1630:7)
I/flutter (29371): #11 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:887:18)
I/flutter (29371): #12 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:402:19)
I/flutter (29371): #13 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:884:13)
I/flutter (29371): #14 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:284:5)
I/flutter (29371): #15 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1113:15)
I/flutter (29371): #16 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1052:9)
I/flutter (29371): #17 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:968:5)
I/flutter (29371): #21 _invoke (dart:ui/hooks.dart:261:10)
I/flutter (29371): #22 _drawFrame (dart:ui/hooks.dart:219:3)
I/flutter (29371): (elided 5 frames from class _AssertionError and dart:async)
I/flutter (29371):
I/flutter (29371): The following RenderObject was being processed when the exception was fired: RenderSliverFillViewport#38a95 relayoutBoundary=up2 NEEDS-LAYOUT NEEDS-COMPOSITING-BITS-UPDATE:
I/flutter (29371): needs compositing
I/flutter (29371): creator: _SliverFillViewportRenderObjectWidget ← _SliverFractionalPadding ← SliverFillViewport ←
I/flutter (29371): Viewport ← IgnorePointer-[GlobalKey#73898] ← Semantics ← _PointerListener ← Listener ←
I/flutter (29371): _GestureSemantics ← RawGestureDetector-[LabeledGlobalKey<RawGestureDetectorState>#b5513] ←
I/flutter (29371): _PointerListener ← Listener ← ⋯
I/flutter (29371): parentData: paintOffset=Offset(0.0, 0.0) (can use size)
I/flutter (29371): constraints: SliverConstraints(AxisDirection.right, GrowthDirection.forward, ScrollDirection.idle,
I/flutter (29371): scrollOffset: 719.3, remainingPaintExtent: 359.7, crossAxisExtent: 190.3, crossAxisDirection:
I/flutter (29371): AxisDirection.down, viewportMainAxisExtent: 359.7, remainingCacheExtent: 359.7, cacheOrigin: 0.0)
I/flutter (29371): geometry: SliverGeometry(scrollExtent: 1438.6, paintExtent: 359.7, maxPaintExtent: 1438.6,
I/flutter (29371): hasVisualOverflow: true, cacheExtent: 359.7)
I/flutter (29371): currently live children: 2 to 2
I/flutter (29371): This RenderObject had the following descendants (showing up to depth 5):
I/flutter (29371): child with index 2: RenderIndexedSemantics#76ebe
I/flutter (29371): child: RenderRepaintBoundary#7d1d5
I/flutter (29371): child: RenderDecoratedBox#05cf5
I/flutter (29371): child: RenderLimitedBox#b3c2a
I/flutter (29371): child: RenderConstrainedBox#9afab
I/flutter (29371): ════════════════════════════════════════════════════════════════════════════════════════════════════
Error that comes after an interval of time
exception was thrown: 'package:flutter/src/rendering/sliver_fixed_extent_list.dart': Failed assertion: line 276 pos 12: 'firstIndex == 0 || childScrollOffset(firstChild) - scrollOffset <= precisionErrorTolerance': is not true.
I have the following code that I am rendering.
return Container(
height: MediaQuery.of(context).size.height * 0.25,
child: Carousel(
boxFit: BoxFit.contain,
images: [
AssetImage('images/Notesbg.png'),
AssetImage('images/Notesbg.png'),
AssetImage('images/Notesbg.png'),
AssetImage('images/Notesbg.png')
],
autoplay: true,
autoplayDuration: Duration(seconds: 5),
animationCurve: Curves.fastLinearToSlowEaseIn,
animationDuration: Duration(milliseconds: 2000),
dotSize: 6.0,
indicatorBgPadding: 1.0,
dotBgColor: Colors.transparent,
dotSpacing: 13,
dotIncreaseSize: 1.4,
dotIncreasedColor: Colors.red,
),
);
Hi,
I have used the below code to show the carousel. However, it won't work. Can you tell me how to use the carousel in listview?
Code
SizedBox(
height: 200,
width: double.infinity,
child: ListView.builder(
itemCount: demoProductCarousel.length,
itemBuilder: (_, i) {
return Carousel(
dotSize: 4.0,
dotSpacing: 15.0,
dotColor: kPrimaryColor,
indicatorBgPadding: 15.0,
dotBgColor: Colors.transparent,
dotVerticalPadding: 5.0,
dotPosition: DotPosition.bottomRight,
images: [
Image.asset(
demoProductCarousel[i].imagePath,
fit: BoxFit.cover,
)
],
);
},
),
)
Thanks
Currently we need to add a sizedbox for the carousel to display images with some fixed height and width. Instead, there should be one more check in the code, if user dont provide height width then the carousel should take the height width of the image or of the device and calculate it and set the images with that height or width. It will become more dynamic for everyone to use.
Just like css sliders on the web.
Hi @jlouage ,
Do you still support this plugin? I have a question about how to remove margin/padding top and bottom of image. My code is:
Container(
alignment: Alignment.topCenter,
decoration: BoxDecoration(color: Colors.red),
child: Carousel(
dotSize: 4,
dotSpacing: 8,
dotBgColor: Colors.transparent,
autoplayDuration: Duration(seconds: 5),
images: carouselImages,
showIndicator: true,
boxFit: BoxFit.contain,
),
),
Then please refer to following screenshot, as you can see there's red background indicate margin/padding top and bottom:
How could I remove it? Thanks in advance!
i'm using a stack that contains carousel and a play button on top of it in a movie trailer app and i want to redirect the user to the trailer when he clicks the play button on the carousel,so i need to get the index of the current image that is being shown,how do i go about this?
Add support for VideoPlayer such that videos can also be played in carousel.
E/flutter (14589): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Bad state: No element
E/flutter (14589): #0 _GrowableList.single (dart:core-patch/growable_array.dart:229)
E/flutter (14589): #1 ScrollController.position (package:flutter/src/widgets/scroll_controller.dart:112)
E/flutter (14589): #2 PageController.page (package:flutter/src/widgets/page_view.dart:147)
E/flutter (14589): #3 CarouselState.initState.<anonymous closure> (package:carousel_pro/src/carousel_pro.dart:110)
E/flutter (14589): #4 _rootRunUnary (dart:async/zone.dart:1192)
E/flutter (14589): #5 _CustomZone.runUnary (dart:async/zone.dart:1085)
E/flutter (14589): #6 _CustomZone.runUnaryGuarded (dart:async/zone.dart:987)
E/flutter (14589): #7 _CustomZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1024)
E/flutter (14589): #8 _rootRunUnary (dart:async/zone.dart:1196)
E/flutter (14589): #9 _CustomZone.runUnary (dart:async/zone.dart:1085)
E/flutter (14589): #10 _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:1008)
E/flutter (14589): #11 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398)
E/flutter (14589): #12 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429)
E/flutter (14589): #13 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168)
E/flutter (14589):
E/flutter (14589): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Bad state: No element
E/flutter (14589): #0 _GrowableList.single (dart:core-patch/growable_array.dart:229)
E/flutter (14589): #1 ScrollController.position (package:flutter/src/widgets/scroll_controller.dart:112)
E/flutter (14589): #2 PageController.page (package:flutter/src/widgets/page_view.dart:147)
E/flutter (14589): #3 CarouselState.initState.<anonymous closure> (package:carousel_pro/src/carousel_pro.dart:110)
E/flutter (14589): #4 _rootRunUnary (dart:async/zone.dart:1192)
E/flutter (14589): #5 _CustomZone.runUnary (dart:async/zone.dart:1085)
E/flutter (14589): #6 _CustomZone.runUnaryGuarded (dart:async/zone.dart:987)
E/flutter (14589): #7 _CustomZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1024)
E/flutter (14589): #8 _rootRunUnary (dart:async/zone.dart:1196)
E/flutter (14589): #9 _CustomZone.runUnary (dart:async/zone.dart:1085)
E/flutter (14589): #10 _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:1008)
E/flutter (14589): #11 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398)
E/flutter (14589): #12 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429)
E/flutter (14589): #13 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168)
E/flutter (14589):
E/flutter (14589): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Bad state: No element
E/flutter (14589): #0 _GrowableList.single (dart:core-patch/growable_array.dart:229)
E/flutter (14589): #1 ScrollController.position (package:flutter/src/widgets/scroll_controller.dart:112)
E/flutter (14589): #2 PageController.page (package:flutter/src/widgets/page_view.dart:147)
E/flutter (14589): #3 CarouselState.initState.<anonymous closure> (package:carousel_pro/src/carousel_pro.dart:110)
E/flutter (14589): #4 _rootRunUnary (dart:async/zone.dart:1192)
E/flutter (14589): #5 _CustomZone.runUnary (dart:async/zone.dart:1085)
E/flutter (14589): #6 _CustomZone.runUnaryGuarded (dart:async/zone.dart:987)
E/flutter (14589): #7 _CustomZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1024)
E/flutter (14589): #8 _rootRunUnary (dart:async/zone.dart:1196)
E/flutter (14589): #9 _CustomZone.runUnary (dart:async/zone.dart:1085)
E/flutter (14589): #10 _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:1008)
E/flutter (14589): #11 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398)
E/flutter (14589): #12 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429)
E/flutter (14589): #13 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168)
E/flutter (14589):
E/flutter (14589): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Bad state: No element
E/flutter (14589): #0 _GrowableList.single (dart:core-patch/growable_array.dart:229)
E/flutter (14589): #1 ScrollController.position (package:flutter/src/widgets/scroll_controller.dart:112)
E/flutter (14589): #2 PageController.page (package:flutter/src/widgets/page_view.dart:147)
E/flutter (14589): #3 CarouselState.initState.<anonymous closure> (package:carousel_pro/src/carousel_pro.dart:110)
E/flutter (14589): #4 _rootRunUnary (dart:async/zone.dart:1192)
E/flutter (14589): #5 _CustomZone.runUnary (dart:async/zone.dart:1085)
E/flutter (14589): #6 _CustomZone.runUnaryGuarded (dart:async/zone.dart:987)
E/flutter (14589): #7 _CustomZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1024)
E/flutter (14589): #8 _rootRunUnary (dart:async/zone.dart:1196)
E/flutter (14589): #9 _CustomZone.runUnary (dart:async/zone.dart:1085)
E/flutter (14589): #10 _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:1008)
E/flutter (14589): #11 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398)
E/flutter (14589): #12 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429)
E/flutter (14589): #13 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168)
E/flutter (14589):
E/flutter (14589): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Bad state: No element
E/flutter (14589): #0 _GrowableList.single (dart:core-patch/growable_array.dart:229)
E/flutter (14589): #1 ScrollController.position (package:flutter/src/widgets/scroll_controller.dart:112)
E/flutter (14589): #2 PageController.page (package:flutter/src/widgets/page_view.dart:147)
E/flutter (14589): #3 CarouselState.initState.<anonymous closure> (package:carousel_pro/src/carousel_pro.dart:110)
E/flutter (14589): #4 _rootRunUnary (dart:async/zone.dart:1192)
E/flutter (14589): #5 _CustomZone.runUnary (dart:async/zone.dart:1085)
E/flutter (14589): #6 _CustomZone.runUnaryGuarded (dart:async/zone.dart:987)
E/flutter (14589): #7 _CustomZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1024)
E/flutter (14589): #8 _rootRunUnary (dart:async/zone.dart:1196)
E/flutter (14589): #9 _CustomZone.runUnary (dart:async/zone.dart:1085)
E/flutter (14589): #10 _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:1008)
E/flutter (14589): #11 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398)
E/flutter (14589): #12 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429)
E/flutter (14589): #13 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168)
E/flutter (14589):
E/flutter (14589): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Bad state: No element
E/flutter (14589): #0 _GrowableList.single (dart:core-patch/growable_array.dart:229)
E/flutter (14589): #1 ScrollController.position (package:flutter/src/widgets/scroll_controller.dart:112)
E/flutter (14589): #2 PageController.page (package:flutter/src/widgets/page_view.dart:147)
E/flutter (14589): #3 CarouselState.initState.<anonymous closure> (package:carousel_pro/src/carousel_pro.dart:110)
E/flutter (14589): #4 _rootRunUnary (dart:async/zone.dart:1192)
E/flutter (14589): #5 _CustomZone.runUnary (dart:async/zone.dart:1085)
E/flutter (14589): #6 _CustomZone.runUnaryGuarded (dart:async/zone.dart:987)
E/flutter (14589): #7 _CustomZone.bindUnaryCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1024)
E/flutter (14589): #8 _rootRunUnary (dart:async/zone.dart:1196)
E/flutter (14589): #9 _CustomZone.runUnary (dart:async/zone.dart:1085)
E/flutter (14589): #10 _CustomZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:1008)
E/flutter (14589): #11 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398)
E/flutter (14589): #12 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429)
E/flutter (14589): #13 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168)
Performing hot restart...
E/flutter (18054): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter (18054): 'package:flutter/src/widgets/page_view.dart': Failed assertion: line 96 pos 7: 'positions.isNotEmpty': PageController.page cannot be accessed before a PageView is built with it.
E/flutter (18054): #0 _AssertionError._doThrowNew (dart:core/runtime/liberrors_patch.dart:37:39)
E/flutter (18054): #1 _AssertionError._throwNew (dart:core/runtime/liberrors_patch.dart:33:5)
E/flutter (18054): #2 PageController.page (package:flutter/src/widgets/page_view.dart)
E/flutter (18054): #3 CarouselState.initState. (package:carousel_pro/src/carousel_pro.dart:110:24)
E/flutter (18054): #4 _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
E/flutter (18054): #5 _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
E/flutter (18054): #6 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:165:12)
Restarted app in 1,805ms.
I/flutter (18054): start
hi .
crash on exit because PageController
not disposed .
here the log
`[ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter ( 2562): 'package:flutter/src/widgets/page_view.dart': Failed assertion: line 96 pos 7: 'positions.isNotEmpty': PageController.page cannot be accessed before a PageView is built with it.
E/flutter ( 2562): #0 _AssertionError._doThrowNew (dart:core/runtime/liberrors_patch.dart:37:39)
E/flutter ( 2562): #1 _AssertionError._throwNew (dart:core/runtime/liberrors_patch.dart:33:5)
E/flutter ( 2562): #2 PageController.page (package:flutter/src/widgets/page_view.dart)
E/flutter ( 2562): #3 CarouselState.initState. (package:carousel_pro/src/carousel_pro.dart:110:24)
E/flutter ( 2562): #4 _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:382:19)
E/flutter ( 2562): #5 _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
E/flutter ( 2562): #6 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:165:12)
`
When I want to click on the image to another page, I don't know how to do.
I am using flutter carousel pro and in somehow I am getting this error any solution?
it says like this:
The preferred solution is to cancel the timer or stop listening to the animation in the dispose() callback. Another solution is to check the "mounted" property of this object before calling setState() to ensure the object is still in the tree.
This error might indicate a memory leak if setState() is being called because another object is retaining a reference to this State object after it has been removed from the tree. To avoid memory leaks, consider breaking the reference to this object during dispose().
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.