-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
After running the app...
- Tap on the dropdown button, the menu should appear
- Select an item from the dropdown (that isn't the selected element)
- (Issue 1) The menu disappears without the selection changing
- (Issue 2) Tap on the dropdown button again...
- The error shown below occurs
Use the sample code below
import 'package:flutter/material.dart';
void main() {
runApp(
new MaterialApp(
title: 'DropdownButton Bug',
theme: new ThemeData(
primarySwatch: Colors.red,
),
home: new DropdownButtonBug(),
),
);
}
class DropdownButtonBug extends StatefulWidget {
DropdownButtonBug({Key key}) : super(key: key);
@override
_DropdownButtonBugState createState() => new _DropdownButtonBugState();
}
class _DropdownButtonBugState extends State<DropdownButtonBug> {
final List<String> _items = ['One', 'Two', 'Three', 'Four'].toList();
String _selection;
@override
Widget build(BuildContext context) {
_selection = _items.first;
final dropdownMenuOptions = _items
.map((String item) =>
new DropdownMenuItem<String>(value: item, child: new Text(item))
)
.toList();
return new Scaffold(
body: new DropdownButton<String>(
value: _selection,
items: dropdownMenuOptions,
onChanged: (s) {
setState(() {
if(s != null)
_selection = s;
});
}
)
);
}
}
Error
> I/flutter : ══╡ EXCEPTION CAUGHT BY GESTURE LIBRARY ╞═══════════════════════════════════════════════════════════
> I/flutter : The following assertion was thrown while routing a pointer event:
> I/flutter : 'package:flutter/src/material/drop_down.dart': Failed assertion: line 499 pos 12: '_currentRoute ==
> I/flutter : null' is not true.
> I/flutter :
> I/flutter : When the exception was thrown, this was the stack:
> I/flutter : #2 _DropdownButtonState._handleTap (package:flutter/src/material/drop_down.dart:499:12)
> I/flutter : #3 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:148:14)
> I/flutter : #4 TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:94:7)
> I/flutter : #5 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:198:9)
> I/flutter : #6 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:73:12)
> I/flutter : #7 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:101:11)
> I/flutter : #8 BindingBase&SchedulerBinding&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:122:19)
> I/flutter : #9 BindingBase&SchedulerBinding&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:100:22)
> I/flutter : #10 BindingBase&SchedulerBinding&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:81:7)
> I/flutter : #11 BindingBase&SchedulerBinding&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:40:7)
> I/flutter : #12 BindingBase&SchedulerBinding&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:33:5)
> I/flutter : #13 _dispatchPointerDataPacket (file:///b/build/slave/Linux_Engine/build/src/flutter/lib/ui/hooks.dart:59)
> I/flutter : (elided 2 frames from class _AssertionError)
> I/flutter :
> I/flutter : Event:
> I/flutter : PointerUpEvent(Point(76.6, 345.2))
> I/flutter : ════════════════════════════════════════════════════════════════════════════════════════════════════
## Logs
Output of flutter analyze:
Analyzing lib/main.dart...
No analyzer warnings! (ran in 5.9s)
Flutter Doctor
[✓] Flutter (on Linux, channel master)
• Flutter at /usr/local/flutter
• Framework revision 9cab64a (2 days ago), 2016-10-14 21:57:28
• Engine revision d999f6c
• Tools Dart version 1.20.0-dev.10.2[✓] Android toolchain - develop for Android devices (Android SDK 24.0.2)
• Android SDK at /usr/local/android/Sdk
• Platform android-24, build-tools 24.0.2
• OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-3ubuntu1~16.04.1-b14)[✓] Atom - a lightweight development environment for Flutter
• flutter plugin version 0.2.6
• dartlang plugin version 0.6.40[✓] Connected devices
• Android SDK built for x86 • emulator-5554 • android-x86 (emulator)
Testing System Information
- CPU: i5-2400
- RAM: 24G
- OS: Ubuntu 16.04
- IDE: Atom w/ Flutter plugin
Android Emulator Info:
- Device: Nexus 6 (1440 x 2560, 560dpi)
- Target: Android 7 (API 24)
- CPU: Intel Atom (x86)
- Memory Options: (RAM: 3072, VM Heap: 32)
- Internal Storage: 200MB
- Emulation Options: Use Host GPU