Merge branch 'master' of https://github.com/flutter/samples into chrome-os-sample-update

pull/101/head
Brett Morgan 7 years ago
commit e19cffb738

@ -0,0 +1,30 @@
include: package:pedantic/analysis_options.yaml
analyzer:
strong-mode:
implicit-casts: false
implicit-dynamic: false
linter:
rules:
- avoid_types_on_closure_parameters
- avoid_void_async
- await_only_futures
- camel_case_types
- cancel_subscriptions
- close_sinks
- constant_identifier_names
- control_flow_in_finally
- empty_statements
- hash_and_equals
- implementation_imports
- non_constant_identifier_names
- package_api_docs
- package_names
- package_prefixed_library_names
- test_types_in_equals
- throw_in_finally
- unnecessary_brace_in_string_interps
- unnecessary_getters_setters
- unnecessary_new
- unnecessary_statements

@ -109,7 +109,7 @@ class StoreCarousel extends StatelessWidget {
padding: const EdgeInsets.only(top: 10),
child: SizedBox(
height: 90,
child: new StoreCarouselList(
child: StoreCarouselList(
documents: documents,
mapController: mapController,
),
@ -187,8 +187,8 @@ class _StoreListTileState extends State<StoreListTile> {
}
Future<void> _retrievePlacesDetails() async {
final details =
await _placesApiClient.getDetailsByPlaceId(widget.document['placeId']);
final details = await _placesApiClient
.getDetailsByPlaceId(widget.document['placeId'] as String);
if (!_disposed) {
setState(() {
_placePhotoUrl = _placesApiClient.buildPhotoUrl(
@ -202,8 +202,8 @@ class _StoreListTileState extends State<StoreListTile> {
@override
Widget build(BuildContext context) {
return ListTile(
title: Text(widget.document['name']),
subtitle: Text(widget.document['address']),
title: Text(widget.document['name'] as String),
subtitle: Text(widget.document['address'] as String),
leading: Container(
width: 100,
height: 100,
@ -220,8 +220,8 @@ class _StoreListTileState extends State<StoreListTile> {
CameraUpdate.newCameraPosition(
CameraPosition(
target: LatLng(
widget.document['location'].latitude,
widget.document['location'].longitude,
widget.document['location'].latitude as double,
widget.document['location'].longitude as double,
),
zoom: 16,
),
@ -253,15 +253,15 @@ class StoreMap extends StatelessWidget {
),
markers: documents
.map((document) => Marker(
markerId: MarkerId(document['placeId']),
markerId: MarkerId(document['placeId'] as String),
icon: BitmapDescriptor.defaultMarkerWithHue(_pinkHue),
position: LatLng(
document['location'].latitude,
document['location'].longitude,
document['location'].latitude as double,
document['location'].longitude as double,
),
infoWindow: InfoWindow(
title: document['name'],
snippet: document['address'],
title: document['name'] as String,
snippet: document['address'] as String,
),
))
.toSet(),

@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.2.0"
boolean_selector:
dependency: transitive
description:
@ -110,7 +110,7 @@ packages:
source: hosted
version: "1.6.2"
pedantic:
dependency: transitive
dependency: "direct dev"
description:
name: pedantic
url: "https://pub.dartlang.org"
@ -122,7 +122,7 @@ packages:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
version: "2.0.3"
sky_engine:
dependency: transitive
description: flutter
@ -169,7 +169,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.4"
version: "0.2.5"
typed_data:
dependency: transitive
description:

@ -16,6 +16,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
pedantic: ^1.5.0
flutter:
uses-material-design: true

@ -5,5 +5,5 @@
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('This test always passes', (WidgetTester tester) async {});
testWidgets('This test always passes', (tester) async {});
}

@ -0,0 +1,30 @@
include: package:pedantic/analysis_options.yaml
analyzer:
strong-mode:
implicit-casts: false
implicit-dynamic: false
linter:
rules:
- avoid_types_on_closure_parameters
- avoid_void_async
- await_only_futures
- camel_case_types
- cancel_subscriptions
- close_sinks
- constant_identifier_names
- control_flow_in_finally
- empty_statements
- hash_and_equals
- implementation_imports
- non_constant_identifier_names
- package_api_docs
- package_names
- package_prefixed_library_names
- test_types_in_equals
- throw_in_finally
- unnecessary_brace_in_string_interps
- unnecessary_getters_setters
- unnecessary_new
- unnecessary_statements

@ -18,7 +18,7 @@ import 'page_one.dart';
import 'page_two.dart';
import 'page_three.dart';
void main() => runApp(new MaterialApp(home: new StartApp()));
void main() => runApp(MaterialApp(home: StartApp()));
class StartApp extends StatelessWidget {
@override

@ -37,7 +37,7 @@ class _PerformancePageState extends State<PerformancePage> {
children: [
FutureBuilder<void>(
future: computeFuture,
builder: (BuildContext context, AsyncSnapshot snapshot) {
builder: (context, snapshot) {
return RaisedButton(
child: const Text('Compute on Main'),
elevation: 8.0,
@ -47,7 +47,7 @@ class _PerformancePageState extends State<PerformancePage> {
),
FutureBuilder<void>(
future: computeFuture,
builder: (BuildContext context, AsyncSnapshot snapshot) {
builder: (context, snapshot) {
return RaisedButton(
child: const Text('Compute on Secondary'),
elevation: 8.0,
@ -133,7 +133,7 @@ class SmoothAnimationWidget extends StatefulWidget {
class SmoothAnimationWidgetState extends State<SmoothAnimationWidget>
with TickerProviderStateMixin {
AnimationController _controller;
var borderRadius;
Animation<BorderRadius> borderRadius;
@override
void initState() {
@ -168,10 +168,10 @@ class SmoothAnimationWidgetState extends State<SmoothAnimationWidget>
Widget build(BuildContext context) {
return AnimatedBuilder(
animation: borderRadius,
builder: (BuildContext context, Widget child) {
builder: (context, child) {
return Center(
child: Container(
child: new FlutterLogo(
child: FlutterLogo(
size: 200,
),
alignment: Alignment.bottomCenter,

@ -40,7 +40,7 @@ class InfiniteProcessPage extends StatelessWidget {
'Summation Results',
style: Theme.of(context).textTheme.title,
),
padding: new EdgeInsets.all(8),
padding: EdgeInsets.all(8),
),
Expanded(child: RunningList()),
SafeArea(
@ -97,7 +97,7 @@ class InfiniteProcessIsolateController extends ChangeNotifier {
}
void listen() {
mIceRP.listen((message) {
mIceRP.listen((dynamic message) {
if (message is SendPort) {
newIceSP = message;
newIceSP.send(_currentMultiplier);
@ -166,7 +166,7 @@ class RunningList extends StatelessWidget {
decoration: BoxDecoration(
color: Colors.grey[200],
),
child: new ListView.builder(
child: ListView.builder(
itemCount: sums.length,
itemBuilder: (context, index) {
return Column(
@ -198,7 +198,7 @@ Future<void> _secondIsolateEntryPoint(SendPort callerSP) async {
ReceivePort newIceRP = ReceivePort();
callerSP.send(newIceRP.sendPort);
newIceRP.listen((message) {
newIceRP.listen((dynamic message) {
if (message is int) multiplyValue = message;
});
@ -216,7 +216,7 @@ Future<void> _secondIsolateEntryPoint(SendPort callerSP) async {
}
Future<int> brokenUpComputation(int num) {
Random rng = new Random();
Random rng = Random();
return Future(() {
int sum = 0;
@ -228,7 +228,7 @@ Future<int> brokenUpComputation(int num) {
});
}
Widget newButtons(context) {
Widget newButtons(BuildContext context) {
final controller =
Provider.of<InfiniteProcessIsolateController>(context, listen: false);
@ -249,30 +249,34 @@ Widget newButtons(context) {
);
}
Widget radioButtonWidget(context) {
Widget radioButtonWidget(BuildContext context) {
final controller = Provider.of<InfiniteProcessIsolateController>(context);
return new Row(
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
new Radio(
Radio(
value: 1,
groupValue: controller.multiplier,
onChanged: (_) => controller.setMultiplier(1),
// The following is a result of https://github.com/dart-lang/linter/issues/695
// ignore: avoid_types_on_closure_parameters
onChanged: (int _) => controller.setMultiplier(1),
),
new Text('1x'),
new Radio(
Text('1x'),
Radio(
value: 2,
groupValue: controller.multiplier,
onChanged: (_) => controller.setMultiplier(2),
// ignore: avoid_types_on_closure_parameters
onChanged: (int _) => controller.setMultiplier(2),
),
new Text('2x'),
new Radio(
Text('2x'),
Radio(
value: 3,
groupValue: controller.multiplier,
onChanged: (_) => controller.setMultiplier(3),
// ignore: avoid_types_on_closure_parameters
onChanged: (int _) => controller.setMultiplier(3),
),
new Text('3x'),
Text('3x'),
],
);
}

@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.2.0"
boolean_selector:
dependency: transitive
description:
@ -68,7 +68,7 @@ packages:
source: hosted
version: "1.6.2"
pedantic:
dependency: transitive
dependency: "direct dev"
description:
name: pedantic
url: "https://pub.dartlang.org"
@ -87,7 +87,7 @@ packages:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
version: "2.0.3"
sky_engine:
dependency: transitive
description: flutter
@ -134,7 +134,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.4"
version: "0.2.5"
typed_data:
dependency: transitive
description:

@ -14,6 +14,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
pedantic: ^1.5.0
flutter:

@ -15,7 +15,7 @@
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('This test will always pass', (WidgetTester tester) async {
testWidgets('This test will always pass', (tester) async {
return true;
});
}

@ -0,0 +1,32 @@
include: package:pedantic/analysis_options.yaml
analyzer:
exclude:
- lib/json_serializable/*.g.dart
strong-mode:
implicit-casts: false
implicit-dynamic: false
linter:
rules:
- avoid_types_on_closure_parameters
- avoid_void_async
- await_only_futures
- camel_case_types
- cancel_subscriptions
- close_sinks
- constant_identifier_names
- control_flow_in_finally
- empty_statements
- hash_and_equals
- implementation_imports
- non_constant_identifier_names
- package_api_docs
- package_names
- package_prefixed_library_names
- test_types_in_equals
- throw_in_finally
- unnecessary_brace_in_string_interps
- unnecessary_getters_setters
- unnecessary_new
- unnecessary_statements

@ -40,6 +40,7 @@ abstract class BuiltComplexObject
BuiltComplexObject._();
factory BuiltComplexObject([updates(BuiltComplexObjectBuilder b)]) =
factory BuiltComplexObject(
[void Function(BuiltComplexObjectBuilder) updates]) =
_$BuiltComplexObject;
}

@ -33,6 +33,6 @@ abstract class BuiltSimpleObject
BuiltSimpleObject._();
factory BuiltSimpleObject([updates(BuiltSimpleObjectBuilder b)]) =
factory BuiltSimpleObject([void Function(BuiltSimpleObjectBuilder) updates]) =
_$BuiltSimpleObject;
}

@ -29,24 +29,27 @@ class ConvertedComplexObject {
if (json == null) return null;
return ConvertedComplexObject(
aString: json['aString'],
anInt: json['anInt'],
aDouble: json['aDouble'],
aString: json['aString'] as String,
anInt: json['anInt'] as int,
aDouble: json['aDouble'] as double,
anObject: json['anObject'] != null
? ConvertedSimpleObject.fromJson(json['anObject'])
? ConvertedSimpleObject.fromJson(
json['anObject'] as Map<String, dynamic>)
: null,
aListOfStrings: json['aListOfStrings'] != null
? List<String>.from(json['aListOfStrings'])
? List<String>.from(json['aListOfStrings'] as Iterable<dynamic>)
: null,
aListOfInts: json['aListOfInts'] != null
? List<int>.from(json['aListOfInts'])
? List<int>.from(json['aListOfInts'] as Iterable<dynamic>)
: null,
aListOfDoubles: json['aListOfDoubles'] != null
? List<double>.from(json['aListOfDoubles'])
? List<double>.from(json['aListOfDoubles'] as Iterable<dynamic>)
: null,
aListOfObjects: json['aListOfObjects'] != null
? List<ConvertedSimpleObject>.from(json['aListOfObjects']
.map((o) => ConvertedSimpleObject.fromJson(o)))
? List<ConvertedSimpleObject>.from((json['aListOfObjects']
as Iterable<dynamic>)
.map<dynamic>((dynamic o) =>
ConvertedSimpleObject.fromJson(o as Map<String, dynamic>)))
: null);
}
}

@ -23,17 +23,17 @@ class ConvertedSimpleObject {
if (json == null) return null;
return ConvertedSimpleObject(
aString: json['aString'],
anInt: json['anInt'],
aDouble: json['aDouble'],
aString: json['aString'] as String,
anInt: json['anInt'] as int,
aDouble: json['aDouble'] as double,
aListOfStrings: json['aListOfStrings'] != null
? List<String>.from(json['aListOfStrings'])
? List<String>.from(json['aListOfStrings'] as Iterable<dynamic>)
: null,
aListOfInts: json['aListOfInts'] != null
? List<int>.from(json['aListOfInts'])
? List<int>.from(json['aListOfInts'] as Iterable<dynamic>)
: null,
aListOfDoubles: json['aListOfDoubles'] != null
? List<double>.from(json['aListOfDoubles'])
? List<double>.from(json['aListOfDoubles'] as Iterable<dynamic>)
: null,
);
}

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// ignore_for_file: argument_type_not_assignable, strong_mode_implicit_dynamic_parameter, strong_mode_implicit_dynamic_variable
import 'dart:convert';
import 'package:flutter/material.dart';

@ -58,7 +58,7 @@ class SimpleObjectView extends StatelessWidget {
Text('aListOfStrings:', style: boldStyle),
Text(
prettyPrintList(
simpleObject.aListOfStrings,
simpleObject.aListOfStrings as Iterable<dynamic>,
),
style: localTheme.body1,
),
@ -68,7 +68,7 @@ class SimpleObjectView extends StatelessWidget {
children: [
Text('aListOfInts:', style: boldStyle),
Text(
prettyPrintList(simpleObject.aListOfInts),
prettyPrintList(simpleObject.aListOfInts as Iterable<dynamic>),
style: localTheme.body1,
),
],
@ -80,7 +80,7 @@ class SimpleObjectView extends StatelessWidget {
child: Text('aListOfDoubles:', style: boldStyle),
),
Text(
prettyPrintList(simpleObject.aListOfDoubles),
prettyPrintList(simpleObject.aListOfDoubles as Iterable<dynamic>),
style: localTheme.body1,
),
],
@ -135,7 +135,7 @@ class ComplexObjectView extends StatelessWidget {
];
}
if (simpleObjects.length == 0) {
if (simpleObjects.isEmpty) {
return [
const Padding(
padding: EdgeInsets.symmetric(vertical: 4.0),
@ -145,7 +145,7 @@ class ComplexObjectView extends StatelessWidget {
}
return simpleObjects
.expand((o) => [
.expand((dynamic o) => [
const SizedBox(height: 4.0),
SimpleObjectView(o),
const SizedBox(height: 4.0),
@ -213,7 +213,8 @@ class ComplexObjectView extends StatelessWidget {
children: [
Text('aListOfStrings:', style: boldStyle),
Text(
prettyPrintList(complexObject.aListOfStrings),
prettyPrintList(
complexObject.aListOfStrings as Iterable<dynamic>),
style: localTheme.body1,
),
],
@ -222,7 +223,8 @@ class ComplexObjectView extends StatelessWidget {
children: [
Text('aListOfInts:', style: boldStyle),
Text(
prettyPrintList(complexObject.aListOfInts),
prettyPrintList(
complexObject.aListOfInts as Iterable<dynamic>),
style: localTheme.body1,
),
],
@ -234,7 +236,8 @@ class ComplexObjectView extends StatelessWidget {
child: Text('aListOfDoubles:', style: boldStyle),
),
Text(
prettyPrintList(complexObject.aListOfDoubles),
prettyPrintList(
complexObject.aListOfDoubles as Iterable<dynamic>),
style: localTheme.body1,
),
],
@ -251,8 +254,8 @@ class ComplexObjectView extends StatelessWidget {
padding: const EdgeInsets.only(left: 24.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children:
_generateSimpleObjectWidgets(complexObject.aListOfObjects),
children: _generateSimpleObjectWidgets(
complexObject.aListOfObjects as Iterable<dynamic>),
),
),
],

@ -28,7 +28,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.2.0"
boolean_selector:
dependency: transitive
description:
@ -299,7 +299,7 @@ packages:
source: hosted
version: "1.6.2"
pedantic:
dependency: transitive
dependency: "direct dev"
description:
name: pedantic
url: "https://pub.dartlang.org"
@ -332,7 +332,7 @@ packages:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
version: "2.0.3"
shelf:
dependency: transitive
description:
@ -407,7 +407,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.4"
version: "0.2.5"
timing:
dependency: transitive
description:

@ -16,6 +16,7 @@ dev_dependencies:
build_runner: ^1.0.0
built_value_generator: ^6.1.5
json_serializable: ^2.2.1
pedantic: ^1.5.0
flutter_test:
sdk: flutter

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// ignore_for_file: strong_mode_implicit_dynamic_list_literal
import 'package:flutter_test/flutter_test.dart';
import 'package:jsonexample/built_value/built_simple_object.dart';
import 'package:jsonexample/built_value/built_value_serializers.dart';

@ -10,8 +10,7 @@ import 'package:jsonexample/widgets.dart';
void main() {
group('SimpleObjectView widget test', () {
testWidgets('Typical object is displayed correctly',
(WidgetTester tester) async {
testWidgets('Typical object is displayed correctly', (tester) async {
final simpleObject = ConvertedSimpleObject(
aString: 'Blah, blah, blah',
anInt: 1,
@ -35,8 +34,7 @@ void main() {
expect(find.text('[1.0, 2.0, 3.0]'), findsOneWidget);
});
testWidgets('Empty lists are displayed as brackets',
(WidgetTester tester) async {
testWidgets('Empty lists are displayed as brackets', (tester) async {
final simpleObject = ConvertedSimpleObject(
aString: 'Blah, blah, blah',
anInt: 1,
@ -55,8 +53,7 @@ void main() {
expect(find.text('[]'), findsNWidgets(3));
});
testWidgets('Null values are displayed as NULL',
(WidgetTester tester) async {
testWidgets('Null values are displayed as NULL', (tester) async {
final simpleObject = ConvertedSimpleObject(
aString: null,
anInt: null,
@ -77,8 +74,7 @@ void main() {
});
group('ComplexObjectView widget test', () {
testWidgets('Typical object is displayed correctly',
(WidgetTester tester) async {
testWidgets('Typical object is displayed correctly', (tester) async {
final complexObject = ConvertedComplexObject(
aString: 'Blah, blah, blah',
anInt: 1,
@ -145,8 +141,7 @@ void main() {
}
});
testWidgets('Empty lists are displayed as brackets',
(WidgetTester tester) async {
testWidgets('Empty lists are displayed as brackets', (tester) async {
final complexObject = ConvertedComplexObject(
aString: 'Blah, blah, blah',
anInt: 1,
@ -174,8 +169,7 @@ void main() {
expect(find.text('[]'), findsNWidgets(4));
});
testWidgets('Null values are displayed as NULL',
(WidgetTester tester) async {
testWidgets('Null values are displayed as NULL', (tester) async {
final complexObject = ConvertedComplexObject(
aString: null,
anInt: null,

Loading…
Cancel
Save