Lock screen: the splash line centred (an elided text starts at its box's left, so the box is as wide as the words)
This commit is contained in:
+6
-4
@@ -169,11 +169,13 @@ fn upper(clock: &Clock, shown: &Shown, width: f32) -> Column {
|
||||
let mut parts: Vec<Box<dyn Widget>> = vec![Box::new(Row::new(date).gap(size * 0.4).align(Center)), Box::new(digits)];
|
||||
|
||||
if show::splash() && !shown.splash.is_empty() {
|
||||
let size = text::popup();
|
||||
let size = size * 0.7;
|
||||
let words = format!("“{}”", shown.splash);
|
||||
|
||||
parts.push(Box::new(
|
||||
Rectangle::new().width(width * 0.7).height(size * 1.6).align_child(Center, Center).child(Text::new(format!("“{}”", shown.splash)).size(size).color(theme.dim).elide()),
|
||||
));
|
||||
// as wide as the words, at most most of the screen: elided text starts at its box's left
|
||||
let box_w = (words_width(&words, size) + size).min(width * 0.7);
|
||||
|
||||
parts.push(Box::new(Rectangle::new().width(box_w).height(size * 1.6).align_child(Center, Center).child(Text::new(words).size(size).color(theme.dim).elide())));
|
||||
}
|
||||
|
||||
Column::new(parts).gap(look::gap() * 0.4).align(Center)
|
||||
|
||||
Reference in New Issue
Block a user