mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-16 07:20:08 +08:00
tweaks
This commit is contained in:
@@ -20,20 +20,16 @@ class DisabledIcon extends SingleChildRenderObjectWidget {
|
|||||||
final StrokeCap strokeCap;
|
final StrokeCap strokeCap;
|
||||||
final double lineLengthScale;
|
final double lineLengthScale;
|
||||||
|
|
||||||
|
Icon? get _icon => child is Icon ? child as Icon : null;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
RenderObject createRenderObject(BuildContext context) {
|
RenderObject createRenderObject(BuildContext context) {
|
||||||
late final iconTheme = IconTheme.of(context);
|
late final iconTheme = IconTheme.of(context);
|
||||||
|
final icon = _icon;
|
||||||
return RenderMaskedIcon(
|
return RenderMaskedIcon(
|
||||||
disable: disable,
|
disable: disable,
|
||||||
iconSize:
|
iconSize: iconSize ?? icon?.size ?? iconTheme.size ?? 24.0,
|
||||||
iconSize ??
|
color: color ?? icon?.color ?? iconTheme.color!,
|
||||||
(child is Icon ? (child as Icon).size : null) ??
|
|
||||||
iconTheme.size ??
|
|
||||||
24.0,
|
|
||||||
color:
|
|
||||||
color ??
|
|
||||||
(child is Icon ? (child as Icon).color : null) ??
|
|
||||||
iconTheme.color!,
|
|
||||||
strokeCap: strokeCap,
|
strokeCap: strokeCap,
|
||||||
lineLengthScale: lineLengthScale,
|
lineLengthScale: lineLengthScale,
|
||||||
);
|
);
|
||||||
@@ -42,17 +38,11 @@ class DisabledIcon extends SingleChildRenderObjectWidget {
|
|||||||
@override
|
@override
|
||||||
void updateRenderObject(BuildContext context, RenderMaskedIcon renderObject) {
|
void updateRenderObject(BuildContext context, RenderMaskedIcon renderObject) {
|
||||||
late final iconTheme = IconTheme.of(context);
|
late final iconTheme = IconTheme.of(context);
|
||||||
|
final icon = _icon;
|
||||||
renderObject
|
renderObject
|
||||||
..disable = disable
|
..disable = disable
|
||||||
..iconSize =
|
..iconSize = iconSize ?? icon?.size ?? iconTheme.size ?? 24.0
|
||||||
iconSize ??
|
..color = color ?? icon?.color ?? iconTheme.color!
|
||||||
(child is Icon ? (child as Icon).size : null) ??
|
|
||||||
iconTheme.size ??
|
|
||||||
24.0
|
|
||||||
..color =
|
|
||||||
color ??
|
|
||||||
(child is Icon ? (child as Icon).color : null) ??
|
|
||||||
iconTheme.color!
|
|
||||||
..strokeCap = strokeCap
|
..strokeCap = strokeCap
|
||||||
..lineLengthScale = lineLengthScale;
|
..lineLengthScale = lineLengthScale;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,42 +43,3 @@ class NoRenderLayoutBox extends RenderProxyBox {
|
|||||||
@override
|
@override
|
||||||
void paint(PaintingContext context, Offset offset) {}
|
void paint(PaintingContext context, Offset offset) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
class LayoutSizeWidget extends SingleChildRenderObjectWidget {
|
|
||||||
const LayoutSizeWidget({
|
|
||||||
super.key,
|
|
||||||
super.child,
|
|
||||||
required this.onPerformLayout,
|
|
||||||
});
|
|
||||||
|
|
||||||
final LayoutCallback onPerformLayout;
|
|
||||||
|
|
||||||
@override
|
|
||||||
RenderObject createRenderObject(BuildContext context) =>
|
|
||||||
RenderLayoutBox(onPerformLayout: onPerformLayout);
|
|
||||||
|
|
||||||
@override
|
|
||||||
void updateRenderObject(
|
|
||||||
BuildContext context,
|
|
||||||
RenderLayoutBox renderObject,
|
|
||||||
) {
|
|
||||||
super.updateRenderObject(context, renderObject);
|
|
||||||
renderObject.onPerformLayout = onPerformLayout;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class RenderLayoutBox extends RenderProxyBox {
|
|
||||||
RenderLayoutBox({required this.onPerformLayout});
|
|
||||||
|
|
||||||
LayoutCallback onPerformLayout;
|
|
||||||
|
|
||||||
Size? _size;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void performLayout() {
|
|
||||||
super.performLayout();
|
|
||||||
if (_size != size) {
|
|
||||||
onPerformLayout(_size = size);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -96,7 +96,6 @@ class RenderSliverFixedWrap extends RenderSliverMultiBoxAdaptor {
|
|||||||
set runSpacing(double value) {
|
set runSpacing(double value) {
|
||||||
if (_runSpacing == value) return;
|
if (_runSpacing == value) return;
|
||||||
_runSpacing = value;
|
_runSpacing = value;
|
||||||
markRowsDirty();
|
|
||||||
markNeedsLayout();
|
markNeedsLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,20 +167,20 @@ class RenderSliverFixedWrap extends RenderSliverMultiBoxAdaptor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _buildNextRow(int start, BoxConstraints childConstraints) {
|
bool _buildNextRow(int start, BoxConstraints constraints) {
|
||||||
final int childCount = childManager.childCount;
|
final int childCount = childManager.childCount;
|
||||||
|
|
||||||
if (start >= childCount) {
|
if (start >= childCount) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final crossAxisExtent = constraints.crossAxisExtent;
|
final crossAxisExtent = this.constraints.crossAxisExtent;
|
||||||
|
|
||||||
final List<double> widths = [];
|
final List<double> widths = [];
|
||||||
int idx = start;
|
int idx = start;
|
||||||
RenderBox? child;
|
RenderBox? child;
|
||||||
for (var totalWidth = -_spacing; idx < childCount; idx++) {
|
for (var totalWidth = -_spacing; idx < childCount; idx++) {
|
||||||
child = _getOrCreateChildAtIndex(idx, childConstraints, child);
|
child = _getOrCreateChildAtIndex(idx, constraints, child);
|
||||||
final childWidth = _childCrossExtent(child);
|
final childWidth = _childCrossExtent(child);
|
||||||
totalWidth += childWidth + _spacing;
|
totalWidth += childWidth + _spacing;
|
||||||
|
|
||||||
@@ -215,24 +214,20 @@ class RenderSliverFixedWrap extends RenderSliverMultiBoxAdaptor {
|
|||||||
final firstNeededRow = math.max(0, firstCacheOffset ~/ rowHeight);
|
final firstNeededRow = math.max(0, firstCacheOffset ~/ rowHeight);
|
||||||
final lastNeededRow = math.max(0, lastCacheOffset ~/ rowHeight);
|
final lastNeededRow = math.max(0, lastCacheOffset ~/ rowHeight);
|
||||||
|
|
||||||
|
final childConstraints = constraints.toFixedConstraints(_mainAxisExtent);
|
||||||
|
|
||||||
if (firstChild == null) {
|
if (firstChild == null) {
|
||||||
if (!addInitialChild()) {
|
if (!addInitialChild()) {
|
||||||
geometry = SliverGeometry.zero;
|
geometry = SliverGeometry.zero;
|
||||||
childManager.didFinishLayout();
|
childManager.didFinishLayout();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
firstChild!.layout(
|
firstChild!.layout(childConstraints, parentUsesSize: true);
|
||||||
constraints.toFixedConstraints(_mainAxisExtent),
|
|
||||||
parentUsesSize: true,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (_rows.length <= lastNeededRow) {
|
while (_rows.length <= lastNeededRow) {
|
||||||
final int startIndex = _rows.isEmpty ? 0 : _rows.last.endIndex + 1;
|
final int startIndex = _rows.isEmpty ? 0 : _rows.last.endIndex + 1;
|
||||||
if (!_buildNextRow(
|
if (!_buildNextRow(startIndex, childConstraints)) {
|
||||||
startIndex,
|
|
||||||
constraints.toFixedConstraints(_mainAxisExtent),
|
|
||||||
)) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -256,11 +251,7 @@ class RenderSliverFixedWrap extends RenderSliverMultiBoxAdaptor {
|
|||||||
final rowStartOffset = r * rowHeight;
|
final rowStartOffset = r * rowHeight;
|
||||||
double crossOffset = 0.0;
|
double crossOffset = 0.0;
|
||||||
for (var i = row.startIndex; i <= row.endIndex; i++) {
|
for (var i = row.startIndex; i <= row.endIndex; i++) {
|
||||||
child = _getOrCreateChildAtIndex(
|
child = _getOrCreateChildAtIndex(i, childConstraints, child);
|
||||||
i,
|
|
||||||
constraints.toFixedConstraints(_mainAxisExtent),
|
|
||||||
child,
|
|
||||||
);
|
|
||||||
(child.parentData as SliverWrapParentData)
|
(child.parentData as SliverWrapParentData)
|
||||||
..layoutOffset = rowStartOffset
|
..layoutOffset = rowStartOffset
|
||||||
..crossAxisOffset = crossOffset;
|
..crossAxisOffset = crossOffset;
|
||||||
|
|||||||
@@ -163,19 +163,15 @@ class Dash {
|
|||||||
video = (json['video'] as List?)
|
video = (json['video'] as List?)
|
||||||
?.map<VideoItem>((e) => VideoItem.fromJson(e))
|
?.map<VideoItem>((e) => VideoItem.fromJson(e))
|
||||||
.toList();
|
.toList();
|
||||||
audio = (json['audio'] as List?)
|
final audio = [
|
||||||
?.map<AudioItem>((e) => AudioItem.fromJson(e))
|
if (json['flac']?['audio'] case Map<String, dynamic> flac)
|
||||||
.toList();
|
AudioItem.fromJson(flac),
|
||||||
if (json['dolby']?['audio'] case List list) {
|
if (json['dolby']?['audio'] case List list)
|
||||||
(audio ??= <AudioItem>[]).insertAll(
|
...list.map((e) => AudioItem.fromJson(e)),
|
||||||
0,
|
if (json['audio'] case List list)
|
||||||
list.map((e) => AudioItem.fromJson(e)),
|
...list.map((e) => AudioItem.fromJson(e)),
|
||||||
);
|
];
|
||||||
}
|
this.audio = audio.isEmpty ? null : audio;
|
||||||
final flacAudio = json['flac']?['audio'];
|
|
||||||
if (flacAudio != null) {
|
|
||||||
(audio ??= <AudioItem>[]).insert(0, AudioItem.fromJson(flacAudio));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import 'package:PiliPlus/grpc/dm.dart';
|
|||||||
import 'package:PiliPlus/http/loading_state.dart';
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
import 'package:PiliPlus/plugin/pl_player/controller.dart';
|
import 'package:PiliPlus/plugin/pl_player/controller.dart';
|
||||||
import 'package:PiliPlus/plugin/pl_player/models/data_source.dart';
|
import 'package:PiliPlus/plugin/pl_player/models/data_source.dart';
|
||||||
import 'package:PiliPlus/plugin/pl_player/utils/danmaku_options.dart';
|
|
||||||
import 'package:PiliPlus/utils/accounts.dart';
|
import 'package:PiliPlus/utils/accounts.dart';
|
||||||
import 'package:PiliPlus/utils/path_utils.dart';
|
import 'package:PiliPlus/utils/path_utils.dart';
|
||||||
import 'package:PiliPlus/utils/utils.dart';
|
import 'package:PiliPlus/utils/utils.dart';
|
||||||
@@ -68,8 +67,8 @@ class PlDanmakuController {
|
|||||||
if (elems.isEmpty) return;
|
if (elems.isEmpty) return;
|
||||||
final uniques = HashMap<String, DanmakuElem>();
|
final uniques = HashMap<String, DanmakuElem>();
|
||||||
|
|
||||||
final shouldFilter = _plPlayerController.filters.count != 0;
|
final filters = _plPlayerController.filters;
|
||||||
final danmakuWeight = DanmakuOptions.danmakuWeight;
|
final shouldFilter = filters.count != 0;
|
||||||
for (final element in elems) {
|
for (final element in elems) {
|
||||||
if (_isLogin) {
|
if (_isLogin) {
|
||||||
element.isSelf = element.midHash == _plPlayerController.midHash;
|
element.isSelf = element.midHash == _plPlayerController.midHash;
|
||||||
@@ -86,8 +85,7 @@ class PlDanmakuController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (element.weight < danmakuWeight ||
|
if (shouldFilter && filters.remove(element)) {
|
||||||
(shouldFilter && _plPlayerController.filters.remove(element))) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
import 'dart:typed_data';
|
|
||||||
import 'dart:ui';
|
|
||||||
|
|
||||||
import 'package:PiliPlus/common/constants.dart';
|
import 'package:PiliPlus/common/constants.dart';
|
||||||
import 'package:PiliPlus/common/widgets/button/icon_button.dart';
|
import 'package:PiliPlus/common/widgets/button/icon_button.dart';
|
||||||
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
|
||||||
@@ -292,14 +289,15 @@ class _SavePanelState extends State<SavePanel> {
|
|||||||
}
|
}
|
||||||
SmartDialog.showLoading();
|
SmartDialog.showLoading();
|
||||||
try {
|
try {
|
||||||
RenderRepaintBoundary boundary =
|
final boundary =
|
||||||
boundaryKey.currentContext!.findRenderObject()
|
boundaryKey.currentContext!.findRenderObject()
|
||||||
as RenderRepaintBoundary;
|
as RenderRepaintBoundary;
|
||||||
final image = await boundary.toImage(pixelRatio: 3);
|
final image = await boundary.toImage(pixelRatio: 3);
|
||||||
ByteData? byteData = await image.toByteData(format: ImageByteFormat.png);
|
final byteData = await image.toByteData(format: .png);
|
||||||
Uint8List pngBytes = byteData!.buffer.asUint8List();
|
image.dispose();
|
||||||
String picName =
|
final pngBytes = byteData!.buffer.asUint8List();
|
||||||
"${Constants.appName}_${DateFormat('yyyyMMddHHmmss').format(DateTime.now())}";
|
final picName =
|
||||||
|
"${Constants.appName}_${itemType}_${DateFormat('yyyyMMddHHmmss').format(DateTime.now())}";
|
||||||
if (isShare) {
|
if (isShare) {
|
||||||
Get.back();
|
Get.back();
|
||||||
SmartDialog.dismiss();
|
SmartDialog.dismiss();
|
||||||
@@ -350,8 +348,7 @@ class _SavePanelState extends State<SavePanel> {
|
|||||||
top: 12 + padding.top,
|
top: 12 + padding.top,
|
||||||
bottom: 80 + padding.bottom,
|
bottom: 80 + padding.bottom,
|
||||||
),
|
),
|
||||||
child: GestureDetector(
|
child: Listener(
|
||||||
onTap: () {},
|
|
||||||
child: Container(
|
child: Container(
|
||||||
width: maxWidth,
|
width: maxWidth,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||||
@@ -361,7 +358,7 @@ class _SavePanelState extends State<SavePanel> {
|
|||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: theme.colorScheme.surface,
|
color: theme.colorScheme.surface,
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
borderRadius: const .all(.circular(12)),
|
||||||
),
|
),
|
||||||
child: AnimatedSize(
|
child: AnimatedSize(
|
||||||
curve: Curves.easeInOut,
|
curve: Curves.easeInOut,
|
||||||
@@ -393,40 +390,33 @@ class _SavePanelState extends State<SavePanel> {
|
|||||||
Container(
|
Container(
|
||||||
height: 81,
|
height: 81,
|
||||||
clipBehavior: Clip.hardEdge,
|
clipBehavior: Clip.hardEdge,
|
||||||
margin: const EdgeInsets.symmetric(
|
margin: const .symmetric(horizontal: 12),
|
||||||
horizontal: 12,
|
padding: const .all(8),
|
||||||
),
|
|
||||||
padding: const EdgeInsets.all(8),
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: theme.colorScheme.onInverseSurface,
|
color: theme.colorScheme.onInverseSurface,
|
||||||
borderRadius: const BorderRadius.all(
|
borderRadius: const .all(.circular(8)),
|
||||||
Radius.circular(8),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
NetworkImgLayer(
|
NetworkImgLayer(
|
||||||
src: cover!,
|
src: cover!,
|
||||||
height: coverSize,
|
height: coverSize,
|
||||||
width: coverType == _CoverType.def16_9
|
width: coverType == .def16_9
|
||||||
? coverSize *
|
? coverSize *
|
||||||
StyleString.aspectRatio16x9
|
StyleString.aspectRatio16x9
|
||||||
: coverSize,
|
: coverSize,
|
||||||
quality: 100,
|
quality: 100,
|
||||||
borderRadius: const BorderRadius.all(
|
borderRadius: const .all(.circular(6)),
|
||||||
Radius.circular(6),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(width: 10),
|
const SizedBox(width: 10),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment: .start,
|
||||||
CrossAxisAlignment.start,
|
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'$title\n',
|
'$title\n',
|
||||||
maxLines: 2,
|
maxLines: 2,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: .ellipsis,
|
||||||
),
|
),
|
||||||
if (pubdate != null) ...[
|
if (pubdate != null) ...[
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
@@ -466,8 +456,7 @@ class _SavePanelState extends State<SavePanel> {
|
|||||||
Text(
|
Text(
|
||||||
'@$uname',
|
'@$uname',
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow:
|
overflow: .ellipsis,
|
||||||
TextOverflow.ellipsis,
|
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: theme
|
color: theme
|
||||||
.colorScheme
|
.colorScheme
|
||||||
@@ -485,9 +474,7 @@ class _SavePanelState extends State<SavePanel> {
|
|||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
DateFormatUtils.longFormatDs
|
DateFormatUtils.longFormatDs
|
||||||
.format(
|
.format(.now()),
|
||||||
DateTime.now(),
|
|
||||||
),
|
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.end,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 13,
|
fontSize: 13,
|
||||||
@@ -504,12 +491,8 @@ class _SavePanelState extends State<SavePanel> {
|
|||||||
child: Container(
|
child: Container(
|
||||||
width: 88,
|
width: 88,
|
||||||
height: 88,
|
height: 88,
|
||||||
margin: const EdgeInsets.all(
|
margin: const .all(12),
|
||||||
12,
|
padding: const .all(3),
|
||||||
),
|
|
||||||
padding: const EdgeInsets.all(
|
|
||||||
3,
|
|
||||||
),
|
|
||||||
color: theme.brightness.isDark
|
color: theme.brightness.isDark
|
||||||
? Colors.white
|
? Colors.white
|
||||||
: theme.colorScheme.surface,
|
: theme.colorScheme.surface,
|
||||||
|
|||||||
@@ -357,7 +357,6 @@ class _SearchPageState extends State<SearchPage> {
|
|||||||
runSpacing: 8,
|
runSpacing: 8,
|
||||||
delegate: SliverChildBuilderDelegate(
|
delegate: SliverChildBuilderDelegate(
|
||||||
addAutomaticKeepAlives: false,
|
addAutomaticKeepAlives: false,
|
||||||
addRepaintBoundaries: false,
|
|
||||||
childCount: list.length,
|
childCount: list.length,
|
||||||
(context, index) => SearchText(
|
(context, index) => SearchText(
|
||||||
text: list[index],
|
text: list[index],
|
||||||
|
|||||||
@@ -202,9 +202,9 @@ mixin HeaderMixin<T extends StatefulWidget> on State<T> {
|
|||||||
data: sliderTheme,
|
data: sliderTheme,
|
||||||
child: Slider(
|
child: Slider(
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 10,
|
max: 11,
|
||||||
value: DanmakuOptions.danmakuWeight.toDouble(),
|
value: DanmakuOptions.danmakuWeight.toDouble(),
|
||||||
divisions: 10,
|
divisions: 11,
|
||||||
label: DanmakuOptions.danmakuWeight.toString(),
|
label: DanmakuOptions.danmakuWeight.toString(),
|
||||||
onChanged: updateDanmakuWeight,
|
onChanged: updateDanmakuWeight,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import 'dart:ui' as ui;
|
|||||||
import 'package:PiliPlus/common/constants.dart';
|
import 'package:PiliPlus/common/constants.dart';
|
||||||
import 'package:PiliPlus/http/browser_ua.dart';
|
import 'package:PiliPlus/http/browser_ua.dart';
|
||||||
import 'package:PiliPlus/http/constants.dart';
|
import 'package:PiliPlus/http/constants.dart';
|
||||||
import 'package:PiliPlus/http/init.dart';
|
|
||||||
import 'package:PiliPlus/http/loading_state.dart';
|
import 'package:PiliPlus/http/loading_state.dart';
|
||||||
import 'package:PiliPlus/http/video.dart';
|
import 'package:PiliPlus/http/video.dart';
|
||||||
import 'package:PiliPlus/models/common/account_type.dart';
|
import 'package:PiliPlus/models/common/account_type.dart';
|
||||||
@@ -47,7 +46,6 @@ import 'package:PiliPlus/utils/storage_pref.dart';
|
|||||||
import 'package:PiliPlus/utils/utils.dart';
|
import 'package:PiliPlus/utils/utils.dart';
|
||||||
import 'package:archive/archive.dart' show getCrc32;
|
import 'package:archive/archive.dart' show getCrc32;
|
||||||
import 'package:canvas_danmaku/canvas_danmaku.dart';
|
import 'package:canvas_danmaku/canvas_danmaku.dart';
|
||||||
import 'package:dio/dio.dart' show Options;
|
|
||||||
import 'package:easy_debounce/easy_throttle.dart';
|
import 'package:easy_debounce/easy_throttle.dart';
|
||||||
import 'package:floating/floating.dart';
|
import 'package:floating/floating.dart';
|
||||||
import 'package:flutter/foundation.dart' show kDebugMode;
|
import 'package:flutter/foundation.dart' show kDebugMode;
|
||||||
@@ -1659,34 +1657,7 @@ class PlPlayerController with BlockConfigMixin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getVideoShot() async {
|
Future<void> getVideoShot() async {
|
||||||
try {
|
videoShot = await VideoHttp.videoshot(bvid: bvid, cid: cid!);
|
||||||
final res = await Request().get(
|
|
||||||
'/x/player/videoshot',
|
|
||||||
queryParameters: {
|
|
||||||
// 'aid': IdUtils.bv2av(_bvid),
|
|
||||||
'bvid': _bvid,
|
|
||||||
'cid': cid,
|
|
||||||
'index': 1,
|
|
||||||
},
|
|
||||||
options: Options(
|
|
||||||
headers: {
|
|
||||||
'user-agent': BrowserUa.pc,
|
|
||||||
'referer': 'https://www.bilibili.com/video/$bvid',
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
if (res.data['code'] == 0) {
|
|
||||||
final data = VideoShotData.fromJson(res.data['data']);
|
|
||||||
if (data.index.isNotEmpty) {
|
|
||||||
videoShot = Success(data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
videoShot = const Error(null);
|
|
||||||
} catch (e) {
|
|
||||||
videoShot = const Error(null);
|
|
||||||
if (kDebugMode) debugPrint('getVideoShot: $e');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void takeScreenshot() {
|
void takeScreenshot() {
|
||||||
|
|||||||
Reference in New Issue
Block a user