mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 22:09:06 +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({
|
TemplateRouteParser({
|
||||||
/// The list of allowed path templates (['/', '/users/:id'])
|
/// The list of allowed path templates (['/', '/users/:id'])
|
||||||
required List<String> allowedPaths,
|
required List<String> allowedPaths,
|
||||||
|
|
||||||
/// The initial route
|
/// The initial route
|
||||||
String? initialRoute = '/',
|
String? initialRoute = '/',
|
||||||
|
|
||||||
/// [RouteGuard] used to redirect.
|
/// [RouteGuard] used to redirect.
|
||||||
this.guard,
|
this.guard,
|
||||||
}) : initialRoute =
|
}) : initialRoute =
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ class RouteState extends ChangeNotifier {
|
|||||||
TemplateRouteParser parser;
|
TemplateRouteParser parser;
|
||||||
ParsedRoute _route;
|
ParsedRoute _route;
|
||||||
|
|
||||||
RouteState(this.parser)
|
RouteState(this.parser) : _route = parser.initialRoute;
|
||||||
: _route = parser.initialRoute;
|
|
||||||
|
|
||||||
ParsedRoute get route => _route;
|
ParsedRoute get route => _route;
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../data.dart';
|
import '../data.dart';
|
||||||
import '../widgets/book_list.dart';
|
|
||||||
import 'book_details.dart';
|
|
||||||
import '../routing.dart';
|
import '../routing.dart';
|
||||||
|
import '../widgets/book_list.dart';
|
||||||
|
|
||||||
class AuthorDetailsScreen extends StatelessWidget {
|
class AuthorDetailsScreen extends StatelessWidget {
|
||||||
final Author author;
|
final Author author;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import '../widgets/author_list.dart';
|
|||||||
import '../widgets/library_scope.dart';
|
import '../widgets/library_scope.dart';
|
||||||
|
|
||||||
class AuthorsScreen extends StatelessWidget {
|
class AuthorsScreen extends StatelessWidget {
|
||||||
final String title = "Authors";
|
final String title = 'Authors';
|
||||||
|
|
||||||
const AuthorsScreen({Key? key}) : super(key: key);
|
const AuthorsScreen({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
|||||||
@@ -34,17 +34,11 @@ class BookDetailsScreen extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
book!.title,
|
book!.title,
|
||||||
style: Theme
|
style: Theme.of(context).textTheme.headline4,
|
||||||
.of(context)
|
|
||||||
.textTheme
|
|
||||||
.headline4,
|
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
book!.author.name,
|
book!.author.name,
|
||||||
style: Theme
|
style: Theme.of(context).textTheme.subtitle1,
|
||||||
.of(context)
|
|
||||||
.textTheme
|
|
||||||
.subtitle1,
|
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
child: const Text('View author (Push)'),
|
child: const Text('View author (Push)'),
|
||||||
@@ -62,8 +56,8 @@ class BookDetailsScreen extends StatelessWidget {
|
|||||||
uri: Uri.parse('/author/${book!.author.id}'),
|
uri: Uri.parse('/author/${book!.author.id}'),
|
||||||
builder: (context, followLink) {
|
builder: (context, followLink) {
|
||||||
return TextButton(
|
return TextButton(
|
||||||
child: const Text('View author (Link)'),
|
|
||||||
onPressed: followLink,
|
onPressed: followLink,
|
||||||
|
child: const Text('View author (Link)'),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import 'book_details.dart';
|
|||||||
import 'scaffold.dart';
|
import 'scaffold.dart';
|
||||||
|
|
||||||
/// Builds the top-level navigator for the app. The pages to display are based
|
/// 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 {
|
class BookstoreNavigator extends StatefulWidget {
|
||||||
final GlobalKey<NavigatorState> navigatorKey;
|
final GlobalKey<NavigatorState> navigatorKey;
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import '../screens/settings.dart';
|
|||||||
import '../widgets/fade_transition_page.dart';
|
import '../widgets/fade_transition_page.dart';
|
||||||
import 'authors.dart';
|
import 'authors.dart';
|
||||||
import 'books.dart';
|
import 'books.dart';
|
||||||
|
import 'scaffold.dart';
|
||||||
|
|
||||||
/// Displays the contents of the body of [BookstoreScaffold]
|
/// Displays the contents of the body of [BookstoreScaffold]
|
||||||
class BookstoreScaffoldBody extends StatelessWidget {
|
class BookstoreScaffoldBody extends StatelessWidget {
|
||||||
@@ -45,12 +46,12 @@ class BookstoreScaffoldBody extends StatelessWidget {
|
|||||||
child: BooksScreen(currentRoute: currentRoute),
|
child: BooksScreen(currentRoute: currentRoute),
|
||||||
)
|
)
|
||||||
|
|
||||||
// Avoid building a Navigator with an empty `pages` list when the
|
// Avoid building a Navigator with an empty `pages` list when the
|
||||||
// RouteState is set to an unexpected path, such as /signin.
|
// RouteState is set to an unexpected path, such as /signin.
|
||||||
//
|
//
|
||||||
// Since RouteStateScope is an InheritedNotifier, any change to the
|
// Since RouteStateScope is an InheritedNotifier, any change to the
|
||||||
// route will result in a call to this build method, even though this
|
// route will result in a call to this build method, even though this
|
||||||
// widget isn't built when those routes are active.
|
// widget isn't built when those routes are active.
|
||||||
else
|
else
|
||||||
FadeTransitionPage<void>(
|
FadeTransitionPage<void>(
|
||||||
key: const ValueKey('empty'),
|
key: const ValueKey('empty'),
|
||||||
|
|||||||
@@ -2,11 +2,11 @@
|
|||||||
// for details. All rights reserved. Use of this source code is governed by a
|
// 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.
|
// BSD-style license that can be found in the LICENSE file.
|
||||||
|
|
||||||
import 'package:bookstore/src/routing.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:url_launcher/link.dart';
|
import 'package:url_launcher/link.dart';
|
||||||
|
|
||||||
import '../auth/auth.dart';
|
import '../auth/auth.dart';
|
||||||
|
import '../routing.dart';
|
||||||
|
|
||||||
class SettingsScreen extends StatefulWidget {
|
class SettingsScreen extends StatefulWidget {
|
||||||
const SettingsScreen({Key? key}) : super(key: key);
|
const SettingsScreen({Key? key}) : super(key: key);
|
||||||
@@ -63,8 +63,8 @@ class SettingsContent extends StatelessWidget {
|
|||||||
uri: Uri.parse('/book/0'),
|
uri: Uri.parse('/book/0'),
|
||||||
builder: (context, followLink) {
|
builder: (context, followLink) {
|
||||||
return TextButton(
|
return TextButton(
|
||||||
child: const Text('Go directly to /book/0 (Link)'),
|
|
||||||
onPressed: followLink,
|
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.
|
// BSD-style license that can be found in the LICENSE file.
|
||||||
|
|
||||||
/// Shows how a custom TransitionDelegate can be used to customized when
|
/// Shows how a custom TransitionDelegate can be used to customized when
|
||||||
/// transition animations are shown. (For example, [when two routes are popped
|
/// transition animations are shown. (For example,
|
||||||
/// off the stack](https://github.com/flutter/flutter/issues/12146), however the
|
/// [when two routes are popped off the stack](https://github.com/flutter/flutter/issues/12146),
|
||||||
/// default TransitionDelegate will handle this if you are using Router)
|
/// however the default TransitionDelegate will handle this if you are using
|
||||||
|
/// `Router`.)
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -5,19 +5,19 @@ version: 1.0.0+1
|
|||||||
environment:
|
environment:
|
||||||
sdk: ">=2.12.0 <3.0.0"
|
sdk: ">=2.12.0 <3.0.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
|
||||||
sdk: flutter
|
|
||||||
cupertino_icons: ^1.0.2
|
|
||||||
quiver: ^3.0.0
|
|
||||||
path_to_regexp: ^0.4.0
|
|
||||||
adaptive_navigation: ^0.0.3
|
adaptive_navigation: ^0.0.3
|
||||||
collection: ^1.15.0
|
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_launcher: ^6.0.0
|
||||||
url_strategy: ^0.2.0
|
url_strategy: ^0.2.0
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
test: ^1.16.0
|
flutter_lints: ^1.0.0
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_lints: ^1.0.0
|
test: ^1.16.0
|
||||||
flutter:
|
flutter:
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
|||||||
Reference in New Issue
Block a user