diff --git a/navigation_and_routing/lib/src/screens/author_details.dart b/navigation_and_routing/lib/src/screens/author_details.dart index 5bcf48568..30a25b38d 100644 --- a/navigation_and_routing/lib/src/screens/author_details.dart +++ b/navigation_and_routing/lib/src/screens/author_details.dart @@ -7,6 +7,7 @@ import 'package:flutter/material.dart'; import '../data.dart'; import '../widgets/book_list.dart'; import 'book_details.dart'; +import '../routing.dart'; class AuthorDetailsScreen extends StatelessWidget { final Author author; @@ -29,15 +30,7 @@ class AuthorDetailsScreen extends StatelessWidget { child: BookList( books: author.books, onTap: (book) { - Navigator.of(context).push( - MaterialPageRoute( - builder: (context) { - return BookDetailsScreen( - book: book, - ); - }, - ), - ); + RouteStateScope.of(context)!.go('/book/${book.id}'); }, ), ),