修复下载页面模组简介只会显示一行的问题 (#5300)

This commit is contained in:
辞庐
2026-01-27 20:52:34 +08:00
committed by GitHub
parent e9e6ef1f20
commit 4cbe874c81
2 changed files with 14 additions and 2 deletions

View File

@@ -44,6 +44,9 @@ public class TwoLineListItem extends VBox {
private final ObservableList<Label> tags = FXCollections.observableArrayList();
private final StringProperty subtitle = new SimpleStringProperty(this, "subtitle");
private final Label lblSubtitle;
private final Label lblTitle;
private final AggregatedObservableList<Node> firstLineChildren;
public TwoLineListItem(String titleString, String subtitleString) {
@@ -59,7 +62,7 @@ public class TwoLineListItem extends VBox {
HBox firstLine = new HBox();
firstLine.getStyleClass().add("first-line");
Label lblTitle = new Label();
lblTitle = new Label();
lblTitle.getStyleClass().add("title");
lblTitle.textProperty().bind(title);
@@ -68,7 +71,7 @@ public class TwoLineListItem extends VBox {
firstLineChildren.appendList(tags);
Bindings.bindContent(firstLine.getChildren(), firstLineChildren.getAggregatedList());
Label lblSubtitle = new Label();
lblSubtitle = new Label();
lblSubtitle.getStyleClass().add("subtitle");
lblSubtitle.textProperty().bind(subtitle);
@@ -109,6 +112,14 @@ public class TwoLineListItem extends VBox {
this.subtitle.set(subtitle);
}
public Label getSubtitleLabel() {
return lblSubtitle;
}
public Label getTitleLabel() {
return lblTitle;
}
public void addTag(String tag) {
Label tagLabel = createTagLabel(tag);
tagLabel.getStyleClass().add("tag");

View File

@@ -230,6 +230,7 @@ public class DownloadPage extends Control implements DecoratorPage {
ModTranslations.Mod mod = getSkinnable().translations.getModByCurseForgeId(getSkinnable().addon.getSlug());
content.setTitle(mod != null && I18n.isUseChinese() ? mod.getDisplayName() : getSkinnable().addon.getTitle());
content.setSubtitle(getSkinnable().addon.getDescription());
content.getSubtitleLabel().setWrapText(true);
getSkinnable().addon.getCategories().stream()
.map(category -> getSkinnable().page.getLocalizedCategory(category))
.forEach(content::addTag);