feat: custom show dyn decorate

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-01-27 21:01:15 +08:00
parent 9e4187ef17
commit c5877b7c5e
7 changed files with 80 additions and 10 deletions

Binary file not shown.

View File

@@ -1,5 +1,7 @@
import 'dart:convert';
import 'package:PiliPlus/utils/storage.dart';
class DynamicsDataModel {
DynamicsDataModel({
this.hasMore,
@@ -126,6 +128,7 @@ class ModuleAuthorModel {
this.pubTs,
this.type,
this.vip,
this.decorate,
});
String? face;
@@ -139,6 +142,7 @@ class ModuleAuthorModel {
int? pubTs;
String? type;
Map? vip;
Map? decorate;
ModuleAuthorModel.fromJson(Map<String, dynamic> json) {
face = json['face'];
@@ -152,7 +156,10 @@ class ModuleAuthorModel {
pubTs = json['pub_ts'] == 0 ? null : json['pub_ts'];
type = json['type'];
vip = json['vip'];
if (showDynDecorate) decorate = json['decorate'];
}
static bool showDynDecorate = GStorage.showDynDecorate;
}
// 单个动态详情 - 动态信息

View File

@@ -43,7 +43,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
AnimationController? _fabAnimationCtr;
late StreamController<bool> _titleStreamC; // appBar title
bool _visibleTitle = false;
String? action;
// String? action;
// 回复类型
late int replyType;
bool _isFabVisible = true;
@@ -89,10 +89,10 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
// floor 1原创 2转发
init();
_titleStreamC = StreamController<bool>();
if (action == 'comment') {
_visibleTitle = true;
_titleStreamC.add(true);
}
// if (action == 'comment') {
// _visibleTitle = true;
// _titleStreamC.add(true);
// }
_fabAnimationCtr = AnimationController(
vsync: this,
@@ -109,7 +109,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
// 楼层
int floor = args['floor'];
// 从action栏点击进入
action = args.containsKey('action') ? args['action'] : null;
// action = args.containsKey('action') ? args['action'] : null;
// 评论类型
int commentType = args['item'].basic!['comment_type'] ?? 11;
replyType = (commentType == 0) ? 11 : commentType;

View File

@@ -126,6 +126,56 @@ class AuthorPanel extends StatelessWidget {
),
),
),
if (item.modules.moduleAuthor.decorate != null)
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: [
Image.network(
height: 32,
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(
fontSize: 11,
fontFamily: 'digital_id_num',
color: (item.modules.moduleAuthor.decorate?['fan']
?['color'] as String?)
?.startsWith('#') ==
true
? Color(
int.parse(
item.modules.moduleAuthor
.decorate['fan']['color']
.replaceFirst('#', '0xFF'),
),
)
: null,
),
),
),
],
),
),
SizedBox(
width: 32,
height: 32,

View File

@@ -13,6 +13,7 @@ import 'package:PiliPlus/models/common/reply_sort_type.dart';
import 'package:PiliPlus/models/common/super_resolution_type.dart';
import 'package:PiliPlus/models/common/theme_type.dart';
import 'package:PiliPlus/models/common/up_panel_position.dart';
import 'package:PiliPlus/models/dynamics/result.dart';
import 'package:PiliPlus/models/video/play/CDN.dart';
import 'package:PiliPlus/models/video/play/quality.dart';
import 'package:PiliPlus/models/video/play/subtitle.dart';
@@ -1905,6 +1906,14 @@ List<SettingsModel> get extraSettings => [
setKey: SettingBoxKey.searchSuggestion,
defaultVal: true,
),
SettingsModel(
settingsType: SettingsType.sw1tch,
title: '展示动态装饰',
leading: Icon(MdiIcons.stickerCircleOutline),
setKey: SettingBoxKey.showDynDecorate,
defaultVal: true,
onChanged: (value) => ModuleAuthorModel.showDynDecorate = value,
),
SettingsModel(
settingsType: SettingsType.sw1tch,
enableFeedback: true,

View File

@@ -351,6 +351,9 @@ class GStorage {
static bool get searchSuggestion =>
GStorage.setting.get(SettingBoxKey.searchSuggestion, defaultValue: true);
static bool get showDynDecorate =>
GStorage.setting.get(SettingBoxKey.showDynDecorate, defaultValue: true);
static List<double> get dynamicDetailRatio => List<double>.from(setting
.get(SettingBoxKey.dynamicDetailRatio, defaultValue: [60.0, 40.0]));
@@ -577,6 +580,7 @@ class SettingBoxKey {
preInitPlayer = 'preInitPlayer',
mainTabBarView = 'mainTabBarView',
searchSuggestion = 'searchSuggestion',
showDynDecorate = 'showDynDecorate',
// Sponsor Block
enableSponsorBlock = 'enableSponsorBlock',

View File

@@ -262,10 +262,10 @@ flutter:
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: fansCard
# fonts:
# - asset: assets/fonts/fansCard.ttf
fonts:
- family: digital_id_num
fonts:
- asset: assets/fonts/digital_id_num.ttf
# - family: Jura-Bold
# fonts:
# - asset: assets/fonts/Jura-Bold.ttf