Skip to content

Commit 96aa1d4

Browse files
authored
Merge branch 'flutter:main' into purchase-details-jsonRepresentation
2 parents 2d464a8 + c3c4c5a commit 96aa1d4

File tree

160 files changed

+2233
-1090
lines changed

Some content is hidden

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

160 files changed

+2233
-1090
lines changed

.ci/flutter_master.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0e536eb9fe4b15eb22ea62c0652f0851b9580026
1+
d8baa77b38461e7061e06e72c6bf50d64d302b8c

packages/camera/camera/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## NEXT
2+
3+
* Fixes overflowed toggles in the camera example.
4+
15
## 0.11.1
26

37
* Adds API support query for image streaming.

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

Lines changed: 35 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -225,43 +225,33 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
225225

226226
/// Display the thumbnail of the captured image or video.
227227
Widget _thumbnailWidget() {
228-
final VideoPlayerController? localVideoController = videoController;
229-
230-
return Expanded(
231-
child: Align(
232-
alignment: Alignment.centerRight,
233-
child: Row(
234-
mainAxisSize: MainAxisSize.min,
235-
children: <Widget>[
236-
if (localVideoController == null && imageFile == null)
237-
Container()
238-
else
239-
SizedBox(
240-
width: 64.0,
241-
height: 64.0,
242-
child: (localVideoController == null)
243-
? (
244-
// The captured image on the web contains a network-accessible URL
245-
// pointing to a location within the browser. It may be displayed
246-
// either with Image.network or Image.memory after loading the image
247-
// bytes to memory.
248-
kIsWeb
249-
? Image.network(imageFile!.path)
250-
: Image.file(File(imageFile!.path)))
251-
: Container(
252-
decoration: BoxDecoration(
253-
border: Border.all(color: Colors.pink)),
254-
child: Center(
255-
child: AspectRatio(
256-
aspectRatio:
257-
localVideoController.value.aspectRatio,
258-
child: VideoPlayer(localVideoController)),
259-
),
260-
),
228+
return Row(
229+
mainAxisSize: MainAxisSize.min,
230+
children: <Widget>[
231+
if (videoController case final VideoPlayerController controller?)
232+
Container(
233+
width: 64.0,
234+
height: 64.0,
235+
decoration: BoxDecoration(border: Border.all(color: Colors.pink)),
236+
child: Center(
237+
child: AspectRatio(
238+
aspectRatio: controller.value.aspectRatio,
239+
child: VideoPlayer(controller),
261240
),
262-
],
263-
),
264-
),
241+
),
242+
)
243+
else if (imageFile?.path case final String path)
244+
Container(
245+
width: 64.0,
246+
height: 64.0,
247+
decoration: BoxDecoration(border: Border.all(color: Colors.pink)),
248+
// The captured image on the web contains a network-accessible URL
249+
// pointing to a location within the browser. It may be displayed
250+
// either with Image.network or Image.memory after loading the image
251+
// bytes to memory.
252+
child: kIsWeb ? Image.network(path) : Image.file(File(path)),
253+
),
254+
],
265255
);
266256
}
267257

@@ -598,7 +588,12 @@ class _CameraExampleHomeState extends State<CameraExampleHome>
598588
}
599589
}
600590

601-
return Row(children: toggles);
591+
return Expanded(
592+
child: SizedBox(
593+
height: 56.0,
594+
child: ListView(scrollDirection: Axis.horizontal, children: toggles),
595+
),
596+
);
602597
}
603598

604599
String timestamp() => DateTime.now().millisecondsSinceEpoch.toString();
@@ -1048,6 +1043,9 @@ class CameraApp extends StatelessWidget {
10481043
}
10491044
}
10501045

1046+
/// Getting available cameras for testing.
1047+
@visibleForTesting
1048+
List<CameraDescription> get cameras => _cameras;
10511049
List<CameraDescription> _cameras = <CameraDescription>[];
10521050

10531051
Future<void> main() async {

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

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

5+
import 'package:camera/camera.dart';
56
import 'package:camera_example/main.dart';
67
import 'package:flutter/material.dart';
78
import 'package:flutter_test/flutter_test.dart';
@@ -13,4 +14,23 @@ void main() {
1314
await tester.pumpAndSettle();
1415
expect(find.byType(SnackBar), findsOneWidget);
1516
});
17+
18+
testWidgets(
19+
'CameraDescription toggles will not overflow',
20+
(WidgetTester tester) async {
21+
WidgetsFlutterBinding.ensureInitialized();
22+
// Adds 10 fake camera descriptions.
23+
for (int i = 0; i < 10; i++) {
24+
cameras.add(
25+
CameraDescription(
26+
name: 'camera_$i',
27+
lensDirection: CameraLensDirection.back,
28+
sensorOrientation: 90,
29+
),
30+
);
31+
}
32+
await tester.pumpWidget(const CameraApp());
33+
await tester.pumpAndSettle();
34+
},
35+
);
1636
}

packages/camera/camera_android_camerax/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
## 0.6.18+2
2+
3+
* Fixes premature garbage collection of native objects when app is under memory pressure.
4+
5+
## 0.6.18+1
6+
7+
* Makes Java style improvements.
8+
19
## 0.6.18
210

311
* Adds support for the `MediaSettings.enableAudio` setting, which determines whether or not audio is

packages/camera/camera_android_camerax/android/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ android {
4949
unitTests.includeAndroidResources = true
5050
unitTests.returnDefaultValues = true
5151
unitTests.all {
52+
// The org.gradle.jvmargs property that may be set in gradle.properties does not impact
53+
// the Java heap size when running the Android unit tests. The following property here
54+
// sets the heap size to a size large enough to run the robolectric tests across
55+
// multiple SDK levels.
56+
jvmArgs "-Xmx1G"
5257
testLogging {
5358
events "passed", "skipped", "failed", "standardOut", "standardError"
5459
outputs.upToDateWhen {false}

0 commit comments

Comments
 (0)