Skip to content

Commit ebf0cf8

Browse files
mvanbeusekomadsonpleal
authored andcommitted
[camera] Fix example from README.md (flutter#3592)
1 parent c80d873 commit ebf0cf8

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

packages/camera/camera/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.8.0-nullsafety.3
2+
3+
* Updates the example code listed in the [README.md](README.md), so it runs without errors when you simply copy/ paste it into a Flutter App.
4+
15
## 0.8.0-nullsafety.2
26

37
* Solved delay when using the zoom feature on iOS.

packages/camera/camera/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ List<CameraDescription> cameras;
7979
8080
Future<void> main() async {
8181
WidgetsFlutterBinding.ensureInitialized();
82+
8283
cameras = await availableCameras();
8384
runApp(CameraApp());
8485
}
@@ -94,7 +95,7 @@ class _CameraAppState extends State<CameraApp> {
9495
@override
9596
void initState() {
9697
super.initState();
97-
controller = CameraController(cameras[0], ResolutionPreset.medium);
98+
controller = CameraController(cameras[0], ResolutionPreset.max);
9899
controller.initialize().then((_) {
99100
if (!mounted) {
100101
return;
@@ -114,12 +115,12 @@ class _CameraAppState extends State<CameraApp> {
114115
if (!controller.value.isInitialized) {
115116
return Container();
116117
}
117-
return AspectRatio(
118-
aspectRatio:
119-
controller.value.aspectRatio,
120-
child: CameraPreview(controller));
118+
return MaterialApp(
119+
home: CameraPreview(controller),
120+
);
121121
}
122122
}
123+
123124
```
124125

125126
For a more elaborate usage example see [here](https://github.com/flutter/plugins/tree/master/packages/camera/camera/example).

packages/camera/camera/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: camera
22
description: A Flutter plugin for getting information about and controlling the
33
camera on Android and iOS. Supports previewing the camera feed, capturing images, capturing video,
44
and streaming image buffers to dart.
5-
version: 0.8.0-nullsafety.2
5+
version: 0.8.0-nullsafety.3
66
homepage: https://github.com/flutter/plugins/tree/master/packages/camera/camera
77

88
dependencies:

0 commit comments

Comments
 (0)