mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 03:06:59 +08:00
refa: danmaku & feat: scroll fixed velocity (#1791)
This commit is contained in:
committed by
GitHub
parent
0a40d11133
commit
49b7ea14c3
@@ -25,13 +25,13 @@ import 'package:PiliPlus/models_new/video/video_play_info/subtitle.dart';
|
||||
import 'package:PiliPlus/pages/common/common_intro_controller.dart';
|
||||
import 'package:PiliPlus/pages/danmaku/danmaku_model.dart';
|
||||
import 'package:PiliPlus/pages/setting/widgets/select_dialog.dart';
|
||||
import 'package:PiliPlus/pages/setting/widgets/switch_item.dart';
|
||||
import 'package:PiliPlus/pages/video/controller.dart';
|
||||
import 'package:PiliPlus/pages/video/introduction/local/controller.dart';
|
||||
import 'package:PiliPlus/pages/video/introduction/pgc/controller.dart';
|
||||
import 'package:PiliPlus/pages/video/introduction/ugc/controller.dart';
|
||||
import 'package:PiliPlus/pages/video/introduction/ugc/widgets/action_item.dart';
|
||||
import 'package:PiliPlus/pages/video/introduction/ugc/widgets/menu_row.dart';
|
||||
import 'package:PiliPlus/pages/video/widgets/header_mixin.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/controller.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/models/play_repeat.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/utils/fullscreen.dart';
|
||||
@@ -169,636 +169,6 @@ mixin TimeBatteryMixin<T extends StatefulWidget> on State<T> {
|
||||
}
|
||||
}
|
||||
|
||||
mixin HeaderMixin<T extends StatefulWidget> on State<T> {
|
||||
PlPlayerController get plPlayerController;
|
||||
|
||||
bool get isFullScreen => plPlayerController.isFullScreen.value;
|
||||
|
||||
void showBottomSheet(StatefulWidgetBuilder builder, {double? padding}) {
|
||||
PageUtils.showVideoBottomSheet(
|
||||
context,
|
||||
isFullScreen: () => isFullScreen,
|
||||
padding: padding,
|
||||
child: StatefulBuilder(
|
||||
builder: (context, setState) => plPlayerController.darkVideoPage
|
||||
? Theme(
|
||||
data: Theme.of(this.context),
|
||||
child: builder(this.context, setState),
|
||||
)
|
||||
: builder(context, setState),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget resetBtn(
|
||||
ThemeData theme,
|
||||
Object def,
|
||||
VoidCallback onPressed, {
|
||||
bool isDanmaku = true,
|
||||
}) {
|
||||
return iconButton(
|
||||
tooltip: '默认值: $def',
|
||||
icon: const Icon(Icons.refresh),
|
||||
onPressed: () {
|
||||
onPressed();
|
||||
if (isDanmaku) {
|
||||
plPlayerController.putDanmakuSettings();
|
||||
} else {
|
||||
plPlayerController.putSubtitleSettings();
|
||||
}
|
||||
},
|
||||
iconColor: theme.colorScheme.outline,
|
||||
size: 24,
|
||||
iconSize: 24,
|
||||
);
|
||||
}
|
||||
|
||||
/// 弹幕功能
|
||||
void showSetDanmaku({bool isLive = false}) {
|
||||
// 屏蔽类型
|
||||
const blockTypesList = [
|
||||
(value: 2, label: '滚动'),
|
||||
(value: 5, label: '顶部'),
|
||||
(value: 4, label: '底部'),
|
||||
(value: 6, label: '彩色'),
|
||||
(value: 7, label: '高级'),
|
||||
];
|
||||
final blockTypes = plPlayerController.blockTypes;
|
||||
// 智能云屏蔽
|
||||
int danmakuWeight = plPlayerController.danmakuWeight;
|
||||
// 显示区域
|
||||
double showArea = plPlayerController.showArea;
|
||||
// 不透明度
|
||||
double danmakuOpacity = plPlayerController.danmakuOpacity.value;
|
||||
// 字体大小
|
||||
double danmakuFontScale = plPlayerController.danmakuFontScale;
|
||||
// 全屏字体大小
|
||||
double danmakuFontScaleFS = plPlayerController.danmakuFontScaleFS;
|
||||
double danmakuLineHeight = plPlayerController.danmakuLineHeight;
|
||||
// 弹幕速度
|
||||
double danmakuDuration = plPlayerController.danmakuDuration;
|
||||
double danmakuStaticDuration = plPlayerController.danmakuStaticDuration;
|
||||
// 弹幕描边
|
||||
double danmakuStrokeWidth = plPlayerController.danmakuStrokeWidth;
|
||||
// 字体粗细
|
||||
int danmakuFontWeight = plPlayerController.danmakuFontWeight;
|
||||
bool massiveMode = plPlayerController.massiveMode;
|
||||
|
||||
final DanmakuController<DanmakuExtra>? danmakuController =
|
||||
plPlayerController.danmakuController;
|
||||
|
||||
final isFullScreen = this.isFullScreen;
|
||||
|
||||
showBottomSheet(
|
||||
(context, setState) {
|
||||
final theme = Theme.of(context);
|
||||
|
||||
final sliderTheme = SliderThemeData(
|
||||
trackHeight: 10,
|
||||
trackShape: const MSliderTrackShape(),
|
||||
thumbColor: theme.colorScheme.primary,
|
||||
activeTrackColor: theme.colorScheme.primary,
|
||||
inactiveTrackColor: theme.colorScheme.onInverseSurface,
|
||||
thumbShape: const RoundSliderThumbShape(enabledThumbRadius: 6.0),
|
||||
);
|
||||
|
||||
void updateLineHeight(double val) {
|
||||
plPlayerController.danmakuLineHeight = danmakuLineHeight = val
|
||||
.toPrecision(1);
|
||||
setState(() {});
|
||||
try {
|
||||
danmakuController?.updateOption(
|
||||
danmakuController.option.copyWith(
|
||||
lineHeight: danmakuLineHeight,
|
||||
),
|
||||
);
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
void updateDuration(double val) {
|
||||
plPlayerController.danmakuDuration = danmakuDuration = val
|
||||
.toPrecision(1);
|
||||
setState(() {});
|
||||
try {
|
||||
danmakuController?.updateOption(
|
||||
danmakuController.option.copyWith(
|
||||
duration: danmakuDuration / plPlayerController.playbackSpeed,
|
||||
),
|
||||
);
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
void updateStaticDuration(double val) {
|
||||
plPlayerController.danmakuStaticDuration = danmakuStaticDuration = val
|
||||
.toPrecision(1);
|
||||
setState(() {});
|
||||
try {
|
||||
danmakuController?.updateOption(
|
||||
danmakuController.option.copyWith(
|
||||
staticDuration:
|
||||
danmakuStaticDuration / plPlayerController.playbackSpeed,
|
||||
),
|
||||
);
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
void updateFontSizeFS(double val) {
|
||||
plPlayerController.danmakuFontScaleFS = danmakuFontScaleFS = val;
|
||||
setState(() {});
|
||||
if (isFullScreen) {
|
||||
try {
|
||||
danmakuController?.updateOption(
|
||||
danmakuController.option.copyWith(
|
||||
fontSize: (15 * danmakuFontScaleFS).toDouble(),
|
||||
),
|
||||
);
|
||||
} catch (_) {}
|
||||
}
|
||||
}
|
||||
|
||||
void updateFontSize(double val) {
|
||||
plPlayerController.danmakuFontScale = danmakuFontScale = val;
|
||||
setState(() {});
|
||||
if (!isFullScreen) {
|
||||
try {
|
||||
danmakuController?.updateOption(
|
||||
danmakuController.option.copyWith(
|
||||
fontSize: (15 * danmakuFontScale).toDouble(),
|
||||
),
|
||||
);
|
||||
} catch (_) {}
|
||||
}
|
||||
}
|
||||
|
||||
void updateStrokeWidth(double val) {
|
||||
plPlayerController.danmakuStrokeWidth = danmakuStrokeWidth = val;
|
||||
setState(() {});
|
||||
try {
|
||||
danmakuController?.updateOption(
|
||||
danmakuController.option.copyWith(
|
||||
strokeWidth: danmakuStrokeWidth,
|
||||
),
|
||||
);
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
void updateFontWeight(double val) {
|
||||
plPlayerController.danmakuFontWeight = danmakuFontWeight = val
|
||||
.toInt();
|
||||
setState(() {});
|
||||
try {
|
||||
danmakuController?.updateOption(
|
||||
danmakuController.option.copyWith(fontWeight: danmakuFontWeight),
|
||||
);
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
void updateOpacity(double val) {
|
||||
plPlayerController.danmakuOpacity.value = danmakuOpacity = val;
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
void updateShowArea(double val) {
|
||||
plPlayerController.showArea = showArea = val.toPrecision(1);
|
||||
setState(() {});
|
||||
try {
|
||||
danmakuController?.updateOption(
|
||||
danmakuController.option.copyWith(area: showArea),
|
||||
);
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
void updateDanmakuWeight(double val) {
|
||||
plPlayerController.danmakuWeight = danmakuWeight = val.toInt();
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
void onUpdateBlockType(int blockType, bool blocked) {
|
||||
if (blocked) {
|
||||
blockTypes.remove(blockType);
|
||||
} else {
|
||||
blockTypes.add(blockType);
|
||||
}
|
||||
plPlayerController
|
||||
..blockTypes = blockTypes
|
||||
..blockColorful = blockTypes.contains(6)
|
||||
..putDanmakuSettings();
|
||||
setState(() {});
|
||||
try {
|
||||
danmakuController?.updateOption(
|
||||
danmakuController.option.copyWith(
|
||||
hideTop: blockTypes.contains(5),
|
||||
hideBottom: blockTypes.contains(4),
|
||||
hideScroll: blockTypes.contains(2),
|
||||
hideSpecial: blockTypes.contains(7),
|
||||
// 添加或修改其他需要修改的选项属性
|
||||
),
|
||||
);
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Material(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
color: theme.colorScheme.surface,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14),
|
||||
child: ListView(
|
||||
padding: EdgeInsets.zero,
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 45,
|
||||
child: Center(
|
||||
child: Text('弹幕设置', style: TextStyle(fontSize: 14)),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
if (!isLive) ...[
|
||||
Row(
|
||||
children: [
|
||||
Text('智能云屏蔽 $danmakuWeight 级'),
|
||||
const Spacer(),
|
||||
TextButton(
|
||||
style: TextButton.styleFrom(
|
||||
padding: EdgeInsets.zero,
|
||||
minimumSize: Size.zero,
|
||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||
),
|
||||
onPressed: () => Get
|
||||
..back()
|
||||
..toNamed(
|
||||
'/danmakuBlock',
|
||||
arguments: plPlayerController,
|
||||
),
|
||||
child: Text(
|
||||
"屏蔽管理(${plPlayerController.filters.count})",
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 0,
|
||||
bottom: 6,
|
||||
left: 10,
|
||||
right: 10,
|
||||
),
|
||||
child: SliderTheme(
|
||||
data: sliderTheme,
|
||||
child: Slider(
|
||||
min: 0,
|
||||
max: 10,
|
||||
value: danmakuWeight.toDouble(),
|
||||
divisions: 10,
|
||||
label: '$danmakuWeight',
|
||||
onChanged: updateDanmakuWeight,
|
||||
onChangeEnd: (_) =>
|
||||
plPlayerController.putDanmakuSettings(),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
const Text('按类型屏蔽'),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 12),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
spacing: 10,
|
||||
children: blockTypesList.map(
|
||||
(e) {
|
||||
final blocked = blockTypes.contains(e.value);
|
||||
return ActionRowLineItem(
|
||||
onTap: () => onUpdateBlockType(e.value, blocked),
|
||||
text: e.label,
|
||||
selectStatus: blocked,
|
||||
);
|
||||
},
|
||||
).toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
SetSwitchItem(
|
||||
title: '海量弹幕',
|
||||
contentPadding: EdgeInsets.zero,
|
||||
titleStyle: const TextStyle(fontSize: 14),
|
||||
defaultVal: massiveMode,
|
||||
setKey: SettingBoxKey.danmakuMassiveMode,
|
||||
onChanged: (value) {
|
||||
massiveMode = value;
|
||||
plPlayerController.massiveMode = value;
|
||||
setState(() {});
|
||||
try {
|
||||
danmakuController?.updateOption(
|
||||
danmakuController.option.copyWith(massiveMode: value),
|
||||
);
|
||||
} catch (_) {}
|
||||
},
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text('显示区域 ${showArea * 100}%'),
|
||||
resetBtn(
|
||||
theme,
|
||||
'50.0%',
|
||||
() => updateShowArea(0.5),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 0,
|
||||
bottom: 6,
|
||||
left: 10,
|
||||
right: 10,
|
||||
),
|
||||
child: SliderTheme(
|
||||
data: sliderTheme,
|
||||
child: Slider(
|
||||
min: 0.1,
|
||||
max: 1,
|
||||
value: showArea,
|
||||
divisions: 9,
|
||||
label: '${showArea * 100}%',
|
||||
onChanged: updateShowArea,
|
||||
onChangeEnd: (_) =>
|
||||
plPlayerController.putDanmakuSettings(),
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text('不透明度 ${danmakuOpacity * 100}%'),
|
||||
resetBtn(
|
||||
theme,
|
||||
'100.0%',
|
||||
() => updateOpacity(1.0),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 0,
|
||||
bottom: 6,
|
||||
left: 10,
|
||||
right: 10,
|
||||
),
|
||||
child: SliderTheme(
|
||||
data: sliderTheme,
|
||||
child: Slider(
|
||||
min: 0,
|
||||
max: 1,
|
||||
value: danmakuOpacity,
|
||||
divisions: 10,
|
||||
label: '${danmakuOpacity * 100}%',
|
||||
onChanged: updateOpacity,
|
||||
onChangeEnd: (_) =>
|
||||
plPlayerController.putDanmakuSettings(),
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text('字体粗细 ${danmakuFontWeight + 1}(可能无法精确调节)'),
|
||||
resetBtn(
|
||||
theme,
|
||||
6,
|
||||
() => updateFontWeight(5),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 0,
|
||||
bottom: 6,
|
||||
left: 10,
|
||||
right: 10,
|
||||
),
|
||||
child: SliderTheme(
|
||||
data: sliderTheme,
|
||||
child: Slider(
|
||||
min: 0,
|
||||
max: 8,
|
||||
value: danmakuFontWeight.toDouble(),
|
||||
divisions: 8,
|
||||
label: '${danmakuFontWeight + 1}',
|
||||
onChanged: updateFontWeight,
|
||||
onChangeEnd: (_) =>
|
||||
plPlayerController.putDanmakuSettings(),
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text('描边粗细 $danmakuStrokeWidth'),
|
||||
resetBtn(
|
||||
theme,
|
||||
1.5,
|
||||
() => updateStrokeWidth(1.5),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 0,
|
||||
bottom: 6,
|
||||
left: 10,
|
||||
right: 10,
|
||||
),
|
||||
child: SliderTheme(
|
||||
data: sliderTheme,
|
||||
child: Slider(
|
||||
min: 0,
|
||||
max: 5,
|
||||
value: danmakuStrokeWidth,
|
||||
divisions: 10,
|
||||
label: '$danmakuStrokeWidth',
|
||||
onChanged: updateStrokeWidth,
|
||||
onChangeEnd: (_) =>
|
||||
plPlayerController.putDanmakuSettings(),
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'字体大小 ${(danmakuFontScale * 100).toStringAsFixed(1)}%',
|
||||
),
|
||||
resetBtn(
|
||||
theme,
|
||||
'100.0%',
|
||||
() => updateFontSize(1.0),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 0,
|
||||
bottom: 6,
|
||||
left: 10,
|
||||
right: 10,
|
||||
),
|
||||
child: SliderTheme(
|
||||
data: sliderTheme,
|
||||
child: Slider(
|
||||
min: 0.5,
|
||||
max: 2.5,
|
||||
value: danmakuFontScale,
|
||||
divisions: 20,
|
||||
label:
|
||||
'${(danmakuFontScale * 100).toStringAsFixed(1)}%',
|
||||
onChanged: updateFontSize,
|
||||
onChangeEnd: (_) =>
|
||||
plPlayerController.putDanmakuSettings(),
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'全屏字体大小 ${(danmakuFontScaleFS * 100).toStringAsFixed(1)}%',
|
||||
),
|
||||
resetBtn(
|
||||
theme,
|
||||
'120.0%',
|
||||
() => updateFontSizeFS(1.2),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 0,
|
||||
bottom: 6,
|
||||
left: 10,
|
||||
right: 10,
|
||||
),
|
||||
child: SliderTheme(
|
||||
data: sliderTheme,
|
||||
child: Slider(
|
||||
min: 0.5,
|
||||
max: 2.5,
|
||||
value: danmakuFontScaleFS,
|
||||
divisions: 20,
|
||||
label:
|
||||
'${(danmakuFontScaleFS * 100).toStringAsFixed(1)}%',
|
||||
onChanged: updateFontSizeFS,
|
||||
onChangeEnd: (_) =>
|
||||
plPlayerController.putDanmakuSettings(),
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text('滚动弹幕时长 $danmakuDuration 秒'),
|
||||
resetBtn(
|
||||
theme,
|
||||
7.0,
|
||||
() => updateDuration(7.0),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 0,
|
||||
bottom: 6,
|
||||
left: 10,
|
||||
right: 10,
|
||||
),
|
||||
child: SliderTheme(
|
||||
data: sliderTheme,
|
||||
child: Slider(
|
||||
min: 1,
|
||||
max: 50,
|
||||
value: danmakuDuration,
|
||||
divisions: 49,
|
||||
label: danmakuDuration.toString(),
|
||||
onChanged: updateDuration,
|
||||
onChangeEnd: (_) =>
|
||||
plPlayerController.putDanmakuSettings(),
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text('静态弹幕时长 $danmakuStaticDuration 秒'),
|
||||
resetBtn(
|
||||
theme,
|
||||
4.0,
|
||||
() => updateStaticDuration(4.0),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 0,
|
||||
bottom: 6,
|
||||
left: 10,
|
||||
right: 10,
|
||||
),
|
||||
child: SliderTheme(
|
||||
data: sliderTheme,
|
||||
child: Slider(
|
||||
min: 1,
|
||||
max: 50,
|
||||
value: danmakuStaticDuration,
|
||||
divisions: 49,
|
||||
label: danmakuStaticDuration.toString(),
|
||||
onChanged: updateStaticDuration,
|
||||
onChangeEnd: (_) =>
|
||||
plPlayerController.putDanmakuSettings(),
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text('弹幕行高 $danmakuLineHeight'),
|
||||
resetBtn(
|
||||
theme,
|
||||
1.6,
|
||||
() => updateLineHeight(1.6),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 0,
|
||||
bottom: 6,
|
||||
left: 10,
|
||||
right: 10,
|
||||
),
|
||||
child: SliderTheme(
|
||||
data: sliderTheme,
|
||||
child: Slider(
|
||||
min: 1.0,
|
||||
max: 3.0,
|
||||
value: danmakuLineHeight,
|
||||
onChanged: updateLineHeight,
|
||||
onChangeEnd: (_) =>
|
||||
plPlayerController.putDanmakuSettings(),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class HeaderControl extends StatefulWidget {
|
||||
const HeaderControl({
|
||||
required this.isPortrait,
|
||||
@@ -2298,9 +1668,9 @@ class HeaderControlState extends State<HeaderControl>
|
||||
bgColor: theme.colorScheme.surface,
|
||||
),
|
||||
),
|
||||
?_buildDanmakuList(ctr.staticDanmaku),
|
||||
?_buildDanmakuList(ctr.scrollDanmaku),
|
||||
?_buildDanmakuList(ctr.specialDanmaku),
|
||||
?_buildDanmakuList(ctr.staticDanmaku.nonNulls.toList()),
|
||||
?_buildDanmakuList(ctr.scrollDanmaku.expand((e) => e).toList()),
|
||||
?_buildDanmakuList(ctr.specialDanmaku.toList()),
|
||||
const SliverToBoxAdapter(child: SizedBox(height: 12)),
|
||||
],
|
||||
),
|
||||
@@ -2311,7 +1681,6 @@ class HeaderControlState extends State<HeaderControl>
|
||||
|
||||
Widget? _buildDanmakuList(List<DanmakuItem<DanmakuExtra>> list) {
|
||||
if (list.isEmpty) return null;
|
||||
list = List.of(list);
|
||||
|
||||
return SliverList.builder(
|
||||
itemCount: list.length,
|
||||
@@ -2972,23 +2341,3 @@ class HeaderControlState extends State<HeaderControl>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MSliderTrackShape extends RoundedRectSliderTrackShape {
|
||||
const MSliderTrackShape();
|
||||
|
||||
@override
|
||||
Rect getPreferredRect({
|
||||
required RenderBox parentBox,
|
||||
Offset offset = Offset.zero,
|
||||
SliderThemeData? sliderTheme,
|
||||
bool isEnabled = false,
|
||||
bool isDiscrete = false,
|
||||
}) {
|
||||
const double trackHeight = 3;
|
||||
final double trackLeft = offset.dx;
|
||||
final double trackTop =
|
||||
offset.dy + (parentBox.size.height - trackHeight) / 2 + 4;
|
||||
final double trackWidth = parentBox.size.width;
|
||||
return Rect.fromLTWH(trackLeft, trackTop, trackWidth, trackHeight);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user