1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-08 22:09:06 +00:00
Files
samples/navigation_and_routing/lib/src/screens/author_details.dart
Kevin Moore ecf716dcab navigation_and_routing: a bunch of cleanup (#886)
Fail early on nullable context objects - no code paths allow null
Eliminate superfluous private function
Use a function over an abstract class with one method
2021-08-26 16:14:29 -07:00

40 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 '../routing.dart';
import '../widgets/book_list.dart';
class AuthorDetailsScreen extends StatelessWidget {
final Author author;
const AuthorDetailsScreen({
Key? key,
required this.author,
}) : super(key: key);
@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) {
RouteStateScope.of(context).go('/book/${book.id}');
},
),
),
],
),
),
);
}