fix:调整ios端渲染白边问题

This commit is contained in:
liyi 2025-05-07 15:06:57 +08:00
parent 3db24c3303
commit 4c47b65b0e

View File

@ -1,5 +1,6 @@
import 'dart:async'; import 'dart:async';
import 'dart:math'; import 'dart:math';
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart'; import 'package:flutter/scheduler.dart';
@ -58,7 +59,6 @@ class _TalkViewNativeDecodePageState extends State<TalkViewNativeDecodePage>
state.animationController.forward(); state.animationController.forward();
} }
}); });
} }
@override @override
@ -97,34 +97,39 @@ class _TalkViewNativeDecodePageState extends State<TalkViewNativeDecodePage>
final double scaleWidth = physicalWidth / rotatedImageWidth; final double scaleWidth = physicalWidth / rotatedImageWidth;
final double scaleHeight = physicalHeight / rotatedImageHeight; final double scaleHeight = physicalHeight / rotatedImageHeight;
max(scaleWidth, scaleHeight); // max(scaleWidth, scaleHeight); //
return Column( return state.isLoading.isTrue
children: [
Expanded(
child: state.isLoading.isTrue
? Image.asset( ? Image.asset(
'images/main/monitorBg.png', 'images/main/monitorBg.png',
width: screenWidth, width: screenWidth,
height: screenHeight, height: screenHeight,
fit: BoxFit.cover, fit: BoxFit.cover,
) )
: PopScope( : Positioned.fill(
child: PopScope(
canPop: false, canPop: false,
child: RepaintBoundary( child: RepaintBoundary(
key: state.globalKey, key: state.globalKey,
child: SizedBox.expand( child: SizedBox.expand(
child: RotatedBox( child: RotatedBox(
// 使RotatedBox // 使RotatedBox
quarterTurns: startChartManage.rotateAngle ~/ 90, quarterTurns:
startChartManage.rotateAngle ~/ 90,
child: Platform.isIOS
? Transform.scale(
scale: 1.008, // iOS白边
child: Texture( child: Texture(
textureId: state.textureId.value!, textureId: state.textureId.value!,
filterQuality: FilterQuality.medium, filterQuality: FilterQuality.medium,
), ),
)
: Texture(
textureId: state.textureId.value!,
filterQuality: FilterQuality.medium,
),
), ),
), ),
), ),
), ),
),
],
); );
}, },
), ),