1
0
mirror of https://github.com/flutter/samples.git synced 2026-07-16 05:52:01 +00:00

Move library to a top-level variable, since it never changes (#887)

This commit is contained in:
Kevin Moore
2021-08-26 16:18:40 -07:00
committed by GitHub
parent ecf716dcab
commit c9688ca34b
8 changed files with 77 additions and 114 deletions

View File

@@ -4,9 +4,9 @@
import 'package:flutter/material.dart';
import '../data/library.dart';
import '../routing.dart';
import '../widgets/author_list.dart';
import '../widgets/library_scope.dart';
class AuthorsScreen extends StatelessWidget {
final String title = 'Authors';
@@ -19,7 +19,7 @@ class AuthorsScreen extends StatelessWidget {
title: Text(title),
),
body: AuthorList(
authors: LibraryScope.of(context).allAuthors,
authors: libraryInstance.allAuthors,
onTap: (author) {
RouteStateScope.of(context).go('/author/${author.id}');
},