mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: show tag on dynamic panel
This commit is contained in:
@@ -85,7 +85,7 @@ class ItemModulesModel {
|
|||||||
ModuleDynamicModel? moduleDynamic;
|
ModuleDynamicModel? moduleDynamic;
|
||||||
// ModuleInterModel? moduleInter;
|
// ModuleInterModel? moduleInter;
|
||||||
ModuleStatModel? moduleStat;
|
ModuleStatModel? moduleStat;
|
||||||
Map? moduleTag;
|
ModuleTag? moduleTag;
|
||||||
|
|
||||||
ItemModulesModel.fromJson(Map<String, dynamic> json) {
|
ItemModulesModel.fromJson(Map<String, dynamic> json) {
|
||||||
moduleAuthor = json['module_author'] != null
|
moduleAuthor = json['module_author'] != null
|
||||||
@@ -98,7 +98,9 @@ class ItemModulesModel {
|
|||||||
moduleStat = json['module_stat'] != null
|
moduleStat = json['module_stat'] != null
|
||||||
? ModuleStatModel.fromJson(json['module_stat'])
|
? ModuleStatModel.fromJson(json['module_stat'])
|
||||||
: null;
|
: null;
|
||||||
moduleTag = json['module_tag'];
|
moduleTag = json['module_tag'] != null
|
||||||
|
? ModuleTag.fromJson(json['module_tag'])
|
||||||
|
: null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -759,6 +761,18 @@ class DynamicLive2Model {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ModuleTag {
|
||||||
|
ModuleTag({
|
||||||
|
this.text,
|
||||||
|
});
|
||||||
|
|
||||||
|
String? text;
|
||||||
|
|
||||||
|
ModuleTag.fromJson(Map<String, dynamic> json) {
|
||||||
|
text = json['text'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 动态状态 转发、评论、点赞
|
// 动态状态 转发、评论、点赞
|
||||||
class ModuleStatModel {
|
class ModuleStatModel {
|
||||||
ModuleStatModel({
|
ModuleStatModel({
|
||||||
|
|||||||
@@ -200,7 +200,10 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
|
|||||||
return AnimatedOpacity(
|
return AnimatedOpacity(
|
||||||
opacity: snapshot.data ? 1 : 0,
|
opacity: snapshot.data ? 1 : 0,
|
||||||
duration: const Duration(milliseconds: 300),
|
duration: const Duration(milliseconds: 300),
|
||||||
child: AuthorPanel(item: _dynamicDetailController.item),
|
child: AuthorPanel(
|
||||||
|
item: _dynamicDetailController.item,
|
||||||
|
source: 'detail', //to remove tag
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -13,7 +13,13 @@ import '../controller.dart';
|
|||||||
class AuthorPanel extends StatelessWidget {
|
class AuthorPanel extends StatelessWidget {
|
||||||
final dynamic item;
|
final dynamic item;
|
||||||
final Function? addBannedList;
|
final Function? addBannedList;
|
||||||
const AuthorPanel({super.key, required this.item, this.addBannedList});
|
final String? source;
|
||||||
|
const AuthorPanel({
|
||||||
|
super.key,
|
||||||
|
required this.item,
|
||||||
|
this.addBannedList,
|
||||||
|
this.source,
|
||||||
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -82,6 +88,31 @@ class AuthorPanel extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
const Spacer(),
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 32,
|
width: 32,
|
||||||
height: 32,
|
height: 32,
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class DynamicPanel extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(12, 12, 12, 6),
|
padding: const EdgeInsets.fromLTRB(12, 12, 12, 6),
|
||||||
child: AuthorPanel(item: item),
|
child: AuthorPanel(item: item, source: source),
|
||||||
),
|
),
|
||||||
if (item!.modules!.moduleDynamic!.desc != null ||
|
if (item!.modules!.moduleDynamic!.desc != null ||
|
||||||
item!.modules!.moduleDynamic!.major != null)
|
item!.modules!.moduleDynamic!.major != null)
|
||||||
|
|||||||
Reference in New Issue
Block a user