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
? Positioned(
left: 3,
right: 3,
bottom: 0,
child: ClipRRect(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(
StyleString.imgRadius.x),
bottomRight: Radius.circular(
StyleString.imgRadius.x),
),
child: LinearProgressIndicator(
value: videoItem.progress == -1
? 100
: videoItem.progress /
videoItem.duration,
),
),
)
: const SizedBox()
if (videoItem.duration != null &&
videoItem.duration != 0 &&
videoItem.progress != 0)
Positioned(
left: 3,
right: 3,
bottom: 0,
child: ClipRRect(
borderRadius: BorderRadius.only(
bottomLeft:
Radius.circular(StyleString.imgRadius.x),
bottomRight:
Radius.circular(StyleString.imgRadius.x),
),
child: LinearProgressIndicator(
value: videoItem.progress == -1
? 100
: videoItem.progress / videoItem.duration,
),
),
)
],
),
VideoContent(videoItem: videoItem, ctr: ctr)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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