date_picker: Reduce DatePicker popup position. (#195)

This commit is contained in:
Jason Lee 2024-09-01 00:36:51 +08:00 committed by GitHub
parent 169572fa74
commit 9c4411ff2b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 20 deletions

View file

@ -15,8 +15,7 @@ use ui::{
drawer::Drawer,
h_flex,
modal::Modal,
popover::Popover,
popup_menu::PopupMenu,
popup_menu::PopupMenuExt,
theme::{ActiveTheme, Theme},
ContextModal, IconName, Root, Sizable,
};
@ -430,23 +429,23 @@ impl Render for LocaleSelector {
.track_focus(&focus_handle)
.on_action(cx.listener(Self::on_select_locale))
.child(
Popover::new("locale-selector")
.anchor(AnchorCorner::TopRight)
.trigger(Button::new("btn", cx).small().ghost().icon(IconName::Globe))
.content(move |cx| {
PopupMenu::build(cx, |this, _cx| {
this.menu_with_check(
"English",
locale == "en",
Box::new(SelectLocale("en".into())),
)
.menu_with_check(
"简体中文",
locale == "zh-CN",
Box::new(SelectLocale("zh-CN".into())),
)
})
}),
Button::new("btn", cx)
.small()
.ghost()
.icon(IconName::Globe)
.popup_menu(move |this, _| {
this.menu_with_check(
"English",
locale == "en",
Box::new(SelectLocale("en".into())),
)
.menu_with_check(
"简体中文",
locale == "zh-CN",
Box::new(SelectLocale("zh-CN".into())),
)
})
.anchor(AnchorCorner::TopRight),
)
}
}

View file

@ -219,7 +219,7 @@ impl Render for DatePicker {
.track_focus(&self.focus_handle)
.occlude()
.absolute()
.mt_2()
.mt_1p5()
.overflow_hidden()
.rounded_lg()
.p_3()