List buildPages()

in nav2-usability/scenario_code/lib/skipping-stacks/skipping_stacks_beamer.dart [88:124]


  List<BeamPage> buildPages(BuildContext context, BeamState state) {
    String? rawAuthorId = state.pathParameters['authorId'];
    int? authorId = rawAuthorId != null ? int.parse(rawAuthorId) : null;
    return [
      if (state.pathBlueprintSegments.contains('authors'))
        BeamPage(
          key: ValueKey('authors'),
          child: AuthorsListScreen(
            authors: authors,
            onTapped: (author) => update(
              (state) => state.copyWith(
                pathBlueprintSegments: state.pathBlueprintSegments
                  ..add(':authorId'),
                pathParameters: {
                  'authorId': authors.indexOf(author).toString()
                },
              ),
            ),
            // OR
            // onTapped: (author) => Beamer.of(context)
            //     .beamToNamed('/authors/${authors.indexOf(author)}'),
            onGoToBooksTapped: () => Beamer.of(context).update(
              state: BeamState(),
            ),
            // OR
            // onGoToBooksTapped: () => Beamer.of(context).beamToNamed('/'),
          ),
        ),
      if (authorId != null)
        BeamPage(
          key: ValueKey('author-$authorId'),
          child: AuthorDetailsScreen(
            author: authors[authorId],
          ),
        ),
    ];
  }