1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-12 15:58:32 +00:00

Update Navigation and Routing sample (#851)

* Add duration parameter to FadeTransitionPage

* Use didChangeDependencies instead of didUpdateWidget

* Don't notify listeners if the path hasn't changed

* Update navigation sample WIP

* Use Link and RouteStateScope in settings screen

* update README

* use named parameters for Library.addBook()

* Make _handleAuthStateChanged synchronous

* add missing copyright headers

* Address code review comments

* Address code review comments
This commit is contained in:
John Ryan
2021-07-12 14:22:53 -07:00
committed by GitHub
parent d3c4645a42
commit 35f1670098
17 changed files with 298 additions and 78 deletions

View File

@@ -2,6 +2,7 @@
// 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:bookstore/src/routing.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/link.dart';
@@ -62,18 +63,15 @@ class SettingsContent extends StatelessWidget {
uri: Uri.parse('/book/0'),
builder: (context, followLink) {
return TextButton(
child: const Text('Go directly to /book/0'),
child: const Text('Go directly to /book/0 (Link)'),
onPressed: followLink,
);
},
),
Link(
uri: Uri.parse('/author/0'),
builder: (context, followLink) {
return TextButton(
child: const Text('Go directly to /author/0'),
onPressed: followLink,
);
TextButton(
child: const Text('Go directly to /book/0 (RouteState)'),
onPressed: () {
RouteStateScope.of(context)!.go('/book/0');
},
),
].map((w) => Padding(padding: const EdgeInsets.all(8), child: w)),