From fec6a1801dad562bcf5b6ed0f8e021746a43b1a4 Mon Sep 17 00:00:00 2001 From: orz12 Date: Fri, 22 Mar 2024 13:41:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=93=8D=E4=BD=9C=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E5=B0=BA=E5=AF=B8=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/bangumi/introduction/view.dart | 8 +- lib/pages/video/detail/introduction/view.dart | 8 +- .../introduction/widgets/action_item.dart | 90 ++++++++++--------- 3 files changed, 50 insertions(+), 56 deletions(-) diff --git a/lib/pages/bangumi/introduction/view.dart b/lib/pages/bangumi/introduction/view.dart index 660d8d155..dd79149cd 100644 --- a/lib/pages/bangumi/introduction/view.dart +++ b/lib/pages/bangumi/introduction/view.dart @@ -395,12 +395,8 @@ class _BangumiInfoState extends State { padding: const EdgeInsets.only(top: 1), child: SizedBox( height: 48, - child: GridView.count( - physics: const NeverScrollableScrollPhysics(), - primary: false, - padding: EdgeInsets.zero, - crossAxisCount: 5, - childAspectRatio: 1.25, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Obx(() => ActionItem( icon: const Icon(FontAwesomeIcons.thumbsUp), diff --git a/lib/pages/video/detail/introduction/view.dart b/lib/pages/video/detail/introduction/view.dart index 2bd309aa7..f23a8f463 100644 --- a/lib/pages/video/detail/introduction/view.dart +++ b/lib/pages/video/detail/introduction/view.dart @@ -493,12 +493,8 @@ class _VideoInfoState extends State with TickerProviderStateMixin { return Container( margin: const EdgeInsets.only(top: 1), height: 48, - child: GridView.count( - physics: const NeverScrollableScrollPhysics(), - primary: false, - padding: EdgeInsets.zero, - crossAxisCount: 5, - childAspectRatio: 1.25, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Obx( () => ActionItem( diff --git a/lib/pages/video/detail/introduction/widgets/action_item.dart b/lib/pages/video/detail/introduction/widgets/action_item.dart index 752923ad9..b68324b79 100644 --- a/lib/pages/video/detail/introduction/widgets/action_item.dart +++ b/lib/pages/video/detail/introduction/widgets/action_item.dart @@ -26,54 +26,56 @@ class ActionItem extends StatelessWidget { @override Widget build(BuildContext context) { - return Semantics( - label: (text ?? "") + (selectStatus ? "已" :"") + semanticsLabel, - child: - InkWell( - onTap: () => { - feedBack(), - onTap!(), - }, - onLongPress: () => { - if (onLongPress != null) {onLongPress!()} - }, - borderRadius: StyleString.mdRadius, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - // const SizedBox(height: 2), - Icon( - selectStatus - ? selectIcon!.icon! - : icon!.icon!, - size: 18, - color: selectStatus - ? Theme.of(context).colorScheme.primary - : Theme.of(context).colorScheme.outline, - ), - const SizedBox(height: 3), - AnimatedOpacity( - opacity: loadingStatus! ? 0 : 1, - duration: const Duration(milliseconds: 200), - child: AnimatedSwitcher( - duration: const Duration(milliseconds: 300), - transitionBuilder: (Widget child, Animation animation) { - return ScaleTransition(scale: animation, child: child); + return Expanded( + child: Semantics( + label: (text ?? "") + (selectStatus ? "已" : "") + semanticsLabel, + child: InkWell( + onTap: () => { + feedBack(), + onTap!(), }, - child: Text( - text ?? '', - key: ValueKey(text ?? ''), - style: TextStyle( + onLongPress: () => { + if (onLongPress != null) {onLongPress!()} + }, + // borderRadius: StyleString.mdRadius, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + // const SizedBox(height: 2), + Icon( + selectStatus ? selectIcon!.icon! : icon!.icon!, + size: 18, color: selectStatus ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.outline, - fontSize: Theme.of(context).textTheme.labelSmall!.fontSize), - semanticsLabel: "", + ), + const SizedBox(height: 3), + AnimatedOpacity( + opacity: loadingStatus! ? 0 : 1, + duration: const Duration(milliseconds: 200), + child: AnimatedSwitcher( + duration: const Duration(milliseconds: 300), + transitionBuilder: + (Widget child, Animation animation) { + return ScaleTransition(scale: animation, child: child); + }, + child: Text( + text ?? '', + key: ValueKey(text ?? ''), + style: TextStyle( + color: selectStatus + ? Theme.of(context).colorScheme.primary + : Theme.of(context).colorScheme.outline, + fontSize: Theme.of(context) + .textTheme + .labelSmall! + .fontSize), + semanticsLabel: "", + ), + ), + ), + ], ), - ), - ), - ], - ), - )); + ))); } }