Skip to content

Commit

Permalink
[camera] Fix example from README.md (flutter#3592)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvanbeusekom authored Feb 23, 2021
1 parent a2cb894 commit bd88615
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 4 additions & 0 deletions packages/camera/camera/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.8.0-nullsafety.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.

## 0.8.0-nullsafety.2

* Solved delay when using the zoom feature on iOS.
Expand Down
11 changes: 6 additions & 5 deletions packages/camera/camera/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ List<CameraDescription> cameras;
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
cameras = await availableCameras();
runApp(CameraApp());
}
Expand All @@ -94,7 +95,7 @@ class _CameraAppState extends State<CameraApp> {
@override
void initState() {
super.initState();
controller = CameraController(cameras[0], ResolutionPreset.medium);
controller = CameraController(cameras[0], ResolutionPreset.max);
controller.initialize().then((_) {
if (!mounted) {
return;
Expand All @@ -114,12 +115,12 @@ class _CameraAppState extends State<CameraApp> {
if (!controller.value.isInitialized) {
return Container();
}
return AspectRatio(
aspectRatio:
controller.value.aspectRatio,
child: CameraPreview(controller));
return MaterialApp(
home: CameraPreview(controller),
);
}
}
```

For a more elaborate usage example see [here](https://github.com/flutter/plugins/tree/master/packages/camera/camera/example).
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: camera
description: A Flutter plugin for getting information about and controlling the
camera on Android and iOS. Supports previewing the camera feed, capturing images, capturing video,
and streaming image buffers to dart.
version: 0.8.0-nullsafety.2
version: 0.8.0-nullsafety.3
homepage: https://github.com/flutter/plugins/tree/master/packages/camera/camera

dependencies:
Expand Down

0 comments on commit bd88615

Please sign in to comment.