fluffychat merge
This commit is contained in:
commit
78b581d7fa
20 changed files with 54 additions and 52 deletions
|
|
@ -18,10 +18,10 @@ abstract class FluffyThemes {
|
|||
width > columnWidth * 2 + navRailWidth;
|
||||
|
||||
static bool isColumnMode(BuildContext context) =>
|
||||
isColumnModeByWidth(MediaQuery.of(context).size.width);
|
||||
isColumnModeByWidth(MediaQuery.sizeOf(context).width);
|
||||
|
||||
static bool isThreeColumnMode(BuildContext context) =>
|
||||
MediaQuery.of(context).size.width > FluffyThemes.columnWidth * 3.5;
|
||||
MediaQuery.sizeOf(context).width > FluffyThemes.columnWidth * 3.5;
|
||||
|
||||
static LinearGradient backgroundGradient(
|
||||
BuildContext context,
|
||||
|
|
|
|||
|
|
@ -19,7 +19,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(
|
||||
|
|
|
|||
|
|
@ -630,9 +630,10 @@ class Message extends StatelessWidget {
|
|||
// #Pangea
|
||||
// ignore: noBubble ||
|
||||
// !ownMessage ||
|
||||
// MediaQuery.of(
|
||||
// MediaQuery
|
||||
// .highContrastOf(
|
||||
// context,
|
||||
// ).highContrast,
|
||||
// ),
|
||||
ignore: true,
|
||||
// Pangea#
|
||||
scrollController:
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,7 +150,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;
|
||||
|
|
|
|||
|
|
@ -165,12 +165,12 @@ class OverlayUtil {
|
|||
final halfMaxWidth = maxWidth / 2;
|
||||
final hasLeftOverflow = (horizontalMidpoint - halfMaxWidth) < 10;
|
||||
final hasRightOverflow = (horizontalMidpoint + halfMaxWidth) >
|
||||
(MediaQuery.of(context).size.width - columnWidth - 10);
|
||||
(MediaQuery.widthOf(context) - columnWidth - 10);
|
||||
hasTopOverflow = maxHeight + kToolbarHeight > transformTargetOffset.dy;
|
||||
|
||||
double xOffset = 0;
|
||||
|
||||
MediaQuery.of(context).size.width - (horizontalMidpoint + halfMaxWidth);
|
||||
MediaQuery.widthOf(context) - (horizontalMidpoint + halfMaxWidth);
|
||||
if (hasLeftOverflow) {
|
||||
xOffset = (horizontalMidpoint - halfMaxWidth - 10) * -1;
|
||||
} else if (hasRightOverflow) {
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ class FullWidthDialog extends StatelessWidget {
|
|||
maxHeight: maxHeight,
|
||||
)
|
||||
: BoxConstraints(
|
||||
maxWidth: MediaQuery.of(context).size.width,
|
||||
maxHeight: MediaQuery.of(context).size.height,
|
||||
maxWidth: MediaQuery.widthOf(context),
|
||||
maxHeight: MediaQuery.heightOf(context),
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius:
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ class PQuestionContainer extends StatelessWidget {
|
|||
const PQuestionContainer({super.key, required this.title});
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final Size size = MediaQuery.of(context).size;
|
||||
final Size size = MediaQuery.sizeOf(context);
|
||||
return Container(
|
||||
constraints: const BoxConstraints(minWidth: 100, maxWidth: 650),
|
||||
padding: EdgeInsets.all(size.height * 0.01),
|
||||
|
|
|
|||
|
|
@ -272,9 +272,8 @@ class SubscriptionController with ChangeNotifier {
|
|||
clipBehavior: Clip.hardEdge,
|
||||
context: context,
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: PlatformInfos.isMobile
|
||||
? MediaQuery.of(context).size.height - 50
|
||||
: 600,
|
||||
maxHeight:
|
||||
PlatformInfos.isMobile ? MediaQuery.heightOf(context) - 50 : 600,
|
||||
),
|
||||
builder: (_) {
|
||||
return SubscriptionPaywall(
|
||||
|
|
|
|||
|
|
@ -158,9 +158,15 @@ class MessageSelectionPositionerState extends State<MessageSelectionPositioner>
|
|||
FluffyThemes.isThreeColumnMode(context) &&
|
||||
widget.chatController.room.membership == Membership.join;
|
||||
|
||||
MediaQueryData? get mediaQuery => _runWithLogging<MediaQueryData?>(
|
||||
() => MediaQuery.of(context),
|
||||
"Error getting media query",
|
||||
Size? get screenSize => _runWithLogging<Size?>(
|
||||
() => MediaQuery.sizeOf(context),
|
||||
"Error getting media query size",
|
||||
null,
|
||||
);
|
||||
|
||||
EdgeInsets? get screenPadding => _runWithLogging<EdgeInsets?>(
|
||||
() => MediaQuery.paddingOf(context),
|
||||
"Error getting media query padding",
|
||||
null,
|
||||
);
|
||||
|
||||
|
|
@ -177,8 +183,8 @@ class MessageSelectionPositionerState extends State<MessageSelectionPositioner>
|
|||
messageMargin;
|
||||
double? maxWidth;
|
||||
|
||||
if (mediaQuery != null) {
|
||||
final chatViewWidth = mediaQuery!.size.width - columnWidth;
|
||||
if (screenSize != null) {
|
||||
final chatViewWidth = screenSize!.width - columnWidth;
|
||||
maxWidth = chatViewWidth - (2 * _horizontalPadding) - messageMargin;
|
||||
}
|
||||
|
||||
|
|
@ -278,7 +284,7 @@ class MessageSelectionPositionerState extends State<MessageSelectionPositioner>
|
|||
}
|
||||
|
||||
double? get messageRightOffset {
|
||||
if (mediaQuery == null || !ownMessage) return null;
|
||||
if (screenSize == null || !ownMessage) return null;
|
||||
|
||||
final offset = _originalMessageOffset;
|
||||
if (offset == null) {
|
||||
|
|
@ -286,13 +292,13 @@ class MessageSelectionPositionerState extends State<MessageSelectionPositioner>
|
|||
}
|
||||
|
||||
if (isRtl) {
|
||||
return mediaQuery!.size.width -
|
||||
return screenSize!.width -
|
||||
columnWidth -
|
||||
offset.dx -
|
||||
originalMessageSize.width;
|
||||
}
|
||||
|
||||
return mediaQuery!.size.width -
|
||||
return screenSize!.width -
|
||||
offset.dx -
|
||||
originalMessageSize.width -
|
||||
(showDetails ? FluffyThemes.columnWidth : 0);
|
||||
|
|
@ -325,9 +331,9 @@ class MessageSelectionPositionerState extends State<MessageSelectionPositioner>
|
|||
double? get _wordCardLeftOffset {
|
||||
if (ownMessage) return null;
|
||||
if (widget.overlayController.selectedToken != null &&
|
||||
mediaQuery != null &&
|
||||
(mediaQuery!.size.width < _toolbarMaxWidth + messageLeftOffset!)) {
|
||||
return mediaQuery!.size.width - _toolbarMaxWidth - 8.0;
|
||||
screenSize != null &&
|
||||
(screenSize!.width < _toolbarMaxWidth + messageLeftOffset!)) {
|
||||
return screenSize!.width - _toolbarMaxWidth - 8.0;
|
||||
}
|
||||
return messageLeftOffset;
|
||||
}
|
||||
|
|
@ -337,10 +343,8 @@ class MessageSelectionPositionerState extends State<MessageSelectionPositioner>
|
|||
}
|
||||
|
||||
double? get _screenHeight {
|
||||
if (mediaQuery == null) return null;
|
||||
return mediaQuery!.size.height -
|
||||
mediaQuery!.padding.bottom -
|
||||
mediaQuery!.padding.top;
|
||||
if (screenSize == null || screenPadding == null) return null;
|
||||
return screenSize!.height - screenPadding!.bottom - screenPadding!.top;
|
||||
}
|
||||
|
||||
bool get shouldScroll {
|
||||
|
|
@ -373,16 +377,15 @@ class MessageSelectionPositionerState extends State<MessageSelectionPositioner>
|
|||
final originalContentHeight =
|
||||
messageHeight + _reactionsHeight + AppConfig.toolbarMenuHeight + 8.0;
|
||||
|
||||
final screenHeight = mediaQuery!.size.height - mediaQuery!.padding.bottom;
|
||||
final screenHeight = screenSize!.height - screenPadding!.bottom;
|
||||
|
||||
double boxHeight = screenHeight - offset.dy - originalContentHeight;
|
||||
|
||||
final neededSpace =
|
||||
boxHeight + _fullContentHeight + mediaQuery!.padding.top + 4.0;
|
||||
boxHeight + _fullContentHeight + screenPadding!.top + 4.0;
|
||||
|
||||
if (neededSpace > screenHeight) {
|
||||
boxHeight =
|
||||
screenHeight - _fullContentHeight - mediaQuery!.padding.top - 4.0;
|
||||
boxHeight = screenHeight - _fullContentHeight - screenPadding!.top - 4.0;
|
||||
}
|
||||
|
||||
return boxHeight;
|
||||
|
|
@ -409,7 +412,7 @@ class MessageSelectionPositionerState extends State<MessageSelectionPositioner>
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (_messageRenderBox == null || mediaQuery == null) {
|
||||
if (_messageRenderBox == null || screenSize == null) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
|
||||
|
|
@ -420,7 +423,7 @@ class MessageSelectionPositionerState extends State<MessageSelectionPositioner>
|
|||
Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: mediaQuery!.size.width -
|
||||
width: screenSize!.width -
|
||||
columnWidth -
|
||||
(showDetails ? FluffyThemes.columnWidth : 0),
|
||||
height: _screenHeight!,
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ class OverMessageOverlay extends StatelessWidget {
|
|||
AnimatedContainer(
|
||||
duration: FluffyThemes.animationDuration,
|
||||
height: max(0, controller.spaceBelowContent),
|
||||
width: controller.mediaQuery!.size.width -
|
||||
width: controller.screenSize!.width -
|
||||
controller.columnWidth -
|
||||
(controller.showDetails ? FluffyThemes.columnWidth : 0),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@ class OverlayMessage extends StatelessWidget {
|
|||
|
||||
final maxWidth = min(
|
||||
FluffyThemes.columnWidth * 1.5,
|
||||
MediaQuery.of(context).size.width -
|
||||
MediaQuery.widthOf(context) -
|
||||
(ownMessage ? 0 : Avatar.defaultSize) -
|
||||
32.0 -
|
||||
(FluffyThemes.isColumnMode(context)
|
||||
|
|
|
|||
|
|
@ -182,8 +182,8 @@ class CenteredMessage extends StatelessWidget {
|
|||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: controller.mediaQuery!.size.width -
|
||||
controller.columnWidth,
|
||||
width:
|
||||
controller.screenSize!.width - controller.columnWidth,
|
||||
height: 20.0,
|
||||
),
|
||||
OverlayCenterContent(
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ Future<T?> showAdaptiveBottomSheet<T>({
|
|||
isDismissible: isDismissible,
|
||||
isScrollControlled: isScrollControlled,
|
||||
constraints: BoxConstraints(
|
||||
maxHeight: min(MediaQuery.of(context).size.height - 32, 600),
|
||||
maxHeight: min(MediaQuery.sizeOf(context).height - 32, 600),
|
||||
maxWidth: FluffyThemes.columnWidth * 1.25,
|
||||
),
|
||||
backgroundColor: Colors.transparent,
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ Future<T?> showModalActionPopup<T>({
|
|||
clipBehavior: Clip.hardEdge,
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: 512,
|
||||
maxHeight: MediaQuery.of(context).size.height - 32,
|
||||
maxHeight: MediaQuery.sizeOf(context).height - 32,
|
||||
),
|
||||
builder: (context) => ListView(
|
||||
shrinkWrap: true,
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ class EmptyPage extends StatelessWidget {
|
|||
const EmptyPage({super.key});
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final width = min(MediaQuery.of(context).size.width, EmptyPage._width) / 2;
|
||||
final width = min(MediaQuery.sizeOf(context).width, EmptyPage._width) / 2;
|
||||
// #Pangea
|
||||
// final theme = Theme.of(context);
|
||||
// Pangea#
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ class _MxcImageState extends State<MxcImage> {
|
|||
final event = widget.event;
|
||||
|
||||
if (uri != null) {
|
||||
final devicePixelRatio = MediaQuery.of(context).devicePixelRatio;
|
||||
final devicePixelRatio = MediaQuery.devicePixelRatioOf(context);
|
||||
final width = widget.width;
|
||||
final realWidth = width == null ? null : width * devicePixelRatio;
|
||||
final height = widget.height;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class MxcImageViewer extends StatelessWidget {
|
|||
maxScale: 10.0,
|
||||
onInteractionEnd: (endDetails) {
|
||||
if (endDetails.velocity.pixelsPerSecond.dy >
|
||||
MediaQuery.of(context).size.height * 1.5) {
|
||||
MediaQuery.sizeOf(context).height * 1.5) {
|
||||
Navigator.of(context, rootNavigator: false).pop();
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue