English 中文(简体)
视觉工作室代码中 调试时闪烁导航
原标题:Navigation on flutter on debug in Visual Studio Code

我用电动键构建一个应用程序, 我将主页和配置页建成两页, 之后我在主页上添加了两个按钮, 一个用此代码导航到配置页 :

void _gotoConfigurationPage() {
    Navigator.push(context, MaterialPageRoute(builder: (context) {
      return const ConfigurationPage(title:  ConfigurationPage );
    }));
  }

但当我试图调试安卓模拟器或安卓手机中的应用程序时, 导航工作不起作用, 其他按钮停止工作, 但是当我在模拟器或手机上打开应用程序时, 导航工作就成功了!

我做错什么了吗?

伊迪莎白•伊迪莎白•伊迪莎白•伊迪莎白•伊迪莎白•伊迪莎白•伊迪莎白

这是用于导航到配置页面的主页按钮的代码 。

floatingActionButton: Row(
        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
        children: [
          FloatingActionButton(
            onPressed: _gotoConfigurationPage,
            tooltip:  Configuration ,
            child: const Icon(Icons.settings),
          ),
          FloatingActionButton(
            onPressed: _action2,
            tooltip:  Action2 ,
            child: const Icon(Icons.settings),
          ),
        ],
      ),
最佳回答

经过一些额外的测试后,我意识到了一些事情,第一件事是,调试器在我尝试导航时被暂停,如果我点击继续,应用程序到达配置页面,第二个是控制台上的一条信息。

W/OnBackInvokedCallback( 6052): OnBackInvokedCallback is not enabled for the application.
W/OnBackInvokedCallback( 6052): Set  android:enableOnBackInvokedCallback="true"  in the application manifest.

在添加后,主控台的列表文件开始显示另一个消息

Exception caught by scheduler library 

There are multiple heroes that share the same tag within a subtree.

我发现" https://stackoverflow.com/ questions/51125024/ therere -rea- multiple-heroes- that-share-the-same-tag- in- a-sub-tree"。 '在子树 内有多个英雄拥有相同的标签,所以我修改了按钮代码,现在导航工作正常。

问题回答

试着做个干净的滑动,这样就能解决问题

我遇到了同样的问题。 我添加了 < code> debugshowShoow checkedModeBanner: fraud 。 在“ mantireApp 中, 运行了 < engy> flutter clean , 并运行了应用程序。 < engy> flutterb get, 重新启动了 vscode, 然后运行了应用程序 。





相关问题
navigator.userAgent in Chrome not correct

I use javascript method navigator.userAgent to detect version of browser. But it gives wrong version for Chrome. My Chrome is 114.0.5735.134, but the navigator.userAgent show it is 114.0.0.0. I would ...

jQuery TOOLS scrollable can t find its navigator

So, got a little problem here :) I m using jQuery TOOLS to make a neat, little scrollable gallery. Worked perfectly fine until i moved the correlating navigator one node too far away from the ...

jqGrid navigator - how to specyfy settings globally?

I m using Navigator with jqGrid and I m repeating over and over settings such as: savekey: [true, 13], closeOnEscape: true, closeAfterAdd: true How can I define these settings globally to all my ...

JQgrid want an ALL option on the navigator

I am working on jqGrid.I had a problem in the navigator rowList. my data to this field is like this rowList:[ 25 , 50 , 75 , -1 ]. I am using -1 to display all the records.In the row list,i wish to ...

Android - Distance between two Cities

I need in my Android Application the Distance and the Driving Time between Two cities. Is there a possibility to calculate this things for example via Google Navigator or Google Maps? (the driving ...

热门标签