mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: post panel
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -40,12 +40,12 @@ class _DynamicsTabPageState extends State<DynamicsTabPage>
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
dynamicsController = Get.find<DynamicsController>();
|
||||||
_dynamicsTabController = Get.put(
|
_dynamicsTabController = Get.put(
|
||||||
DynamicsTabController(dynamicsType: widget.dynamicsType),
|
DynamicsTabController(dynamicsType: widget.dynamicsType)
|
||||||
|
..mid = dynamicsController.mid.value,
|
||||||
tag: widget.dynamicsType,
|
tag: widget.dynamicsType,
|
||||||
);
|
);
|
||||||
dynamicsController = Get.find<DynamicsController>();
|
|
||||||
|
|
||||||
_dynamicsTabController.scrollController.addListener(() {
|
_dynamicsTabController.scrollController.addListener(() {
|
||||||
if (_dynamicsTabController.scrollController.position.pixels >=
|
if (_dynamicsTabController.scrollController.position.pixels >=
|
||||||
_dynamicsTabController.scrollController.position.maxScrollExtent -
|
_dynamicsTabController.scrollController.position.maxScrollExtent -
|
||||||
|
|||||||
@@ -1021,7 +1021,7 @@ class VideoDetailController extends GetxController
|
|||||||
ctr = plPlayerController.isFullScreen.value
|
ctr = plPlayerController.isFullScreen.value
|
||||||
? scaffoldKey.currentState?.showBottomSheet(
|
? scaffoldKey.currentState?.showBottomSheet(
|
||||||
enableDrag: false,
|
enableDrag: false,
|
||||||
(context) => _postPanel(ctr?.close),
|
(context) => _postPanel(ctr?.close, false),
|
||||||
)
|
)
|
||||||
: childKey.currentState?.showBottomSheet(
|
: childKey.currentState?.showBottomSheet(
|
||||||
enableDrag: false,
|
enableDrag: false,
|
||||||
@@ -1029,7 +1029,7 @@ class VideoDetailController extends GetxController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _postPanel(onClose) => StatefulBuilder(
|
Widget _postPanel(onClose, [bool isChild = true]) => StatefulBuilder(
|
||||||
builder: (context, setState) {
|
builder: (context, setState) {
|
||||||
List<Widget> segmentWidget({
|
List<Widget> segmentWidget({
|
||||||
required int index,
|
required int index,
|
||||||
@@ -1114,7 +1114,8 @@ class VideoDetailController extends GetxController
|
|||||||
for (int i = 0; i < split.length; i++) {
|
for (int i = 0; i < split.length; i++) {
|
||||||
duration += split[i] * pow(60, i).toInt();
|
duration += split[i] * pow(60, i).toInt();
|
||||||
}
|
}
|
||||||
if (duration <= (data.timeLength ?? 0) / 1000) {
|
if (duration <=
|
||||||
|
plPlayerController.durationSeconds.value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
if (isFirst) {
|
if (isFirst) {
|
||||||
list![index].segment.first = duration;
|
list![index].segment.first = duration;
|
||||||
@@ -1133,241 +1134,249 @@ class VideoDetailController extends GetxController
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return SizedBox(
|
||||||
resizeToAvoidBottomInset: true,
|
height: isChild ? null : Utils.getSheetHeight(context),
|
||||||
appBar: AppBar(
|
child: Scaffold(
|
||||||
automaticallyImplyLeading: false,
|
resizeToAvoidBottomInset: false,
|
||||||
titleSpacing: 16,
|
appBar: AppBar(
|
||||||
title: const Text('提交片段'),
|
automaticallyImplyLeading: false,
|
||||||
actions: [
|
titleSpacing: 16,
|
||||||
iconButton(
|
title: const Text('提交片段'),
|
||||||
context: context,
|
actions: [
|
||||||
tooltip: '添加片段',
|
iconButton(
|
||||||
onPressed: () {
|
context: context,
|
||||||
setState(() {
|
tooltip: '添加片段',
|
||||||
list?.insert(
|
onPressed: () {
|
||||||
0,
|
setState(() {
|
||||||
PostSegmentModel(
|
list?.insert(
|
||||||
segment: Pair(first: 0, second: 0),
|
0,
|
||||||
category: SegmentType.sponsor,
|
PostSegmentModel(
|
||||||
actionType: ActionType.skip,
|
segment: Pair(first: 0, second: 0),
|
||||||
),
|
category: SegmentType.sponsor,
|
||||||
);
|
actionType: ActionType.skip,
|
||||||
});
|
),
|
||||||
},
|
);
|
||||||
icon: Icons.add,
|
});
|
||||||
),
|
},
|
||||||
const SizedBox(width: 10),
|
icon: Icons.add,
|
||||||
iconButton(
|
),
|
||||||
context: context,
|
const SizedBox(width: 10),
|
||||||
tooltip: '关闭',
|
iconButton(
|
||||||
onPressed: onClose,
|
context: context,
|
||||||
icon: Icons.close,
|
tooltip: '关闭',
|
||||||
),
|
onPressed: onClose,
|
||||||
const SizedBox(width: 16),
|
icon: Icons.close,
|
||||||
],
|
),
|
||||||
),
|
const SizedBox(width: 16),
|
||||||
body: list?.isNotEmpty == true
|
],
|
||||||
? Stack(
|
),
|
||||||
children: [
|
body: list?.isNotEmpty == true
|
||||||
SingleChildScrollView(
|
? Stack(
|
||||||
child: Column(
|
children: [
|
||||||
children: [
|
SingleChildScrollView(
|
||||||
...List.generate(
|
child: Column(
|
||||||
list!.length,
|
children: [
|
||||||
(index) => Container(
|
...List.generate(
|
||||||
margin: const EdgeInsets.symmetric(
|
list!.length,
|
||||||
horizontal: 16,
|
(index) => Container(
|
||||||
vertical: 5,
|
margin: const EdgeInsets.symmetric(
|
||||||
),
|
horizontal: 16,
|
||||||
padding: const EdgeInsets.all(12),
|
vertical: 5,
|
||||||
decoration: BoxDecoration(
|
),
|
||||||
color: Theme.of(context)
|
padding: const EdgeInsets.all(12),
|
||||||
.colorScheme
|
decoration: BoxDecoration(
|
||||||
.onInverseSurface,
|
color: Theme.of(context)
|
||||||
borderRadius: BorderRadius.circular(12),
|
.colorScheme
|
||||||
),
|
.onInverseSurface,
|
||||||
child: Column(
|
borderRadius: BorderRadius.circular(12),
|
||||||
mainAxisSize: MainAxisSize.min,
|
),
|
||||||
children: [
|
child: Column(
|
||||||
Row(
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
...segmentWidget(
|
Row(
|
||||||
isFirst: true,
|
children: [
|
||||||
index: index,
|
...segmentWidget(
|
||||||
),
|
isFirst: true,
|
||||||
const SizedBox(width: 16),
|
index: index,
|
||||||
...segmentWidget(
|
),
|
||||||
isFirst: false,
|
const SizedBox(width: 16),
|
||||||
index: index,
|
...segmentWidget(
|
||||||
),
|
isFirst: false,
|
||||||
const Spacer(),
|
index: index,
|
||||||
iconButton(
|
),
|
||||||
context: context,
|
const Spacer(),
|
||||||
size: 26,
|
iconButton(
|
||||||
tooltip: '移除',
|
context: context,
|
||||||
icon: Icons.clear,
|
size: 26,
|
||||||
onPressed: () {
|
tooltip: '移除',
|
||||||
setState(() {
|
icon: Icons.clear,
|
||||||
list!.removeAt(index);
|
onPressed: () {
|
||||||
});
|
setState(() {
|
||||||
},
|
list!.removeAt(index);
|
||||||
),
|
});
|
||||||
],
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
],
|
||||||
Row(
|
),
|
||||||
children: [
|
const SizedBox(height: 8),
|
||||||
const Text('分类: '),
|
Row(
|
||||||
PopupMenuButton(
|
children: [
|
||||||
initialValue: list![index].category,
|
const Text('分类: '),
|
||||||
onSelected: (item) async {
|
PopupMenuButton(
|
||||||
setState(() {
|
initialValue: list![index].category,
|
||||||
list![index].category = item;
|
onSelected: (item) async {
|
||||||
});
|
setState(() {
|
||||||
},
|
list![index].category = item;
|
||||||
itemBuilder: (context) => SegmentType
|
});
|
||||||
.values
|
},
|
||||||
.map((item) =>
|
itemBuilder: (context) =>
|
||||||
PopupMenuItem<SegmentType>(
|
SegmentType.values
|
||||||
value: item,
|
.map((item) =>
|
||||||
child: Text(item.title),
|
PopupMenuItem<
|
||||||
))
|
SegmentType>(
|
||||||
.toList(),
|
value: item,
|
||||||
child: Row(
|
child:
|
||||||
mainAxisSize: MainAxisSize.min,
|
Text(item.title),
|
||||||
crossAxisAlignment:
|
))
|
||||||
CrossAxisAlignment.start,
|
.toList(),
|
||||||
children: [
|
child: Row(
|
||||||
Text(
|
mainAxisSize: MainAxisSize.min,
|
||||||
list![index].category.title,
|
crossAxisAlignment:
|
||||||
style: TextStyle(
|
CrossAxisAlignment.start,
|
||||||
fontSize: 14,
|
children: [
|
||||||
|
Text(
|
||||||
|
list![index].category.title,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.primary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Icon(
|
||||||
|
size: 20,
|
||||||
|
Icons.keyboard_arrow_right,
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.colorScheme
|
.colorScheme
|
||||||
.primary,
|
.primary,
|
||||||
),
|
)
|
||||||
),
|
],
|
||||||
Icon(
|
),
|
||||||
size: 20,
|
|
||||||
Icons.keyboard_arrow_right,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.primary,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(width: 16),
|
||||||
const SizedBox(width: 16),
|
const Text('ActionType: '),
|
||||||
const Text('ActionType: '),
|
PopupMenuButton(
|
||||||
PopupMenuButton(
|
initialValue:
|
||||||
initialValue: list![index].actionType,
|
list![index].actionType,
|
||||||
onSelected: (item) async {
|
onSelected: (item) async {
|
||||||
setState(() {
|
setState(() {
|
||||||
list![index].actionType = item;
|
list![index].actionType = item;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
itemBuilder: (context) => ActionType
|
itemBuilder: (context) => ActionType
|
||||||
.values
|
.values
|
||||||
.map((item) =>
|
.map((item) =>
|
||||||
PopupMenuItem<ActionType>(
|
PopupMenuItem<ActionType>(
|
||||||
value: item,
|
value: item,
|
||||||
child: Text(item.name),
|
child: Text(item.name),
|
||||||
))
|
))
|
||||||
.toList(),
|
.toList(),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
list![index].actionType.name,
|
list![index].actionType.name,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.primary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Icon(
|
||||||
|
size: 20,
|
||||||
|
Icons.keyboard_arrow_right,
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.colorScheme
|
.colorScheme
|
||||||
.primary,
|
.primary,
|
||||||
),
|
)
|
||||||
),
|
],
|
||||||
Icon(
|
),
|
||||||
size: 20,
|
|
||||||
Icons.keyboard_arrow_right,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.primary,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
)
|
||||||
)
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
SizedBox(
|
||||||
SizedBox(
|
height:
|
||||||
height: 88 + MediaQuery.paddingOf(context).bottom,
|
88 + MediaQuery.paddingOf(context).bottom,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
Positioned(
|
||||||
Positioned(
|
right: 16,
|
||||||
right: 16,
|
bottom: 16 + MediaQuery.paddingOf(context).bottom,
|
||||||
bottom: 16 + MediaQuery.paddingOf(context).bottom,
|
child: FloatingActionButton(
|
||||||
child: FloatingActionButton(
|
tooltip: '提交',
|
||||||
tooltip: '提交',
|
onPressed: () {
|
||||||
onPressed: () {
|
Request()
|
||||||
Request()
|
.post(
|
||||||
.post(
|
'${GStorage.blockServer}/api/skipSegments',
|
||||||
'${GStorage.blockServer}/api/skipSegments',
|
queryParameters: {
|
||||||
queryParameters: {
|
'videoID': bvid,
|
||||||
'videoID': bvid,
|
'cid': cid.value,
|
||||||
'cid': cid.value,
|
'userID': GStorage.blockUserID,
|
||||||
'userID': GStorage.blockUserID,
|
'userAgent': Constants.userAgent,
|
||||||
'userAgent': Constants.userAgent,
|
'videoDuration':
|
||||||
'videoDuration': (data.timeLength ?? 0 / 1000),
|
plPlayerController.durationSeconds.value,
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
'segments': list!
|
'segments': list!
|
||||||
.map(
|
.map(
|
||||||
(item) => {
|
(item) => {
|
||||||
'segment': [
|
'segment': [
|
||||||
item.segment.first,
|
item.segment.first,
|
||||||
item.segment.second,
|
item.segment.second,
|
||||||
],
|
],
|
||||||
'category': item.category.name,
|
'category': item.category.name,
|
||||||
'actionType': item.actionType.name,
|
'actionType': item.actionType.name,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
},
|
},
|
||||||
options: _options,
|
options: _options,
|
||||||
)
|
)
|
||||||
.then(
|
.then(
|
||||||
(res) {
|
(res) {
|
||||||
if (res.statusCode == 200) {
|
if (res.statusCode == 200) {
|
||||||
Get.back();
|
Get.back();
|
||||||
SmartDialog.showToast('提交成功');
|
SmartDialog.showToast('提交成功');
|
||||||
list?.clear();
|
list?.clear();
|
||||||
} else {
|
} else {
|
||||||
SmartDialog.showToast(
|
SmartDialog.showToast(
|
||||||
'提交失败: ${{
|
'提交失败: ${{
|
||||||
400: '参数错误',
|
400: '参数错误',
|
||||||
403: '被自动审核机制拒绝',
|
403: '被自动审核机制拒绝',
|
||||||
429: '重复提交太快',
|
429: '重复提交太快',
|
||||||
409: '重复提交'
|
409: '重复提交'
|
||||||
}[res.statusCode]}',
|
}[res.statusCode]}',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Icon(Icons.check),
|
child: Icon(Icons.check),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
: errorWidget(),
|
: errorWidget(),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user