I’m building an application in flutter, I build two pages the main page and a configuration page, after that I added two buttons to the main page, one of then to navigate to the configuration page with this code:
void _gotoConfigurationPage() {
Navigator.push(context, MaterialPageRoute(builder: (context) {
return const ConfigurationPage(title: 'ConfigurationPage');
}));
}
But when I try to debug the application in an Android emulator or an Android phone, the navigation doesn’t work, and the other buttons stop working, BUT when I open the application in the emulator or on the phone, the navigation works!
Am I doing something wrong?
===EDIT===
This is the code of the button in the main page used to navitate to the configuration page.
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),
),
],
),
3
Answers
After some additional tests I realized some things, the first one was that the debugger get paused when I try to navigate and if I clicked in continue the application reach the configuration page, the second one was a message on console
after adding that on the manifest file in the console starts to appear another message
with that in mind I found There are multiple heroes that share the same tag within a subtree, so I modified the buttons code and now the navigation works properly.
I faced the same issue. I added
debugShowCheckedModeBanner: false
in the MaterialApp, ran flutter clean and flutter pub get, restarted vscode, and then ran the app.Just try doing a flutter clean.It would solve the issue