【发布时间】:2020-04-27 07:24:24
【问题描述】:
我在 Flutter 中使用 Navigator,我有一个带有以下代码的屏幕:
tempResultHolder = await Navigator.of(context, rootNavigator: true).push(
MenuOverlay(
studentTest: widget.studentTest,
context: context,
currentQuestionIndex: currentQuestion - 1,
currentSectionIndex: currentSection),
);
debugPrint('String got from menu: $tempResultHolder');
menuOverlay 的弹出代码是:
onTap() {
debugPrint('Sending from menu: $outerIndex,${innerIndex + 1}');
Navigator.pop(context, '$outerIndex,$innerIndex');
}
控制台输出为:
从菜单发送:2,4
从菜单中获得的字符串:2,3
请告诉我,如果我能做些什么来获得正确的数据。如果outerIndex 是奇数,我会在inner index 中再获得1:对于奇数索引:
从菜单发送:1,4
从菜单获得的字符串:1,4
【问题讨论】:
标签: flutter dart mobile-application