当我致电任何Flat Button
时出现问题,我确定问题与我已经尝试过这两件事的pop()
有关,
但是直到现在还没有运气,所以我将不胜感激,谢谢。
showPickerDateRange(BuildContext context) {
Picker ps = new Picker(
hideHeader: true,
adapter: new DateTimePickerAdapter(type: PickerDateTimeType.kYM),
onConfirm: (Picker picker, List value) {
print((picker.adapter as DateTimePickerAdapter).value);
});
Picker pe = new Picker(
hideHeader: true,
adapter: new DateTimePickerAdapter(type: PickerDateTimeType.kYM),
onConfirm: (Picker picker, List value) {
print((picker.adapter as DateTimePickerAdapter).value);
});
List<Widget> actions = [
FlatButton(
onPressed: () {
Future.delayed(Duration.zero, () {
Navigator.of(context).pop();
});
},
child: new Text(PickerLocalizations.of(context).cancelText)),
FlatButton(
onPressed: () {
Future.delayed(Duration.zero, () {
Navigator.of(context).pop();
ps.onConfirm(ps, ps.selecteds);
pe.onConfirm(pe, pe.selecteds);
});
},
child: new Text(PickerLocalizations.of(context).confirmText))
];
showDialog(
context: context,
builder: (BuildContext context) {
return new AlertDialog(
title: Text("Select Date Range"),
actions: actions,
content: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text("Begin:"),
ps.makePicker(),
Text("End:"),
pe.makePicker()
],
),
),
);
});
}
这是终端输出
I/flutter (28546): Another exception was thrown: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 2113 pos 12: '!_debugLocked': is not true.
E/flutter (28546): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: 'package:flutter/src/widgets/navigator.dart': Failed assertion: line 2113 pos 12: '!_debugLocked': is not true.
E/flutter (28546): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:42:39)
E/flutter (28546): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:38:5)
E/flutter (28546): #2 NavigatorState.pop (package:flutter/src/widgets/navigator.dart:2113:12)
E/flutter (28546): #3 _HomeState.showPickerDateRange.<anonymous closure>.<anonymous closure> (package:agence_test/home_agence.dart:170:37)
E/flutter (28546): #4 new Future.delayed.<anonymous closure> (dart:async/future.dart:316:39)
E/flutter (28546): #5 _rootRun (dart:async/zone.dart:1122:38)
E/flutter (28546): #6 _CustomZone.run (dart:async/zone.dart:1023:19)
E/flutter (28546): #7 _CustomZone.runGuarded (dart:async/zone.dart:925:7)
E/flutter (28546): #8 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:965:23)
E/flutter (28546): #9 _rootRun (dart:async/zone.dart:1126:13)
E/flutter (28546): #10 _CustomZone.run (dart:async/zone.dart:1023:19)
E/flutter (28546): #11 _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:949:23)
E/flutter (28546): #12 Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:23:15)
E/flutter (28546): #13 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:384:19)
E/flutter (28546): #14 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:418:5)
E/flutter (28546): #15 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)
E/flutter (28546):
医生结果扑朔迷离
• No issues found!