mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 07:20:39 +00:00
[iOS] fixed camera preview aspect ratio
This commit is contained in:
parent
184ef3a916
commit
5e446800e0
6 changed files with 11 additions and 55 deletions
2
.github/workflows/build_apk.yml
vendored
2
.github/workflows/build_apk.yml
vendored
|
@ -89,7 +89,7 @@ jobs:
|
|||
- name: Build .apk
|
||||
env:
|
||||
FLAVOR: ${{ github.event.inputs.flavor }}
|
||||
run: flutter build apk --release --flavor $FLAVOR --dart-define cameraPreviewAspectRatio=240/320 -t lib/main_$FLAVOR.dart
|
||||
run: flutter build apk --release --flavor $FLAVOR -t lib/main_$FLAVOR.dart
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
|
|
2
.github/workflows/create_release.yml
vendored
2
.github/workflows/create_release.yml
vendored
|
@ -37,7 +37,7 @@ on:
|
|||
default: true
|
||||
|
||||
env:
|
||||
BUILD_ARGS: --release --flavor prod --dart-define cameraPreviewAspectRatio=240/320 -t lib/main_prod.dart
|
||||
BUILD_ARGS: --release --flavor prod -t lib/main_prod.dart
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
|
44
.vscode/launch.json
vendored
44
.vscode/launch.json
vendored
|
@ -5,83 +5,49 @@
|
|||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "dev-debug (android)",
|
||||
"name": "dev-debug",
|
||||
"request": "launch",
|
||||
"type": "dart",
|
||||
"flutterMode": "debug",
|
||||
"args": [
|
||||
"--flavor",
|
||||
"dev",
|
||||
"--dart-define",
|
||||
"cameraPreviewAspectRatio=240/320",
|
||||
],
|
||||
"program": "${workspaceFolder}/lib/main_dev.dart",
|
||||
},
|
||||
{
|
||||
"name": "dev-profile (android)",
|
||||
"name": "dev-profile",
|
||||
"request": "launch",
|
||||
"type": "dart",
|
||||
"flutterMode": "profile",
|
||||
"args": [
|
||||
"--flavor",
|
||||
"dev",
|
||||
"--dart-define",
|
||||
"cameraPreviewAspectRatio=240/320",
|
||||
],
|
||||
"program": "${workspaceFolder}/lib/main_dev.dart",
|
||||
},
|
||||
{
|
||||
"name": "prod-debug (android)",
|
||||
"name": "prod-debug",
|
||||
"request": "launch",
|
||||
"type": "dart",
|
||||
"flutterMode": "debug",
|
||||
"args": [
|
||||
"--flavor",
|
||||
"prod",
|
||||
"--dart-define",
|
||||
"cameraPreviewAspectRatio=240/320",
|
||||
],
|
||||
"program": "${workspaceFolder}/lib/main_release.dart",
|
||||
},
|
||||
{
|
||||
"name": "prod-profile (android)",
|
||||
"name": "prod-profile",
|
||||
"request": "launch",
|
||||
"type": "dart",
|
||||
"flutterMode": "profile",
|
||||
"args": [
|
||||
"--flavor",
|
||||
"prod",
|
||||
"--dart-define",
|
||||
"cameraPreviewAspectRatio=240/320",
|
||||
],
|
||||
"program": "${workspaceFolder}/lib/main_release.dart",
|
||||
},
|
||||
{
|
||||
"name": "dev-debug (ios)",
|
||||
"request": "launch",
|
||||
"type": "dart",
|
||||
"flutterMode": "debug",
|
||||
"args": [
|
||||
"--flavor",
|
||||
"dev",
|
||||
"--dart-define",
|
||||
"cameraPreviewAspectRatio=3/4",
|
||||
],
|
||||
"program": "${workspaceFolder}/lib/main_dev.dart",
|
||||
},
|
||||
{
|
||||
"name": "dev-profile (ios)",
|
||||
"request": "launch",
|
||||
"flutterMode": "profile",
|
||||
"type": "dart",
|
||||
"args": [
|
||||
"--flavor",
|
||||
"dev",
|
||||
"--dart-define",
|
||||
"cameraPreviewAspectRatio=3/4",
|
||||
],
|
||||
"program": "${workspaceFolder}/lib/main_dev.dart",
|
||||
},
|
||||
{
|
||||
"name": "dev-simulator",
|
||||
"request": "launch",
|
||||
|
@ -91,8 +57,6 @@
|
|||
"--flavor",
|
||||
"dev",
|
||||
"--dart-define",
|
||||
"cameraPreviewAspectRatio=240/320",
|
||||
"--dart-define",
|
||||
"cameraStubImage=assets/camera_stub_image.jpg"
|
||||
],
|
||||
"program": "${workspaceFolder}/lib/main_dev.dart",
|
||||
|
|
6
.vscode/tasks.json
vendored
6
.vscode/tasks.json
vendored
|
@ -11,8 +11,6 @@
|
|||
"--flavor",
|
||||
"dev",
|
||||
"--release",
|
||||
"--dart-define",
|
||||
"cameraPreviewAspectRatio=240/320",
|
||||
"-t",
|
||||
"lib/main_dev.dart",
|
||||
],
|
||||
|
@ -27,8 +25,6 @@
|
|||
"--flavor",
|
||||
"prod",
|
||||
"--release",
|
||||
"--dart-define",
|
||||
"cameraPreviewAspectRatio=240/320",
|
||||
"-t",
|
||||
"lib/main_prod.dart",
|
||||
],
|
||||
|
@ -43,8 +39,6 @@
|
|||
"--flavor",
|
||||
"prod",
|
||||
"--release",
|
||||
"--dart-define",
|
||||
"cameraPreviewAspectRatio=240/320",
|
||||
"-t",
|
||||
"lib/main_prod.dart",
|
||||
],
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import 'dart:io';
|
||||
|
||||
class PlatformConfig {
|
||||
const PlatformConfig._();
|
||||
|
||||
static double get cameraPreviewAspectRatio {
|
||||
final rational = const String.fromEnvironment('cameraPreviewAspectRatio').split('/');
|
||||
return int.parse(rational[0]) / int.parse(rational[1]);
|
||||
}
|
||||
static double get cameraPreviewAspectRatio => Platform.isAndroid ? 240 / 320 : 288 / 352;
|
||||
|
||||
static String get cameraStubImage => const String.fromEnvironment('cameraStubImage');
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
flutter drive \
|
||||
--dart-define="cameraPreviewAspectRatio=240/320" \
|
||||
fvm flutter drive \
|
||||
--dart-define="cameraStubImage=assets/camera_stub_image.jpg" \
|
||||
--driver=test_driver/screenshot_driver.dart \
|
||||
--target=screenshots/generate_screenshots.dart \
|
||||
--profile \
|
||||
--debug \
|
||||
--flavor=dev \
|
||||
--no-dds \
|
||||
--endless-trace-buffer \
|
||||
|
|
Loading…
Reference in a new issue