wip: command bar
Some checks failed
Rust / build (ubuntu-latest, stable) (push) Failing after 1m35s
Rust / build (ubuntu-latest, stable) (pull_request) Failing after 1m36s

This commit is contained in:
2026-02-02 15:23:02 +07:00
parent 9b03f873c2
commit f164e86967
19 changed files with 627 additions and 518 deletions

View File

@@ -124,6 +124,7 @@ pub struct Button {
children: Vec<AnyElement>,
variant: ButtonVariant,
center: bool,
rounded: bool,
size: Size,
@@ -170,6 +171,7 @@ impl Button {
on_hover: None,
loading: false,
reverse: false,
center: true,
bold: false,
cta: false,
children: Vec::new(),
@@ -221,6 +223,12 @@ impl Button {
self
}
/// Disable centering the button's content.
pub fn no_center(mut self) -> Self {
self.center = false;
self
}
/// Set the cta style of the button.
pub fn cta(mut self) -> Self {
self.cta = true;
@@ -353,7 +361,7 @@ impl RenderOnce for Button {
.flex_shrink_0()
.flex()
.items_center()
.justify_center()
.when(self.center, |this| this.justify_center())
.cursor_default()
.overflow_hidden()
.refine_style(&self.style)

View File

@@ -4,7 +4,7 @@ pub use focusable::FocusableCycle;
pub use icon::*;
pub use kbd::*;
pub use menu::{context_menu, popup_menu};
pub use root::Root;
pub use root::{window_paddings, Root};
pub use styled::*;
pub use window_ext::*;

View File

@@ -381,7 +381,7 @@ impl Render for Root {
}
/// Get the window paddings.
pub(crate) fn window_paddings(window: &Window, _cx: &App) -> Edges<Pixels> {
pub fn window_paddings(window: &Window, _cx: &App) -> Edges<Pixels> {
match window.window_decorations() {
Decorations::Server => Edges::all(px(0.0)),
Decorations::Client { tiling } => {