fix: Avoid using MediaQuery.of()

This commit is contained in:
imnotlxy 2025-08-01 06:15:23 +08:00
commit d2c2fd48d4
13 changed files with 20 additions and 21 deletions

View file

@ -111,7 +111,7 @@ class ImageViewerController extends State<ImageViewer> {
void onInteractionEnds(ScaleEndDetails endDetails) {
if (PlatformInfos.usesTouchscreen == false) {
if (endDetails.velocity.pixelsPerSecond.dy >
MediaQuery.of(context).size.height * maxScaleFactor) {
MediaQuery.sizeOf(context).height * maxScaleFactor) {
Navigator.of(context, rootNavigator: false).pop();
}
}

View file

@ -127,7 +127,7 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
final infoMap = widget.event.content.tryGetMap<String, Object?>('info');
final videoWidth = infoMap?.tryGet<int>('w') ?? 400;
final videoHeight = infoMap?.tryGet<int>('h') ?? 300;
final height = MediaQuery.of(context).size.height - 52;
final height = MediaQuery.sizeOf(context).height - 52;
final width = videoWidth * (height / videoHeight);
final chewieController = _chewieController;