fix: get tag, history progress

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-11-23 00:39:36 +08:00
parent bd46678a26
commit bd70a34f57
9 changed files with 58 additions and 37 deletions

View File

@@ -278,27 +278,27 @@ class HistoryItem extends StatelessWidget {
), ),
), ),
), ),
videoItem.progress != 0 if (videoItem.duration != null &&
? Positioned( videoItem.duration != 0 &&
left: 3, videoItem.progress != 0)
right: 3, Positioned(
bottom: 0, left: 3,
child: ClipRRect( right: 3,
borderRadius: BorderRadius.only( bottom: 0,
bottomLeft: Radius.circular( child: ClipRRect(
StyleString.imgRadius.x), borderRadius: BorderRadius.only(
bottomRight: Radius.circular( bottomLeft:
StyleString.imgRadius.x), Radius.circular(StyleString.imgRadius.x),
), bottomRight:
child: LinearProgressIndicator( Radius.circular(StyleString.imgRadius.x),
value: videoItem.progress == -1 ),
? 100 child: LinearProgressIndicator(
: videoItem.progress / value: videoItem.progress == -1
videoItem.duration, ? 100
), : videoItem.progress / videoItem.duration,
), ),
) ),
: const SizedBox() )
], ],
), ),
VideoContent(videoItem: videoItem, ctr: ctr) VideoContent(videoItem: videoItem, ctr: ctr)

View File

@@ -51,6 +51,7 @@ class LaterController extends CommonController {
if (aid != null) { if (aid != null) {
List list = (loadingState.value as Success).response; List list = (loadingState.value as Success).response;
list.removeWhere((e) => e.aid == aid); list.removeWhere((e) => e.aid == aid);
count.value -= 1;
loadingState.value = LoadingState.success(list); loadingState.value = LoadingState.success(list);
} else { } else {
loadingState.value = LoadingState.loading(); loadingState.value = LoadingState.loading();

View File

@@ -113,7 +113,7 @@ class LiveRoomController extends GetxController {
if (scrollController.hasClients) { if (scrollController.hasClients) {
scrollController.animateTo( scrollController.animateTo(
scrollController.position.maxScrollExtent, scrollController.position.maxScrollExtent,
duration: const Duration(milliseconds: 200), duration: const Duration(milliseconds: 500),
curve: Curves.linearToEaseOut, curve: Curves.linearToEaseOut,
); );
} }

View File

@@ -27,7 +27,7 @@ class MemberPageNew extends StatefulWidget {
class _MemberPageNewState extends State<MemberPageNew> class _MemberPageNewState extends State<MemberPageNew>
with TickerProviderStateMixin { with TickerProviderStateMixin {
int? _mid; int? _mid;
String? _heroTag; late final String _heroTag;
late final MemberControllerNew _userController; late final MemberControllerNew _userController;
final _key = GlobalKey<ExtendedNestedScrollViewState>(); final _key = GlobalKey<ExtendedNestedScrollViewState>();
@@ -35,7 +35,7 @@ class _MemberPageNewState extends State<MemberPageNew>
void initState() { void initState() {
super.initState(); super.initState();
_mid = int.parse(Get.parameters['mid']!); _mid = int.parse(Get.parameters['mid']!);
_heroTag = Get.arguments['heroTag'] ?? Utils.makeHeroTag(_mid); _heroTag = Utils.makeHeroTag(_mid);
_userController = Get.put( _userController = Get.put(
MemberControllerNew(mid: _mid), MemberControllerNew(mid: _mid),
tag: _heroTag, tag: _heroTag,

View File

@@ -50,9 +50,11 @@ class MemberSearchController extends GetxController
hasData.value = true; hasData.value = true;
dynamicCount.value = -1; dynamicCount.value = -1;
dynamicState.value = LoadingState.loading();
refreshArchive(); refreshArchive();
archiveCount.value = -1; archiveCount.value = -1;
archiveState.value = LoadingState.loading();
refreshDynamic(); refreshDynamic();
} }
} }
@@ -60,14 +62,12 @@ class MemberSearchController extends GetxController
Future refreshDynamic() async { Future refreshDynamic() async {
dynamicPn = 1; dynamicPn = 1;
isEndDynamic = false; isEndDynamic = false;
dynamicState.value = LoadingState.loading();
await searchDynamic(); await searchDynamic();
} }
Future refreshArchive() async { Future refreshArchive() async {
archivePn = 1; archivePn = 1;
isEndArchive = false; isEndArchive = false;
archiveState.value = LoadingState.loading();
await searchArchives(); await searchArchives();
} }
@@ -83,7 +83,7 @@ class MemberSearchController extends GetxController
if (isRefresh) { if (isRefresh) {
dynamicCount.value = res['count']; dynamicCount.value = res['count'];
} }
if (dynamicState.value is Success) { if (isRefresh.not && dynamicState.value is Success) {
res['data'].insertAll(0, (dynamicState.value as Success).response); res['data'].insertAll(0, (dynamicState.value as Success).response);
} }
dynamicState.value = LoadingState.success(res['data']); dynamicState.value = LoadingState.success(res['data']);
@@ -109,7 +109,7 @@ class MemberSearchController extends GetxController
if (isRefresh) { if (isRefresh) {
archiveCount.value = res['data'].page['count']; archiveCount.value = res['data'].page['count'];
} }
if (archiveState.value is Success) { if (isRefresh.not && archiveState.value is Success) {
res['data'] res['data']
.list .list
.vlist .vlist

View File

@@ -64,11 +64,17 @@ class SearchArchive extends StatelessWidget {
), ),
) )
: errorWidget( : errorWidget(
callback: ctr.refreshArchive, callback: () {
ctr.archiveState.value = LoadingState.loading();
ctr.refreshArchive();
},
), ),
Error() => errorWidget( Error() => errorWidget(
errMsg: loadingState.errMsg, errMsg: loadingState.errMsg,
callback: ctr.refreshArchive, callback: () {
ctr.archiveState.value = LoadingState.loading();
ctr.refreshArchive();
},
), ),
LoadingState() => throw UnimplementedError(), LoadingState() => throw UnimplementedError(),
}; };

View File

@@ -93,11 +93,17 @@ class SearchDynamic extends StatelessWidget {
), ),
) )
: errorWidget( : errorWidget(
callback: ctr.refreshDynamic, callback: () {
ctr.dynamicState.value = LoadingState.loading();
ctr.refreshDynamic();
},
), ),
Error() => errorWidget( Error() => errorWidget(
errMsg: loadingState.errMsg, errMsg: loadingState.errMsg,
callback: ctr.refreshDynamic, callback: () {
ctr.dynamicState.value = LoadingState.loading();
ctr.refreshDynamic();
},
), ),
LoadingState() => throw UnimplementedError(), LoadingState() => throw UnimplementedError(),
}; };

View File

@@ -247,6 +247,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
onDelete: _videoReplyController.onMDelete, onDelete: _videoReplyController.onMDelete,
isTop: _videoReplyController.hasUpTop && index == 0, isTop: _videoReplyController.hasUpTop && index == 0,
upMid: loadingState.response.subjectControl.upMid, upMid: loadingState.response.subjectControl.upMid,
getTag: () => heroTag,
); );
} }
}, },

View File

@@ -36,6 +36,7 @@ class ReplyItemGrpc extends StatelessWidget {
this.upMid, this.upMid,
this.isTop = false, this.isTop = false,
this.showDialogue, this.showDialogue,
this.getTag,
}); });
final ReplyInfo replyItem; final ReplyInfo replyItem;
final String? replyLevel; final String? replyLevel;
@@ -48,6 +49,7 @@ class ReplyItemGrpc extends StatelessWidget {
final dynamic upMid; final dynamic upMid;
final bool isTop; final bool isTop;
final VoidCallback? showDialogue; final VoidCallback? showDialogue;
final Function? getTag;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -298,6 +300,7 @@ class ReplyItemGrpc extends StatelessWidget {
null, null,
textPainter, textPainter,
didExceedMaxLines, didExceedMaxLines,
getTag,
), ),
], ],
), ),
@@ -328,6 +331,7 @@ class ReplyItemGrpc extends StatelessWidget {
onDelete!(rpid, replyItem.id.toInt()); onDelete!(rpid, replyItem.id.toInt());
} }
}, },
getTag: getTag,
), ),
), ),
], ],
@@ -440,6 +444,7 @@ class ReplyItemRow extends StatelessWidget {
this.replyReply, this.replyReply,
this.onDelete, this.onDelete,
this.upMid, this.upMid,
this.getTag,
}); });
final int count; final int count;
final List<ReplyInfo> replies; final List<ReplyInfo> replies;
@@ -449,6 +454,7 @@ class ReplyItemRow extends StatelessWidget {
Function? replyReply; Function? replyReply;
final Function(dynamic rpid)? onDelete; final Function(dynamic rpid)? onDelete;
final dynamic upMid; final dynamic upMid;
final Function? getTag;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -558,6 +564,7 @@ class ReplyItemRow extends StatelessWidget {
replyItem, replyItem,
null, null,
null, null,
getTag,
), ),
], ],
), ),
@@ -616,6 +623,7 @@ InlineSpan buildContent(
fReplyItem, fReplyItem,
textPainter, textPainter,
didExceedMaxLines, didExceedMaxLines,
getTag,
) { ) {
final String routePath = Get.currentRoute; final String routePath = Get.currentRoute;
bool isVideoPage = routePath.startsWith('/video'); bool isVideoPage = routePath.startsWith('/video');
@@ -763,11 +771,10 @@ InlineSpan buildContent(
for (int i = 0; i < split.length; i++) { for (int i = 0; i < split.length; i++) {
seek += split[i] * pow(60, i).toInt(); seek += split[i] * pow(60, i).toInt();
} }
int duration = int duration = Get.find<VideoDetailController>(
Get.find<VideoDetailController>(tag: Get.arguments['heroTag']) tag: getTag?.call() ?? Get.arguments['heroTag'],
.data ).data.timeLength ??
.timeLength ?? 0;
0;
isValid = seek * 1000 <= duration; isValid = seek * 1000 <= duration;
} catch (e) { } catch (e) {
debugPrint('failed to validate: $e'); debugPrint('failed to validate: $e');