Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

轮播图嵌套在ListView中listView加上滚动监听会报错 #38

Open
js1121302139 opened this issue Jan 6, 2019 · 1 comment
Open

Comments

@js1121302139
Copy link

js1121302139 commented Jan 6, 2019

new ListView( children: <Widget>[ new Container( key: Key('banner'), child: new Swiper( itemBuilder: (BuildContext context, int index) { return images[index]; }, pagination: new SwiperPagination(), itemCount: 3, autoplay: true, autoplayDelay: 5000, layout: SwiperLayout.DEFAULT, scale: 1, ), height: 170.0 + MediaQuery.of(context).padding.top, ), new Text('aaaa'), new Text('aaaa'), new Text('aaaa'), new Text('aaaa'), new Text('aaaa'), new Text('aaaa'), new Text('aaaa'), new Text('aaaa'), new Text('aaaa'), new Text('aaaa'), new Text('aaaa'), new Text('aaaa'), new Text('aaaa'), new Text('aaaa'), new Text('aaaa'), new Text('aaaa'), new Text('aaaa'), new Text('aaaa'), new Text('aaaa'), new Text('aaaa'), new Text('aaaa'), new Text('aaaa'), new Text('aaaa'), new Text('aaaa'), new Text('aaaa'), ], ), ScrollController sc = new ScrollController(); @override void initState() { //监听滚动事件,打印滚动位置 sc.addListener(() { _setOpacity(sc.offset); }); super.initState(); }
错误信息:
══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ╞═════════════════════════════════════════════════════════
flutter: The following NoSuchMethodError was thrown during a scheduler callback:
flutter: The method 'findRenderObject' was called on null.
flutter: Receiver: null
flutter: Tried calling: findRenderObject()
flutter:
flutter: When the exception was thrown, this was the stack:
flutter: #0 Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
flutter: #1 _TransformerPageViewState._onGetSize (package:transformer_page_view/transformer_page_view.dart:455:41)
flutter: #2 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:990:15)
flutter: #3 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:938:9)
flutter: #4 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:842:5)
flutter: #5 _invoke (dart:ui/hooks.dart:154:13)
flutter: #6 _drawFrame (dart:ui/hooks.dart:143:3)
flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════
flutter: Another exception was thrown: NoSuchMethodError: The method 'findRenderObject' was called on null.
flutter: Another exception was thrown: NoSuchMethodError: The method 'findRenderObject' was called on null.

flutter_swiper: ^1.1.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants