Navaron Bracke
Committed by GitHub

Merge pull request #1032 from penkzhou/feature/change_platform_os_detect

feat: change platform os detect pattern
## 5.0.1
Improvements:
* Adjusted the platform checks to use the defaultTargetPlatform API, so that tests can use the correct platform overrides.
## 5.0.0
This major release contains all the changes from the 5.0.0 beta releases, along with the following changes:
... ...
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:mobile_scanner/mobile_scanner.dart';
... ... @@ -204,7 +202,7 @@ class BarcodeOverlay extends CustomPainter {
final double ratioWidth;
final double ratioHeight;
if (!kIsWeb && Platform.isIOS) {
if (!kIsWeb && defaultTargetPlatform == TargetPlatform.iOS) {
ratioWidth = barcodeSize.width / adjustedSize.destination.width;
ratioHeight = barcodeSize.height / adjustedSize.destination.height;
} else {
... ...
import 'dart:async';
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:mobile_scanner/src/enums/barcode_format.dart';
... ... @@ -54,7 +54,7 @@ class MethodChannelMobileScanner extends MobileScannerPlatform {
final List<Map<Object?, Object?>> barcodes =
data.cast<Map<Object?, Object?>>();
if (Platform.isMacOS) {
if (defaultTargetPlatform == TargetPlatform.macOS) {
return BarcodeCapture(
raw: event,
barcodes: barcodes
... ... @@ -70,7 +70,8 @@ class MethodChannelMobileScanner extends MobileScannerPlatform {
);
}
if (Platform.isAndroid || Platform.isIOS) {
if (defaultTargetPlatform == TargetPlatform.android ||
defaultTargetPlatform == TargetPlatform.iOS) {
final double? width = event['width'] as double?;
final double? height = event['height'] as double?;
... ...
name: mobile_scanner
description: A universal barcode and QR code scanner for Flutter based on MLKit. Uses CameraX on Android, AVFoundation on iOS and Apple Vision & AVFoundation on macOS.
version: 5.0.0
version: 5.0.1
repository: https://github.com/juliansteenbakker/mobile_scanner
screenshots:
... ...