mod: dyn author panel

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-01-27 21:46:44 +08:00
parent c5877b7c5e
commit 7f3f7f6bdd
2 changed files with 182 additions and 159 deletions

View File

@@ -143,6 +143,7 @@ class ModuleAuthorModel {
String? type; String? type;
Map? vip; Map? vip;
Map? decorate; Map? decorate;
// Map? pendant;
ModuleAuthorModel.fromJson(Map<String, dynamic> json) { ModuleAuthorModel.fromJson(Map<String, dynamic> json) {
face = json['face']; face = json['face'];
@@ -156,7 +157,10 @@ class ModuleAuthorModel {
pubTs = json['pub_ts'] == 0 ? null : json['pub_ts']; pubTs = json['pub_ts'] == 0 ? null : json['pub_ts'];
type = json['type']; type = json['type'];
vip = json['vip']; vip = json['vip'];
if (showDynDecorate) decorate = json['decorate']; if (showDynDecorate) {
decorate = json['decorate'];
// pendant = json['pendant'];
}
} }
static bool showDynDecorate = GStorage.showDynDecorate; static bool showDynDecorate = GStorage.showDynDecorate;

View File

@@ -3,6 +3,7 @@ import 'package:PiliPlus/http/index.dart';
import 'package:PiliPlus/models/dynamics/result.dart'; import 'package:PiliPlus/models/dynamics/result.dart';
import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/extension.dart';
import 'package:PiliPlus/utils/storage.dart'; import 'package:PiliPlus/utils/storage.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@@ -32,14 +33,20 @@ class AuthorPanel extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
String heroTag = Utils.makeHeroTag(item.modules.moduleAuthor.mid); return Stack(
return Row( alignment: Alignment.center,
children: [
Align(
alignment: Alignment.centerLeft,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [ children: [
GestureDetector( GestureDetector(
onTap: () { onTap: () {
// 番剧 // 番剧
if (item.modules.moduleAuthor.type == 'AUTHOR_TYPE_PGC' || if (item.modules.moduleAuthor.type == 'AUTHOR_TYPE_PGC' ||
item.modules.moduleAuthor.type == 'AUTHOR_TYPE_UGC_SEASON') { item.modules.moduleAuthor.type ==
'AUTHOR_TYPE_UGC_SEASON') {
return; return;
} }
feedBack(); feedBack();
@@ -47,12 +54,9 @@ class AuthorPanel extends StatelessWidget {
'/member?mid=${item.modules.moduleAuthor.mid}', '/member?mid=${item.modules.moduleAuthor.mid}',
arguments: { arguments: {
'face': item.modules.moduleAuthor.face, 'face': item.modules.moduleAuthor.face,
'heroTag': heroTag
}, },
); );
}, },
child: Hero(
tag: heroTag,
child: NetworkImgLayer( child: NetworkImgLayer(
width: 40, width: 40,
height: 40, height: 40,
@@ -60,12 +64,9 @@ class AuthorPanel extends StatelessWidget {
src: item.modules.moduleAuthor.face, src: item.modules.moduleAuthor.face,
), ),
), ),
),
const SizedBox(width: 10), const SizedBox(width: 10),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [ children: [
Text( Text(
item.modules.moduleAuthor.name, item.modules.moduleAuthor.name,
@@ -76,15 +77,15 @@ class AuthorPanel extends StatelessWidget {
item.modules.moduleAuthor!.vip['type'] == 2 item.modules.moduleAuthor!.vip['type'] == 2
? context.vipColor ? context.vipColor
: Theme.of(context).colorScheme.onSurface, : Theme.of(context).colorScheme.onSurface,
fontSize: Theme.of(context).textTheme.titleSmall!.fontSize, fontSize:
Theme.of(context).textTheme.titleSmall!.fontSize,
), ),
), ),
],
),
DefaultTextStyle.merge( DefaultTextStyle.merge(
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.outline, color: Theme.of(context).colorScheme.outline,
fontSize: Theme.of(context).textTheme.labelSmall!.fontSize, fontSize:
Theme.of(context).textTheme.labelSmall!.fontSize,
), ),
child: Row( child: Row(
children: [ children: [
@@ -100,35 +101,45 @@ class AuthorPanel extends StatelessWidget {
) )
], ],
), ),
const Spacer(), // const Spacer(),
if (source != 'detail' && item.modules?.moduleTag?.text != null) // if (source != 'detail' && item.modules?.moduleTag?.text != null)
Container( // Container(
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2), // padding:
decoration: BoxDecoration( // const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
color: Theme.of(context).colorScheme.surface, // decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(4)), // color: Theme.of(context).colorScheme.surface,
border: Border.all( // borderRadius: const BorderRadius.all(Radius.circular(4)),
width: 1.25, // border: Border.all(
color: Theme.of(context).colorScheme.primary, // width: 1.25,
// color: Theme.of(context).colorScheme.primary,
// ),
// ),
// child: Text(
// item.modules.moduleTag.text,
// style: TextStyle(
// height: 1,
// fontSize: 12,
// color: Theme.of(context).colorScheme.primary,
// ),
// strutStyle: const StrutStyle(
// leading: 0,
// height: 1,
// fontSize: 12,
// ),
// ),
// ),
],
), ),
), ),
child: Text( Align(
item.modules.moduleTag.text, alignment: Alignment.centerRight,
style: TextStyle( child: item.modules.moduleAuthor.decorate != null
height: 1, ? Row(
fontSize: 12, mainAxisSize: MainAxisSize.min,
color: Theme.of(context).colorScheme.primary, children: [
),
strutStyle: const StrutStyle(
leading: 0,
height: 1,
fontSize: 12,
),
),
),
if (item.modules.moduleAuthor.decorate != null)
GestureDetector( GestureDetector(
onTap: item.modules.moduleAuthor.decorate['jump_url'] != null onTap:
item.modules.moduleAuthor.decorate['jump_url'] != null
? () { ? () {
Get.toNamed( Get.toNamed(
'/webview', '/webview',
@@ -143,12 +154,13 @@ class AuthorPanel extends StatelessWidget {
clipBehavior: Clip.none, clipBehavior: Clip.none,
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
children: [ children: [
Image.network( CachedNetworkImage(
height: 32, height: 32,
imageUrl:
item.modules.moduleAuthor.decorate['card_url'], item.modules.moduleAuthor.decorate['card_url'],
), ),
if ((item.modules.moduleAuthor.decorate?['fan']?['num_str'] if ((item.modules.moduleAuthor.decorate?['fan']
as String?) ?['num_str'] as String?)
?.isNotEmpty == ?.isNotEmpty ==
true) true)
Padding( Padding(
@@ -158,7 +170,8 @@ class AuthorPanel extends StatelessWidget {
style: TextStyle( style: TextStyle(
fontSize: 11, fontSize: 11,
fontFamily: 'digital_id_num', fontFamily: 'digital_id_num',
color: (item.modules.moduleAuthor.decorate?['fan'] color: (item.modules.moduleAuthor
.decorate?['fan']
?['color'] as String?) ?['color'] as String?)
?.startsWith('#') == ?.startsWith('#') ==
true true
@@ -176,7 +189,16 @@ class AuthorPanel extends StatelessWidget {
], ],
), ),
), ),
SizedBox( _moreWidget(context),
],
)
: _moreWidget(context),
)
],
);
}
Widget _moreWidget(context) => SizedBox(
width: 32, width: 32,
height: 32, height: 32,
child: IconButton( child: IconButton(
@@ -196,10 +218,7 @@ class AuthorPanel extends StatelessWidget {
}, },
icon: const Icon(Icons.more_vert_outlined, size: 18), icon: const Icon(Icons.more_vert_outlined, size: 18),
), ),
),
],
); );
}
Widget morePanel(context) { Widget morePanel(context) {
return Container( return Container(