diff --git a/.github/workflows/build_apk.yml b/.github/workflows/build_apk.yml index d39bd31..03478a2 100644 --- a/.github/workflows/build_apk.yml +++ b/.github/workflows/build_apk.yml @@ -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 diff --git a/.github/workflows/create_release.yml b/.github/workflows/create_release.yml index 69a672b..2e3ffde 100644 --- a/.github/workflows/create_release.yml +++ b/.github/workflows/create_release.yml @@ -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: diff --git a/.vscode/launch.json b/.vscode/launch.json index a222516..3ff1ae7 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -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", diff --git a/.vscode/tasks.json b/.vscode/tasks.json index adaac0f..a59d2c7 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -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", ], diff --git a/lib/platform_config.dart b/lib/platform_config.dart index d06223e..0c86deb 100644 --- a/lib/platform_config.dart +++ b/lib/platform_config.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'); diff --git a/screenshots/generate_screenshots.sh b/screenshots/generate_screenshots.sh index c95568e..bea315b 100644 --- a/screenshots/generate_screenshots.sh +++ b/screenshots/generate_screenshots.sh @@ -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 \