Skip to content

Commit a5007fd

Browse files
stuartmorgan-gmauricioluz
authored andcommitted
Revert "Enable lints library_private_types_in_public_api, sort_child_properties_last and use_key_in_widget_constructors" (flutter#5691)
This reverts commit 4b7b679. This includes a fix for a latent bug in the version-check repo tooling command that caused it to fail when reverting a package that previously had a NEXT section, so that tests will pass.
1 parent d229293 commit a5007fd

File tree

231 files changed

+574
-948
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

231 files changed

+574
-948
lines changed

analysis_options.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ linter:
134134
- leading_newlines_in_multiline_strings
135135
- library_names
136136
- library_prefixes
137-
- library_private_types_in_public_api
138137
# - lines_longer_than_80_chars # not required by flutter style
139138
- list_remove_unrelated_type
140139
# - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181
@@ -198,7 +197,7 @@ linter:
198197
- recursive_getters
199198
# - sized_box_for_whitespace # not yet tested
200199
- slash_for_doc_comments
201-
- sort_child_properties_last
200+
# - sort_child_properties_last # not yet tested
202201
- sort_constructors_first
203202
- sort_unnamed_constructors_first
204203
- test_types_in_equals
@@ -230,7 +229,7 @@ linter:
230229
- use_full_hex_values_for_flutter_colors
231230
# - use_function_type_syntax_for_parameters # not yet tested
232231
- use_is_even_rather_than_modulo
233-
- use_key_in_widget_constructors
232+
# - use_key_in_widget_constructors # not yet tested
234233
- use_late_for_private_fields_and_variables
235234
- use_raw_strings
236235
- use_rethrow_when_possible

packages/camera/camera/CHANGELOG.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
## 0.9.4+22
1+
## NEXT
22

33
* Removes unnecessary imports.
4-
* Fixes library_private_types_in_public_api, sort_child_properties_last and use_key_in_widget_constructors
5-
lint warnings.
64

75
## 0.9.4+21
86

packages/camera/camera/README.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,22 +89,18 @@ Here is a small example flutter app displaying a full screen camera preview.
8989
import 'package:camera/camera.dart';
9090
import 'package:flutter/material.dart';
9191
92-
late List<CameraDescription> _cameras;
92+
late List<CameraDescription> cameras;
9393
9494
Future<void> main() async {
9595
WidgetsFlutterBinding.ensureInitialized();
9696
97-
_cameras = await availableCameras();
98-
runApp(const CameraApp());
97+
cameras = await availableCameras();
98+
runApp(CameraApp());
9999
}
100100
101-
/// CameraApp is the Main Application.
102101
class CameraApp extends StatefulWidget {
103-
/// Default Constructor
104-
const CameraApp({Key? key}) : super(key: key);
105-
106102
@override
107-
State<CameraApp> createState() => _CameraAppState();
103+
_CameraAppState createState() => _CameraAppState();
108104
}
109105
110106
class _CameraAppState extends State<CameraApp> {
@@ -113,7 +109,7 @@ class _CameraAppState extends State<CameraApp> {
113109
@override
114110
void initState() {
115111
super.initState();
116-
controller = CameraController(_cameras[0], ResolutionPreset.max);
112+
controller = CameraController(cameras[0], ResolutionPreset.max);
117113
controller.initialize().then((_) {
118114
if (!mounted) {
119115
return;

packages/camera/camera/example/lib/main.dart

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
// ignore_for_file: public_member_api_docs
6+
57
import 'dart:async';
68
import 'dart:io';
79

@@ -11,13 +13,9 @@ import 'package:flutter/material.dart';
1113
import 'package:flutter/scheduler.dart';
1214
import 'package:video_player/video_player.dart';
1315

14-
/// Camera example home widget.
1516
class CameraExampleHome extends StatefulWidget {
16-
/// Default Constructor
17-
const CameraExampleHome({Key? key}) : super(key: key);
18-
1917
@override
20-
State<CameraExampleHome> createState() {
18+
_CameraExampleHomeState createState() {
2119
return _CameraExampleHomeState();
2220
}
2321
}
@@ -36,7 +34,7 @@ IconData getCameraLensIcon(CameraLensDirection direction) {
3634
}
3735
}
3836

39-
void _logError(String code, String? message) {
37+
void logError(String code, String? message) {
4038
if (message != null) {
4139
print('Error: $code\nError Message: $message');
4240
} else {
@@ -136,6 +134,12 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
136134
children: <Widget>[
137135
Expanded(
138136
child: Container(
137+
child: Padding(
138+
padding: const EdgeInsets.all(1.0),
139+
child: Center(
140+
child: _cameraPreviewWidget(),
141+
),
142+
),
139143
decoration: BoxDecoration(
140144
color: Colors.black,
141145
border: Border.all(
@@ -146,12 +150,6 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
146150
width: 3.0,
147151
),
148152
),
149-
child: Padding(
150-
padding: const EdgeInsets.all(1.0),
151-
child: Center(
152-
child: _cameraPreviewWidget(),
153-
),
154-
),
155153
),
156154
),
157155
_captureControlRowWidget(),
@@ -235,8 +233,6 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
235233
Container()
236234
else
237235
SizedBox(
238-
width: 64.0,
239-
height: 64.0,
240236
child: (localVideoController == null)
241237
? (
242238
// The captured image on the web contains a network-accessible URL
@@ -247,8 +243,6 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
247243
? Image.network(imageFile!.path)
248244
: Image.file(File(imageFile!.path)))
249245
: Container(
250-
decoration: BoxDecoration(
251-
border: Border.all(color: Colors.pink)),
252246
child: Center(
253247
child: AspectRatio(
254248
aspectRatio:
@@ -257,7 +251,11 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
257251
: 1.0,
258252
child: VideoPlayer(localVideoController)),
259253
),
254+
decoration: BoxDecoration(
255+
border: Border.all(color: Colors.pink)),
260256
),
257+
width: 64.0,
258+
height: 64.0,
261259
),
262260
],
263261
),
@@ -396,6 +394,7 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
396394
mainAxisSize: MainAxisSize.max,
397395
children: <Widget>[
398396
TextButton(
397+
child: const Text('AUTO'),
399398
style: styleAuto,
400399
onPressed: controller != null
401400
? () =>
@@ -407,22 +406,21 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
407406
showInSnackBar('Resetting exposure point');
408407
}
409408
},
410-
child: const Text('AUTO'),
411409
),
412410
TextButton(
411+
child: const Text('LOCKED'),
413412
style: styleLocked,
414413
onPressed: controller != null
415414
? () =>
416415
onSetExposureModeButtonPressed(ExposureMode.locked)
417416
: null,
418-
child: const Text('LOCKED'),
419417
),
420418
TextButton(
419+
child: const Text('RESET OFFSET'),
421420
style: styleLocked,
422421
onPressed: controller != null
423422
? () => controller!.setExposureOffset(0.0)
424423
: null,
425-
child: const Text('RESET OFFSET'),
426424
),
427425
],
428426
),
@@ -481,6 +479,7 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
481479
mainAxisSize: MainAxisSize.max,
482480
children: <Widget>[
483481
TextButton(
482+
child: const Text('AUTO'),
484483
style: styleAuto,
485484
onPressed: controller != null
486485
? () => onSetFocusModeButtonPressed(FocusMode.auto)
@@ -491,14 +490,13 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
491490
}
492491
showInSnackBar('Resetting focus point');
493492
},
494-
child: const Text('AUTO'),
495493
),
496494
TextButton(
495+
child: const Text('LOCKED'),
497496
style: styleLocked,
498497
onPressed: controller != null
499498
? () => onSetFocusModeButtonPressed(FocusMode.locked)
500499
: null,
501-
child: const Text('LOCKED'),
502500
),
503501
],
504502
),
@@ -584,13 +582,13 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
584582
onNewCameraSelected(description);
585583
};
586584

587-
if (_cameras.isEmpty) {
585+
if (cameras.isEmpty) {
588586
_ambiguate(SchedulerBinding.instance)?.addPostFrameCallback((_) async {
589587
showInSnackBar('No camera found.');
590588
});
591589
return const Text('None');
592590
} else {
593-
for (final CameraDescription cameraDescription in _cameras) {
591+
for (final CameraDescription cameraDescription in cameras) {
594592
toggles.add(
595593
SizedBox(
596594
width: 90.0,
@@ -1016,35 +1014,31 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
10161014
}
10171015

10181016
void _showCameraException(CameraException e) {
1019-
_logError(e.code, e.description);
1017+
logError(e.code, e.description);
10201018
showInSnackBar('Error: ${e.code}\n${e.description}');
10211019
}
10221020
}
10231021

1024-
/// CameraApp is the Main Application.
10251022
class CameraApp extends StatelessWidget {
1026-
/// Default Constructor
1027-
const CameraApp({Key? key}) : super(key: key);
1028-
10291023
@override
10301024
Widget build(BuildContext context) {
1031-
return const MaterialApp(
1025+
return MaterialApp(
10321026
home: CameraExampleHome(),
10331027
);
10341028
}
10351029
}
10361030

1037-
List<CameraDescription> _cameras = <CameraDescription>[];
1031+
List<CameraDescription> cameras = <CameraDescription>[];
10381032

10391033
Future<void> main() async {
10401034
// Fetch the available cameras before initializing the app.
10411035
try {
10421036
WidgetsFlutterBinding.ensureInitialized();
1043-
_cameras = await availableCameras();
1037+
cameras = await availableCameras();
10441038
} on CameraException catch (e) {
1045-
_logError(e.code, e.description);
1039+
logError(e.code, e.description);
10461040
}
1047-
runApp(const CameraApp());
1041+
runApp(CameraApp());
10481042
}
10491043

10501044
/// This allows a value of type T or T? to be treated as a value of type T?.

packages/camera/camera/example/lib/readme_full_example.dart

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,24 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
// ignore_for_file: public_member_api_docs
6+
57
// #docregion FullAppExample
68
import 'package:camera/camera.dart';
79
import 'package:flutter/material.dart';
810

9-
late List<CameraDescription> _cameras;
11+
late List<CameraDescription> cameras;
1012

1113
Future<void> main() async {
1214
WidgetsFlutterBinding.ensureInitialized();
1315

14-
_cameras = await availableCameras();
15-
runApp(const CameraApp());
16+
cameras = await availableCameras();
17+
runApp(CameraApp());
1618
}
1719

18-
/// CameraApp is the Main Application.
1920
class CameraApp extends StatefulWidget {
20-
/// Default Constructor
21-
const CameraApp({Key? key}) : super(key: key);
22-
2321
@override
24-
State<CameraApp> createState() => _CameraAppState();
22+
_CameraAppState createState() => _CameraAppState();
2523
}
2624

2725
class _CameraAppState extends State<CameraApp> {
@@ -30,7 +28,7 @@ class _CameraAppState extends State<CameraApp> {
3028
@override
3129
void initState() {
3230
super.initState();
33-
controller = CameraController(_cameras[0], ResolutionPreset.max);
31+
controller = CameraController(cameras[0], ResolutionPreset.max);
3432
controller.initialize().then((_) {
3533
if (!mounted) {
3634
return;

packages/camera/camera/example/test/main_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
99
void main() {
1010
testWidgets('Test snackbar', (WidgetTester tester) async {
1111
WidgetsFlutterBinding.ensureInitialized();
12-
await tester.pumpWidget(const CameraApp());
12+
await tester.pumpWidget(CameraApp());
1313
await tester.pumpAndSettle();
1414
expect(find.byType(SnackBar), findsOneWidget);
1515
});

packages/camera/camera/lib/src/camera_preview.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ import 'package:flutter/services.dart';
1010
/// A widget showing a live camera preview.
1111
class CameraPreview extends StatelessWidget {
1212
/// Creates a preview widget for the given camera controller.
13-
const CameraPreview(this.controller, {Key? key, this.child})
14-
: super(key: key);
13+
const CameraPreview(this.controller, {this.child});
1514

1615
/// The controller for the camera that the preview is shown for.
1716
final CameraController controller;

packages/camera/camera/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: A Flutter plugin for controlling the camera. Supports previewing
44
Dart.
55
repository: https://github.com/flutter/plugins/tree/main/packages/camera/camera
66
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
7-
version: 0.9.4+22
7+
version: 0.9.4+21
88

99
environment:
1010
sdk: ">=2.14.0 <3.0.0"

packages/camera/camera_web/CHANGELOG.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
## 0.2.1+5
2-
3-
* Fixes library_private_types_in_public_api, sort_child_properties_last and use_key_in_widget_constructors
4-
lint warnings.
5-
61
## 0.2.1+4
72

83
* Migrates from `ui.hash*` to `Object.hash*`.

packages/camera/camera_web/example/lib/main.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@
44

55
import 'package:flutter/material.dart';
66

7-
void main() => runApp(const MyApp());
7+
void main() => runApp(MyApp());
88

99
/// App for testing
1010
class MyApp extends StatelessWidget {
11-
/// Default Constructor
12-
const MyApp({Key? key}) : super(key: key);
13-
1411
@override
1512
Widget build(BuildContext context) {
1613
return const Directionality(

0 commit comments

Comments
 (0)