-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
a: animationAnimation APIsAnimation APIsc: crashStack traces logged to the consoleStack traces logged to the consolef: gesturesflutter/packages/flutter/gestures repository.flutter/packages/flutter/gestures repository.f: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.
Milestone
Description
Steps to Reproduce
I am creating NumberPicker which is a ListView inside a Dialog.
Right now after opening a dialog and scrolling few times I get an error and then the scrolling just freezes.
The reason is calling intScrollController.animateTo method.
In the attached gif you can see that at first I can scroll freely but at some point the scroll freezes and I get a lot of this:
I/flutter ( 3471): Another exception was thrown: 'package:flutter/src/widgets/scrollable.dart': Failed assertion: line 414: '_hold == null || _drag == null': is not true.
Code
Widget _intListView(ThemeData themeData) {
final TextStyle style = themeData.textTheme.body1;
return new NotificationListener(
child: new Container(
height: _listViewHeight,
width: log(widget.maxIntValue).floorToDouble() * 20,
child: new ListView.builder(
controller: intScrollController,
itemExtent: _itemExtent,
itemCount: widget.maxIntValue - widget.minIntValue + 3,
itemBuilder: (BuildContext context, int index) {
final int value = widget.minIntValue + index - 1;
final TextStyle itemStyle = value == selectedIntValue
? themeData.textTheme.headline
.copyWith(color: themeData.accentColor)
: style;
bool isExtra = index == 0 ||
index == widget.maxIntValue - widget.minIntValue + 2;
return isExtra
? new Container()
: new Center(
child: new Text(value.toString(), style: itemStyle),
);
},
),
),
onNotification: (notification) {
if (notification is ScrollNotification) {
if (notification is UserScrollNotification && notification.direction == ScrollDirection.idle) {
intScrollController.animateTo(
(selectedIntValue - widget.minIntValue) * _itemExtent,
duration: new Duration(seconds: 1),
curve: new ElasticOutCurve());
} else {
//calculate
int intIndexOfMiddleElement =
(notification.metrics.pixels + _listViewHeight / 2) ~/
_itemExtent;
int intValueInTheMiddle =
widget.minIntValue + intIndexOfMiddleElement - 1;
if (intValueInTheMiddle != selectedIntValue) {
setState(() => selectedIntValue = intValueInTheMiddle);
}
}
}
return true;
},
);
}
Logs
Error message:
I/flutter (20929): ══╡ EXCEPTION CAUGHT BY GESTURE ╞═══════════════════════════════════════════════════════════════════
I/flutter (20929): The following assertion was thrown while handling a gesture:
I/flutter (20929): 'package:flutter/src/widgets/scrollable.dart': Failed assertion: line 409 pos 12: '_hold == null':
I/flutter (20929): is not true.
I/flutter (20929): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter (20929): more information in this error message to help you determine and fix the underlying cause.
I/flutter (20929): In either case, please report this assertion by filing a bug on GitHub:
I/flutter (20929): https://github.com/flutter/flutter/issues/new
I/flutter (20929): When the exception was thrown, this was the stack:
I/flutter (20929): #2 ScrollableState._handleDragStart (package:flutter/src/widgets/scrollable.dart:409:12)
I/flutter (20929): #3 DragGestureRecognizer.acceptGesture.<anonymous closure> (package:flutter/src/gestures/monodrag.dart:156:54)
I/flutter (20929): #4 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:71:24)
I/flutter (20929): #5 DragGestureRecognizer.acceptGesture (package:flutter/src/gestures/monodrag.dart:156:9)
I/flutter (20929): #6 GestureArenaManager._resolveByDefault (package:flutter/src/gestures/arena.dart:171:25)
I/flutter (20929): #7 GestureArenaManager._tryToResolveArena.<anonymous closure> (package:flutter/src/gestures/arena.dart:178:31)
I/flutter (20929): (elided 4 frames from class _AssertionError and package dart:async)
I/flutter (20929): Handler: onStart
I/flutter (20929): Recognizer:
I/flutter (20929): VerticalDragGestureRecognizer#3b7b5
I/flutter (20929): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter (20929): Another exception was thrown: 'package:flutter/src/widgets/scrollable.dart': Failed assertion: line 414 pos 12: '_hold == null || _drag == null': is not true.
I/flutter (20929): Another exception was thrown: 'package:flutter/src/widgets/scrollable.dart': Failed assertion: line 414 pos 12: '_hold == null || _drag == null': is not true.
I/flutter (20929): Another exception was thrown: 'package:flutter/src/widgets/scrollable.dart': Failed assertion: line 414 pos 12: '_hold == null || _drag == null': is not true.
I/flutter (20929): Another exception was thrown: 'package:flutter/src/widgets/scrollable.dart': Failed assertion: line 414 pos 12: '_hold == null || _drag == null': is not true.
I/flutter (20929): Another exception was thrown: 'package:flutter/src/widgets/scrollable.dart': Failed assertion: line 414 pos 12: '_hold == null || _drag == null': is not true.
I/flutter (20929): Another exception was thrown: 'package:flutter/src/widgets/scrollable.dart': Failed assertion: line 414 pos 12: '_hold == null || _drag == null': is not true.
I/flutter (20929): Another exception was thrown: 'package:flutter/src/widgets/scrollable.dart': Failed assertion: line 414 pos 12: '_hold == null || _drag == null': is not true.
I/flutter (20929): Another exception was thrown: 'package:flutter/src/widgets/scrollable.dart': Failed assertion: line 414 pos 12: '_hold == null || _drag == null': is not true.
I/flutter (20929): Another exception was thrown: 'package:flutter/src/widgets/scrollable.dart': Failed assertion: line 414 pos 12: '_hold == null || _drag == null': is not true.
I/flutter (20929): Another exception was thrown: 'package:flutter/src/widgets/scrollable.dart': Failed assertion: line 420 pos 12: '_hold == null || _drag == null': is not true.
Flutter Analyze
Analyzing /home/marcinus/dev/numberpicker...
No issues found!
Ran in 6.3s
Flutter Doctor
[✓] Flutter (on Linux, locale en_US.UTF-8, channel alpha)
• Flutter at /home/marcinus/flutter
• Framework revision d36e2f6191 (5 weeks ago), 2017-06-21 15:09:10 -0700
• Engine revision b0dee695ec
• Tools Dart version 1.24.0-dev.6.7
[✓] Android toolchain - develop for Android devices (Android SDK 25.0.3)
• Android SDK at /home/marcinus/Android/Sdk
• Platform android-25, build-tools 25.0.3
• Java binary at: /home/marcinus/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)
[✓] Android Studio (version 2.3)
• Android Studio at /home/marcinus/android-studio
• Gradle version 3.2
• Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)
[✓] IntelliJ IDEA Ultimate Edition (version 2017.2)
• Flutter plugin version 15.2
• Dart plugin version 172.3317.48
[✓] Connected devices
• ALE L21 • W3D7N16C16019415 • android-arm • Android 6.0 (API 23)
gmaggio, eastrd and kbokariusgctommy, tresheffron, gmaggio and eastrd
Metadata
Metadata
Assignees
Labels
a: animationAnimation APIsAnimation APIsc: crashStack traces logged to the consoleStack traces logged to the consolef: gesturesflutter/packages/flutter/gestures repository.flutter/packages/flutter/gestures repository.f: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.
