mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: viewpoints page
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -23,12 +23,10 @@ class AtMeController extends CommonController {
|
|||||||
cursor = data.cursor?.id ?? -1;
|
cursor = data.cursor?.id ?? -1;
|
||||||
cursorTime = data.cursor?.time ?? -1;
|
cursorTime = data.cursor?.time ?? -1;
|
||||||
if (currentPage != 1 && loadingState.value is Success) {
|
if (currentPage != 1 && loadingState.value is Success) {
|
||||||
loadingState.value = LoadingState.success(
|
data.items ??= <AtMeItems>[];
|
||||||
(loadingState.value as Success).response as List
|
data.items!.insertAll(0, (loadingState.value as Success).response);
|
||||||
..addAll(data.items ?? <AtMeItems>[]));
|
|
||||||
} else {
|
|
||||||
loadingState.value = LoadingState.success(data.items);
|
|
||||||
}
|
}
|
||||||
|
loadingState.value = LoadingState.success(data.items);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,14 +27,13 @@ class LikeMeController extends CommonController {
|
|||||||
List<LikeMeItems> latest = data.latest?.items ?? [];
|
List<LikeMeItems> latest = data.latest?.items ?? [];
|
||||||
List<LikeMeItems> total = data.total?.items ?? [];
|
List<LikeMeItems> total = data.total?.items ?? [];
|
||||||
if (currentPage != 1 && loadingState.value is Success) {
|
if (currentPage != 1 && loadingState.value is Success) {
|
||||||
loadingState.value = LoadingState.success((loadingState.value as Success)
|
Pair<List<LikeMeItems>, List<LikeMeItems>> pair =
|
||||||
.response as Pair<List<LikeMeItems>, List<LikeMeItems>>
|
(loadingState.value as Success).response;
|
||||||
..first.addAll(latest)
|
latest.insertAll(0, pair.first);
|
||||||
..second.addAll(total));
|
total.insertAll(0, pair.second);
|
||||||
} else {
|
|
||||||
loadingState.value =
|
|
||||||
LoadingState.success(Pair(first: latest, second: total));
|
|
||||||
}
|
}
|
||||||
|
loadingState.value =
|
||||||
|
LoadingState.success(Pair(first: latest, second: total));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,12 +23,10 @@ class ReplyMeController extends CommonController {
|
|||||||
cursor = data.cursor?.id ?? -1;
|
cursor = data.cursor?.id ?? -1;
|
||||||
cursorTime = data.cursor?.time ?? -1;
|
cursorTime = data.cursor?.time ?? -1;
|
||||||
if (currentPage != 1 && loadingState.value is Success) {
|
if (currentPage != 1 && loadingState.value is Success) {
|
||||||
loadingState.value = LoadingState.success(
|
data.items ??= <ReplyMeItems>[];
|
||||||
(loadingState.value as Success).response as List
|
data.items!.insertAll(0, (loadingState.value as Success).response);
|
||||||
..addAll(data.items ?? <ReplyMeItems>[]));
|
|
||||||
} else {
|
|
||||||
loadingState.value = LoadingState.success(data.items);
|
|
||||||
}
|
}
|
||||||
|
loadingState.value = LoadingState.success(data.items);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,17 +17,19 @@ class SysMsgController extends CommonController {
|
|||||||
@override
|
@override
|
||||||
List? handleListResponse(List currentList, List dataList) {
|
List? handleListResponse(List currentList, List dataList) {
|
||||||
if (cursor == -1) {
|
if (cursor == -1) {
|
||||||
msgSysUpdateCursor(dataList.first.cursor!);
|
msgSysUpdateCursor(dataList.firstOrNull?.cursor);
|
||||||
}
|
}
|
||||||
cursor = dataList.last.cursor ?? -1;
|
cursor = dataList.lastOrNull?.cursor ?? -1;
|
||||||
if (isEnd.not && dataList.length + 1 < pageSize) {
|
if (isEnd.not && dataList.length + 1 < pageSize) {
|
||||||
isEnd = true;
|
isEnd = true;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future msgSysUpdateCursor(int cursor) async {
|
Future msgSysUpdateCursor(int? cursor) async {
|
||||||
MsgHttp.msgSysUpdateCursor(cursor);
|
if (cursor != null) {
|
||||||
|
MsgHttp.msgSysUpdateCursor(cursor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ class _ViewPointsPageState
|
|||||||
automaticallyImplyLeading: false,
|
automaticallyImplyLeading: false,
|
||||||
titleSpacing: 16,
|
titleSpacing: 16,
|
||||||
title: const Text('分段信息'),
|
title: const Text('分段信息'),
|
||||||
|
toolbarHeight: 45,
|
||||||
actions: [
|
actions: [
|
||||||
Text(
|
Text(
|
||||||
'分段进度条',
|
'分段进度条',
|
||||||
@@ -73,97 +74,95 @@ class _ViewPointsPageState
|
|||||||
),
|
),
|
||||||
const SizedBox(width: 16),
|
const SizedBox(width: 16),
|
||||||
],
|
],
|
||||||
|
bottom: PreferredSize(
|
||||||
|
preferredSize: Size.fromHeight(1),
|
||||||
|
child: Divider(
|
||||||
|
height: 1,
|
||||||
|
color: Theme.of(context).dividerColor.withOpacity(0.1),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
body: enableSlide ? slideList() : buildList,
|
body: enableSlide ? slideList() : buildList,
|
||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget get buildList => ListView(
|
Widget get buildList => ListView.separated(
|
||||||
controller: ScrollController(),
|
controller: ScrollController(),
|
||||||
physics: const AlwaysScrollableScrollPhysics(),
|
physics: const AlwaysScrollableScrollPhysics(),
|
||||||
padding:
|
padding:
|
||||||
EdgeInsets.only(bottom: MediaQuery.paddingOf(context).bottom + 80),
|
EdgeInsets.only(bottom: MediaQuery.paddingOf(context).bottom + 80),
|
||||||
children: [
|
itemCount: videoDetailController.viewPointList.length,
|
||||||
...List.generate(
|
itemBuilder: (context, index) {
|
||||||
videoDetailController.viewPointList.length * 2 - 1,
|
Segment segment = videoDetailController.viewPointList[index];
|
||||||
(rawIndex) {
|
if (currentIndex == -1 &&
|
||||||
if (rawIndex % 2 == 1) {
|
segment.from != null &&
|
||||||
return Divider(
|
segment.to != null) {
|
||||||
height: 1,
|
if (videoDetailController
|
||||||
color: Theme.of(context).dividerColor.withOpacity(0.1),
|
.plPlayerController.positionSeconds.value >=
|
||||||
);
|
segment.from! &&
|
||||||
}
|
videoDetailController.plPlayerController.positionSeconds.value <
|
||||||
int index = rawIndex ~/ 2;
|
segment.to!) {
|
||||||
Segment segment = videoDetailController.viewPointList[index];
|
currentIndex = index;
|
||||||
if (currentIndex == -1 &&
|
}
|
||||||
segment.from != null &&
|
}
|
||||||
segment.to != null) {
|
return ListTile(
|
||||||
if (videoDetailController
|
dense: true,
|
||||||
.plPlayerController.positionSeconds.value >=
|
onTap: segment.from != null
|
||||||
segment.from! &&
|
? () {
|
||||||
videoDetailController
|
currentIndex = index;
|
||||||
.plPlayerController.positionSeconds.value <
|
plPlayerController?.danmakuController?.clear();
|
||||||
segment.to!) {
|
plPlayerController?.videoPlayerController
|
||||||
currentIndex = index;
|
?.seek(Duration(seconds: segment.from!));
|
||||||
}
|
Get.back();
|
||||||
}
|
}
|
||||||
return ListTile(
|
: null,
|
||||||
dense: true,
|
leading: segment.url?.isNotEmpty == true
|
||||||
onTap: segment.from != null
|
? Container(
|
||||||
? () {
|
margin: const EdgeInsets.symmetric(vertical: 6),
|
||||||
currentIndex = index;
|
decoration: currentIndex == index
|
||||||
plPlayerController?.danmakuController?.clear();
|
? BoxDecoration(
|
||||||
plPlayerController?.videoPlayerController
|
borderRadius: BorderRadius.circular(6),
|
||||||
?.seek(Duration(seconds: segment.from!));
|
border: Border.all(
|
||||||
Get.back();
|
width: 1.8,
|
||||||
}
|
strokeAlign: BorderSide.strokeAlignOutside,
|
||||||
: null,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
leading: segment.url?.isNotEmpty == true
|
),
|
||||||
? Container(
|
)
|
||||||
margin: const EdgeInsets.symmetric(vertical: 6),
|
|
||||||
decoration: currentIndex == index
|
|
||||||
? BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(6),
|
|
||||||
border: Border.all(
|
|
||||||
width: 1.8,
|
|
||||||
strokeAlign: BorderSide.strokeAlignOutside,
|
|
||||||
color: Theme.of(context).colorScheme.primary,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
child: LayoutBuilder(
|
|
||||||
builder: (context, constraints) => NetworkImgLayer(
|
|
||||||
radius: 6,
|
|
||||||
src: segment.url,
|
|
||||||
width:
|
|
||||||
constraints.maxHeight * StyleString.aspectRatio,
|
|
||||||
height: constraints.maxHeight,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
title: Text(
|
|
||||||
segment.title ?? '',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 14,
|
|
||||||
fontWeight: currentIndex == index ? FontWeight.bold : null,
|
|
||||||
color: currentIndex == index
|
|
||||||
? Theme.of(context).colorScheme.primary
|
|
||||||
: null,
|
: null,
|
||||||
),
|
child: LayoutBuilder(
|
||||||
),
|
builder: (context, constraints) => NetworkImgLayer(
|
||||||
subtitle: Text(
|
radius: 6,
|
||||||
'${segment.from != null ? Utils.timeFormat(segment.from) : ''} - ${segment.to != null ? Utils.timeFormat(segment.to) : ''}',
|
src: segment.url,
|
||||||
style: TextStyle(
|
width: constraints.maxHeight * StyleString.aspectRatio,
|
||||||
fontSize: 13,
|
height: constraints.maxHeight,
|
||||||
color: currentIndex == index
|
),
|
||||||
? Theme.of(context).colorScheme.primary
|
),
|
||||||
: Theme.of(context).colorScheme.outline,
|
)
|
||||||
),
|
: null,
|
||||||
),
|
title: Text(
|
||||||
);
|
segment.title ?? '',
|
||||||
},
|
style: TextStyle(
|
||||||
),
|
fontSize: 14,
|
||||||
],
|
fontWeight: currentIndex == index ? FontWeight.bold : null,
|
||||||
|
color: currentIndex == index
|
||||||
|
? Theme.of(context).colorScheme.primary
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
subtitle: Text(
|
||||||
|
'${segment.from != null ? Utils.timeFormat(segment.from) : ''} - ${segment.to != null ? Utils.timeFormat(segment.to) : ''}',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
color: currentIndex == index
|
||||||
|
? Theme.of(context).colorScheme.primary
|
||||||
|
: Theme.of(context).colorScheme.outline,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
separatorBuilder: (context, index) => Divider(
|
||||||
|
height: 1,
|
||||||
|
color: Theme.of(context).dividerColor.withOpacity(0.1),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user