fix: 稍后再看

This commit is contained in:
guozhigq
2023-08-15 10:08:17 +08:00
parent 1c59764500
commit 3c9a97181b
3 changed files with 76 additions and 68 deletions

View File

@ -16,12 +16,14 @@ class VideoCardH extends StatelessWidget {
final videoItem; final videoItem;
final Function()? longPress; final Function()? longPress;
final Function()? longPressEnd; final Function()? longPressEnd;
final String source;
const VideoCardH({ const VideoCardH({
Key? key, Key? key,
required this.videoItem, required this.videoItem,
this.longPress, this.longPress,
this.longPressEnd, this.longPressEnd,
this.source = 'normal',
}) : super(key: key); }) : super(key: key);
@override @override
@ -92,7 +94,7 @@ class VideoCardH extends StatelessWidget {
}, },
), ),
), ),
VideoContent(videoItem: videoItem) VideoContent(videoItem: videoItem, source: source)
], ],
), ),
); );
@ -107,7 +109,9 @@ class VideoCardH extends StatelessWidget {
class VideoContent extends StatelessWidget { class VideoContent extends StatelessWidget {
// ignore: prefer_typing_uninitialized_variables // ignore: prefer_typing_uninitialized_variables
final videoItem; final videoItem;
const VideoContent({super.key, required this.videoItem}); final String source;
const VideoContent(
{super.key, required this.videoItem, this.source = 'normal'});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -217,41 +221,42 @@ class VideoContent extends StatelessWidget {
// ), // ),
// ), // ),
// ), // ),
SizedBox( if (source == 'normal')
width: 24, SizedBox(
height: 24, width: 24,
child: PopupMenuButton<String>( height: 24,
padding: EdgeInsets.zero, child: PopupMenuButton<String>(
tooltip: '稍后再看', padding: EdgeInsets.zero,
icon: Icon( tooltip: '稍后再看',
Icons.more_vert_outlined, icon: Icon(
color: Theme.of(context).colorScheme.outline, Icons.more_vert_outlined,
size: 14, color: Theme.of(context).colorScheme.outline,
), size: 14,
position: PopupMenuPosition.under,
// constraints: const BoxConstraints(maxHeight: 35),
onSelected: (String type) {},
itemBuilder: (BuildContext context) =>
<PopupMenuEntry<String>>[
PopupMenuItem<String>(
onTap: () async {
var res =
await UserHttp.toViewLater(bvid: videoItem.bvid);
SmartDialog.showToast(res['msg']);
},
value: 'pause',
height: 35,
child: const Row(
children: [
Icon(Icons.watch_later_outlined, size: 16),
SizedBox(width: 6),
Text('稍后再看', style: TextStyle(fontSize: 13))
],
),
), ),
], position: PopupMenuPosition.under,
// constraints: const BoxConstraints(maxHeight: 35),
onSelected: (String type) {},
itemBuilder: (BuildContext context) =>
<PopupMenuEntry<String>>[
PopupMenuItem<String>(
onTap: () async {
var res = await UserHttp.toViewLater(
bvid: videoItem.bvid);
SmartDialog.showToast(res['msg']);
},
value: 'pause',
height: 35,
child: const Row(
children: [
Icon(Icons.watch_later_outlined, size: 16),
SizedBox(width: 6),
Text('稍后再看', style: TextStyle(fontSize: 13))
],
),
),
],
),
), ),
),
], ],
), ),
], ],

View File

@ -210,41 +210,43 @@ class VideoContent extends StatelessWidget {
); );
}), }),
), ),
SizedBox( if (videoItem.goto == 'av')
width: 24, SizedBox(
height: 24, width: 24,
child: PopupMenuButton<String>( height: 24,
padding: EdgeInsets.zero, child: PopupMenuButton<String>(
tooltip: '稍后再看', padding: EdgeInsets.zero,
icon: Icon( tooltip: '稍后再看',
Icons.more_vert_outlined, icon: Icon(
color: Theme.of(context).colorScheme.outline, Icons.more_vert_outlined,
size: 14, color: Theme.of(context).colorScheme.outline,
), size: 14,
position: PopupMenuPosition.under,
// constraints: const BoxConstraints(maxHeight: 35),
onSelected: (String type) {},
itemBuilder: (BuildContext context) =>
<PopupMenuEntry<String>>[
PopupMenuItem<String>(
onTap: () async {
var res =
await UserHttp.toViewLater(bvid: videoItem.bvid);
SmartDialog.showToast(res['msg']);
},
value: 'pause',
height: 35,
child: const Row(
children: [
Icon(Icons.watch_later_outlined, size: 16),
SizedBox(width: 6),
Text('稍后再看', style: TextStyle(fontSize: 13))
],
),
), ),
], position: PopupMenuPosition.under,
// constraints: const BoxConstraints(maxHeight: 35),
onSelected: (String type) {},
itemBuilder: (BuildContext context) =>
<PopupMenuEntry<String>>[
PopupMenuItem<String>(
onTap: () async {
int aid = videoItem.param;
var res = await UserHttp.toViewLater(
bvid: IdUtils.av2bv(aid));
SmartDialog.showToast(res['msg']);
},
value: 'pause',
height: 35,
child: const Row(
children: [
Icon(Icons.watch_later_outlined, size: 16),
SizedBox(width: 6),
Text('稍后再看', style: TextStyle(fontSize: 13))
],
),
),
],
),
), ),
),
], ],
), ),
// Row( // Row(

View File

@ -65,6 +65,7 @@ class _LaterPageState extends State<LaterPage> {
delegate: SliverChildBuilderDelegate((context, index) { delegate: SliverChildBuilderDelegate((context, index) {
return VideoCardH( return VideoCardH(
videoItem: _laterController.laterList[index], videoItem: _laterController.laterList[index],
source: 'later',
); );
}, childCount: _laterController.laterList.length), }, childCount: _laterController.laterList.length),
), ),