From d059a439fbeab610d249af1563a5e2e6a6491e74 Mon Sep 17 00:00:00 2001 From: guozhigq Date: Sun, 6 Aug 2023 22:36:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=90=9C=E7=B4=A2=E6=A1=86=E8=87=AA?= =?UTF-8?q?=E5=8A=A8focus=E5=A4=B1=E6=95=88=E3=80=81=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E7=A8=8D=E5=90=8E=E5=86=8D=E7=9C=8B=E8=A7=A6=E5=8F=91=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E3=80=81=E6=8E=A8=E8=8D=90=E8=A7=86=E9=A2=91=E9=95=BF?= =?UTF-8?q?=E6=8C=89=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/common/skeleton/media_bangumi.dart | 6 +- lib/common/widgets/video_card_h.dart | 27 ++++++-- lib/common/widgets/video_card_v.dart | 27 ++++++-- lib/pages/home/view.dart | 78 +++++++++++------------- lib/pages/search/view.dart | 37 ++++++----- lib/pages/video/detail/related/view.dart | 29 +++++---- 6 files changed, 117 insertions(+), 87 deletions(-) diff --git a/lib/common/skeleton/media_bangumi.dart b/lib/common/skeleton/media_bangumi.dart index 50148f0d..cf589254 100644 --- a/lib/common/skeleton/media_bangumi.dart +++ b/lib/common/skeleton/media_bangumi.dart @@ -28,9 +28,9 @@ class _MediaBangumiSkeletonState extends State { color: bgColor), ), const SizedBox(width: 10), - SizedBox( - height: 148, - child: Expanded( + Expanded( + child: SizedBox( + height: 148, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/common/widgets/video_card_h.dart b/lib/common/widgets/video_card_h.dart index fed20c7b..02ec260f 100644 --- a/lib/common/widgets/video_card_h.dart +++ b/lib/common/widgets/video_card_h.dart @@ -40,11 +40,6 @@ class VideoCardH extends StatelessWidget { longPressEnd!(); } }, - // 双击 稍后再看 - onDoubleTap: () async { - var res = await UserHttp.toViewLater(bvid: videoItem.bvid); - SmartDialog.showToast(res['msg']); - }, child: InkWell( onTap: () async { try { @@ -185,7 +180,6 @@ class VideoContent extends StatelessWidget { ), ], ), - const SizedBox(height: 3), Row( children: [ StatView( @@ -203,6 +197,27 @@ class VideoContent extends StatelessWidget { // fontSize: 11, // color: Theme.of(context).colorScheme.outline), // ) + const Spacer(), + SizedBox( + width: 20, + height: 20, + child: IconButton( + tooltip: '稍后再看', + style: ButtonStyle( + padding: MaterialStateProperty.all(EdgeInsets.zero), + ), + onPressed: () async { + var res = + await UserHttp.toViewLater(bvid: videoItem.bvid); + SmartDialog.showToast(res['msg']); + }, + icon: Icon( + Icons.more_vert_outlined, + color: Theme.of(context).colorScheme.outline, + size: 14, + ), + ), + ), ], ), ], diff --git a/lib/common/widgets/video_card_v.dart b/lib/common/widgets/video_card_v.dart index 3a1c4f73..97e1077c 100644 --- a/lib/common/widgets/video_card_v.dart +++ b/lib/common/widgets/video_card_v.dart @@ -45,11 +45,6 @@ class VideoCardV extends StatelessWidget { longPressEnd!(); } }, - // 双击 稍后再看 - onDoubleTap: () async { - var res = await UserHttp.toViewLater(bvid: videoItem.bvid); - SmartDialog.showToast(res['msg']); - }, child: InkWell( onTap: () async { String bvid = videoItem.bvid ?? IdUtils.av2bv(videoItem.aid); @@ -119,7 +114,7 @@ class VideoContent extends StatelessWidget { return Expanded( child: Padding( // 多列 - padding: const EdgeInsets.fromLTRB(4, 5, 6, 6), + padding: const EdgeInsets.fromLTRB(4, 5, 0, 3), // 单列 // padding: const EdgeInsets.fromLTRB(14, 10, 4, 8), child: Column( @@ -185,6 +180,26 @@ class VideoContent extends StatelessWidget { ); }), ), + SizedBox( + width: 20, + height: 20, + child: IconButton( + tooltip: '稍后再看', + style: ButtonStyle( + padding: MaterialStateProperty.all(EdgeInsets.zero), + ), + onPressed: () async { + var res = + await UserHttp.toViewLater(bvid: videoItem.bvid); + SmartDialog.showToast(res['msg']); + }, + icon: Icon( + Icons.more_vert_outlined, + color: Theme.of(context).colorScheme.outline, + size: 14, + ), + ), + ), ], ), // Row( diff --git a/lib/pages/home/view.dart b/lib/pages/home/view.dart index 56c89abe..6a71d664 100644 --- a/lib/pages/home/view.dart +++ b/lib/pages/home/view.dart @@ -165,49 +165,45 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget { ), const SizedBox(width: 10), Expanded( - child: Hero( - tag: 'searchWrap', - child: GestureDetector( - onTap: () { - Get.toNamed('/search', parameters: { - 'hintText': ctr.defaultSearch.value - }); - }, - child: Container( - width: 250, - height: 45, - clipBehavior: Clip.hardEdge, - padding: const EdgeInsets.only(left: 12, right: 22), - decoration: BoxDecoration( - borderRadius: - const BorderRadius.all(Radius.circular(25)), - color: Theme.of(context) - .colorScheme - .onInverseSurface, - ), - child: Row( - children: [ - Icon( - Icons.search_outlined, - size: 23, - color: Theme.of(context).colorScheme.outline, - ), - const SizedBox(width: 7), - Expanded( - child: Obx( - () => Text( - ctr.defaultSearch.value, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: TextStyle( - color: Theme.of(context) - .colorScheme - .outline), - ), + child: GestureDetector( + onTap: () { + Get.toNamed('/search', parameters: { + 'hintText': ctr.defaultSearch.value + }); + }, + child: Container( + width: 250, + height: 45, + clipBehavior: Clip.hardEdge, + padding: const EdgeInsets.only(left: 12, right: 22), + decoration: BoxDecoration( + borderRadius: + const BorderRadius.all(Radius.circular(25)), + color: + Theme.of(context).colorScheme.onInverseSurface, + ), + child: Row( + children: [ + Icon( + Icons.search_outlined, + size: 23, + color: Theme.of(context).colorScheme.outline, + ), + const SizedBox(width: 7), + Expanded( + child: Obx( + () => Text( + ctr.defaultSearch.value, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + color: Theme.of(context) + .colorScheme + .outline), ), ), - ], - ), + ), + ], ), ), ), diff --git a/lib/pages/search/view.dart b/lib/pages/search/view.dart index 766ca080..4a1f809d 100644 --- a/lib/pages/search/view.dart +++ b/lib/pages/search/view.dart @@ -60,29 +60,26 @@ class _SearchPageState extends State with RouteAware { ), const SizedBox(width: 10) ], - title: Hero( - tag: 'searchWrap', - child: Obx( - () => TextField( - autofocus: true, - focusNode: _searchController.searchFocusNode, - controller: _searchController.controller.value, - textInputAction: TextInputAction.search, - onChanged: (value) => _searchController.onChange(value), - decoration: InputDecoration( - hintText: _searchController.hintText, - border: InputBorder.none, - suffixIcon: IconButton( - icon: Icon( - Icons.clear, - size: 22, - color: Theme.of(context).colorScheme.outline, - ), - onPressed: () => _searchController.onClear(), + title: Obx( + () => TextField( + autofocus: true, + focusNode: _searchController.searchFocusNode, + controller: _searchController.controller.value, + textInputAction: TextInputAction.search, + onChanged: (value) => _searchController.onChange(value), + decoration: InputDecoration( + hintText: _searchController.hintText, + border: InputBorder.none, + suffixIcon: IconButton( + icon: Icon( + Icons.clear, + size: 22, + color: Theme.of(context).colorScheme.outline, ), + onPressed: () => _searchController.onClear(), ), - onSubmitted: (String value) => _searchController.submit(), ), + onSubmitted: (String value) => _searchController.submit(), ), ), ), diff --git a/lib/pages/video/detail/related/view.dart b/lib/pages/video/detail/related/view.dart index 381b2cac..bc2c326c 100644 --- a/lib/pages/video/detail/related/view.dart +++ b/lib/pages/video/detail/related/view.dart @@ -27,17 +27,24 @@ class RelatedVideoPanel extends GetView { return SizedBox( height: MediaQuery.of(context).padding.bottom); } else { - return VideoCardH( - videoItem: snapshot.data['data'][index], - longPress: () { - ReleatedController().popupDialog = - _createPopupDialog(snapshot.data['data'][index]); - Overlay.of(context) - .insert(ReleatedController().popupDialog!); - }, - longPressEnd: () { - ReleatedController().popupDialog?.remove(); - }, + return Material( + child: VideoCardH( + videoItem: snapshot.data['data'][index], + longPress: () { + try { + ReleatedController().popupDialog = + _createPopupDialog( + snapshot.data['data'][index]); + Overlay.of(context) + .insert(ReleatedController().popupDialog!); + } catch (_) { + return {}; + } + }, + longPressEnd: () { + ReleatedController().popupDialog?.remove(); + }, + ), ); } }, childCount: snapshot.data['data'].length + 1));