Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-07-23 16:47:11 +08:00
parent 148e0872b4
commit 418a1e8d39
821 changed files with 29467 additions and 25520 deletions

View File

@@ -98,7 +98,8 @@ class _ActionPanelState extends State<ActionPanel> {
label: Text(
widget.item.modules.moduleStat!.forward!.count != null
? NumUtil.numFormat(
widget.item.modules.moduleStat!.forward!.count)
widget.item.modules.moduleStat!.forward!.count,
)
: '转发',
),
),
@@ -121,7 +122,8 @@ class _ActionPanelState extends State<ActionPanel> {
label: Text(
widget.item.modules.moduleStat!.comment!.count != null
? NumUtil.numFormat(
widget.item.modules.moduleStat!.comment!.count)
widget.item.modules.moduleStat!.comment!.count,
)
: '评论',
),
),
@@ -138,8 +140,9 @@ class _ActionPanelState extends State<ActionPanel> {
color: widget.item.modules.moduleStat!.like!.status!
? primary
: color,
semanticLabel:
widget.item.modules.moduleStat!.like!.status! ? "已赞" : "点赞",
semanticLabel: widget.item.modules.moduleStat!.like!.status!
? "已赞"
: "点赞",
),
style: TextButton.styleFrom(
padding: const EdgeInsets.fromLTRB(15, 0, 15, 0),
@@ -153,11 +156,13 @@ class _ActionPanelState extends State<ActionPanel> {
child: Text(
widget.item.modules.moduleStat!.like!.count != null
? NumUtil.numFormat(
widget.item.modules.moduleStat!.like!.count)
widget.item.modules.moduleStat!.like!.count,
)
: '点赞',
key: ValueKey<String>(
widget.item.modules.moduleStat!.like!.count?.toString() ??
'点赞'),
widget.item.modules.moduleStat!.like!.count?.toString() ??
'点赞',
),
style: TextStyle(
color: widget.item.modules.moduleStat!.like!.status!
? primary
@@ -166,7 +171,7 @@ class _ActionPanelState extends State<ActionPanel> {
),
),
),
)
),
],
);
}

View File

@@ -12,8 +12,12 @@ import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get.dart';
Widget addWidget(ThemeData theme, DynamicItemModel item, BuildContext context,
{floor = 1}) {
Widget addWidget(
ThemeData theme,
DynamicItemModel item,
BuildContext context, {
floor = 1,
}) {
final type = item.modules.moduleDynamic?.additional?.type;
late final Color bgColor = floor == 1
? theme.dividerColor.withValues(alpha: 0.08)
@@ -35,8 +39,10 @@ Widget addWidget(ThemeData theme, DynamicItemModel item, BuildContext context,
? null
: () => PiliScheme.routePushFromUrl(ugc.jumpUrl!),
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 8,
),
child: Row(
children: [
NetworkImgLayer(
@@ -61,7 +67,7 @@ Widget addWidget(ThemeData theme, DynamicItemModel item, BuildContext context,
color: theme.colorScheme.outline,
fontSize: theme.textTheme.labelMedium!.fontSize,
),
)
),
],
),
),
@@ -77,163 +83,182 @@ Widget addWidget(ThemeData theme, DynamicItemModel item, BuildContext context,
late final borderRadius = floor == 1 ? null : StyleString.mdRadius;
return reserve.state != -1
? reserve.title != null
? Padding(
padding: const EdgeInsets.only(top: 6),
child: Material(
color: bgColor,
borderRadius: borderRadius,
child: InkWell(
onTap: () {},
? Padding(
padding: const EdgeInsets.only(top: 6),
child: Material(
color: bgColor,
borderRadius: borderRadius,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 12, vertical: 10),
child: Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
reserve.title!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
const SizedBox(height: 1),
Text.rich(
TextSpan(
style: TextStyle(
color: theme.colorScheme.outline,
fontSize: 13,
),
children: [
if (reserve.desc1?.text?.isNotEmpty ==
true)
TextSpan(text: reserve.desc1!.text),
if (reserve.desc2?.text?.isNotEmpty ==
true)
TextSpan(
child: InkWell(
onTap: () {},
borderRadius: borderRadius,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 10,
),
child: Row(
children: [
Expanded(
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
reserve.title!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
const SizedBox(height: 1),
Text.rich(
TextSpan(
style: TextStyle(
color: theme.colorScheme.outline,
fontSize: 13,
),
children: [
if (reserve
.desc1
?.text
?.isNotEmpty ==
true)
TextSpan(
text: reserve.desc1!.text,
),
if (reserve
.desc2
?.text
?.isNotEmpty ==
true)
TextSpan(
text:
' ${reserve.desc2!.text}'),
if (reserve.desc3?.text?.isNotEmpty ==
true) ...[
const TextSpan(text: '\n'),
WidgetSpan(
alignment:
PlaceholderAlignment.middle,
child: Icon(
size: 17,
Icons.card_giftcard,
color:
theme.colorScheme.primary,
' ${reserve.desc2!.text}',
),
),
TextSpan(
text: ' ${reserve.desc3!.text}',
style: TextStyle(
color:
theme.colorScheme.primary,
if (reserve
.desc3
?.text
?.isNotEmpty ==
true) ...[
const TextSpan(text: '\n'),
WidgetSpan(
alignment:
PlaceholderAlignment.middle,
child: Icon(
size: 17,
Icons.card_giftcard,
color:
theme.colorScheme.primary,
),
),
recognizer:
reserve.desc3!.jumpUrl == null
? null
: (TapGestureRecognizer()
TextSpan(
text: ' ${reserve.desc3!.text}',
style: TextStyle(
color:
theme.colorScheme.primary,
),
recognizer:
reserve.desc3!.jumpUrl ==
null
? null
: (TapGestureRecognizer()
..onTap = () {
Get.toNamed(
'/webview',
parameters: {
'url': reserve
.desc3!
.jumpUrl!
.jumpUrl!,
},
);
}),
),
),
],
],
],
),
),
)
],
],
),
),
),
if (reserve.button != null) ...[
const SizedBox(width: 10),
Builder(
builder: (context) {
final btn = reserve.button!;
final isReserved = btn.status == btn.type;
final bool canJump = btn.jumpUrl != null;
return FilledButton.tonal(
style: FilledButton.styleFrom(
foregroundColor: canJump
? null
: isReserved
? theme.colorScheme.onSurface
.withValues(alpha: 0.38)
: null,
backgroundColor: canJump
? null
: isReserved
? theme.colorScheme.onSurface
.withValues(alpha: 0.12)
: null,
visualDensity: VisualDensity.compact,
padding: const EdgeInsets.symmetric(
horizontal: 16),
tapTargetSize:
MaterialTapTargetSize.shrinkWrap,
),
onPressed: canJump
? () => PiliScheme.routePushFromUrl(
btn.jumpUrl!)
: btn.disable == 1
if (reserve.button != null) ...[
const SizedBox(width: 10),
Builder(
builder: (context) {
final btn = reserve.button!;
final isReserved = btn.status == btn.type;
final bool canJump = btn.jumpUrl != null;
return FilledButton.tonal(
style: FilledButton.styleFrom(
foregroundColor: canJump
? null
: () async {
var res = await DynamicsHttp
.dynReserve(
reserveId: reserve.rid,
curBtnStatus: btn.status,
dynamicIdStr: item.idStr,
reserveTotal:
reserve.reserveTotal,
);
if (res['status']) {
DynReserveData data =
res['data'];
reserve
..desc2?.text =
data.descUpdate
..reserveTotal =
data.reserveUpdate
..button!.status =
data.finalBtnStatus;
if (context.mounted) {
(context as Element?)
?.markNeedsBuild();
}
} else {
SmartDialog.showToast(
res['msg']);
: isReserved
? theme.colorScheme.onSurface
.withValues(alpha: 0.38)
: null,
backgroundColor: canJump
? null
: isReserved
? theme.colorScheme.onSurface
.withValues(alpha: 0.12)
: null,
visualDensity: VisualDensity.compact,
padding: const EdgeInsets.symmetric(
horizontal: 16,
),
tapTargetSize:
MaterialTapTargetSize.shrinkWrap,
),
onPressed: canJump
? () => PiliScheme.routePushFromUrl(
btn.jumpUrl!,
)
: btn.disable == 1
? null
: () async {
var res =
await DynamicsHttp.dynReserve(
reserveId: reserve.rid,
curBtnStatus: btn.status,
dynamicIdStr: item.idStr,
reserveTotal:
reserve.reserveTotal,
);
if (res['status']) {
DynReserveData data =
res['data'];
reserve
..desc2?.text =
data.descUpdate
..reserveTotal =
data.reserveUpdate
..button!.status =
data.finalBtnStatus;
if (context.mounted) {
(context as Element?)
?.markNeedsBuild();
}
},
child: Text(
btn.jumpText != null
? btn.jumpText!
: isReserved
? btn.checkText!
: btn.uncheckText!,
),
);
},
),
} else {
SmartDialog.showToast(
res['msg'],
);
}
},
child: Text(
btn.jumpText != null
? btn.jumpText!
: isReserved
? btn.checkText!
: btn.uncheckText!,
),
);
},
),
],
],
],
),
),
),
),
),
)
: const SizedBox.shrink()
)
: const SizedBox.shrink()
: const SizedBox.shrink();
case 'ADDITIONAL_TYPE_UPOWER_LOTTERY':
final content = item.modules.moduleDynamic!.additional!.upowerLottery!;
@@ -249,8 +274,10 @@ Widget addWidget(ThemeData theme, DynamicItemModel item, BuildContext context,
? null
: () => PiliScheme.routePushFromUrl(content.jumpUrl!),
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 8,
),
child: Row(
children: [
Expanded(
@@ -290,14 +317,14 @@ Widget addWidget(ThemeData theme, DynamicItemModel item, BuildContext context,
recognizer: content.desc!.jumpUrl == null
? null
: (TapGestureRecognizer()
..onTap = () {
Get.toNamed(
'/webview',
parameters: {
'url': content.desc!.jumpUrl!
},
);
}),
..onTap = () {
Get.toNamed(
'/webview',
parameters: {
'url': content.desc!.jumpUrl!,
},
);
}),
),
],
),
@@ -311,20 +338,24 @@ Widget addWidget(ThemeData theme, DynamicItemModel item, BuildContext context,
onPressed: content.button!.jumpUrl == null
? null
: () => PiliScheme.routePushFromUrl(
content.button!.jumpUrl!,
),
content.button!.jumpUrl!,
),
style: FilledButton.styleFrom(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(6)),
),
padding: const EdgeInsets.symmetric(horizontal: 10),
visualDensity:
const VisualDensity(horizontal: -2, vertical: -3),
visualDensity: const VisualDensity(
horizontal: -2,
vertical: -3,
),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
child: Text(content.button!.jumpStyle?.text ??
content.button!.check?.text ??
''),
child: Text(
content.button!.jumpStyle?.text ??
content.button!.check?.text ??
'',
),
),
],
],
@@ -351,7 +382,9 @@ Widget addWidget(ThemeData theme, DynamicItemModel item, BuildContext context,
onTap: () => PiliScheme.routePushFromUrl(e.jumpUrl!),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 12, vertical: 8),
horizontal: 12,
vertical: 8,
),
child: Row(
children: [
if (e.cover?.isNotEmpty == true) ...[
@@ -399,13 +432,17 @@ Widget addWidget(ThemeData theme, DynamicItemModel item, BuildContext context,
PiliScheme.routePushFromUrl(e.jumpUrl!),
style: FilledButton.styleFrom(
shape: const RoundedRectangleBorder(
borderRadius:
BorderRadius.all(Radius.circular(6)),
borderRadius: BorderRadius.all(
Radius.circular(6),
),
),
padding: const EdgeInsets.symmetric(
horizontal: 10,
),
padding:
const EdgeInsets.symmetric(horizontal: 10),
visualDensity: const VisualDensity(
horizontal: -2, vertical: -3),
horizontal: -2,
vertical: -3,
),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
child: Text(e.jumpDesc!),
@@ -437,12 +474,14 @@ Widget addWidget(ThemeData theme, DynamicItemModel item, BuildContext context,
item.idStr is int
? item.idStr
: item.idStr is String
? int.parse(item.idStr)
: null,
? int.parse(item.idStr)
: null,
),
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 8,
),
child: Row(
children: [
Container(
@@ -450,8 +489,9 @@ Widget addWidget(ThemeData theme, DynamicItemModel item, BuildContext context,
color: floor == 1
? theme.colorScheme.surface
: theme.dividerColor.withValues(alpha: 0.08),
borderRadius:
const BorderRadius.all(Radius.circular(8)),
borderRadius: const BorderRadius.all(
Radius.circular(8),
),
),
width: 70,
height: 50,
@@ -475,7 +515,9 @@ Widget addWidget(ThemeData theme, DynamicItemModel item, BuildContext context,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 13, color: theme.colorScheme.outline),
fontSize: 13,
color: theme.colorScheme.outline,
),
),
],
),
@@ -488,16 +530,18 @@ Widget addWidget(ThemeData theme, DynamicItemModel item, BuildContext context,
item.idStr is int
? item.idStr
: item.idStr is String
? int.parse(item.idStr)
: null,
? int.parse(item.idStr)
: null,
),
style: FilledButton.styleFrom(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(6)),
),
padding: const EdgeInsets.symmetric(horizontal: 10),
visualDensity:
const VisualDensity(horizontal: -2, vertical: -3),
visualDensity: const VisualDensity(
horizontal: -2,
vertical: -3,
),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
child: const Text('参与'),
@@ -522,8 +566,10 @@ Widget addWidget(ThemeData theme, DynamicItemModel item, BuildContext context,
? null
: () => PiliScheme.routePushFromUrl(content.jumpUrl!),
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 8,
),
child: Row(
children: [
if (content.cover?.isNotEmpty == true) ...[
@@ -573,8 +619,10 @@ Widget addWidget(ThemeData theme, DynamicItemModel item, BuildContext context,
borderRadius: BorderRadius.all(Radius.circular(6)),
),
padding: const EdgeInsets.symmetric(horizontal: 10),
visualDensity:
const VisualDensity(horizontal: -2, vertical: -3),
visualDensity: const VisualDensity(
horizontal: -2,
vertical: -3,
),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
child: Text(content.button!.jumpStyle?.text ?? ''),
@@ -600,8 +648,10 @@ Widget addWidget(ThemeData theme, DynamicItemModel item, BuildContext context,
? null
: () => PiliScheme.routePushFromUrl(content.jumpUrl!),
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 8,
),
child: Row(
children: [
Column(
@@ -636,7 +686,7 @@ Widget addWidget(ThemeData theme, DynamicItemModel item, BuildContext context,
Text(
content.matchInfo!.leftTeam!.name!,
style: const TextStyle(fontSize: 13),
)
),
],
),
const SizedBox(width: 16),
@@ -679,7 +729,7 @@ Widget addWidget(ThemeData theme, DynamicItemModel item, BuildContext context,
Text(
content.matchInfo!.rightTeam!.name!,
style: const TextStyle(fontSize: 13),
)
),
],
),
],
@@ -694,8 +744,10 @@ Widget addWidget(ThemeData theme, DynamicItemModel item, BuildContext context,
borderRadius: BorderRadius.all(Radius.circular(6)),
),
padding: const EdgeInsets.symmetric(horizontal: 10),
visualDensity:
const VisualDensity(horizontal: -2, vertical: -3),
visualDensity: const VisualDensity(
horizontal: -2,
vertical: -3,
),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
child: Text(content.button!.jumpStyle?.text ?? ''),

View File

@@ -61,9 +61,11 @@ class AuthorPanel extends StatelessWidget {
final theme = Theme.of(context);
final pubTime = item.modules.moduleAuthor?.pubTs != null
? isSave
? DateUtil.format(item.modules.moduleAuthor!.pubTs,
format: DateUtil.longFormatDs)
: DateUtil.dateFormat(item.modules.moduleAuthor!.pubTs)
? DateUtil.format(
item.modules.moduleAuthor!.pubTs,
format: DateUtil.longFormatDs,
)
: DateUtil.dateFormat(item.modules.moduleAuthor!.pubTs)
: item.modules.moduleAuthor?.pubTime;
return Stack(
clipBehavior: Clip.none,
@@ -77,7 +79,8 @@ class AuthorPanel extends StatelessWidget {
? () {
feedBack();
Get.toNamed(
'/member?mid=${item.modules.moduleAuthor!.mid}');
'/member?mid=${item.modules.moduleAuthor!.mid}',
);
}
: null,
child: Row(
@@ -91,7 +94,8 @@ class AuthorPanel extends StatelessWidget {
Text(
item.modules.moduleAuthor?.name ?? '',
style: TextStyle(
color: item.modules.moduleAuthor!.vip != null &&
color:
item.modules.moduleAuthor!.vip != null &&
item.modules.moduleAuthor!.vip!.status > 0 &&
item.modules.moduleAuthor!.vip!.type == 2
? context.vipColor
@@ -121,10 +125,13 @@ class AuthorPanel extends StatelessWidget {
children: [
Container(
padding: const EdgeInsets.symmetric(
horizontal: 4, vertical: 2),
horizontal: 4,
vertical: 2,
),
decoration: BoxDecoration(
borderRadius:
const BorderRadius.all(Radius.circular(4)),
borderRadius: const BorderRadius.all(
Radius.circular(4),
),
border: Border.all(
width: 1.25,
color: theme.colorScheme.primary,
@@ -148,51 +155,69 @@ class AuthorPanel extends StatelessWidget {
],
)
: item.modules.moduleAuthor!.decorate != null
? Row(
mainAxisSize: MainAxisSize.min,
? Row(
mainAxisSize: MainAxisSize.min,
children: [
Stack(
clipBehavior: Clip.none,
alignment: Alignment.centerRight,
children: [
Stack(
clipBehavior: Clip.none,
alignment: Alignment.centerRight,
children: [
CachedNetworkImage(
height: 32,
imageUrl: item.modules.moduleAuthor!.decorate!
.cardUrl.http2https,
),
if (item.modules.moduleAuthor?.decorate?.fan?.numStr
?.isNotEmpty ==
true)
Padding(
padding: const EdgeInsets.only(right: 32),
child: Text(
'${item.modules.moduleAuthor!.decorate!.fan!.numStr}',
style: TextStyle(
height: 1,
fontSize: 11,
fontFamily: 'digital_id_num',
color: item.modules.moduleAuthor!.decorate!
.fan?.color
?.startsWith('#') ==
true
? Color(
int.parse(
item.modules.moduleAuthor!
.decorate!.fan!.color!
.replaceFirst('#', '0xFF'),
),
)
: null,
),
),
),
],
CachedNetworkImage(
height: 32,
imageUrl: item
.modules
.moduleAuthor!
.decorate!
.cardUrl
.http2https,
),
_moreWidget(context),
if (item
.modules
.moduleAuthor
?.decorate
?.fan
?.numStr
?.isNotEmpty ==
true)
Padding(
padding: const EdgeInsets.only(right: 32),
child: Text(
'${item.modules.moduleAuthor!.decorate!.fan!.numStr}',
style: TextStyle(
height: 1,
fontSize: 11,
fontFamily: 'digital_id_num',
color:
item
.modules
.moduleAuthor!
.decorate!
.fan
?.color
?.startsWith('#') ==
true
? Color(
int.parse(
item
.modules
.moduleAuthor!
.decorate!
.fan!
.color!
.replaceFirst('#', '0xFF'),
),
)
: null,
),
),
),
],
)
: _moreWidget(context),
)
),
_moreWidget(context),
],
)
: _moreWidget(context),
),
],
);
}
@@ -216,14 +241,16 @@ class AuthorPanel extends StatelessWidget {
String? bvid;
try {
String? getBvid(String? type, DynamicMajorModel? major) => switch (type) {
'DYNAMIC_TYPE_AV' => major?.archive?.bvid,
'DYNAMIC_TYPE_UGC_SEASON' => major?.ugcSeason?.bvid,
_ => null,
};
'DYNAMIC_TYPE_AV' => major?.archive?.bvid,
'DYNAMIC_TYPE_UGC_SEASON' => major?.ugcSeason?.bvid,
_ => null,
};
bvid = getBvid(item.type, item.modules.moduleDynamic?.major);
if (bvid == null && item.orig != null) {
bvid =
getBvid(item.orig!.type, item.orig?.modules.moduleDynamic?.major);
bvid = getBvid(
item.orig!.type,
item.orig?.modules.moduleDynamic?.major,
);
}
} catch (_) {}
@@ -237,8 +264,9 @@ class AuthorPanel extends StatelessWidget {
builder: (context1) {
final theme = Theme.of(context);
return Padding(
padding:
EdgeInsets.only(bottom: MediaQuery.paddingOf(context1).bottom),
padding: EdgeInsets.only(
bottom: MediaQuery.paddingOf(context1).bottom,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
@@ -253,9 +281,11 @@ class AuthorPanel extends StatelessWidget {
width: 32,
height: 3,
decoration: BoxDecoration(
color: theme.colorScheme.outline,
borderRadius:
const BorderRadius.all(Radius.circular(3))),
color: theme.colorScheme.outline,
borderRadius: const BorderRadius.all(
Radius.circular(3),
),
),
),
),
),
@@ -296,7 +326,8 @@ class AuthorPanel extends StatelessWidget {
onTap: () {
Get.back();
Utils.shareText(
'${HttpString.dynamicShareBaseUrl}/${item.idStr}');
'${HttpString.dynamicShareBaseUrl}/${item.idStr}',
);
},
minLeadingWidth: 0,
),
@@ -320,15 +351,27 @@ class AuthorPanel extends StatelessWidget {
title = item.modules.moduleDynamic!.desc!.text!;
} else if (item.modules.moduleDynamic?.major != null) {
title = item
.modules.moduleDynamic!.major!.opus!.summary!.text!;
.modules
.moduleDynamic!
.major!
.opus!
.summary!
.text!;
} else {
throw UnsupportedError(
'error getting title: {"type": ${item.basic!.commentType}, "id": $id}');
'error getting title: {"type": ${item.basic!.commentType}, "id": $id}',
);
}
String? thumb = isDyn
? item.modules.moduleAuthor?.face
: item.modules.moduleDynamic?.major?.opus?.pics
?.firstOrNull?.url;
: item
.modules
.moduleDynamic
?.major
?.opus
?.pics
?.firstOrNull
?.url;
PageUtils.pmShare(
context,
content: {
@@ -338,7 +381,8 @@ class AuthorPanel extends StatelessWidget {
"source": source,
if (thumb?.isNotEmpty == true) "thumb": thumb,
"author": item.modules.moduleAuthor!.name,
"author_id": item.modules.moduleAuthor!.mid.toString()
"author_id": item.modules.moduleAuthor!.mid
.toString(),
},
);
} catch (e) {
@@ -357,11 +401,12 @@ class AuthorPanel extends StatelessWidget {
Get.back();
onBlock?.call();
try {
Get.find<DynamicsController>()
.tempBannedList
.add(item.modules.moduleAuthor!.mid!);
Get.find<DynamicsController>().tempBannedList.add(
item.modules.moduleAuthor!.mid!,
);
SmartDialog.showToast(
'已临时屏蔽${item.modules.moduleAuthor?.name}(${item.modules.moduleAuthor!.mid!}),重启恢复');
'已临时屏蔽${item.modules.moduleAuthor?.name}(${item.modules.moduleAuthor!.mid!}),重启恢复',
);
} catch (_) {}
},
minLeadingWidth: 0,
@@ -371,7 +416,9 @@ class AuthorPanel extends StatelessWidget {
onTap: () {
Get.back();
RequestUtils.checkCreatedDyn(
id: item.idStr, isManual: true);
id: item.idStr,
isManual: true,
);
},
minLeadingWidth: 0,
leading: const Stack(
@@ -389,13 +436,16 @@ class AuthorPanel extends StatelessWidget {
onTap: () {
Get.back();
onSetTop!(
item.modules.moduleTag?.text != null, item.idStr);
item.modules.moduleTag?.text != null,
item.idStr,
);
},
minLeadingWidth: 0,
leading: const Icon(Icons.vertical_align_top, size: 19),
title: Text(
'${item.modules.moduleTag?.text != null ? '取消' : ''}置顶',
style: theme.textTheme.titleSmall!),
'${item.modules.moduleTag?.text != null ? '取消' : ''}置顶',
style: theme.textTheme.titleSmall!,
),
),
if (onRemove != null)
ListTile(
@@ -427,11 +477,17 @@ class AuthorPanel extends StatelessWidget {
);
},
minLeadingWidth: 0,
leading: Icon(Icons.delete_outline,
color: theme.colorScheme.error, size: 19),
title: Text('删除',
style: theme.textTheme.titleSmall!
.copyWith(color: theme.colorScheme.error)),
leading: Icon(
Icons.delete_outline,
color: theme.colorScheme.error,
size: 19,
),
title: Text(
'删除',
style: theme.textTheme.titleSmall!.copyWith(
color: theme.colorScheme.error,
),
),
),
],
if (Accounts.main.isLogin)

View File

@@ -55,8 +55,8 @@ Widget content(
fontSize: floor != 1
? 14
: isDetail && !isSave
? 16
: 15,
? 16
: 15,
color: theme.colorScheme.primary,
),
),

View File

@@ -44,7 +44,8 @@ class DynamicPanel extends StatelessWidget {
final child = Material(
type: MaterialType.transparency,
child: InkWell(
onTap: isDetail &&
onTap:
isDetail &&
!const {
'DYNAMIC_TYPE_AV',
'DYNAMIC_TYPE_UGC_SEASON',

View File

@@ -54,7 +54,7 @@ Widget livePanel(
color: theme.colorScheme.outline,
fontSize: theme.textTheme.labelMedium!.fontSize,
),
)
),
],
),
),
@@ -64,7 +64,7 @@ Widget livePanel(
style: TextStyle(
fontSize: theme.textTheme.labelMedium!.fontSize,
),
)
),
],
),
),

View File

@@ -109,8 +109,9 @@ Widget livePanelSub(
const SizedBox(height: 6),
if (content.title != null)
Padding(
padding:
const EdgeInsets.symmetric(horizontal: StyleString.safeSpace),
padding: const EdgeInsets.symmetric(
horizontal: StyleString.safeSpace,
),
child: Text(
content.title!,
maxLines: isDetail ? null : 1,

View File

@@ -109,8 +109,9 @@ Widget liveRcmdPanel(
const SizedBox(height: 6),
if (liveRcmd.title != null)
Padding(
padding:
const EdgeInsets.symmetric(horizontal: StyleString.safeSpace),
padding: const EdgeInsets.symmetric(
horizontal: StyleString.safeSpace,
),
child: Text(
liveRcmd.title!,
maxLines: isDetail ? null : 1,

View File

@@ -38,8 +38,15 @@ Widget module(
// 视频
case 'DYNAMIC_TYPE_AV':
return videoSeasonWidget(
theme, isSave, isDetail, item, context, 'archive', callback,
floor: floor);
theme,
isSave,
isDetail,
item,
context,
'archive',
callback,
floor: floor,
);
// 转发
case 'DYNAMIC_TYPE_FORWARD':
final orig = item.orig!;
@@ -121,7 +128,8 @@ Widget module(
GestureDetector(
onTap: isNormalAuth
? () => Get.toNamed(
'/member?mid=${orig.modules.moduleAuthor!.mid}')
'/member?mid=${orig.modules.moduleAuthor!.mid}',
)
: null,
child: Text(
'${isNormalAuth ? '@' : ''}${orig.modules.moduleAuthor!.name}',
@@ -131,20 +139,37 @@ Widget module(
const SizedBox(width: 6),
Text(
isSave
? DateUtil.format(orig.modules.moduleAuthor!.pubTs,
format: DateUtil.longFormatDs)
? DateUtil.format(
orig.modules.moduleAuthor!.pubTs,
format: DateUtil.longFormatDs,
)
: DateUtil.dateFormat(orig.modules.moduleAuthor!.pubTs),
style: TextStyle(
color: theme.colorScheme.outline,
fontSize: theme.textTheme.labelSmall!.fontSize),
color: theme.colorScheme.outline,
fontSize: theme.textTheme.labelSmall!.fontSize,
),
),
],
),
const SizedBox(height: 5),
content(theme, isSave, context, orig, isDetail, callback,
floor: floor + 1),
module(theme, isSave, orig, context, isDetail, callback,
floor: floor + 1),
content(
theme,
isSave,
context,
orig,
isDetail,
callback,
floor: floor + 1,
),
module(
theme,
isSave,
orig,
context,
isDetail,
callback,
floor: floor + 1,
),
if (orig.modules.moduleDynamic?.additional != null)
addWidget(theme, orig, context, floor: floor + 1),
if (orig.modules.moduleDynamic?.major?.blocked != null)
@@ -162,21 +187,42 @@ Widget module(
// 合集
case 'DYNAMIC_TYPE_UGC_SEASON':
return videoSeasonWidget(
theme, isSave, isDetail, item, context, 'ugcSeason', callback);
theme,
isSave,
isDetail,
item,
context,
'ugcSeason',
callback,
);
case 'DYNAMIC_TYPE_PGC':
return videoSeasonWidget(
theme, isSave, isDetail, item, context, 'pgc', callback,
floor: floor);
theme,
isSave,
isDetail,
item,
context,
'pgc',
callback,
floor: floor,
);
case 'DYNAMIC_TYPE_PGC_UNION':
return videoSeasonWidget(
theme, isSave, isDetail, item, context, 'pgc', callback,
floor: floor);
theme,
isSave,
isDetail,
item,
context,
'pgc',
callback,
floor: floor,
);
case 'DYNAMIC_TYPE_NONE':
return Row(
spacing: 4,
children: [
const Icon(FontAwesomeIcons.ghost, size: 14),
Text(item.modules.moduleDynamic!.major!.none!.tips!)
Text(item.modules.moduleDynamic!.major!.none!.tips!),
],
);
// 课堂
@@ -214,12 +260,21 @@ Widget module(
} catch (_) {}
},
child: Padding(
padding:
const EdgeInsets.only(left: 12, top: 10, right: 12, bottom: 10),
padding: const EdgeInsets.only(
left: 12,
top: 10,
right: 12,
bottom: 10,
),
child: Row(
spacing: 10,
children: [
if (item.modules.moduleDynamic!.major!.common!.cover
if (item
.modules
.moduleDynamic!
.major!
.common!
.cover
?.isNotEmpty ==
true)
ClipRRect(
@@ -228,8 +283,13 @@ Widget module(
width: 45,
height: 45,
fit: BoxFit.cover,
imageUrl: item.modules.moduleDynamic!.major!.common!
.cover!.http2https,
imageUrl: item
.modules
.moduleDynamic!
.major!
.common!
.cover!
.http2https,
),
),
Expanded(
@@ -243,7 +303,12 @@ Widget module(
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
if (item.modules.moduleDynamic!.major!.common!.desc
if (item
.modules
.moduleDynamic!
.major!
.common!
.desc
?.isNotEmpty ==
true)
Text(
@@ -269,8 +334,12 @@ Widget module(
onTap: () => PageUtils.handleWebview("https:${music['jump_url']}"),
child: Container(
width: double.infinity,
padding:
const EdgeInsets.only(left: 12, top: 10, right: 12, bottom: 10),
padding: const EdgeInsets.only(
left: 12,
top: 10,
right: 12,
bottom: 10,
),
color: theme.dividerColor.withValues(alpha: 0.08),
child: Row(
children: [
@@ -303,7 +372,7 @@ Widget module(
overflow: TextOverflow.ellipsis,
),
],
)
),
],
),
),
@@ -331,7 +400,7 @@ Widget module(
top: 6,
text:
item.modules.moduleDynamic!.major!.medialist!.badge?.text,
)
),
],
),
const SizedBox(width: 14),
@@ -347,8 +416,9 @@ Widget module(
Text(
item.modules.moduleDynamic!.major!.medialist!.title!,
style: TextStyle(
fontSize: theme.textTheme.titleMedium!.fontSize,
fontWeight: FontWeight.bold),
fontSize: theme.textTheme.titleMedium!.fontSize,
fontWeight: FontWeight.bold,
),
),
if (item.modules.moduleDynamic?.major?.medialist?.subTitle !=
null) ...[
@@ -356,8 +426,9 @@ Widget module(
Text(
item.modules.moduleDynamic!.major!.medialist!.subTitle!,
style: TextStyle(
fontSize: theme.textTheme.labelLarge!.fontSize,
color: theme.colorScheme.outline),
fontSize: theme.textTheme.labelLarge!.fontSize,
color: theme.colorScheme.outline,
),
),
],
],

View File

@@ -77,12 +77,14 @@ TextSpan? richNode(
style: style,
recognizer: TapGestureRecognizer()
..onTap = () => Get.toNamed(
'/searchResult',
parameters: {
'keyword':
i.origText!.substring(1, i.origText!.length - 1),
},
'/searchResult',
parameters: {
'keyword': i.origText!.substring(
1,
i.origText!.length - 1,
),
},
),
),
);
break;
@@ -106,8 +108,8 @@ TextSpan? richNode(
recognizer: i.origText == null
? null
: (TapGestureRecognizer()
..onTap =
() => PiliScheme.routePushFromUrl(i.origText!)),
..onTap = () =>
PiliScheme.routePushFromUrl(i.origText!)),
),
);
break;
@@ -131,8 +133,9 @@ TextSpan? richNode(
recognizer: TapGestureRecognizer()
..onTap = () {
final dynIdStr = item.basic?.commentIdStr;
final dynId =
dynIdStr != null ? int.tryParse(dynIdStr) : null;
final dynId = dynIdStr != null
? int.tryParse(dynIdStr)
: null;
showVoteDialog(context, int.parse(i.rid!), dynId);
},
),
@@ -171,12 +174,12 @@ TextSpan? richNode(
style: style,
recognizer: TapGestureRecognizer()
..onTap = () => Get.toNamed(
'/webview',
parameters: {
'url':
'https://www.bilibili.com/h5/lottery/result?business_id=${item.idStr}'
},
),
'/webview',
parameters: {
'url':
'https://www.bilibili.com/h5/lottery/result?business_id=${item.idStr}',
},
),
),
);
break;
@@ -200,8 +203,8 @@ TextSpan? richNode(
recognizer: i.jumpUrl == null
? null
: (TapGestureRecognizer()
..onTap =
() => PiliScheme.routePushFromUrl(i.jumpUrl!)),
..onTap = () =>
PiliScheme.routePushFromUrl(i.jumpUrl!)),
),
);
break;
@@ -252,11 +255,13 @@ TextSpan? richNode(
return imageView(
constraints.maxWidth,
i.pics!
.map((item) => ImageModel(
url: item.src ?? '',
width: item.width,
height: item.height,
))
.map(
(item) => ImageModel(
url: item.src ?? '',
width: item.width,
height: item.height,
),
)
.toList(),
);
},
@@ -272,9 +277,10 @@ TextSpan? richNode(
..onTap = () {
void onView(List<OpusPicModel> list) {
Get.context!.imageView(
imgList: list
.map((e) => SourceModel(url: e.src!))
.toList());
imgList: list
.map((e) => SourceModel(url: e.src!))
.toList(),
);
}
if (i.pics?.isNotEmpty == true) {

View File

@@ -135,7 +135,8 @@ class _UpPanelState extends State<UpPanel> {
}
Widget upItemBuild(ThemeData theme, UserItem data) {
bool isCurrent = widget.dynamicsController.currentMid == data.mid ||
bool isCurrent =
widget.dynamicsController.currentMid == data.mid ||
widget.dynamicsController.currentMid == -1;
final isLive = data is LiveUserItem;
return SizedBox(
@@ -191,11 +192,13 @@ class _UpPanelState extends State<UpPanel> {
label: isLive ? const Text(' Live ') : null,
textColor: theme.colorScheme.onSecondaryContainer,
alignment: AlignmentDirectional.topStart,
isLabelVisible: isLive ||
isLabelVisible:
isLive ||
(data is UpItem && (data.hasUpdate ?? false)),
backgroundColor: isLive
? theme.colorScheme.secondaryContainer
.withValues(alpha: 0.75)
? theme.colorScheme.secondaryContainer.withValues(
alpha: 0.75,
)
: theme.colorScheme.primary,
),
),

View File

@@ -146,8 +146,9 @@ Widget videoSeasonWidget(
if (itemContent.cover != null)
if (floor == 1)
Padding(
padding:
const EdgeInsets.symmetric(horizontal: StyleString.safeSpace),
padding: const EdgeInsets.symmetric(
horizontal: StyleString.safeSpace,
),
child: buildCover(),
)
else

View File

@@ -29,7 +29,8 @@ class _VotePanelState extends State<VotePanel> {
late VoteInfo _voteInfo;
late final RxSet<int> groupValue = (_voteInfo.myVotes?.toSet() ?? {}).obs;
late var _percentage = _cnt2Percentage(_voteInfo.options);
late bool _enabled = groupValue.isEmpty &&
late bool _enabled =
groupValue.isEmpty &&
_voteInfo.endTime! * 1000 > DateTime.now().millisecondsSinceEpoch;
late bool _showPercentage = !_enabled;
late final _maxCnt = _voteInfo.choiceCnt ?? _voteInfo.options.length;
@@ -81,10 +82,10 @@ class _VotePanelState extends State<VotePanel> {
_enabled
? '投票选项'
: groupValue.isEmpty
? '已结束'
: '已完成',
? '已结束'
: '已完成',
),
if (_enabled) Obx(() => Text('${groupValue.length} / $_maxCnt'))
if (_enabled) Obx(() => Text('${groupValue.length} / $_maxCnt')),
],
),
Flexible(fit: FlexFit.loose, child: _buildContext()),
@@ -122,23 +123,23 @@ class _VotePanelState extends State<VotePanel> {
}
List<Widget> get _checkBoxs => [
CheckBoxText(
text: '显示比例',
selected: _showPercentage,
onChanged: (value) {
setState(() {
_showPercentage = value;
});
},
),
CheckBoxText(
text: '匿名',
selected: anonymity,
onChanged: (val) {
anonymity = val;
},
),
];
CheckBoxText(
text: '显示比例',
selected: _showPercentage,
onChanged: (value) {
setState(() {
_showPercentage = value;
});
},
),
CheckBoxText(
text: '匿名',
selected: anonymity,
onChanged: (val) {
anonymity = val;
},
),
];
Widget _buildOptions(int index) {
return Padding(
@@ -185,7 +186,7 @@ class _VotePanelState extends State<VotePanel> {
itemCount: _voteInfo.options.length,
itemBuilder: (context, index) => _buildOptions(index),
),
if (_enabled) SliverList.list(children: _checkBoxs)
if (_enabled) SliverList.list(children: _checkBoxs),
],
);
}
@@ -277,27 +278,31 @@ class PercentageChip extends StatelessWidget {
}
}
Future showVoteDialog(BuildContext context, int voteId,
[int? dynamicId]) async {
Future showVoteDialog(
BuildContext context,
int voteId, [
int? dynamicId,
]) async {
final voteInfo = await DynamicsHttp.voteInfo(voteId);
if (context.mounted) {
if (voteInfo.isSuccess) {
showDialog(
context: context,
builder: (context) => AlertDialog(
content: SizedBox(
width: 160,
child: VotePanel(
voteInfo: voteInfo.data,
callback: (votes, anonymity) => DynamicsHttp.doVote(
voteId: voteId,
votes: votes.toList(),
anonymity: anonymity,
dynamicId: dynamicId,
),
),
),
));
context: context,
builder: (context) => AlertDialog(
content: SizedBox(
width: 160,
child: VotePanel(
voteInfo: voteInfo.data,
callback: (votes, anonymity) => DynamicsHttp.doVote(
voteId: voteId,
votes: votes.toList(),
anonymity: anonymity,
dynamicId: dynamicId,
),
),
),
),
);
} else {
voteInfo.toast();
}