В Flutter я пытаюсь перейти на новую страницу, когда нажимаю на виджет ListTile. Я пытаюсь использовать функцию ontap (), однако она не работает.
ListTile(
leading: Icon(Icons.border_color),
title: Text('Freelance English Native needed'),
subtitle: Text('Requirements: Native English'),
onTap: () {
Navigator.pushNamed(context, '/second');
},
),
MaterialApp(
// Start the app with the "/" named route. In this case, the app starts
// on the FirstScreen widget.
initialRoute: '/',
routes: {
// When navigating to the "/" route, build the FirstScreen widget.
'/': (context) => MyApp(),
// When navigating to the "/second" route, build the SecondScreen widget.
'/second': (context) => SecondScreen(),
},
);