mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: later: show progress
Closes #569 Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import 'package:PiliPlus/common/widgets/image_save.dart';
|
import 'package:PiliPlus/common/widgets/image_save.dart';
|
||||||
|
import 'package:PiliPlus/common/widgets/video_progress_indicator.dart';
|
||||||
import 'package:PiliPlus/models/model_hot_video_item.dart';
|
import 'package:PiliPlus/models/model_hot_video_item.dart';
|
||||||
import 'package:PiliPlus/models/model_video.dart';
|
import 'package:PiliPlus/models/model_video.dart';
|
||||||
import 'package:PiliPlus/models/search/result.dart';
|
import 'package:PiliPlus/models/search/result.dart';
|
||||||
@@ -53,6 +54,7 @@ class VideoCardH extends StatelessWidget {
|
|||||||
return Material(
|
return Material(
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
child: Stack(
|
child: Stack(
|
||||||
|
clipBehavior: Clip.none,
|
||||||
children: [
|
children: [
|
||||||
Semantics(
|
Semantics(
|
||||||
label: Utils.videoItemSemantics(videoItem),
|
label: Utils.videoItemSemantics(videoItem),
|
||||||
@@ -125,7 +127,14 @@ class VideoCardH extends StatelessWidget {
|
|||||||
BoxConstraints boxConstraints) {
|
BoxConstraints boxConstraints) {
|
||||||
final double maxWidth = boxConstraints.maxWidth;
|
final double maxWidth = boxConstraints.maxWidth;
|
||||||
final double maxHeight = boxConstraints.maxHeight;
|
final double maxHeight = boxConstraints.maxHeight;
|
||||||
|
num? progress;
|
||||||
|
if (videoItem is HotVideoItemModel) {
|
||||||
|
progress =
|
||||||
|
(videoItem as HotVideoItemModel).progress;
|
||||||
|
}
|
||||||
|
|
||||||
return Stack(
|
return Stack(
|
||||||
|
clipBehavior: Clip.none,
|
||||||
children: [
|
children: [
|
||||||
NetworkImgLayer(
|
NetworkImgLayer(
|
||||||
src: videoItem.pic,
|
src: videoItem.pic,
|
||||||
@@ -143,7 +152,26 @@ class VideoCardH extends StatelessWidget {
|
|||||||
top: 6.0,
|
top: 6.0,
|
||||||
right: 6.0,
|
right: 6.0,
|
||||||
),
|
),
|
||||||
if (videoItem.duration > 0)
|
if (progress != null && progress != 0) ...[
|
||||||
|
PBadge(
|
||||||
|
text: progress == -1
|
||||||
|
? '已看完'
|
||||||
|
: '${Utils.timeFormat(progress)}/${Utils.timeFormat(videoItem.duration)}',
|
||||||
|
right: 6,
|
||||||
|
bottom: 8,
|
||||||
|
type: 'gray',
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
left: 0,
|
||||||
|
bottom: 0,
|
||||||
|
right: 0,
|
||||||
|
child: videoProgressIndicator(
|
||||||
|
progress == -1
|
||||||
|
? 1
|
||||||
|
: progress / videoItem.duration,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
] else if (videoItem.duration > 0)
|
||||||
PBadge(
|
PBadge(
|
||||||
text: Utils.timeFormat(videoItem.duration),
|
text: Utils.timeFormat(videoItem.duration),
|
||||||
right: 6.0,
|
right: 6.0,
|
||||||
|
|||||||
@@ -18,6 +18,8 @@ class HotVideoItemModel extends BaseRecVideoItemModel {
|
|||||||
|
|
||||||
bool? checked; // 手动设置的
|
bool? checked; // 手动设置的
|
||||||
|
|
||||||
|
num? progress;
|
||||||
|
|
||||||
HotVideoItemModel.fromJson(Map<String, dynamic> json) {
|
HotVideoItemModel.fromJson(Map<String, dynamic> json) {
|
||||||
aid = json["aid"];
|
aid = json["aid"];
|
||||||
cid = json["cid"];
|
cid = json["cid"];
|
||||||
@@ -44,6 +46,7 @@ class HotVideoItemModel extends BaseRecVideoItemModel {
|
|||||||
pgcLabel = json['pgc_label'];
|
pgcLabel = json['pgc_label'];
|
||||||
redirectUrl = json['redirect_url'];
|
redirectUrl = json['redirect_url'];
|
||||||
// uri = json['uri']; // 仅在稍后再看存在
|
// uri = json['uri']; // 仅在稍后再看存在
|
||||||
|
progress = json['progress'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// @override
|
// @override
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class HisListItem {
|
|||||||
String? authorFace;
|
String? authorFace;
|
||||||
int? authorMid;
|
int? authorMid;
|
||||||
int? viewAt;
|
int? viewAt;
|
||||||
int progress = 0;
|
int? progress;
|
||||||
String? badge;
|
String? badge;
|
||||||
String? showTitle;
|
String? showTitle;
|
||||||
int? duration;
|
int? duration;
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ class HistoryItem extends StatelessWidget {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Stack(
|
Stack(
|
||||||
|
clipBehavior: Clip.none,
|
||||||
children: [
|
children: [
|
||||||
AspectRatio(
|
AspectRatio(
|
||||||
aspectRatio: StyleString.aspectRatio,
|
aspectRatio: StyleString.aspectRatio,
|
||||||
@@ -162,6 +163,7 @@ class HistoryItem extends StatelessWidget {
|
|||||||
double maxWidth = boxConstraints.maxWidth;
|
double maxWidth = boxConstraints.maxWidth;
|
||||||
double maxHeight = boxConstraints.maxHeight;
|
double maxHeight = boxConstraints.maxHeight;
|
||||||
return Stack(
|
return Stack(
|
||||||
|
clipBehavior: Clip.none,
|
||||||
children: [
|
children: [
|
||||||
NetworkImgLayer(
|
NetworkImgLayer(
|
||||||
src: (videoItem.cover.isNullOrEmpty
|
src: (videoItem.cover.isNullOrEmpty
|
||||||
@@ -246,6 +248,7 @@ class HistoryItem extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
if (videoItem.duration != null &&
|
if (videoItem.duration != null &&
|
||||||
videoItem.duration != 0 &&
|
videoItem.duration != 0 &&
|
||||||
|
videoItem.progress != null &&
|
||||||
videoItem.progress != 0)
|
videoItem.progress != 0)
|
||||||
Positioned(
|
Positioned(
|
||||||
left: 0,
|
left: 0,
|
||||||
@@ -254,7 +257,7 @@ class HistoryItem extends StatelessWidget {
|
|||||||
child: videoProgressIndicator(
|
child: videoProgressIndicator(
|
||||||
videoItem.progress == -1
|
videoItem.progress == -1
|
||||||
? 1
|
? 1
|
||||||
: videoItem.progress / videoItem.duration!,
|
: videoItem.progress! / videoItem.duration!,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user