in nav2-usability/scenario_code/lib/skipping-stacks/skipping_stacks_beamer.dart [40:78]
List<BeamPage> buildPages(BuildContext context, BeamState state) {
String? rawBookId = state.pathParameters['bookId'];
int? bookId = rawBookId != null ? int.parse(rawBookId) : null;
return [
BeamPage(
key: ValueKey('books'),
child: BooksListScreen(
books: books,
onTapped: (book) => update(
(state) => state.copyWith(
pathBlueprintSegments: ['books', ':bookId'],
pathParameters: {'bookId': books.indexOf(book).toString()},
),
),
// OR
// onTapped: (book) =>
// Beamer.of(context).beamToNamed('/books/${books.indexOf(book)}'),
),
),
if (bookId != null)
BeamPage(
key: ValueKey('books-$bookId'),
child: BookDetailsScreen(
book: books[bookId],
onAuthorTapped: (author) => Beamer.of(context).update(
state: BeamState(
pathBlueprintSegments: ['authors', ':authorId'],
pathParameters: {
'authorId': authors.indexOf(author).toString()
},
),
),
// OR
// onAuthorTapped: (author) => Beamer.of(context)
// .beamToNamed('/authors/${authors.indexOf(author)}'),
),
),
];
}