Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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_web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.3.1+5

* Updates README to improve example of `Image` creation.

## 0.3.1+4

* Removes obsolete null checks on non-nullable values.
Expand Down
6 changes: 4 additions & 2 deletions packages/camera/camera_web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,13 @@ URL pointing to a location within the browser (blob) and can be displayed using

See the example below:

<?code-excerpt "example/lib/readme_excerpts.dart (ImageFromXFile)"?>
```dart
final Image image;
if (kIsWeb) {
Image.network(capturedImage.path);
image = Image.network(capturedImage.path);
} else {
Image.file(File(capturedImage.path));
image = Image.file(File(capturedImage.path));
}
```

Expand Down
22 changes: 22 additions & 0 deletions packages/camera/camera_web/example/lib/readme_excerpts.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:io';

import 'package:camera_platform_interface/camera_platform_interface.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';

/// Demonstrates using an XFile result as an [Image] source, for the README.
Image getImageFromResultExample(XFile capturedImage) {
// #docregion ImageFromXFile
final Image image;
if (kIsWeb) {
image = Image.network(capturedImage.path);
} else {
image = Image.file(File(capturedImage.path));
}
// #enddocregion ImageFromXFile
return image;
}
7 changes: 3 additions & 4 deletions packages/camera/camera_web/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ environment:
flutter: ">=3.3.0"

dependencies:
camera_platform_interface: ^2.1.0
camera_web:
path: ../
flutter:
sdk: flutter

dev_dependencies:
async: ^2.5.0
camera_platform_interface: ^2.1.0
camera_web:
path: ../
cross_file: ^0.3.1
flutter_test:
sdk: flutter
integration_test:
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera_web/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: camera_web
description: A Flutter plugin for getting information about and controlling the camera on Web.
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_web
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
version: 0.3.1+4
version: 0.3.1+5

environment:
sdk: ">=2.18.0 <4.0.0"
Expand Down
1 change: 0 additions & 1 deletion script/configs/temp_exclude_excerpt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

# TODO(stuartmorgan): Remove everything from this list. See
# https://github.com/flutter/flutter/issues/102679
- camera_web
- cross_file
- css_colors
- espresso
Expand Down