From ba37796a92b89a4254c344162c4f0c4719f73adb Mon Sep 17 00:00:00 2001 From: SimpleLove520 <1960997571@qq.com> Date: Wed, 19 Jun 2024 15:41:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E5=8F=96=E6=99=AF?= =?UTF-8?q?=E7=94=BB=E9=9D=A2=E5=8F=B3=E6=97=8B=E4=BA=8690=E5=BA=A6=20?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: SimpleLove520 <1960997571@qq.com> --- lib/src/mobile_scanner.dart | 46 +++++++++++++++---------------------- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/lib/src/mobile_scanner.dart b/lib/src/mobile_scanner.dart index 345364c..2f4d91f 100644 --- a/lib/src/mobile_scanner.dart +++ b/lib/src/mobile_scanner.dart @@ -91,8 +91,7 @@ class MobileScanner extends StatefulWidget { State createState() => _MobileScannerState(); } -class _MobileScannerState extends State - with WidgetsBindingObserver { +class _MobileScannerState extends State with WidgetsBindingObserver { /// The subscription that listens to barcode detection. StreamSubscription? _barcodesSubscription; @@ -116,8 +115,7 @@ class _MobileScannerState extends State ); } - return widget.placeholderBuilder?.call(context, child) ?? - const ColoredBox(color: Colors.black); + return widget.placeholderBuilder?.call(context, child) ?? const ColoredBox(color: Colors.black); } /// Start the given [scanner]. @@ -281,9 +279,7 @@ class _MobileScannerState extends State child: SizedBox( width: size.width, height: size.height, - child: kIsWeb - ? HtmlElementView(viewType: webId!) - : Texture(textureId: textureId!), + child: kIsWeb ? HtmlElementView(viewType: webId!) : Texture(textureId: textureId!), ), ), ); @@ -299,27 +295,21 @@ class _MobileScannerState extends State int? numberOfCameras, ) { return Center( - child: AspectRatio( - aspectRatio: 1, - child: Transform.rotate( - angle: 90 * math.pi / 180, - child: ClipRect( - child: LayoutBuilder( - builder: (_, constraints) { - return SizedBox.fromSize( - size: constraints.biggest, - child: FittedBox( - fit: widget.fit, - child: SizedBox( - width: size.width, - height: size.height, - child: Texture(textureId: textureId!), - ), - ), - ); - }, - ), - ), + child: ClipRect( + child: LayoutBuilder( + builder: (_, constraints) { + return SizedBox.fromSize( + size: constraints.biggest, + child: FittedBox( + fit: widget.fit, + child: SizedBox( + width: size.width, + height: size.height, + child: Texture(textureId: textureId!), + ), + ), + ); + }, ), ), ); -- Gitee