mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
General cleanup: consistent quoting, sort dependencies, (#859)
single quotes everywhere fix comment references
This commit is contained in:
@@ -25,8 +25,10 @@ class TemplateRouteParser extends RouteInformationParser<ParsedRoute> {
|
||||
TemplateRouteParser({
|
||||
/// The list of allowed path templates (['/', '/users/:id'])
|
||||
required List<String> allowedPaths,
|
||||
|
||||
/// The initial route
|
||||
String? initialRoute = '/',
|
||||
|
||||
/// [RouteGuard] used to redirect.
|
||||
this.guard,
|
||||
}) : initialRoute =
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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)'),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
@@ -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<NavigatorState> navigatorKey;
|
||||
|
||||
|
||||
@@ -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<void>(
|
||||
key: const ValueKey('empty'),
|
||||
|
||||
@@ -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)'),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -5,19 +5,19 @@ version: 1.0.0+1
|
||||
environment:
|
||||
sdk: ">=2.12.0 <3.0.0"
|
||||
dependencies:
|
||||
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
|
||||
cupertino_icons: ^1.0.2
|
||||
flutter:
|
||||
sdk: flutter
|
||||
path_to_regexp: ^0.4.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
|
||||
|
||||
Reference in New Issue
Block a user