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