diff --git a/lib/pages/dynamics/widgets/up_panel.dart b/lib/pages/dynamics/widgets/up_panel.dart index 84753ff9..aa0bdd02 100644 --- a/lib/pages/dynamics/widgets/up_panel.dart +++ b/lib/pages/dynamics/widgets/up_panel.dart @@ -88,36 +88,32 @@ class _UpPanelState extends State { Container( height: 90, color: Theme.of(context).colorScheme.background, - child: Row( - children: [ - Expanded( - child: ListView( - scrollDirection: Axis.horizontal, - controller: scrollController, - children: [ - const SizedBox(width: 10), - if (liveList.isNotEmpty) ...[ - for (int i = 0; i < liveList.length; i++) ...[ - upItemBuild(liveList[i], i) - ], - VerticalDivider( - indent: 20, - endIndent: 40, - width: 26, - color: Theme.of(context) - .colorScheme - .primary - .withOpacity(0.5), - ), - ], - for (int i = 0; i < upList.length; i++) ...[ - upItemBuild(upList[i], i) - ], - const SizedBox(width: 10), + child: Expanded( + child: ListView( + scrollDirection: Axis.horizontal, + controller: scrollController, + children: [ + const SizedBox(width: 10), + if (liveList.isNotEmpty) ...[ + for (int i = 0; i < liveList.length; i++) ...[ + upItemBuild(liveList[i], i) ], - ), - ), - ], + VerticalDivider( + indent: 20, + endIndent: 40, + width: 26, + color: Theme.of(context) + .colorScheme + .primary + .withOpacity(0.5), + ), + ], + for (int i = 0; i < upList.length; i++) ...[ + upItemBuild(upList[i], i) + ], + const SizedBox(width: 10), + ], + ), ), ), Container( diff --git a/lib/pages/video/detail/reply_new/view.dart b/lib/pages/video/detail/reply_new/view.dart index 83201697..678c66cc 100644 --- a/lib/pages/video/detail/reply_new/view.dart +++ b/lib/pages/video/detail/reply_new/view.dart @@ -109,21 +109,24 @@ class _VideoReplyNewDialogState extends State @override void didChangeMetrics() { super.didChangeMetrics(); - WidgetsBinding.instance.addPostFrameCallback((_) { - // 键盘高度 - final viewInsets = EdgeInsets.fromViewPadding( - View.of(context).viewInsets, View.of(context).devicePixelRatio); - _debouncer.run(() { - if (mounted) { - if (keyboardHeight == 0 && emoteHeight == 0) { - setState(() { - emoteHeight = keyboardHeight = - keyboardHeight == 0.0 ? viewInsets.bottom : keyboardHeight; - }); + final String routePath = Get.currentRoute; + if (mounted && routePath.startsWith('/video')) { + WidgetsBinding.instance.addPostFrameCallback((_) { + // 键盘高度 + final viewInsets = EdgeInsets.fromViewPadding( + View.of(context).viewInsets, View.of(context).devicePixelRatio); + _debouncer.run(() { + if (mounted) { + if (keyboardHeight == 0 && emoteHeight == 0) { + setState(() { + emoteHeight = keyboardHeight = + keyboardHeight == 0.0 ? viewInsets.bottom : keyboardHeight; + }); + } } - } + }); }); - }); + } } @override @@ -131,11 +134,15 @@ class _VideoReplyNewDialogState extends State WidgetsBinding.instance.removeObserver(this); _replyContentController.dispose(); replyContentFocusNode.removeListener(() {}); + replyContentFocusNode.dispose(); super.dispose(); } @override Widget build(BuildContext context) { + double keyboardHeight = EdgeInsets.fromViewPadding( + View.of(context).viewInsets, View.of(context).devicePixelRatio) + .bottom; return Container( clipBehavior: Clip.hardEdge, decoration: BoxDecoration( diff --git a/lib/pages/whisper_detail/view.dart b/lib/pages/whisper_detail/view.dart index e94b7d6d..1701be33 100644 --- a/lib/pages/whisper_detail/view.dart +++ b/lib/pages/whisper_detail/view.dart @@ -51,27 +51,31 @@ class _WhisperDetailPageState extends State @override void didChangeMetrics() { super.didChangeMetrics(); - WidgetsBinding.instance.addPostFrameCallback((_) { - // 键盘高度 - final viewInsets = EdgeInsets.fromViewPadding( - View.of(context).viewInsets, View.of(context).devicePixelRatio); - _debouncer.run(() { - if (mounted) { - if (keyboardHeight == 0) { - setState(() { - emoteHeight = keyboardHeight = - keyboardHeight == 0.0 ? viewInsets.bottom : keyboardHeight; - }); + final String routePath = Get.currentRoute; + if (mounted && routePath.startsWith('/whisper_detail')) { + WidgetsBinding.instance.addPostFrameCallback((_) { + // 键盘高度 + final viewInsets = EdgeInsets.fromViewPadding( + View.of(context).viewInsets, View.of(context).devicePixelRatio); + _debouncer.run(() { + if (mounted) { + if (keyboardHeight == 0) { + setState(() { + emoteHeight = keyboardHeight = + keyboardHeight == 0.0 ? viewInsets.bottom : keyboardHeight; + }); + } } - } + }); }); - }); + } } @override void dispose() { WidgetsBinding.instance.removeObserver(this); replyContentFocusNode.removeListener(() {}); + replyContentFocusNode.dispose(); super.dispose(); }