Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[camera] Fix example from README.md #3592

Merged
merged 2 commits into from
Feb 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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