Skip to content

Commit

Permalink
fix: simplify styling in scroll_view composable and update http example
Browse files Browse the repository at this point in the history
  • Loading branch information
matthunz committed Dec 9, 2024
1 parent 5dad9a3 commit f90e4c4
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 13 deletions.
2 changes: 2 additions & 0 deletions examples/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ impl Compose for BreedList {
name: breed.0.clone(),
families: breed.1.clone(),
}))
.max_width(Val::Px(400.))
.flex_gap(Val::Px(30.)),
)
.align_items(AlignItems::Center)
}
}

Expand Down
4 changes: 1 addition & 3 deletions src/ui/material/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ impl<'a, C> Button<'a, C> {

impl<C: Compose> Compose for Button<'_, C> {
fn compose(cx: Scope<Self>) -> impl Compose {
let theme = use_context::<Theme>(&cx)
.cloned()
.unwrap_or_default();
let theme = use_context::<Theme>(&cx).cloned().unwrap_or_default();

container(unsafe { Signal::map_unchecked(cx.me(), |me| &me.content) })
.background_color(cx.me().background_color.unwrap_or(theme.colors.primary))
Expand Down
4 changes: 1 addition & 3 deletions src/ui/material/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ impl<'a, C> Container<'a, C> {

impl<C: Compose> Compose for Container<'_, C> {
fn compose(cx: Scope<Self>) -> impl Compose {
let theme = use_context::<Theme>(&cx)
.cloned()
.unwrap_or_default();
let theme = use_context::<Theme>(&cx).cloned().unwrap_or_default();

cx.me()
.modifier
Expand Down
4 changes: 1 addition & 3 deletions src/ui/material/radio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ impl RadioButton<'_> {

impl Compose for RadioButton<'_> {
fn compose(cx: Scope<Self>) -> impl Compose {
let theme = use_context::<Theme>(&cx)
.cloned()
.unwrap_or_default();
let theme = use_context::<Theme>(&cx).cloned().unwrap_or_default();

let size = Val::Px(cx.me().outer_radius * 2.);
let inner_size = Val::Px(cx.me().inner_radius * 2.);
Expand Down
4 changes: 1 addition & 3 deletions src/ui/material/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ impl Text<'_> {

impl Compose for Text<'_> {
fn compose(cx: crate::Scope<Self>) -> impl Compose {
let theme = use_context::<Theme>(&cx)
.cloned()
.unwrap_or_default();
let theme = use_context::<Theme>(&cx).cloned().unwrap_or_default();

let style = &theme.typography[cx.me().typography][cx.me().typography_style];

Expand Down
1 change: 0 additions & 1 deletion src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ impl<C: Compose> Compose for ScrollView<'_, C> {
modifier
.apply(
spawn(Node {
height: Val::Percent(100.),
flex_direction: FlexDirection::Column,
overflow: Overflow::scroll_y(),
..Default::default()
Expand Down

0 comments on commit f90e4c4

Please sign in to comment.