Add UI dev mode indicator
This commit is contained in:
parent
53ac9f52ff
commit
1c46a7a5d5
@ -31,8 +31,8 @@ import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static atlantafx.base.controls.Popover.ArrowLocation.TOP_CENTER;
|
||||
import static atlantafx.base.theme.Styles.BUTTON_ICON;
|
||||
import static atlantafx.base.theme.Styles.FLAT;
|
||||
import static atlantafx.base.theme.Styles.*;
|
||||
import static atlantafx.sampler.Launcher.IS_DEV_MODE;
|
||||
import static atlantafx.sampler.util.Containers.setScrollConstraints;
|
||||
|
||||
public abstract class AbstractPage extends BorderPane implements Page {
|
||||
@ -95,6 +95,11 @@ public abstract class AbstractPage extends BorderPane implements Page {
|
||||
header.setMinHeight(HEADER_HEIGHT);
|
||||
header.setAlignment(Pos.CENTER_LEFT);
|
||||
header.getChildren().setAll(titleLabel, new Spacer(), quickConfigBtn, sourceCodeToggleBtn);
|
||||
if (IS_DEV_MODE) {
|
||||
var devModeLabel = new Label("App is running in development mode");
|
||||
devModeLabel.getStyleClass().addAll(TEXT_SMALL, "dev-mode-indicator");
|
||||
header.getChildren().add(1, devModeLabel);
|
||||
}
|
||||
|
||||
// == user content ==
|
||||
|
||||
@ -107,8 +112,8 @@ public abstract class AbstractPage extends BorderPane implements Page {
|
||||
|
||||
var scrollPane = new ScrollPane(userContentWrapper);
|
||||
setScrollConstraints(scrollPane,
|
||||
ScrollPane.ScrollBarPolicy.AS_NEEDED, true,
|
||||
ScrollPane.ScrollBarPolicy.AS_NEEDED, true
|
||||
ScrollPane.ScrollBarPolicy.AS_NEEDED, true,
|
||||
ScrollPane.ScrollBarPolicy.AS_NEEDED, true
|
||||
);
|
||||
scrollPane.setMaxHeight(10_000);
|
||||
|
||||
|
@ -81,13 +81,7 @@ public final class ThemeManager {
|
||||
Objects.requireNonNull(theme);
|
||||
|
||||
Application.setUserAgentStylesheet(Objects.requireNonNull(theme.getUserAgentStylesheet()));
|
||||
|
||||
if (currentTheme != null) {
|
||||
getScene().getStylesheets().removeIf(s -> theme.getAllStylesheets().contains(s));
|
||||
}
|
||||
|
||||
theme.getAllStylesheets().forEach(s -> getScene().getStylesheets().add(s));
|
||||
|
||||
getScene().getStylesheets().setAll(theme.getAllStylesheets());
|
||||
getScene().getRoot().pseudoClassStateChanged(DARK, theme.isDarkMode());
|
||||
|
||||
// remove user CSS customizations and reset accent on theme change
|
||||
|
@ -5,6 +5,16 @@
|
||||
-fx-padding: 10px 20px 14px 20px;
|
||||
-fx-spacing: 10px;
|
||||
-fx-background-color: -color-bg-default;
|
||||
|
||||
>.dev-mode-indicator {
|
||||
-fx-background-color: -color-warning-subtle;
|
||||
-fx-background-radius: 10px;
|
||||
-fx-text-fill: -color-warning-fg;
|
||||
-fx-padding: 5px;
|
||||
-fx-border-color: -color-warning-muted;
|
||||
-fx-border-width: 1px;
|
||||
-fx-border-radius: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
>.stack {
|
||||
|
Loading…
Reference in New Issue
Block a user