如何使用MethodChannel在本机顶部显示抖动视图?

时间:2019-02-27 08:50:27

标签: flutter

我正在遵循Flutter的示例“ Platform_view”, 使用MethodChannel,我可以在本机代码和Flutter代码之间进行通信。 我的情况: 当本机代码中发生按钮按下时,我想在flutter中运行一个方法,该方法又会在本机应用程序顶部启动全屏视图。

我的代码陷入混乱:

_methodChannel.setMethodCallHandler((MethodCall call) {
      if (call.method == "launchSecondView") {
        Navigator.push(context, MaterialPageRoute(builder: (context) {
          SecondView view = SecondView();
          view.callback = () {
            _methodChannel.invokeMethod("callbackFromSecond");
          };
        })
        );
      }
    });

该处理程序被调用,但是Navigator.push()未显示第二个屏幕。

0 个答案:

没有答案