Skip to content
This repository was archived by the owner on Jul 17, 2025. It is now read-only.

Commit 0965952

Browse files
committed
feat: 继续调整弹出层,弹幕新增屏蔽类型转滚动
1 parent ddd48fb commit 0965952

File tree

21 files changed

+423
-306
lines changed

21 files changed

+423
-306
lines changed

lib/common/widgets/video_card_v.dart

Lines changed: 63 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -147,70 +147,72 @@ class VideoCardV extends StatelessWidget {
147147
CustomSemanticsAction(label: item.title): item.onTap!,
148148
},
149149
child: Card(
150-
elevation: 0,
151-
clipBehavior: Clip.hardEdge,
152-
margin: EdgeInsets.zero,
153-
child: GestureDetector(
154-
onLongPress: () {
155-
// longPress!();
156-
},
157-
child: InkWell(
158-
onTap: () async => onPushDetail(heroTag),
159-
child: Column(
160-
children: [
161-
AspectRatio(
162-
aspectRatio: StyleString.aspectRatio,
163-
child: LayoutBuilder(builder: (context, boxConstraints) {
164-
double maxWidth = boxConstraints.maxWidth;
165-
double maxHeight = boxConstraints.maxHeight;
166-
// print('heroTagV: $heroTag');
167-
return Stack(
168-
children: [
169-
GestureDetector (
170-
onLongPress: () {
171-
// 弹窗显示封面
172-
SmartDialog.show(
173-
useSystem: true,
174-
alignment: Alignment.center,
175-
builder: (BuildContext context) {
176-
return OverlayPop(
177-
videoItem: videoItem,
178-
closeFn: () {
179-
SmartDialog.dismiss();
180-
},
181-
);
182-
},
183-
);
184-
},
185-
behavior: HitTestBehavior.translucent,
186-
child: Hero(
187-
tag: heroTag,
188-
child: NetworkImgLayer(
189-
src: videoItem.pic,
190-
width: maxWidth,
191-
height: maxHeight,
192-
),
150+
color: Theme.of(context).colorScheme.surface.withOpacity(0.4),
151+
elevation: 0,
152+
clipBehavior: Clip.hardEdge,
153+
margin: EdgeInsets.zero,
154+
child: GestureDetector(
155+
onLongPress: () {
156+
// longPress!();
157+
},
158+
child: InkWell(
159+
onTap: () async => onPushDetail(heroTag),
160+
child: Column(
161+
children: [
162+
AspectRatio(
163+
aspectRatio: StyleString.aspectRatio,
164+
child: LayoutBuilder(builder: (context, boxConstraints) {
165+
double maxWidth = boxConstraints.maxWidth;
166+
double maxHeight = boxConstraints.maxHeight;
167+
// print('heroTagV: $heroTag');
168+
return Stack(
169+
children: [
170+
GestureDetector(
171+
onLongPress: () {
172+
// 弹窗显示封面
173+
SmartDialog.show(
174+
useSystem: true,
175+
alignment: Alignment.center,
176+
builder: (BuildContext context) {
177+
return OverlayPop(
178+
videoItem: videoItem,
179+
closeFn: () {
180+
SmartDialog.dismiss();
181+
},
182+
);
183+
},
184+
);
185+
},
186+
behavior: HitTestBehavior.translucent,
187+
child: Hero(
188+
tag: heroTag,
189+
child: NetworkImgLayer(
190+
src: videoItem.pic,
191+
width: maxWidth,
192+
height: maxHeight,
193193
),
194194
),
195-
if (videoItem.duration > 0)
196-
PBadge(
197-
bottom: 6,
198-
right: 7,
199-
size: 'small',
200-
type: 'gray',
201-
text: Utils.timeFormat(videoItem.duration),
202-
// semanticsLabel:
203-
// '时长${Utils.durationReadFormat(Utils.timeFormat(videoItem.duration))}',
204-
)
205-
],
206-
);
207-
}),
208-
),
209-
VideoContent(videoItem: videoItem)
210-
],
211-
),
195+
),
196+
if (videoItem.duration > 0)
197+
PBadge(
198+
bottom: 6,
199+
right: 7,
200+
size: 'small',
201+
type: 'gray',
202+
text: Utils.timeFormat(videoItem.duration),
203+
// semanticsLabel:
204+
// '时长${Utils.durationReadFormat(Utils.timeFormat(videoItem.duration))}',
205+
)
206+
],
207+
);
208+
}),
209+
),
210+
VideoContent(videoItem: videoItem)
211+
],
212212
),
213-
)),
213+
),
214+
),
215+
),
214216
),
215217
if (videoItem.goto == 'av')
216218
Positioned(

lib/pages/danmaku/controller.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ class PlDanmakuController {
88
final int cid;
99
static int danmakuWeight = 0;
1010
static List<Map<String, dynamic>> danmakuFilter = [];
11+
// 按类型屏蔽弹幕转为滚动弹幕
12+
static bool convertToScrollDanmaku = true;
1113
PlDanmakuController(this.cid) {
1214
refresh();
1315
}
@@ -27,6 +29,8 @@ class PlDanmakuController {
2729
defaultValue: []).map<Map<String, dynamic>>((e) {
2830
return Map<String, dynamic>.from(e);
2931
}).toList();
32+
convertToScrollDanmaku = GStorage.setting
33+
.get(SettingBoxKey.convertToScrollDanmaku, defaultValue: true);
3034
}
3135

3236
void initiate(int videoDuration, int progress) {
@@ -61,10 +65,9 @@ class PlDanmakuController {
6165
if (result.elems.isNotEmpty) {
6266
for (var element in result.elems) {
6367
int pos = element.progress ~/ 100; //每0.1秒存储一次
64-
if (dmSegMap[pos] == null) {
65-
dmSegMap[pos] = [];
66-
}
67-
dmSegMap[pos]!.add(element);
68+
dmSegMap[pos] ??= [];
69+
int i = dmSegMap[pos]!.indexWhere((e) => element.weight > e.weight);
70+
(i > 0 ? dmSegMap[pos]!.insert : dmSegMap[pos]!.add)(i, element);
6871
}
6972
}
7073
}

lib/pages/danmaku/view.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,20 @@ class _PlDanmakuState extends State<PlDanmaku> {
102102
Color? defaultColor = playerController.blockTypes.contains(6)
103103
? Colors.white //DmUtils.decimalToColor(16777215)
104104
: null;
105+
DanmakuItemType convertType(int type) {
106+
if (PlDanmakuController.convertToScrollDanmaku &&
107+
playerController.blockTypes.contains(type)) {
108+
return DanmakuItemType.scroll;
109+
} else {
110+
return DmUtils.getPosition(type);
111+
}
112+
}
113+
105114
currentDanmakuList
106115
.map((e) => _controller!.addDanmaku(DanmakuContentItem(
107116
e.content,
108117
color: defaultColor ?? DmUtils.decimalToColor(e.color),
109-
type: DmUtils.getPosition(e.mode),
118+
type: convertType(e.mode),
110119
)))
111120
.toList();
112121
}

lib/pages/dynamics/widgets/forward_panel.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ Widget forWard(item, context, ctr, source, {floor = 1}) {
159159
pics = item.modules.moduleDynamic.major.opus.pics;
160160
}
161161
InlineSpan? richNodes = richNode(item, context);
162-
print(item.type);
162+
// print(item.type);
163163
switch (item.type) {
164164
// 图文
165165
case 'DYNAMIC_TYPE_DRAW':
@@ -358,7 +358,8 @@ Widget forWard(item, context, ctr, source, {floor = 1}) {
358358
height: 50,
359359
),
360360
const SizedBox(width: 10),
361-
Column(
361+
Expanded(
362+
child: Column(
362363
crossAxisAlignment: CrossAxisAlignment.start,
363364
children: [
364365
Text(
@@ -373,7 +374,7 @@ Widget forWard(item, context, ctr, source, {floor = 1}) {
373374
overflow: TextOverflow.ellipsis,
374375
),
375376
],
376-
)
377+
))
377378
],
378379
));
379380
default:

lib/pages/video/controller.dart

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ class VideoDetailController extends GetxController
6666

6767
RxInt oid = 0.obs;
6868
// 评论id 请求楼中楼评论使用
69-
int fRpid = 0;
69+
// int fRpid = 0;
7070

71-
ReplyItemModel? firstFloor;
71+
// ReplyItemModel? firstFloor;
7272
final scaffoldKey = GlobalKey<ScaffoldState>();
7373
RxString bgCover = ''.obs;
7474
PlPlayerController? plPlayerController;
@@ -170,27 +170,27 @@ class VideoDetailController extends GetxController
170170
}
171171
}
172172

173-
showReplyReplyPanel() {
174-
replyReplyBottomSheetCtr =
175-
scaffoldKey.currentState?.showBottomSheet((BuildContext context) {
176-
// SmartDialog.show(
177-
// alignment: Alignment.bottomRight,
178-
// builder: (context) {
179-
return VideoReplyReplyPanel(
180-
oid: oid.value,
181-
rpid: fRpid,
182-
closePanel: () => {
183-
fRpid = 0,
184-
},
185-
firstFloor: firstFloor,
186-
replyType: ReplyType.video,
187-
source: 'videoDetail',
188-
);
189-
});
190-
replyReplyBottomSheetCtr?.closed.then((value) {
191-
fRpid = 0;
192-
});
193-
}
173+
// showReplyReplyPanel(BuildContext context) {
174+
// // replyReplyBottomSheetCtr =
175+
// // scaffoldKey.currentState?.showBottomSheet((BuildContext context) {
176+
// SmartDialog.showAttach(
177+
// targetContext: context,
178+
// builder: (context) {
179+
// return VideoReplyReplyPanel(
180+
// oid: oid.value,
181+
// rpid: fRpid,
182+
// closePanel: () => {
183+
// fRpid = 0,
184+
// },
185+
// firstFloor: firstFloor,
186+
// replyType: ReplyType.video,
187+
// source: 'videoDetail',
188+
// );
189+
// });
190+
// // replyReplyBottomSheetCtr?.closed.then((value) {
191+
// // fRpid = 0;
192+
// // });
193+
// }
194194

195195
/// 更新画质、音质
196196
/// TODO 继续进度播放

lib/pages/video/introduction/bangumi/view.dart

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,11 @@ class _BangumiInfoState extends State<BangumiInfo> {
167167
// 视频介绍
168168
showIntroDetail() {
169169
feedBack();
170-
showBottomSheet(
171-
context: context,
172-
enableDrag: true,
170+
SmartDialog.show(
171+
alignment: MediaQuery.of(context).orientation == Orientation.portrait
172+
? Alignment.bottomRight
173+
: Alignment.topRight,
174+
useSystem: true,
173175
builder: (BuildContext context) {
174176
return BangumiIntroDetail(bangumiDetail: widget.bangumiDetail!);
175177
},
@@ -382,8 +384,8 @@ class _BangumiInfoState extends State<BangumiInfo> {
382384
mainAxisAlignment: MainAxisAlignment.spaceAround,
383385
children: <Widget>[
384386
Obx(() => ActionItem(
385-
icon: const Icon(Icons.thumb_up_outlined),
386-
selectIcon: const Icon(Icons.thumb_up),
387+
icon: const Icon(Icons.thumb_up_outlined),
388+
selectIcon: const Icon(Icons.thumb_up),
387389
onTap:
388390
handleState(bangumiIntroController.actionLikeVideo),
389391
selectStatus: bangumiIntroController.hasLike.value,

lib/pages/video/introduction/detail/controller.dart

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -682,10 +682,14 @@ class VideoIntroController extends GetxController {
682682

683683
// 设置关注分组
684684
void setFollowGroup() {
685-
Get.bottomSheet(
686-
GroupPanel(mid: videoDetail.value.owner!.mid!),
687-
isScrollControlled: true,
688-
);
685+
SmartDialog.show(
686+
alignment: Get.context?.orientation != Orientation.landscape
687+
? Alignment.bottomRight
688+
: Alignment.topRight,
689+
useSystem: true,
690+
builder: (BuildContext context) {
691+
return GroupPanel(mid: videoDetail.value.owner!.mid!);
692+
});
689693
}
690694

691695
// ai总结

0 commit comments

Comments
 (0)