mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 22:09:06 +00:00
This is a new PR to update the navigation_and_routing sample to the latest version of go_router. It is a based on https://github.com/flutter/samples/pull/1437 --------- Co-authored-by: Brett Morgan <brettmorgan@google.com>
41 lines
1.0 KiB
Dart
41 lines
1.0 KiB
Dart
// Copyright 2021, the Flutter project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import '../data.dart';
|
|
import '../widgets/book_list.dart';
|
|
|
|
class AuthorDetailsScreen extends StatelessWidget {
|
|
final Author author;
|
|
final ValueChanged<Book> onBookTapped;
|
|
|
|
const AuthorDetailsScreen({
|
|
super.key,
|
|
required this.author,
|
|
required this.onBookTapped,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) => Scaffold(
|
|
appBar: AppBar(
|
|
title: Text(author.name),
|
|
),
|
|
body: Center(
|
|
child: Column(
|
|
children: [
|
|
Expanded(
|
|
child: BookList(
|
|
books: author.books,
|
|
onTap: (book) {
|
|
onBookTapped(book);
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|