fix: 搜索框自动focus失效、修改稍后再看触发逻辑、推荐视频长按动画

This commit is contained in:
guozhigq
2023-08-06 22:36:58 +08:00
parent 90bb2a5270
commit d059a439fb
6 changed files with 117 additions and 87 deletions

View File

@ -28,9 +28,9 @@ class _MediaBangumiSkeletonState extends State<MediaBangumiSkeleton> {
color: bgColor), color: bgColor),
), ),
const SizedBox(width: 10), const SizedBox(width: 10),
SizedBox( Expanded(
child: SizedBox(
height: 148, height: 148,
child: Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [

View File

@ -40,11 +40,6 @@ class VideoCardH extends StatelessWidget {
longPressEnd!(); longPressEnd!();
} }
}, },
// 双击 稍后再看
onDoubleTap: () async {
var res = await UserHttp.toViewLater(bvid: videoItem.bvid);
SmartDialog.showToast(res['msg']);
},
child: InkWell( child: InkWell(
onTap: () async { onTap: () async {
try { try {
@ -185,7 +180,6 @@ class VideoContent extends StatelessWidget {
), ),
], ],
), ),
const SizedBox(height: 3),
Row( Row(
children: [ children: [
StatView( StatView(
@ -203,6 +197,27 @@ class VideoContent extends StatelessWidget {
// fontSize: 11, // fontSize: 11,
// color: Theme.of(context).colorScheme.outline), // 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,
),
),
),
], ],
), ),
], ],

View File

@ -45,11 +45,6 @@ class VideoCardV extends StatelessWidget {
longPressEnd!(); longPressEnd!();
} }
}, },
// 双击 稍后再看
onDoubleTap: () async {
var res = await UserHttp.toViewLater(bvid: videoItem.bvid);
SmartDialog.showToast(res['msg']);
},
child: InkWell( child: InkWell(
onTap: () async { onTap: () async {
String bvid = videoItem.bvid ?? IdUtils.av2bv(videoItem.aid); String bvid = videoItem.bvid ?? IdUtils.av2bv(videoItem.aid);
@ -119,7 +114,7 @@ class VideoContent extends StatelessWidget {
return Expanded( return Expanded(
child: Padding( 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), // padding: const EdgeInsets.fromLTRB(14, 10, 4, 8),
child: Column( 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( // Row(

View File

@ -165,8 +165,6 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
), ),
const SizedBox(width: 10), const SizedBox(width: 10),
Expanded( Expanded(
child: Hero(
tag: 'searchWrap',
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
Get.toNamed('/search', parameters: { Get.toNamed('/search', parameters: {
@ -181,9 +179,8 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: borderRadius:
const BorderRadius.all(Radius.circular(25)), const BorderRadius.all(Radius.circular(25)),
color: Theme.of(context) color:
.colorScheme Theme.of(context).colorScheme.onInverseSurface,
.onInverseSurface,
), ),
child: Row( child: Row(
children: [ children: [
@ -211,7 +208,6 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
), ),
), ),
), ),
),
const SizedBox(width: 12), const SizedBox(width: 12),
if (user.get(UserBoxKey.userLogin) ?? false) ...[ if (user.get(UserBoxKey.userLogin) ?? false) ...[
GestureDetector( GestureDetector(

View File

@ -60,9 +60,7 @@ class _SearchPageState extends State<SearchPage> with RouteAware {
), ),
const SizedBox(width: 10) const SizedBox(width: 10)
], ],
title: Hero( title: Obx(
tag: 'searchWrap',
child: Obx(
() => TextField( () => TextField(
autofocus: true, autofocus: true,
focusNode: _searchController.searchFocusNode, focusNode: _searchController.searchFocusNode,
@ -85,7 +83,6 @@ class _SearchPageState extends State<SearchPage> with RouteAware {
), ),
), ),
), ),
),
body: SingleChildScrollView( body: SingleChildScrollView(
child: Column( child: Column(
children: [ children: [

View File

@ -27,17 +27,24 @@ class RelatedVideoPanel extends GetView<ReleatedController> {
return SizedBox( return SizedBox(
height: MediaQuery.of(context).padding.bottom); height: MediaQuery.of(context).padding.bottom);
} else { } else {
return VideoCardH( return Material(
child: VideoCardH(
videoItem: snapshot.data['data'][index], videoItem: snapshot.data['data'][index],
longPress: () { longPress: () {
try {
ReleatedController().popupDialog = ReleatedController().popupDialog =
_createPopupDialog(snapshot.data['data'][index]); _createPopupDialog(
snapshot.data['data'][index]);
Overlay.of(context) Overlay.of(context)
.insert(ReleatedController().popupDialog!); .insert(ReleatedController().popupDialog!);
} catch (_) {
return {};
}
}, },
longPressEnd: () { longPressEnd: () {
ReleatedController().popupDialog?.remove(); ReleatedController().popupDialog?.remove();
}, },
),
); );
} }
}, childCount: snapshot.data['data'].length + 1)); }, childCount: snapshot.data['data'].length + 1));