mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 15:30:59 +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
|
- name: Build .apk
|
||||||
env:
|
env:
|
||||||
FLAVOR: ${{ github.event.inputs.flavor }}
|
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
|
- name: Upload artifact
|
||||||
uses: actions/upload-artifact@v3
|
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
|
default: true
|
||||||
|
|
||||||
env:
|
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:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
44
.vscode/launch.json
vendored
44
.vscode/launch.json
vendored
|
@ -5,83 +5,49 @@
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "dev-debug (android)",
|
"name": "dev-debug",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"type": "dart",
|
"type": "dart",
|
||||||
"flutterMode": "debug",
|
"flutterMode": "debug",
|
||||||
"args": [
|
"args": [
|
||||||
"--flavor",
|
"--flavor",
|
||||||
"dev",
|
"dev",
|
||||||
"--dart-define",
|
|
||||||
"cameraPreviewAspectRatio=240/320",
|
|
||||||
],
|
],
|
||||||
"program": "${workspaceFolder}/lib/main_dev.dart",
|
"program": "${workspaceFolder}/lib/main_dev.dart",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "dev-profile (android)",
|
"name": "dev-profile",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"type": "dart",
|
"type": "dart",
|
||||||
"flutterMode": "profile",
|
"flutterMode": "profile",
|
||||||
"args": [
|
"args": [
|
||||||
"--flavor",
|
"--flavor",
|
||||||
"dev",
|
"dev",
|
||||||
"--dart-define",
|
|
||||||
"cameraPreviewAspectRatio=240/320",
|
|
||||||
],
|
],
|
||||||
"program": "${workspaceFolder}/lib/main_dev.dart",
|
"program": "${workspaceFolder}/lib/main_dev.dart",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "prod-debug (android)",
|
"name": "prod-debug",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"type": "dart",
|
"type": "dart",
|
||||||
"flutterMode": "debug",
|
"flutterMode": "debug",
|
||||||
"args": [
|
"args": [
|
||||||
"--flavor",
|
"--flavor",
|
||||||
"prod",
|
"prod",
|
||||||
"--dart-define",
|
|
||||||
"cameraPreviewAspectRatio=240/320",
|
|
||||||
],
|
],
|
||||||
"program": "${workspaceFolder}/lib/main_release.dart",
|
"program": "${workspaceFolder}/lib/main_release.dart",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "prod-profile (android)",
|
"name": "prod-profile",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"type": "dart",
|
"type": "dart",
|
||||||
"flutterMode": "profile",
|
"flutterMode": "profile",
|
||||||
"args": [
|
"args": [
|
||||||
"--flavor",
|
"--flavor",
|
||||||
"prod",
|
"prod",
|
||||||
"--dart-define",
|
|
||||||
"cameraPreviewAspectRatio=240/320",
|
|
||||||
],
|
],
|
||||||
"program": "${workspaceFolder}/lib/main_release.dart",
|
"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",
|
"name": "dev-simulator",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
|
@ -91,8 +57,6 @@
|
||||||
"--flavor",
|
"--flavor",
|
||||||
"dev",
|
"dev",
|
||||||
"--dart-define",
|
"--dart-define",
|
||||||
"cameraPreviewAspectRatio=240/320",
|
|
||||||
"--dart-define",
|
|
||||||
"cameraStubImage=assets/camera_stub_image.jpg"
|
"cameraStubImage=assets/camera_stub_image.jpg"
|
||||||
],
|
],
|
||||||
"program": "${workspaceFolder}/lib/main_dev.dart",
|
"program": "${workspaceFolder}/lib/main_dev.dart",
|
||||||
|
|
6
.vscode/tasks.json
vendored
6
.vscode/tasks.json
vendored
|
@ -11,8 +11,6 @@
|
||||||
"--flavor",
|
"--flavor",
|
||||||
"dev",
|
"dev",
|
||||||
"--release",
|
"--release",
|
||||||
"--dart-define",
|
|
||||||
"cameraPreviewAspectRatio=240/320",
|
|
||||||
"-t",
|
"-t",
|
||||||
"lib/main_dev.dart",
|
"lib/main_dev.dart",
|
||||||
],
|
],
|
||||||
|
@ -27,8 +25,6 @@
|
||||||
"--flavor",
|
"--flavor",
|
||||||
"prod",
|
"prod",
|
||||||
"--release",
|
"--release",
|
||||||
"--dart-define",
|
|
||||||
"cameraPreviewAspectRatio=240/320",
|
|
||||||
"-t",
|
"-t",
|
||||||
"lib/main_prod.dart",
|
"lib/main_prod.dart",
|
||||||
],
|
],
|
||||||
|
@ -43,8 +39,6 @@
|
||||||
"--flavor",
|
"--flavor",
|
||||||
"prod",
|
"prod",
|
||||||
"--release",
|
"--release",
|
||||||
"--dart-define",
|
|
||||||
"cameraPreviewAspectRatio=240/320",
|
|
||||||
"-t",
|
"-t",
|
||||||
"lib/main_prod.dart",
|
"lib/main_prod.dart",
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
class PlatformConfig {
|
class PlatformConfig {
|
||||||
const PlatformConfig._();
|
const PlatformConfig._();
|
||||||
|
|
||||||
static double get cameraPreviewAspectRatio {
|
static double get cameraPreviewAspectRatio => Platform.isAndroid ? 240 / 320 : 288 / 352;
|
||||||
final rational = const String.fromEnvironment('cameraPreviewAspectRatio').split('/');
|
|
||||||
return int.parse(rational[0]) / int.parse(rational[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
static String get cameraStubImage => const String.fromEnvironment('cameraStubImage');
|
static String get cameraStubImage => const String.fromEnvironment('cameraStubImage');
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
flutter drive \
|
fvm flutter drive \
|
||||||
--dart-define="cameraPreviewAspectRatio=240/320" \
|
|
||||||
--dart-define="cameraStubImage=assets/camera_stub_image.jpg" \
|
--dart-define="cameraStubImage=assets/camera_stub_image.jpg" \
|
||||||
--driver=test_driver/screenshot_driver.dart \
|
--driver=test_driver/screenshot_driver.dart \
|
||||||
--target=screenshots/generate_screenshots.dart \
|
--target=screenshots/generate_screenshots.dart \
|
||||||
--profile \
|
--debug \
|
||||||
--flavor=dev \
|
--flavor=dev \
|
||||||
--no-dds \
|
--no-dds \
|
||||||
--endless-trace-buffer \
|
--endless-trace-buffer \
|
||||||
|
|
Loading…
Reference in a new issue