From b0745a00d442ad689713a89b0b8ef5bb88168a1b Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Mon, 2 Aug 2021 10:57:30 -0700 Subject: [PATCH] General cleanup: consistent quoting, sort dependencies, (#859) single quotes everywhere fix comment references --- navigation_and_routing/lib/src/routing/parser.dart | 2 ++ .../lib/src/routing/route_state.dart | 3 +-- .../lib/src/screens/author_details.dart | 3 +-- navigation_and_routing/lib/src/screens/authors.dart | 2 +- .../lib/src/screens/book_details.dart | 12 +++--------- .../lib/src/screens/navigator.dart | 2 +- .../lib/src/screens/scaffold_body.dart | 13 +++++++------ .../lib/src/screens/settings.dart | 4 ++-- .../router_advanced/transition_delegate.dart | 7 ++++--- navigation_and_routing/pubspec.yaml | 12 ++++++------ 10 files changed, 28 insertions(+), 32 deletions(-) diff --git a/navigation_and_routing/lib/src/routing/parser.dart b/navigation_and_routing/lib/src/routing/parser.dart index 4d0bbda6d..17d7cf35d 100644 --- a/navigation_and_routing/lib/src/routing/parser.dart +++ b/navigation_and_routing/lib/src/routing/parser.dart @@ -25,8 +25,10 @@ class TemplateRouteParser extends RouteInformationParser { TemplateRouteParser({ /// The list of allowed path templates (['/', '/users/:id']) required List allowedPaths, + /// The initial route String? initialRoute = '/', + /// [RouteGuard] used to redirect. this.guard, }) : initialRoute = diff --git a/navigation_and_routing/lib/src/routing/route_state.dart b/navigation_and_routing/lib/src/routing/route_state.dart index 21565b78a..3c8149070 100644 --- a/navigation_and_routing/lib/src/routing/route_state.dart +++ b/navigation_and_routing/lib/src/routing/route_state.dart @@ -18,8 +18,7 @@ class RouteState extends ChangeNotifier { TemplateRouteParser parser; ParsedRoute _route; - RouteState(this.parser) - : _route = parser.initialRoute; + RouteState(this.parser) : _route = parser.initialRoute; ParsedRoute get route => _route; diff --git a/navigation_and_routing/lib/src/screens/author_details.dart b/navigation_and_routing/lib/src/screens/author_details.dart index 30a25b38d..b7916bb03 100644 --- a/navigation_and_routing/lib/src/screens/author_details.dart +++ b/navigation_and_routing/lib/src/screens/author_details.dart @@ -5,9 +5,8 @@ import 'package:flutter/material.dart'; import '../data.dart'; -import '../widgets/book_list.dart'; -import 'book_details.dart'; import '../routing.dart'; +import '../widgets/book_list.dart'; class AuthorDetailsScreen extends StatelessWidget { final Author author; diff --git a/navigation_and_routing/lib/src/screens/authors.dart b/navigation_and_routing/lib/src/screens/authors.dart index 9a76237dc..bfaff2350 100644 --- a/navigation_and_routing/lib/src/screens/authors.dart +++ b/navigation_and_routing/lib/src/screens/authors.dart @@ -9,7 +9,7 @@ import '../widgets/author_list.dart'; import '../widgets/library_scope.dart'; class AuthorsScreen extends StatelessWidget { - final String title = "Authors"; + final String title = 'Authors'; const AuthorsScreen({Key? key}) : super(key: key); diff --git a/navigation_and_routing/lib/src/screens/book_details.dart b/navigation_and_routing/lib/src/screens/book_details.dart index 7193d73d9..4b6aeb1c1 100644 --- a/navigation_and_routing/lib/src/screens/book_details.dart +++ b/navigation_and_routing/lib/src/screens/book_details.dart @@ -34,17 +34,11 @@ class BookDetailsScreen extends StatelessWidget { children: [ Text( book!.title, - style: Theme - .of(context) - .textTheme - .headline4, + style: Theme.of(context).textTheme.headline4, ), Text( book!.author.name, - style: Theme - .of(context) - .textTheme - .subtitle1, + style: Theme.of(context).textTheme.subtitle1, ), TextButton( child: const Text('View author (Push)'), @@ -62,8 +56,8 @@ class BookDetailsScreen extends StatelessWidget { uri: Uri.parse('/author/${book!.author.id}'), builder: (context, followLink) { return TextButton( - child: const Text('View author (Link)'), onPressed: followLink, + child: const Text('View author (Link)'), ); }, ), diff --git a/navigation_and_routing/lib/src/screens/navigator.dart b/navigation_and_routing/lib/src/screens/navigator.dart index a443f917b..458435788 100644 --- a/navigation_and_routing/lib/src/screens/navigator.dart +++ b/navigation_and_routing/lib/src/screens/navigator.dart @@ -16,7 +16,7 @@ import 'book_details.dart'; import 'scaffold.dart'; /// Builds the top-level navigator for the app. The pages to display are based -/// on the [routeState] that was parsed by the TemplateRouteParser. +/// on the `routeState` that was parsed by the TemplateRouteParser. class BookstoreNavigator extends StatefulWidget { final GlobalKey navigatorKey; diff --git a/navigation_and_routing/lib/src/screens/scaffold_body.dart b/navigation_and_routing/lib/src/screens/scaffold_body.dart index c30081a98..bc44a0378 100644 --- a/navigation_and_routing/lib/src/screens/scaffold_body.dart +++ b/navigation_and_routing/lib/src/screens/scaffold_body.dart @@ -9,6 +9,7 @@ import '../screens/settings.dart'; import '../widgets/fade_transition_page.dart'; import 'authors.dart'; import 'books.dart'; +import 'scaffold.dart'; /// Displays the contents of the body of [BookstoreScaffold] class BookstoreScaffoldBody extends StatelessWidget { @@ -45,12 +46,12 @@ class BookstoreScaffoldBody extends StatelessWidget { child: BooksScreen(currentRoute: currentRoute), ) - // Avoid building a Navigator with an empty `pages` list when the - // RouteState is set to an unexpected path, such as /signin. - // - // Since RouteStateScope is an InheritedNotifier, any change to the - // route will result in a call to this build method, even though this - // widget isn't built when those routes are active. + // Avoid building a Navigator with an empty `pages` list when the + // RouteState is set to an unexpected path, such as /signin. + // + // Since RouteStateScope is an InheritedNotifier, any change to the + // route will result in a call to this build method, even though this + // widget isn't built when those routes are active. else FadeTransitionPage( key: const ValueKey('empty'), diff --git a/navigation_and_routing/lib/src/screens/settings.dart b/navigation_and_routing/lib/src/screens/settings.dart index 35a18bff3..c0ad7d647 100644 --- a/navigation_and_routing/lib/src/screens/settings.dart +++ b/navigation_and_routing/lib/src/screens/settings.dart @@ -2,11 +2,11 @@ // 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'; import '../auth/auth.dart'; +import '../routing.dart'; class SettingsScreen extends StatefulWidget { const SettingsScreen({Key? key}) : super(key: key); @@ -63,8 +63,8 @@ class SettingsContent extends StatelessWidget { uri: Uri.parse('/book/0'), builder: (context, followLink) { return TextButton( - child: const Text('Go directly to /book/0 (Link)'), onPressed: followLink, + child: const Text('Go directly to /book/0 (Link)'), ); }, ), diff --git a/navigation_and_routing/old_snippets/router_advanced/transition_delegate.dart b/navigation_and_routing/old_snippets/router_advanced/transition_delegate.dart index 98a43cb38..c161f48f9 100644 --- a/navigation_and_routing/old_snippets/router_advanced/transition_delegate.dart +++ b/navigation_and_routing/old_snippets/router_advanced/transition_delegate.dart @@ -3,9 +3,10 @@ // BSD-style license that can be found in the LICENSE file. /// Shows how a custom TransitionDelegate can be used to customized when -/// transition animations are shown. (For example, [when two routes are popped -/// off the stack](https://github.com/flutter/flutter/issues/12146), however the -/// default TransitionDelegate will handle this if you are using Router) +/// transition animations are shown. (For example, +/// [when two routes are popped off the stack](https://github.com/flutter/flutter/issues/12146), +/// however the default TransitionDelegate will handle this if you are using +/// `Router`.) import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; diff --git a/navigation_and_routing/pubspec.yaml b/navigation_and_routing/pubspec.yaml index bcedeb647..44c5a8e6e 100644 --- a/navigation_and_routing/pubspec.yaml +++ b/navigation_and_routing/pubspec.yaml @@ -5,19 +5,19 @@ version: 1.0.0+1 environment: sdk: ">=2.12.0 <3.0.0" dependencies: + adaptive_navigation: ^0.0.3 + collection: ^1.15.0 + cupertino_icons: ^1.0.2 flutter: sdk: flutter - cupertino_icons: ^1.0.2 - quiver: ^3.0.0 path_to_regexp: ^0.4.0 - adaptive_navigation: ^0.0.3 - collection: ^1.15.0 + quiver: ^3.0.0 url_launcher: ^6.0.0 url_strategy: ^0.2.0 dev_dependencies: - test: ^1.16.0 + flutter_lints: ^1.0.0 flutter_test: sdk: flutter - flutter_lints: ^1.0.0 + test: ^1.16.0 flutter: uses-material-design: true