From ce1c80fd86ad564f0fdd886e4ad8772bdeb046d0 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Thu, 29 Feb 2024 23:42:09 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E5=8A=A8=E6=80=81=E6=9C=80=E6=96=B0?= =?UTF-8?q?=E5=85=B3=E6=B3=A8=E6=A8=AA=E8=A1=8C=E6=8B=89=E4=BC=B8=20issuse?= =?UTF-8?q?=20#580?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/dynamics/widgets/up_panel.dart | 54 +++++++++++------------- 1 file changed, 25 insertions(+), 29 deletions(-) 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( From be56fb721fd9d23b3efdebbc2123090b4a7b8464 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Fri, 1 Mar 2024 00:14:42 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E7=A7=81=E4=BF=A1=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E8=A1=A8=E6=83=85=E9=9D=A2=E6=9D=BF=20issues=20#588?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/video/detail/reply_new/view.dart | 33 +++++++++++++--------- lib/pages/whisper_detail/view.dart | 30 +++++++++++--------- 2 files changed, 37 insertions(+), 26 deletions(-) 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(); }