fix: Avoid using MediaQuery.of()
This commit is contained in:
parent
92c5549f74
commit
d2c2fd48d4
13 changed files with 20 additions and 21 deletions
|
|
@ -21,7 +21,7 @@ class ChatEmojiPicker extends StatelessWidget {
|
|||
clipBehavior: Clip.hardEdge,
|
||||
decoration: const BoxDecoration(),
|
||||
height: controller.showEmojiPicker
|
||||
? MediaQuery.of(context).size.height / 2
|
||||
? MediaQuery.sizeOf(context).height / 2
|
||||
: 0,
|
||||
child: controller.showEmojiPicker
|
||||
? DefaultTabController(
|
||||
|
|
|
|||
|
|
@ -274,8 +274,8 @@ class ChatView extends StatelessWidget {
|
|||
cacheKey: accountConfig.wallpaperUrl.toString(),
|
||||
uri: accountConfig.wallpaperUrl,
|
||||
fit: BoxFit.cover,
|
||||
height: MediaQuery.of(context).size.height,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: MediaQuery.sizeOf(context).height,
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
isThumbnail: false,
|
||||
placeholder: (_) => Container(),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -463,8 +463,8 @@ class Message extends StatelessWidget {
|
|||
colors: colors,
|
||||
ignore: noBubble ||
|
||||
!ownMessage ||
|
||||
MediaQuery.of(context)
|
||||
.highContrast,
|
||||
MediaQuery.highContrastOf(
|
||||
context),
|
||||
scrollController:
|
||||
scrollController,
|
||||
child: Container(
|
||||
|
|
|
|||
|
|
@ -238,18 +238,18 @@ class MyCallingPage extends State<Calling> {
|
|||
|
||||
void _resizeLocalVideo(Orientation orientation) {
|
||||
final shortSide = min(
|
||||
MediaQuery.of(widget.context).size.width,
|
||||
MediaQuery.of(widget.context).size.height,
|
||||
MediaQuery.sizeOf(widget.context).width,
|
||||
MediaQuery.sizeOf(widget.context).height,
|
||||
);
|
||||
_localVideoMargin = remoteStream != null
|
||||
? const EdgeInsets.only(top: 20.0, right: 20.0)
|
||||
: EdgeInsets.zero;
|
||||
_localVideoWidth = remoteStream != null
|
||||
? shortSide / 3
|
||||
: MediaQuery.of(widget.context).size.width;
|
||||
: MediaQuery.sizeOf(widget.context).width;
|
||||
_localVideoHeight = remoteStream != null
|
||||
? shortSide / 4
|
||||
: MediaQuery.of(widget.context).size.height;
|
||||
: MediaQuery.sizeOf(widget.context).height;
|
||||
}
|
||||
|
||||
void _handleCallState(CallState state) {
|
||||
|
|
|
|||
|
|
@ -138,10 +138,9 @@ class PIPViewState extends State<PIPView> with TickerProviderStateMixin {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final mediaQuery = MediaQuery.of(context);
|
||||
var windowPadding = mediaQuery.padding;
|
||||
var windowPadding = MediaQuery.paddingOf(context);
|
||||
if (widget.avoidKeyboard) {
|
||||
windowPadding += mediaQuery.viewInsets;
|
||||
windowPadding += MediaQuery.viewInsetsOf(context);
|
||||
}
|
||||
final isFloating = _floating;
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue