mod: show tag on dynamic panel

This commit is contained in:
bggRGjQaUbCoE
2024-09-26 15:37:02 +08:00
parent f73fd8d6a6
commit 381a44de4c
4 changed files with 53 additions and 5 deletions

View File

@@ -13,7 +13,13 @@ import '../controller.dart';
class AuthorPanel extends StatelessWidget {
final dynamic item;
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
Widget build(BuildContext context) {
@@ -82,6 +88,31 @@ 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,
),
),
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(
width: 32,
height: 32,

View File

@@ -42,7 +42,7 @@ class DynamicPanel extends StatelessWidget {
children: [
Padding(
padding: const EdgeInsets.fromLTRB(12, 12, 12, 6),
child: AuthorPanel(item: item),
child: AuthorPanel(item: item, source: source),
),
if (item!.modules!.moduleDynamic!.desc != null ||
item!.modules!.moduleDynamic!.major != null)