Skip to content

Commit

Permalink
Merge branch 'flutter:main' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
vanlooverenkoen authored Oct 5, 2022
2 parents 892aac0 + 3a928b8 commit 66b5ff1
Show file tree
Hide file tree
Showing 340 changed files with 3,633 additions and 1,205 deletions.
35 changes: 14 additions & 21 deletions .ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,47 +1,40 @@
# The Flutter version is not important here, since the CI scripts update Flutter
# before running. What matters is that the base image is pinned to minimize
# unintended changes when modifying this file.
FROM cirrusci/flutter@sha256:505fe8bce2896c75b4df9ccf500b1604155bf932af7465ffcc66fcae8612f82f
# This is the hash for the 3.0.0 image.
FROM cirrusci/flutter@sha256:0224587bba33241cf908184283ec2b544f1b672d87043ead1c00521c368cf844

RUN apt-get update -y

# Set up Firebase Test Lab requirements.
RUN apt-get install -y --no-install-recommends gnupg

# Add repo for gcloud sdk and install it
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | \
sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list

RUN curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | \
sudo apt-key --keyring /usr/share/keyrings/cloud.google.gpg add -

RUN apt-get update && apt-get install -y google-cloud-sdk && \
gcloud config set core/disable_usage_reporting true && \
gcloud config set component_manager/disable_update_check true

RUN yes | sdkmanager \
"platforms;android-27" \
"build-tools;27.0.3" \
"extras;google;m2repository" \
"extras;android;m2repository"

RUN yes | sdkmanager --licenses

# Install formatter.
# Install formatter for C-based languages.
RUN apt-get install -y clang-format

# Install xvfb to allow running headless
RUN apt-get install -y xvfb libegl1-mesa
# Install Linux desktop build tool requirements.
# Install Linux desktop requirements:
# - build tools.
RUN apt-get install -y clang cmake ninja-build file pkg-config
# Install necessary libraries.
# - libraries.
RUN apt-get install -y libgtk-3-dev libblkid-dev liblzma-dev libgcrypt20-dev
# - xvfb to allow running headless.
RUN apt-get install -y xvfb libegl1-mesa

# Add repo for Google Chrome and install it
# Install Chrome and make it the default browser, for url_launcher tests.
# IMPORTANT: Web tests should use a pinned version of Chromium, not this, since
# this isn't pinned, so any time the docker image is re-created the version of
# Chrome may change.
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
RUN echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | sudo tee /etc/apt/sources.list.d/google-chrome.list
RUN apt-get update && apt-get install -y --no-install-recommends google-chrome-stable

# Make Chrome the default so http: and file: has a handler for url_launcher tests.
# Make Chrome the default for http:, https: and file:.
RUN apt-get install -y xdg-utils
RUN xdg-settings set default-web-browser google-chrome.desktop
RUN xdg-mime default google-chrome.desktop inode/directory
2 changes: 1 addition & 1 deletion .ci/flutter_master.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
64f84f6a47d276e4d79cb10c203adbddeeeae336
55d67cc7d99226cd12d6c4a76de357fc2c92823e
2 changes: 1 addition & 1 deletion .ci/flutter_stable.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e3c29ec00c9c825c891d75054c63fcc46454dca1
18a827f3933c19f51862dde3fa472197683249d6
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ jobs:
run: |
git config --global user.name ${{ secrets.USER_NAME }}
git config --global user.email ${{ secrets.USER_EMAIL }}
dart ./script/tool/lib/src/main.dart publish-plugin --all-changed --base-sha=HEAD~ --skip-confirmation --remote=origin
dart ./script/tool/lib/src/main.dart publish --all-changed --base-sha=HEAD~ --skip-confirmation --remote=origin
env: {PUB_CREDENTIALS: "${{ secrets.PUB_CREDENTIALS }}"}
2 changes: 1 addition & 1 deletion .github/workflows/scorecards-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@904260d7d935dff982205cbdb42025ce30b7a34f
uses: github/codeql-action/upload-sarif@86f3159a697a097a813ad9bfa0002412d97690a4
with:
sarif_file: results.sarif
10 changes: 5 additions & 5 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

analyzer:
strong-mode:
implicit-casts: false
implicit-dynamic: false
strict-casts: true
strict-raw-types: true
errors:
# treat missing required parameters as a warning (not a hint)
missing_required_param: warning
Expand Down Expand Up @@ -114,7 +114,7 @@ linter:
# - constant_identifier_names # needs an opt-out https://github.com/dart-lang/linter/issues/204
- control_flow_in_finally
# - curly_braces_in_flow_control_structures # not required by flutter style
# - depend_on_referenced_packages # LOCAL CHANGE - Needs to be enabled and violations fixed.
- depend_on_referenced_packages
- deprecated_consistency
# - diagnostic_describe_all_properties # enabled only at the framework level (packages/flutter/lib)
- directives_ordering
Expand Down Expand Up @@ -143,7 +143,7 @@ linter:
# - no_default_cases # LOCAL CHANGE - Needs to be enabled and violations fixed.
- no_duplicate_case_values
- no_leading_underscores_for_library_prefixes
# - no_leading_underscores_for_local_identifiers # LOCAL CHANGE - Needs to be enabled and violations fixed.
- no_leading_underscores_for_local_identifiers
- no_logic_in_create_state
# - no_runtimeType_toString # ok in tests; we enable this only in packages/
- non_constant_identifier_names
Expand Down Expand Up @@ -193,7 +193,7 @@ linter:
# - prefer_mixin # Has false positives, see https://github.com/dart-lang/linter/issues/3018
# - prefer_null_aware_method_calls # "call()" is confusing to people new to the language since it's not documented anywhere
- prefer_null_aware_operators
# - prefer_relative_imports # LOCAL CHANGE - Needs to be enabled and violations fixed.
- prefer_relative_imports
- prefer_single_quotes
- prefer_spread_collections
- prefer_typing_uninitialized_variables
Expand Down
7 changes: 6 additions & 1 deletion packages/camera/camera/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## NEXT
## 0.10.0+3

* Updates code for `no_leading_underscores_for_local_identifiers` lint.

## 0.10.0+2

* Updates imports for `prefer_relative_imports`.
* Updates minimum Flutter version to 2.10.

## 0.10.0+1
Expand Down
40 changes: 20 additions & 20 deletions packages/camera/camera/example/integration_test/camera_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -221,16 +221,16 @@ void main() {
);

await controller.initialize();
bool _isDetecting = false;
bool isDetecting = false;

await controller.startImageStream((CameraImage image) {
if (_isDetecting) {
if (isDetecting) {
return;
}

_isDetecting = true;
isDetecting = true;

expectLater(image, isNotNull).whenComplete(() => _isDetecting = false);
expectLater(image, isNotNull).whenComplete(() => isDetecting = false);
});

expect(controller.value.isStreamingImages, true);
Expand All @@ -254,19 +254,19 @@ void main() {
);

await controller.initialize();
final Completer<CameraImage> _completer = Completer<CameraImage>();
final Completer<CameraImage> completer = Completer<CameraImage>();

await controller.startImageStream((CameraImage image) {
if (!_completer.isCompleted) {
if (!completer.isCompleted) {
Future<void>(() async {
await controller.stopImageStream();
await controller.dispose();
}).then((Object? value) {
_completer.complete(image);
completer.complete(image);
});
}
});
return _completer.future;
return completer.future;
}

testWidgets(
Expand All @@ -277,20 +277,20 @@ void main() {
return;
}

CameraImage _image = await startStreaming(cameras, null);
expect(_image, isNotNull);
expect(_image.format.group, ImageFormatGroup.bgra8888);
expect(_image.planes.length, 1);
CameraImage image = await startStreaming(cameras, null);
expect(image, isNotNull);
expect(image.format.group, ImageFormatGroup.bgra8888);
expect(image.planes.length, 1);

_image = await startStreaming(cameras, ImageFormatGroup.yuv420);
expect(_image, isNotNull);
expect(_image.format.group, ImageFormatGroup.yuv420);
expect(_image.planes.length, 2);
image = await startStreaming(cameras, ImageFormatGroup.yuv420);
expect(image, isNotNull);
expect(image.format.group, ImageFormatGroup.yuv420);
expect(image.planes.length, 2);

_image = await startStreaming(cameras, ImageFormatGroup.bgra8888);
expect(_image, isNotNull);
expect(_image.format.group, ImageFormatGroup.bgra8888);
expect(_image.planes.length, 1);
image = await startStreaming(cameras, ImageFormatGroup.bgra8888);
expect(image, isNotNull);
expect(image.format.group, ImageFormatGroup.bgra8888);
expect(image.planes.length, 1);
},
skip: !Platform.isIOS,
);
Expand Down
17 changes: 9 additions & 8 deletions packages/camera/camera/lib/src/camera_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
import 'dart:async';
import 'dart:math';

import 'package:camera/camera.dart';
import 'package:camera_platform_interface/camera_platform_interface.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:quiver/core.dart';

import '../camera.dart';

/// Signature for a callback receiving the a camera image.
///
/// This is used by [CameraController.startImageStream].
Expand Down Expand Up @@ -281,7 +282,7 @@ class CameraController extends ValueNotifier<CameraValue> {
);
}
try {
final Completer<CameraInitializedEvent> _initializeCompleter =
final Completer<CameraInitializedEvent> initializeCompleter =
Completer<CameraInitializedEvent>();

_deviceOrientationSubscription = CameraPlatform.instance
Expand All @@ -302,7 +303,7 @@ class CameraController extends ValueNotifier<CameraValue> {
.onCameraInitialized(_cameraId)
.first
.then((CameraInitializedEvent event) {
_initializeCompleter.complete(event);
initializeCompleter.complete(event);
}));

await CameraPlatform.instance.initializeCamera(
Expand All @@ -312,18 +313,18 @@ class CameraController extends ValueNotifier<CameraValue> {

value = value.copyWith(
isInitialized: true,
previewSize: await _initializeCompleter.future
previewSize: await initializeCompleter.future
.then((CameraInitializedEvent event) => Size(
event.previewWidth,
event.previewHeight,
)),
exposureMode: await _initializeCompleter.future
exposureMode: await initializeCompleter.future
.then((CameraInitializedEvent event) => event.exposureMode),
focusMode: await _initializeCompleter.future
focusMode: await initializeCompleter.future
.then((CameraInitializedEvent event) => event.focusMode),
exposurePointSupported: await _initializeCompleter.future.then(
exposurePointSupported: await initializeCompleter.future.then(
(CameraInitializedEvent event) => event.exposurePointSupported),
focusPointSupported: await _initializeCompleter.future
focusPointSupported: await initializeCompleter.future
.then((CameraInitializedEvent event) => event.focusPointSupported),
);
} on PlatformException catch (e) {
Expand Down
3 changes: 2 additions & 1 deletion packages/camera/camera/lib/src/camera_preview.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:camera/camera.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import '../camera.dart';

/// A widget showing a live camera preview.
class CameraPreview extends StatelessWidget {
/// Creates a preview widget for the given camera controller.
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 @@ -4,7 +4,7 @@ description: A Flutter plugin for controlling the camera. Supports previewing
Dart.
repository: https://github.com/flutter/plugins/tree/main/packages/camera/camera
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
version: 0.10.0+1
version: 0.10.0+3

environment:
sdk: ">=2.14.0 <3.0.0"
Expand Down
4 changes: 4 additions & 0 deletions packages/camera/camera_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.10.0+3

* Updates code for `no_leading_underscores_for_local_identifiers` lint.

## 0.10.0+2

* Removes call to `join` on the camera's background `HandlerThread`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,16 +225,16 @@ void main() {
);

await controller.initialize();
bool _isDetecting = false;
bool isDetecting = false;

await controller.startImageStream((CameraImageData image) {
if (_isDetecting) {
if (isDetecting) {
return;
}

_isDetecting = true;
isDetecting = true;

expectLater(image, isNotNull).whenComplete(() => _isDetecting = false);
expectLater(image, isNotNull).whenComplete(() => isDetecting = false);
});

expect(controller.value.isStreamingImages, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class CameraController extends ValueNotifier<CameraValue> {

/// Initializes the camera on the device.
Future<void> initialize() async {
final Completer<CameraInitializedEvent> _initializeCompleter =
final Completer<CameraInitializedEvent> initializeCompleter =
Completer<CameraInitializedEvent>();

_deviceOrientationSubscription = CameraPlatform.instance
Expand All @@ -224,7 +224,7 @@ class CameraController extends ValueNotifier<CameraValue> {
.onCameraInitialized(_cameraId)
.first
.then((CameraInitializedEvent event) {
_initializeCompleter.complete(event);
initializeCompleter.complete(event);
});

await CameraPlatform.instance.initializeCamera(
Expand All @@ -234,18 +234,18 @@ class CameraController extends ValueNotifier<CameraValue> {

value = value.copyWith(
isInitialized: true,
previewSize: await _initializeCompleter.future
previewSize: await initializeCompleter.future
.then((CameraInitializedEvent event) => Size(
event.previewWidth,
event.previewHeight,
)),
exposureMode: await _initializeCompleter.future
exposureMode: await initializeCompleter.future
.then((CameraInitializedEvent event) => event.exposureMode),
focusMode: await _initializeCompleter.future
focusMode: await initializeCompleter.future
.then((CameraInitializedEvent event) => event.focusMode),
exposurePointSupported: await _initializeCompleter.future
exposurePointSupported: await initializeCompleter.future
.then((CameraInitializedEvent event) => event.exposurePointSupported),
focusPointSupported: await _initializeCompleter.future
focusPointSupported: await initializeCompleter.future
.then((CameraInitializedEvent event) => event.focusPointSupported),
);

Expand Down
1 change: 1 addition & 0 deletions packages/camera/camera_android/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dependencies:
# The example app is bundled with the plugin so we use a path dependency on
# the parent directory to use the current plugin's version.
path: ../
camera_platform_interface: ^2.2.0
flutter:
sdk: flutter
path_provider: ^2.0.0
Expand Down
Loading

0 comments on commit 66b5ff1

Please sign in to comment.