Skip to content

Commit

Permalink
$ dart fix --apply
Browse files Browse the repository at this point in the history
  • Loading branch information
X-Wei committed Jan 2, 2022
1 parent dbe84df commit 132a072
Show file tree
Hide file tree
Showing 56 changed files with 111 additions and 112 deletions.
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ analyzer:
linter:
rules:
prefer_relative_imports: true # https://stackoverflow.com/a/66188522/12421326
always_use_package_imports: false
# Rationale: in our app, the codes are for reading on mobile phones, adding
# `this` makes it easier for readers to understand which variables class
# members and which ones are not.
Expand Down
2 changes: 2 additions & 0 deletions lib/generated_plugin_registrant.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:cloud_firestore_web/cloud_firestore_web.dart';
import 'package:firebase_analytics_web/firebase_analytics_web.dart';
import 'package:firebase_auth_web/firebase_auth_web.dart';
import 'package:firebase_core_web/firebase_core_web.dart';
import 'package:firebase_database_web/firebase_database_web.dart';
import 'package:firebase_storage_web/firebase_storage_web.dart';
import 'package:fluttertoast/fluttertoast_web.dart';
import 'package:google_sign_in_web/google_sign_in_web.dart';
Expand All @@ -25,6 +26,7 @@ void registerPlugins(Registrar registrar) {
FirebaseAnalyticsWeb.registerWith(registrar);
FirebaseAuthWeb.registerWith(registrar);
FirebaseCoreWeb.registerWith(registrar);
FirebaseDatabaseWeb.registerWith(registrar);
FirebaseStorageWeb.registerWith(registrar);
FluttertoastWebPlugin.registerWith(registrar);
GoogleSignInPlugin.registerWith(registrar);
Expand Down
2 changes: 1 addition & 1 deletion lib/home_page.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:badges/badges.dart';
import 'package:flutter/material.dart';
import 'package:flutter_catalog/my_app_routes.dart';
import 'my_app_routes.dart';
import 'package:provider/provider.dart';

import './my_app_routes.dart'
Expand Down
6 changes: 3 additions & 3 deletions lib/my_app_routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// "structure" of the group of example routes, in a const List<Tuple2> object.
// ignore_for_file: sort_child_properties_last
import 'package:flutter/material.dart';
import 'package:flutter_catalog/routes/animation_animated_radial_menu_ex.dart';
import 'routes/animation_animated_radial_menu_ex.dart';

import 'constants.dart';
import 'home_page.dart';
Expand Down Expand Up @@ -984,7 +984,7 @@ const kMyAppRoutesAdvanced = <MyRouteGroup>[
title: 'Radar Chart',
links: {'pub.dev': 'https://pub.dev/packages/flutter_radar_chart'},
),
]),
],),
MyRouteGroup(
groupName: 'Networking',
icon: Icon(Icons.http),
Expand Down Expand Up @@ -1020,7 +1020,7 @@ const kMyAppRoutesAdvanced = <MyRouteGroup>[
description: 'Another REST example using the Google books seach API.',
links: {'Hacker News API': 'https://github.com/HackerNews/API'},
),
]),
],),
MyRouteGroup(
groupName: 'Firebase',
icon: Icon(Icons.cloud),
Expand Down
2 changes: 1 addition & 1 deletion lib/my_route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class MyRoute extends StatelessWidget {
onStateChanged: (bool value) => settings.setDarkMode(value),
),
);
}),
},),
],
);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/my_route_search_delegate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class MyRouteSearchDelegate extends SearchDelegate<String> {
suggestions = kAllRoutes
.where((route) =>
route.title.toLowerCase().contains(query.toLowerCase()) ||
route.description.toLowerCase().contains(query.toLowerCase()))
route.description.toLowerCase().contains(query.toLowerCase()),)
.toList();
}
return _buildSuggestionsList(suggestions);
Expand Down
4 changes: 2 additions & 2 deletions lib/routes/about.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart' as url_launcher;

import 'package:flutter_catalog/constants.dart';
import '../constants.dart';

// Inspired by the about page in Eajy's flutter demo:
// https://github.com/Eajy/flutter_demo/blob/master/lib/route/about.dart
Expand Down Expand Up @@ -50,7 +50,7 @@ class MyAboutRoute extends StatelessWidget {
applicationName: APP_NAME,
applicationVersion: APP_VERSION,
applicationIcon: kAppIcon,
children: <Widget>[const Text(APP_DESCRIPTION)]);
children: <Widget>[const Text(APP_DESCRIPTION)],);
},
),
);
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/animation_animated_container_ex.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class _AnimatedContainerExampleState extends State<AnimatedContainerExample> {
_borderRadius = _rng.nextInt(50).toDouble();
// Generate a random color.
_color = Color.fromRGBO(
_rng.nextInt(256), _rng.nextInt(256), _rng.nextInt(256), 1);
_rng.nextInt(256), _rng.nextInt(256), _rng.nextInt(256), 1,);
},
),
),
Expand Down
12 changes: 6 additions & 6 deletions lib/routes/animation_animated_radial_menu_ex.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,28 @@ class RadialMenuExample extends StatelessWidget {
icon: Icon(Icons.ac_unit),
buttonColor: Colors.teal,
onPress: () => Navigator.push(
context, MaterialPageRoute(builder: (_) => TargetScreen()))),
context, MaterialPageRoute(builder: (_) => TargetScreen()),),),
RadialButton(
icon: Icon(Icons.camera_alt),
buttonColor: Colors.green,
onPress: () => Navigator.push(
context, MaterialPageRoute(builder: (_) => TargetScreen()))),
context, MaterialPageRoute(builder: (_) => TargetScreen()),),),
RadialButton(
icon: Icon(Icons.map),
buttonColor: Colors.orange,
onPress: () => Navigator.push(
context, MaterialPageRoute(builder: (_) => TargetScreen()))),
context, MaterialPageRoute(builder: (_) => TargetScreen()),),),
RadialButton(
icon: Icon(Icons.access_alarm),
buttonColor: Colors.indigo,
onPress: () => Navigator.push(
context, MaterialPageRoute(builder: (_) => TargetScreen()))),
context, MaterialPageRoute(builder: (_) => TargetScreen()),),),
RadialButton(
icon: Icon(Icons.watch),
buttonColor: Colors.pink,
onPress: () => Navigator.push(
context, MaterialPageRoute(builder: (_) => TargetScreen()))),
]),
context, MaterialPageRoute(builder: (_) => TargetScreen()),),),
],),
);
}
}
Expand Down
16 changes: 8 additions & 8 deletions lib/routes/animation_animations_pkg_ex.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ class AnimationsPackageExample extends StatelessWidget {
ListTile(
title: const Text('1. OpenContainer'),
subtitle: const Text(
'A container that grows to fill the screen to reveal new content when tapped.'),
'A container that grows to fill the screen to reveal new content when tapped.',),
trailing: IconButton(
tooltip: 'Documentation',
icon: const Icon(Icons.open_in_new),
onPressed: () => launch(
'https://pub.dev/documentation/animations/latest/animations/OpenContainer-class.html'),
'https://pub.dev/documentation/animations/latest/animations/OpenContainer-class.html',),
),
),
OpenContainer(
Expand All @@ -37,12 +37,12 @@ class AnimationsPackageExample extends StatelessWidget {
ListTile(
title: const Text('2. PageTransitionSwitcher'),
subtitle: const Text(
'Transition from an old child to a new child, similar to AnimationSwitcher'),
'Transition from an old child to a new child, similar to AnimationSwitcher',),
trailing: IconButton(
tooltip: 'Documentation',
icon: const Icon(Icons.open_in_new),
onPressed: () => launch(
'https://pub.dev/documentation/animations/latest/animations/PageTransitionSwitcher-class.html'),
'https://pub.dev/documentation/animations/latest/animations/PageTransitionSwitcher-class.html',),
),
),
const SizedBox(
Expand All @@ -53,12 +53,12 @@ class AnimationsPackageExample extends StatelessWidget {
ListTile(
title: const Text('3. SharedAxisTransition'),
subtitle: const Text(
'Transition animation between UI elements that have a spatial or navigational relationship.'),
'Transition animation between UI elements that have a spatial or navigational relationship.',),
trailing: IconButton(
tooltip: 'Documentation',
icon: const Icon(Icons.open_in_new),
onPressed: () => launch(
'https://pub.dev/documentation/animations/latest/animations/SharedAxisTransition-class.html'),
'https://pub.dev/documentation/animations/latest/animations/SharedAxisTransition-class.html',),
),
),
const SizedBox(
Expand All @@ -73,7 +73,7 @@ class AnimationsPackageExample extends StatelessWidget {
tooltip: 'Documentation',
icon: const Icon(Icons.open_in_new),
onPressed: () => launch(
'https://pub.dev/documentation/animations/latest/animations/showModal.html'),
'https://pub.dev/documentation/animations/latest/animations/showModal.html',),
),
),
ElevatedButton(
Expand Down Expand Up @@ -229,7 +229,7 @@ class __SharedAxisExState extends State<_SharedAxisEx> {
value: val,
child: Text(val
.toString()
.substring('SharedAxisTransitionType.'.length)),
.substring('SharedAxisTransitionType.'.length),),
)
],
onChanged: (SharedAxisTransitionType? val) {
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/animation_hero_ex.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class HeroExample extends StatelessWidget {
),
),
title: const Text(
'Tap on the photo to view the animation transition.'),
'Tap on the photo to view the animation transition.',),
),
],
),
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/animation_lottie_ex.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class __LottieCustomState extends State<_LottieCustom>
icon: const Icon(Icons.arrow_right),
onPressed: () {
_controller.forward(
from: _controller.value == 1 ? 0 : _controller.value);
from: _controller.value == 1 ? 0 : _controller.value,);
},
),
],
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/animation_opacity_ex.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class _OpacityExampleState extends State<OpacityExample> {
children: <Widget>[
const Text(
'Click on colored squares below to make them invisible, click '
'once again to make them reappear.'),
'once again to make them reappear.',),
GestureDetector(
onTap: () {
setState(() => this._opacity1 = 1.0 - this._opacity1);
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/appbar_backdrop_ex.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class BackdropExample extends StatelessWidget {
child: Text(
'(front layer) \n Click top-right button to show back layer.\n\n'
"There's no flutter official backdrop widget, this demo uses the "
"'backdrop' package.")),
"'backdrop' package.",),),
backLayer: const Center(child: Text('(back layer)')),
);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/async_futurebuilder_ex.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class FutureBuilderExampleState extends State<FutureBuilderExample> {
'In this example we first have an async operatio that takes '
'~3 seconds and succeeds with the content of an image from asset.\n'
'Note this is just for demonstration purposes, normally we just '
'use `Image.asset()`.'),
'use `Image.asset()`.',),
FutureBuilder<ByteData>(
future: _wait3SecAndLoadImage(),
builder: (BuildContext context, AsyncSnapshot<ByteData> snapshot) {
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/async_streambuilder_ex.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class StreamBuilderExampleState extends State<StreamBuilderExample> {
const Text("StreamBuilders can listen to a stream, and update UI "
"according to the stream's latest snapshot value.\n\n"
"In this demo we build a simple timer app by listening to a "
"stream that updates every second.\n"),
"stream that updates every second.\n",),
Card(child: _buildTimerUI()),
],
);
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/async_streamcontroller_ex.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class _StreamControllerExampleState extends State<StreamControllerExample> {
"and put a function between the input controller and output controller.\n\n"
"In this demo, the card renders the widget from _outputStreamController.stream "
"and you can send a new random word to the "
"_inputStreamController.sink by clicking the 'send' button.\n"),
"_inputStreamController.sink by clicking the 'send' button.\n",),
Card(
elevation: 4.0,
child: StreamBuilder<Widget>(
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/charts_graphview_ex.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class GraphViewExample extends StatelessWidget {
onPressed: () => Navigator.of(context)
.push(MaterialPageRoute(builder: (BuildContext context) {
return const GraphViewEx();
})),
},),),
),
);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/charts_time_series_ex.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class _TimeseriesChartExampleState extends State<TimeseriesChartExample> {
behaviors: [
// Add title.
charts.ChartTitle('Dummy sales time series',
behaviorPosition: _titlePosition),
behaviorPosition: _titlePosition,),
// Add legend.
charts.SeriesLegend(position: _legendPosition),
// Highlight X and Y value of selected point.
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/firebase_chatroom_ex.dart
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class _FirebaseChatroomExampleState extends State<FirebaseChatroomExample> {
title: const Text('Login required'),
content: const Text('To send messages you need to first log in.\n\n'
'Go to the "Firebase login" example, and log in from there. '
'You will then be able to send messages.'),
'You will then be able to send messages.',),
actions: <Widget>[
TextButton(
onPressed: () => Navigator.of(ctx).pop(),
Expand Down
4 changes: 2 additions & 2 deletions lib/routes/firebase_vote_ex.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class _FirebaseVoteExampleState extends State<FirebaseVoteExample> {
final freshRecord =
_LangaugeVotingRecord.fromSnapshot(freshSnapshot);
transaction.update(record.firestoreDocReference,
{'votes': freshRecord.votes + deltaVotes});
{'votes': freshRecord.votes + deltaVotes},);
} catch (e) {
print(e);
rethrow;
Expand Down Expand Up @@ -155,7 +155,7 @@ class _LangaugeVotingRecord {

_LangaugeVotingRecord.fromSnapshot(DocumentSnapshot<JsonMap> snapshot)
: this.fromMap(snapshot.data()!,
firestoreDocReference: snapshot.reference);
firestoreDocReference: snapshot.reference,);

@override
String toString() => "Record<$language:$votes>";
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/layouts_container_padding_center_ex.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ContainerExample extends StatelessWidget {
decoration: BoxDecoration(
border: Border.all(width: 5.0),
color: Colors.yellow,
borderRadius: BorderRadius.circular(20.0)),
borderRadius: BorderRadius.circular(20.0),),
// Container.padding is implementd internally with Padding widgets.
// const EdgeInsets.fromLTRB: specify padding for left/right/top/bottom.
padding: const EdgeInsets.fromLTRB(10.0, 20.0, 30.0, 40.0),
Expand Down
8 changes: 4 additions & 4 deletions lib/routes/layouts_fractionally_sizedbox_ex.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ class FractionallySizedBoxExample extends StatelessWidget {
children: const [
SizedBox(height: 20),
Text('Fractionally sized box sizes its child to a fraction of the '
'total available space.'),
'total available space.',),
Text(
'To use it inside a column or a row, wrap it in a Flexible widget'),
'To use it inside a column or a row, wrap it in a Flexible widget',),
Text('FractionallySizedBox with no child serves as whitespace. '
'The whitespace below always takes 10% of the available height'),
'The whitespace below always takes 10% of the available height',),
Flexible(child: FractionallySizedBox(heightFactor: 0.1)),
Text(
'The placeholder below always takes 20% of the available height and 50% of the width.\n'),
'The placeholder below always takes 20% of the available height and 50% of the width.\n',),
Flexible(
child: FractionallySizedBox(
heightFactor: 0.2,
Expand Down
18 changes: 9 additions & 9 deletions lib/routes/layouts_row_col_ex.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class _RowColExampleState extends State<RowColExample> {
groupValue: this._isRow,
onChanged: (bool? value) {
if (value != null) setState(() => this._isRow = value);
}),
},),
const Text('Row'),
],
),
Expand All @@ -70,7 +70,7 @@ class _RowColExampleState extends State<RowColExample> {
groupValue: this._isRow,
onChanged: (bool? value) {
if (value != null) setState(() => this._isRow = value);
}),
},),
const Text('Column'),
],
),
Expand All @@ -89,8 +89,8 @@ class _RowColExampleState extends State<RowColExample> {
.map((MainAxisSize val) => DropdownMenuItem(
value: val,
child: Text(
val.toString().substring('MainAxisSize.'.length)),
))
val.toString().substring('MainAxisSize.'.length),),
),)
.toList(),
),
),
Expand All @@ -108,8 +108,8 @@ class _RowColExampleState extends State<RowColExample> {
value: val,
child: Text(val
.toString()
.substring('MainAxisAlignment.'.length)),
))
.substring('MainAxisAlignment.'.length),),
),)
.toList(),
),
),
Expand All @@ -127,12 +127,12 @@ class _RowColExampleState extends State<RowColExample> {
value: val,
child: Text(val
.toString()
.substring('CrossAxisAlignment.'.length)),
))
.substring('CrossAxisAlignment.'.length),),
),)
.toList(),
),
),
]),
],),
);
}
}
Loading

0 comments on commit 132a072

Please sign in to comment.