mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-10 21:11:27 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
70aecd1e38 | ||
|
|
a40c773491 | ||
|
|
b4abb58a41 |
@@ -22,7 +22,7 @@ class Segment {
|
|||||||
|
|
||||||
class SegmentProgressBar extends CustomPainter {
|
class SegmentProgressBar extends CustomPainter {
|
||||||
final List<Segment> segmentColors;
|
final List<Segment> segmentColors;
|
||||||
late double _defHeight;
|
double? _defHeight;
|
||||||
|
|
||||||
SegmentProgressBar({
|
SegmentProgressBar({
|
||||||
required this.segmentColors,
|
required this.segmentColors,
|
||||||
@@ -42,6 +42,18 @@ class SegmentProgressBar extends CustomPainter {
|
|||||||
if (segmentColors[i].title != null) {
|
if (segmentColors[i].title != null) {
|
||||||
double fontSize = 10;
|
double fontSize = 10;
|
||||||
|
|
||||||
|
_defHeight ??= (TextPainter(
|
||||||
|
text: TextSpan(
|
||||||
|
text: segmentColors[i].title,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: fontSize,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
textDirection: TextDirection.ltr,
|
||||||
|
)..layout())
|
||||||
|
.height +
|
||||||
|
2;
|
||||||
|
|
||||||
TextPainter getTextPainter() => TextPainter(
|
TextPainter getTextPainter() => TextPainter(
|
||||||
text: TextSpan(
|
text: TextSpan(
|
||||||
text: segmentColors[i].title,
|
text: segmentColors[i].title,
|
||||||
@@ -51,14 +63,12 @@ class SegmentProgressBar extends CustomPainter {
|
|||||||
height: 1,
|
height: 1,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
strutStyle: StrutStyle(height: 1, leading: 0),
|
strutStyle:
|
||||||
|
StrutStyle(leading: 0, height: 1, fontSize: fontSize),
|
||||||
textDirection: TextDirection.ltr,
|
textDirection: TextDirection.ltr,
|
||||||
)..layout();
|
)..layout();
|
||||||
|
|
||||||
TextPainter textPainter = getTextPainter();
|
TextPainter textPainter = getTextPainter();
|
||||||
if (i == 0) {
|
|
||||||
_defHeight = textPainter.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
late double prevStart;
|
late double prevStart;
|
||||||
if (i != 0) {
|
if (i != 0) {
|
||||||
@@ -75,7 +85,7 @@ class SegmentProgressBar extends CustomPainter {
|
|||||||
canvas.drawRect(
|
canvas.drawRect(
|
||||||
Rect.fromLTRB(
|
Rect.fromLTRB(
|
||||||
0,
|
0,
|
||||||
-_defHeight - 2,
|
-_defHeight!,
|
||||||
size.width,
|
size.width,
|
||||||
0,
|
0,
|
||||||
),
|
),
|
||||||
@@ -86,9 +96,9 @@ class SegmentProgressBar extends CustomPainter {
|
|||||||
canvas.drawRect(
|
canvas.drawRect(
|
||||||
Rect.fromLTWH(
|
Rect.fromLTWH(
|
||||||
segmentStart,
|
segmentStart,
|
||||||
-_defHeight - 2,
|
-_defHeight!,
|
||||||
segmentEnd == segmentStart ? 2 : segmentEnd - segmentStart,
|
segmentEnd == segmentStart ? 2 : segmentEnd - segmentStart,
|
||||||
size.height + _defHeight + 2,
|
size.height + _defHeight!,
|
||||||
),
|
),
|
||||||
paint,
|
paint,
|
||||||
);
|
);
|
||||||
@@ -98,7 +108,7 @@ class SegmentProgressBar extends CustomPainter {
|
|||||||
: (segmentStart - prevStart - textPainter.width) / 2 +
|
: (segmentStart - prevStart - textPainter.width) / 2 +
|
||||||
prevStart +
|
prevStart +
|
||||||
1;
|
1;
|
||||||
double textY = (-_defHeight - textPainter.height) / 2 - 1;
|
double textY = (-_defHeight! - textPainter.height) / 2;
|
||||||
textPainter.paint(canvas, Offset(textX, textY));
|
textPainter.paint(canvas, Offset(textX, textY));
|
||||||
} else {
|
} else {
|
||||||
canvas.drawRect(
|
canvas.drawRect(
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:PiliPlus/http/api.dart';
|
import 'package:PiliPlus/http/api.dart';
|
||||||
import 'package:PiliPlus/pages/mine/controller.dart';
|
import 'package:PiliPlus/pages/mine/controller.dart';
|
||||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||||
@@ -31,7 +29,24 @@ class ApiInterceptor extends Interceptor {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
|
void onRequest(RequestOptions options, RequestInterceptorHandler handler) {
|
||||||
if (MineController.anonymity.value) {
|
void onRemoveCookie() {
|
||||||
|
options.headers.remove('x-bili-mid');
|
||||||
|
options.headers.remove('x-bili-aurora-eid');
|
||||||
|
options.headers.remove('x-bili-aurora-zone');
|
||||||
|
options.headers['cookie'] = '';
|
||||||
|
options.queryParameters.remove('access_key');
|
||||||
|
options.queryParameters.remove('csrf');
|
||||||
|
options.queryParameters.remove('csrf_token');
|
||||||
|
if (options.data is Map) {
|
||||||
|
options.data.remove('access_key');
|
||||||
|
options.data.remove('csrf');
|
||||||
|
options.data.remove('csrf_token');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.extra['clearCookie'] == true) {
|
||||||
|
onRemoveCookie();
|
||||||
|
} else if (MineController.anonymity.value) {
|
||||||
String uri = options.uri.toString();
|
String uri = options.uri.toString();
|
||||||
for (var i in anonymityList) {
|
for (var i in anonymityList) {
|
||||||
// 如果请求的url包含无痕列表中的url,则清空cookie
|
// 如果请求的url包含无痕列表中的url,则清空cookie
|
||||||
@@ -40,22 +55,11 @@ class ApiInterceptor extends Interceptor {
|
|||||||
if (index == -1) continue;
|
if (index == -1) continue;
|
||||||
if (uri.lastIndexOf('/') >= index + i.length) continue;
|
if (uri.lastIndexOf('/') >= index + i.length) continue;
|
||||||
//SmartDialog.showToast('触发无痕模式\n\n$i\n\n${options.uri}');
|
//SmartDialog.showToast('触发无痕模式\n\n$i\n\n${options.uri}');
|
||||||
options.headers[HttpHeaders.cookieHeader] = "";
|
onRemoveCookie();
|
||||||
if (options.data != null && options.data.csrf != null) {
|
|
||||||
options.data.csrf = "";
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (options.extra['clearCookie'] == true) {
|
|
||||||
options.headers['x-bili-mid'] = '';
|
|
||||||
options.headers['x-bili-aurora-eid'] = '';
|
|
||||||
options.headers['x-bili-aurora-zone'] = '';
|
|
||||||
options.headers[HttpHeaders.cookieHeader] = '';
|
|
||||||
if (options.data != null && options.data.csrf != null) {
|
|
||||||
options.data.csrf = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
handler.next(options);
|
handler.next(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -110,78 +110,84 @@ class AuthorPanel extends StatelessWidget {
|
|||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
// const Spacer(),
|
|
||||||
// if (source != 'detail' && item.modules?.moduleTag?.text != null)
|
|
||||||
// Container(
|
|
||||||
// padding:
|
|
||||||
// const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// color: Theme.of(context).colorScheme.surface,
|
|
||||||
// borderRadius: const BorderRadius.all(Radius.circular(4)),
|
|
||||||
// border: Border.all(
|
|
||||||
// width: 1.25,
|
|
||||||
// color: Theme.of(context).colorScheme.primary,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// child: Text(
|
|
||||||
// item.modules.moduleTag.text,
|
|
||||||
// style: TextStyle(
|
|
||||||
// height: 1,
|
|
||||||
// fontSize: 12,
|
|
||||||
// color: Theme.of(context).colorScheme.primary,
|
|
||||||
// ),
|
|
||||||
// strutStyle: const StrutStyle(
|
|
||||||
// leading: 0,
|
|
||||||
// height: 1,
|
|
||||||
// fontSize: 12,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
child: item.modules.moduleAuthor.decorate != null
|
child: source != 'detail' && item.modules?.moduleTag?.text != null
|
||||||
? Row(
|
? Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
// GestureDetector(
|
Container(
|
||||||
// onTap:
|
padding: const EdgeInsets.symmetric(
|
||||||
// item.modules.moduleAuthor.decorate['jump_url'] != null
|
horizontal: 4, vertical: 2),
|
||||||
// ? () {
|
decoration: BoxDecoration(
|
||||||
// Get.toNamed(
|
borderRadius:
|
||||||
// '/webview',
|
const BorderRadius.all(Radius.circular(4)),
|
||||||
// parameters: {
|
border: Border.all(
|
||||||
// 'url':
|
width: 1.25,
|
||||||
// '${item.modules.moduleAuthor.decorate['jump_url']}'
|
color: Theme.of(context).colorScheme.primary,
|
||||||
// },
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
// : null,
|
|
||||||
// child:
|
|
||||||
Stack(
|
|
||||||
clipBehavior: Clip.none,
|
|
||||||
alignment: Alignment.centerRight,
|
|
||||||
children: [
|
|
||||||
CachedNetworkImage(
|
|
||||||
height: 32,
|
|
||||||
imageUrl:
|
|
||||||
item.modules.moduleAuthor.decorate['card_url'],
|
|
||||||
),
|
),
|
||||||
if ((item.modules.moduleAuthor.decorate?['fan']
|
),
|
||||||
?['num_str'] as String?)
|
child: Text(
|
||||||
?.isNotEmpty ==
|
item.modules.moduleTag.text,
|
||||||
true)
|
style: TextStyle(
|
||||||
Padding(
|
height: 1,
|
||||||
padding: const EdgeInsets.only(right: 32),
|
fontSize: 12,
|
||||||
child: Text(
|
color: Theme.of(context).colorScheme.primary,
|
||||||
'${item.modules.moduleAuthor.decorate['fan']['num_str']}',
|
),
|
||||||
style: TextStyle(
|
strutStyle: const StrutStyle(
|
||||||
fontSize: 11,
|
leading: 0,
|
||||||
fontFamily: 'digital_id_num',
|
height: 1,
|
||||||
color:
|
fontSize: 12,
|
||||||
(item.modules.moduleAuthor.decorate?['fan']
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
_moreWidget(context),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: item.modules.moduleAuthor.decorate != null
|
||||||
|
? Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
// GestureDetector(
|
||||||
|
// onTap:
|
||||||
|
// item.modules.moduleAuthor.decorate['jump_url'] != null
|
||||||
|
// ? () {
|
||||||
|
// Get.toNamed(
|
||||||
|
// '/webview',
|
||||||
|
// parameters: {
|
||||||
|
// 'url':
|
||||||
|
// '${item.modules.moduleAuthor.decorate['jump_url']}'
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// : null,
|
||||||
|
// child:
|
||||||
|
Stack(
|
||||||
|
clipBehavior: Clip.none,
|
||||||
|
alignment: Alignment.centerRight,
|
||||||
|
children: [
|
||||||
|
CachedNetworkImage(
|
||||||
|
height: 32,
|
||||||
|
imageUrl: item
|
||||||
|
.modules.moduleAuthor.decorate['card_url'],
|
||||||
|
),
|
||||||
|
if ((item.modules.moduleAuthor.decorate?['fan']
|
||||||
|
?['num_str'] as String?)
|
||||||
|
?.isNotEmpty ==
|
||||||
|
true)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 32),
|
||||||
|
child: Text(
|
||||||
|
'${item.modules.moduleAuthor.decorate['fan']['num_str']}',
|
||||||
|
style: TextStyle(
|
||||||
|
height: 1,
|
||||||
|
fontSize: 11,
|
||||||
|
fontFamily: 'digital_id_num',
|
||||||
|
color: (item.modules.moduleAuthor
|
||||||
|
.decorate?['fan']
|
||||||
?['color'] as String?)
|
?['color'] as String?)
|
||||||
?.startsWith('#') ==
|
?.startsWith('#') ==
|
||||||
true
|
true
|
||||||
@@ -193,16 +199,16 @@ class AuthorPanel extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
: null,
|
: null,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
|
// ),
|
||||||
|
_moreWidget(context),
|
||||||
],
|
],
|
||||||
),
|
)
|
||||||
// ),
|
: _moreWidget(context),
|
||||||
_moreWidget(context),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
: _moreWidget(context),
|
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1166,7 +1166,7 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
|
|||||||
buildDmChart(context, plPlayerController),
|
buildDmChart(context, plPlayerController),
|
||||||
if (plPlayerController.viewPointList.isNotEmpty &&
|
if (plPlayerController.viewPointList.isNotEmpty &&
|
||||||
plPlayerController.showVP.value)
|
plPlayerController.showVP.value)
|
||||||
buildViewPointWidget(plPlayerController),
|
buildViewPointWidget(plPlayerController, 4.25),
|
||||||
ProgressBar(
|
ProgressBar(
|
||||||
progress: Duration(seconds: value),
|
progress: Duration(seconds: value),
|
||||||
buffered: Duration(seconds: buffer),
|
buffered: Duration(seconds: buffer),
|
||||||
@@ -1681,13 +1681,15 @@ Widget buildSeekPreviewWidget(PlPlayerController plPlayerController) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget buildViewPointWidget(PlPlayerController plPlayerController) {
|
Widget buildViewPointWidget(
|
||||||
|
PlPlayerController plPlayerController, double offset) {
|
||||||
return LayoutBuilder(
|
return LayoutBuilder(
|
||||||
builder: (context, constraints) {
|
builder: (context, constraints) {
|
||||||
return SizedBox(
|
return Container(
|
||||||
height: 20,
|
height: 16,
|
||||||
|
margin: EdgeInsets.only(bottom: offset),
|
||||||
child: Listener(
|
child: Listener(
|
||||||
behavior: HitTestBehavior.translucent,
|
behavior: HitTestBehavior.opaque,
|
||||||
onPointerDown: (event) {
|
onPointerDown: (event) {
|
||||||
try {
|
try {
|
||||||
double seg = event.localPosition.dx / constraints.maxWidth;
|
double seg = event.localPosition.dx / constraints.maxWidth;
|
||||||
|
|||||||
@@ -62,10 +62,7 @@ class BottomControl extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
buildDmChart(context, controller!, 4.5),
|
buildDmChart(context, controller!, 4.5),
|
||||||
if (controller?.viewPointList.isNotEmpty == true &&
|
if (controller?.viewPointList.isNotEmpty == true &&
|
||||||
controller?.showVP.value == true)
|
controller?.showVP.value == true)
|
||||||
Padding(
|
buildViewPointWidget(controller!, 8.75),
|
||||||
padding: const EdgeInsets.only(bottom: 5.25),
|
|
||||||
child: buildViewPointWidget(controller!),
|
|
||||||
),
|
|
||||||
ProgressBar(
|
ProgressBar(
|
||||||
progress: Duration(seconds: value),
|
progress: Duration(seconds: value),
|
||||||
buffered: Duration(seconds: buffer),
|
buffered: Duration(seconds: buffer),
|
||||||
|
|||||||
Reference in New Issue
Block a user