fix: 私信页面表情面板 issues #588

This commit is contained in:
guozhigq
2024-03-01 00:14:42 +08:00
committed by orz12
parent 96e1a5af2c
commit 05143fc90e
2 changed files with 26 additions and 18 deletions

View File

@@ -109,9 +109,10 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
@override @override
void didChangeMetrics() { void didChangeMetrics() {
super.didChangeMetrics(); super.didChangeMetrics();
WidgetsBinding.instance.addPostFrameCallback((_) { final String routePath = Get.currentRoute;
// 键盘高度 if (mounted && routePath.startsWith('/video')) {
if (mounted) { WidgetsBinding.instance.addPostFrameCallback((_) {
// 键盘高度
final viewInsets = EdgeInsets.fromViewPadding( final viewInsets = EdgeInsets.fromViewPadding(
View.of(context).viewInsets, View.of(context).devicePixelRatio); View.of(context).viewInsets, View.of(context).devicePixelRatio);
_debouncer.run(() { _debouncer.run(() {
@@ -124,8 +125,8 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
} }
} }
}); });
} });
}); }
} }
@override @override
@@ -139,6 +140,9 @@ class _VideoReplyNewDialogState extends State<VideoReplyNewDialog>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double keyboardHeight = EdgeInsets.fromViewPadding(
View.of(context).viewInsets, View.of(context).devicePixelRatio)
.bottom;
return Container( return Container(
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
decoration: BoxDecoration( decoration: BoxDecoration(

View File

@@ -51,27 +51,31 @@ class _WhisperDetailPageState extends State<WhisperDetailPage>
@override @override
void didChangeMetrics() { void didChangeMetrics() {
super.didChangeMetrics(); super.didChangeMetrics();
WidgetsBinding.instance.addPostFrameCallback((_) { final String routePath = Get.currentRoute;
// 键盘高度 if (mounted && routePath.startsWith('/whisper_detail')) {
final viewInsets = EdgeInsets.fromViewPadding( WidgetsBinding.instance.addPostFrameCallback((_) {
View.of(context).viewInsets, View.of(context).devicePixelRatio); // 键盘高度
_debouncer.run(() { final viewInsets = EdgeInsets.fromViewPadding(
if (mounted) { View.of(context).viewInsets, View.of(context).devicePixelRatio);
if (keyboardHeight == 0) { _debouncer.run(() {
setState(() { if (mounted) {
emoteHeight = keyboardHeight = if (keyboardHeight == 0) {
keyboardHeight == 0.0 ? viewInsets.bottom : keyboardHeight; setState(() {
}); emoteHeight = keyboardHeight =
keyboardHeight == 0.0 ? viewInsets.bottom : keyboardHeight;
});
}
} }
} });
}); });
}); }
} }
@override @override
void dispose() { void dispose() {
WidgetsBinding.instance.removeObserver(this); WidgetsBinding.instance.removeObserver(this);
replyContentFocusNode.removeListener(() {}); replyContentFocusNode.removeListener(() {});
replyContentFocusNode.dispose();
super.dispose(); super.dispose();
} }