Because Of instantiated two MaterialApp widgets. You need to remove the one in MyApp class and may change it to Scaffold
Example:
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Scaffold(
// ...
return new ListTile(
onTap: () {
Navigator.pushNamed(context, "/listadecompras");
},
// ...
}
THE PROBLEM IS YOUR CODE IS – the route is trying to resolve for the nearest MaterialApp which has no route definition. That said you should use only one MaterialApp as the root of your widget tree.