fix: 修复联机核心第三方下载渠道按钮高度不一致 (#6247)

close #6245
This commit is contained in:
庐庐绫
2026-07-05 20:06:23 +08:00
committed by GitHub
parent a6b3872af4
commit 6374ec0de7
3 changed files with 33 additions and 17 deletions
@@ -19,6 +19,7 @@ package org.jackhuang.hmcl.ui.construct;
import javafx.beans.property.*;
import javafx.collections.ObservableList;
import javafx.css.PseudoClass;
import javafx.geometry.Orientation;
import javafx.scene.Node;
import javafx.scene.control.Control;
@@ -228,4 +229,30 @@ public class ComponentSublist extends Control implements NoPaddingComponent {
public void setTip(String tip) {
this.tip.set(tip);
}
/// Whether the sublist header should use a larger title font.
private static final PseudoClass PSEUDO_LARGE_TITLE = PseudoClass.getPseudoClass("large-title");
/// The property controlling whether the sublist header uses a larger title font.
private final BooleanProperty largeTitle = new SimpleBooleanProperty(this, "largeTitle", false) {
@Override
protected void invalidated() {
pseudoClassStateChanged(PSEUDO_LARGE_TITLE, get());
}
};
/// Returns the property controlling whether the sublist header uses a larger title font.
public BooleanProperty largeTitleProperty() {
return largeTitle;
}
/// Returns whether the sublist header uses a larger title font.
public final boolean isLargeTitle() {
return largeTitle.get();
}
/// Sets whether the sublist header uses a larger title font.
public final void setLargeTitle(boolean value) {
largeTitle.set(value);
}
}
@@ -145,10 +145,7 @@ final class ComponentSublistWrapper extends VBox implements NoPaddingComponent {
});
});
Node headerLeft = sublist.getHeaderLeft();
if (headerLeft != null) {
header.setTitleContent(headerLeft);
}
FXUtils.onChangeAndOperate(sublist.largeTitleProperty(), header::setLargeTitle);
InvalidationListener updateTitleTrailing = observable -> {
Node titleTrailing = sublist.getTitleTrailing();
@@ -32,8 +32,7 @@ import javafx.scene.Cursor;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.image.ImageView;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.text.TextFlow;
@@ -550,17 +549,10 @@ public class TerracottaControllerPage extends StackPane {
private ComponentSublist getThirdPartyDownloadNodes() {
ComponentSublist locals = new ComponentSublist();
var header = new LinePane();
header.getStyleClass().add("no-padding");
header.setLargeTitle(true);
header.setMinHeight(LinePane.USE_COMPUTED_SIZE);
HBox.setHgrow(header, Priority.ALWAYS);
header.setMouseTransparent(true);
header.setLeading(FXUtils.newBuiltinImage("/assets/img/terracotta.png"));
header.setTitle(i18n("terracotta.from_local.title"));
header.setSubtitle(i18n("terracotta.from_local.desc"));
locals.setHeaderLeft(header);
locals.setLargeTitle(true);
locals.setLeading(new ImageView(FXUtils.newBuiltinImage("/assets/img/terracotta.png")));
locals.setTitle(i18n("terracotta.from_local.title"));
locals.setSubtitle(i18n("terracotta.from_local.desc"));
for (TerracottaMetadata.Link link : TerracottaMetadata.PACKAGE_LINKS) {
LineButton item = new LineButton();