Made the theme picker sort from dark to light

Added a layer into 'ConstrainedBox' to clip it
's children

Made the welcome experience responsive to small and large sizes
This commit is contained in:
Mikayla Maki 2023-03-06 18:36:18 -08:00
parent 8db7e17ac5
commit 3b31f10c6f
4 changed files with 9 additions and 4 deletions

View file

@ -153,7 +153,9 @@ impl Element for ConstrainedBox {
_: &mut Self::LayoutState, _: &mut Self::LayoutState,
cx: &mut PaintContext, cx: &mut PaintContext,
) -> Self::PaintState { ) -> Self::PaintState {
self.child.paint(bounds.origin(), visible_bounds, cx); cx.paint_layer(Some(visible_bounds), |cx| {
self.child.paint(bounds.origin(), visible_bounds, cx);
})
} }
fn rect_for_text_range( fn rect_for_text_range(

View file

@ -102,7 +102,10 @@ impl<D: PickerDelegate> View for Picker<D> {
.read(cx) .read(cx)
.render_match(ix, state, ix == selected_ix, cx) .render_match(ix, state, ix == selected_ix, cx)
}) })
.on_down(MouseButton::Left, move |_, cx| { // Capture mouse events
.on_down(MouseButton::Left, |_, _| {})
.on_up(MouseButton::Left, |_, _| {})
.on_click(MouseButton::Left, move |_, cx| {
cx.dispatch_action(SelectIndex(ix)) cx.dispatch_action(SelectIndex(ix))
}) })
.with_cursor_style(CursorStyle::PointingHand) .with_cursor_style(CursorStyle::PointingHand)

View file

@ -50,7 +50,6 @@ impl ThemeSelector {
theme_names.sort_unstable_by(|a, b| { theme_names.sort_unstable_by(|a, b| {
a.is_light a.is_light
.cmp(&b.is_light) .cmp(&b.is_light)
.reverse()
.then(a.name.cmp(&b.name)) .then(a.name.cmp(&b.name))
}); });
let matches = theme_names let matches = theme_names

View file

@ -84,6 +84,7 @@ impl View for WelcomePage {
]) ])
.constrained() .constrained()
.with_max_width(width) .with_max_width(width)
.contained().with_uniform_padding(10.)
.aligned() .aligned()
.boxed(), .boxed(),
) )
@ -126,7 +127,7 @@ impl WelcomePage {
.contained() .contained()
.with_style(style.container) .with_style(style.container)
.constrained() .constrained()
.with_width(width) .with_max_width(width)
.boxed() .boxed()
}) })
.on_click(MouseButton::Left, move |_, cx| { .on_click(MouseButton::Left, move |_, cx| {