mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-24 01:58:36 +00:00
fix menu position
fix sc opt ui Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -527,9 +527,11 @@ class LiveRoomController extends GetxController {
|
||||
} else {
|
||||
bool? refresh;
|
||||
for (final id in ids) {
|
||||
final item = superChatMsg.firstWhereOrNull((e) => e.id == id);
|
||||
item?.deleted = true;
|
||||
refresh ??= true;
|
||||
if (superChatMsg.firstWhereOrNull((e) => e.id == id)
|
||||
case final item?) {
|
||||
item.deleted = true;
|
||||
refresh ??= true;
|
||||
}
|
||||
}
|
||||
if (refresh ?? false) {
|
||||
superChatMsg.refresh();
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'dart:async';
|
||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||
import 'package:PiliPlus/models/common/image_type.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_superchat/item.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/platform_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -93,7 +94,7 @@ class _SuperChatCardState extends State<SuperChatCard> {
|
||||
}
|
||||
showMenu(
|
||||
context: context,
|
||||
position: RelativeRect.fromLTRB(offset.dx, offset.dy, offset.dx, 0),
|
||||
position: PageUtils.menuPosition(offset),
|
||||
items: [
|
||||
PopupMenuItem(
|
||||
height: 38,
|
||||
@@ -200,7 +201,7 @@ class _SuperChatCardState extends State<SuperChatCard> {
|
||||
item.message,
|
||||
style: TextStyle(
|
||||
color: Utils.parseColor(item.messageFontColor),
|
||||
decoration: !widget.persistentSC && item.deleted
|
||||
decoration: widget.persistentSC && item.deleted
|
||||
? .lineThrough
|
||||
: null,
|
||||
decorationThickness: 1.5,
|
||||
|
||||
@@ -9,6 +9,7 @@ import 'package:PiliPlus/pages/live_room/superchat/superchat_card.dart';
|
||||
import 'package:PiliPlus/pages/video/widgets/header_control.dart';
|
||||
import 'package:PiliPlus/utils/accounts.dart';
|
||||
import 'package:PiliPlus/utils/extension/theme_ext.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||
import 'package:flutter/gestures.dart';
|
||||
@@ -294,9 +295,11 @@ class LiveRoomChatPanel extends StatelessWidget {
|
||||
TapUpDetails details,
|
||||
DanmakuMsg item,
|
||||
) {
|
||||
final dx = details.globalPosition.dx;
|
||||
final uiScale = Pref.uiScale;
|
||||
final dx = details.globalPosition.dx / uiScale;
|
||||
final renderBox = itemContext.findRenderObject() as RenderBox;
|
||||
final dy = renderBox.localToGlobal(renderBox.size.bottomLeft(.zero)).dy;
|
||||
final dy =
|
||||
renderBox.localToGlobal(renderBox.size.bottomLeft(.zero)).dy / uiScale;
|
||||
final autoScroll =
|
||||
liveRoomController.autoScroll &&
|
||||
!liveRoomController.disableAutoScroll.value;
|
||||
|
||||
@@ -805,6 +805,7 @@ void _showUiScaleDialog(
|
||||
value: uiScale,
|
||||
min: _minUiScale,
|
||||
max: _maxUiScale,
|
||||
secondaryTrackValue: 1.0,
|
||||
divisions: ((_maxUiScale - _minUiScale) * 20).toInt(),
|
||||
label: textController.text,
|
||||
onChanged: (value) => setDialogState(() {
|
||||
@@ -845,6 +846,7 @@ void _showUiScaleDialog(
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
Pref.uiScale = 1.0;
|
||||
GStorage.setting.delete(SettingBoxKey.uiScale).whenComplete(() {
|
||||
setState();
|
||||
Get.appUpdate();
|
||||
@@ -864,6 +866,7 @@ void _showUiScaleDialog(
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
Pref.uiScale = uiScale;
|
||||
GStorage.setting.put(SettingBoxKey.uiScale, uiScale).whenComplete(
|
||||
() {
|
||||
setState();
|
||||
|
||||
@@ -1885,34 +1885,39 @@ class VideoDetailController extends GetxController
|
||||
final index = episodes.indexWhere(
|
||||
(e) => e.cid == (seasonCid ?? cid.value),
|
||||
);
|
||||
final size = context.mediaQuerySize;
|
||||
final maxChildSize = PlatformUtils.isMobile && !size.isPortrait
|
||||
? 1.0
|
||||
: 0.7;
|
||||
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
useSafeArea: true,
|
||||
isScrollControlled: true,
|
||||
constraints: BoxConstraints(maxWidth: min(640, size.shortestSide)),
|
||||
builder: (context) => DraggableScrollableSheet(
|
||||
snap: true,
|
||||
expand: false,
|
||||
minChildSize: 0,
|
||||
snapSizes: [maxChildSize],
|
||||
maxChildSize: maxChildSize,
|
||||
initialChildSize: maxChildSize,
|
||||
builder: (context, scrollController) => DownloadPanel(
|
||||
index: index,
|
||||
videoDetail: videoDetail,
|
||||
pgcItem: pgcItem,
|
||||
episodes: episodes!,
|
||||
scrollController: scrollController,
|
||||
videoDetailController: this,
|
||||
heroTag: heroTag,
|
||||
ugcIntroController: ugcIntroController,
|
||||
cidSet: cidSet,
|
||||
),
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: min(640, context.mediaQueryShortestSide),
|
||||
),
|
||||
builder: (context) {
|
||||
final maxChildSize =
|
||||
PlatformUtils.isMobile && !context.mediaQuerySize.isPortrait
|
||||
? 1.0
|
||||
: 0.7;
|
||||
return DraggableScrollableSheet(
|
||||
snap: true,
|
||||
expand: false,
|
||||
minChildSize: 0,
|
||||
snapSizes: [maxChildSize],
|
||||
maxChildSize: maxChildSize,
|
||||
initialChildSize: maxChildSize,
|
||||
builder: (context, scrollController) => DownloadPanel(
|
||||
index: index,
|
||||
videoDetail: videoDetail,
|
||||
pgcItem: pgcItem,
|
||||
episodes: episodes!,
|
||||
scrollController: scrollController,
|
||||
videoDetailController: this,
|
||||
heroTag: heroTag,
|
||||
ugcIntroController: ugcIntroController,
|
||||
cidSet: cidSet,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import 'package:PiliPlus/utils/date_utils.dart';
|
||||
import 'package:PiliPlus/utils/extension/iterable_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/num_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/theme_ext.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/platform_utils.dart';
|
||||
import 'package:fixnum/fixnum.dart';
|
||||
import 'package:flutter/material.dart' hide ListTile;
|
||||
@@ -102,38 +103,35 @@ class WhisperSessionItem extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
onSecondaryTapUp: PlatformUtils.isDesktop
|
||||
? (details) {
|
||||
final offset = details.globalPosition;
|
||||
showMenu(
|
||||
context: context,
|
||||
position: .fromLTRB(offset.dx, offset.dy, offset.dx, 0),
|
||||
items: [
|
||||
? (details) => showMenu(
|
||||
context: context,
|
||||
position: PageUtils.menuPosition(details.globalPosition),
|
||||
items: [
|
||||
PopupMenuItem(
|
||||
height: 42,
|
||||
onTap: () => onSetTop(item.isPinned, item.id),
|
||||
child: Text(item.isPinned ? '移除置顶' : '置顶'),
|
||||
),
|
||||
if (item.id.privateId.hasTalkerUid())
|
||||
PopupMenuItem(
|
||||
height: 42,
|
||||
onTap: () => onSetTop(item.isPinned, item.id),
|
||||
child: Text(item.isPinned ? '移除置顶' : '置顶'),
|
||||
onTap: () =>
|
||||
onSetMute(item.isMuted, item.id.privateId.talkerUid),
|
||||
child: Text('${item.isMuted ? '关闭' : '开启'}免打扰'),
|
||||
),
|
||||
if (item.id.privateId.hasTalkerUid())
|
||||
PopupMenuItem(
|
||||
height: 42,
|
||||
onTap: () =>
|
||||
onSetMute(item.isMuted, item.id.privateId.talkerUid),
|
||||
child: Text('${item.isMuted ? '关闭' : '开启'}免打扰'),
|
||||
if (item.id.privateId.hasTalkerUid())
|
||||
PopupMenuItem(
|
||||
height: 42,
|
||||
onTap: () => showConfirmDialog(
|
||||
context: context,
|
||||
title: '确定删除该对话?',
|
||||
onConfirm: () =>
|
||||
onRemove(item.id.privateId.talkerUid.toInt()),
|
||||
),
|
||||
if (item.id.privateId.hasTalkerUid())
|
||||
PopupMenuItem(
|
||||
height: 42,
|
||||
onTap: () => showConfirmDialog(
|
||||
context: context,
|
||||
title: '确定删除该对话?',
|
||||
onConfirm: () =>
|
||||
onRemove(item.id.privateId.talkerUid.toInt()),
|
||||
),
|
||||
child: const Text('删除'),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
child: const Text('删除'),
|
||||
),
|
||||
],
|
||||
)
|
||||
: null,
|
||||
onTap: () {
|
||||
if (item.hasUnread()) {
|
||||
|
||||
@@ -20,6 +20,7 @@ import 'package:PiliPlus/utils/extension/iterable_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/num_ext.dart';
|
||||
import 'package:PiliPlus/utils/extension/widget_ext.dart';
|
||||
import 'package:PiliPlus/utils/feed_back.dart';
|
||||
import 'package:PiliPlus/utils/page_utils.dart';
|
||||
import 'package:PiliPlus/utils/platform_utils.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart' hide TextField;
|
||||
@@ -197,7 +198,7 @@ class _WhisperDetailPageState
|
||||
void _showMenu(Offset offset, int index, Msg item, bool isOwner) {
|
||||
showMenu(
|
||||
context: context,
|
||||
position: .fromLTRB(offset.dx, offset.dy, offset.dx, 0),
|
||||
position: PageUtils.menuPosition(offset),
|
||||
items: [
|
||||
if (isOwner)
|
||||
PopupMenuItem(
|
||||
|
||||
Reference in New Issue
Block a user