remove state generic from a lot of things

This commit is contained in:
2025-12-17 21:37:55 -05:00
parent 7e6369029f
commit 30bc55c78e
45 changed files with 740 additions and 856 deletions

View File

@@ -1,7 +1,7 @@
use crate::prelude::*;
pub struct Scroll<State> {
inner: WidgetHandle<State>,
pub struct Scroll {
inner: WidgetHandle,
axis: Axis,
amt: f32,
snap_end: bool,
@@ -9,8 +9,8 @@ pub struct Scroll<State> {
content_len: f32,
}
impl<State: 'static> Widget<State> for Scroll<State> {
fn draw(&mut self, painter: &mut Painter<State>) {
impl Widget for Scroll {
fn draw(&mut self, painter: &mut Painter) {
let output_len = painter.output_size().axis(self.axis);
let container_len = painter.region().axis(self.axis).len();
let content_len = painter
@@ -31,17 +31,17 @@ impl<State: 'static> Widget<State> for Scroll<State> {
painter.widget_within(&self.inner, region);
}
fn desired_width(&mut self, ctx: &mut SizeCtx<State>) -> Len {
fn desired_width(&mut self, ctx: &mut SizeCtx) -> Len {
ctx.width(&self.inner)
}
fn desired_height(&mut self, ctx: &mut SizeCtx<State>) -> Len {
fn desired_height(&mut self, ctx: &mut SizeCtx) -> Len {
ctx.height(&self.inner)
}
}
impl<State> Scroll<State> {
pub fn new(inner: WidgetHandle<State>, axis: Axis) -> Self {
impl Scroll {
pub fn new(inner: WidgetHandle, axis: Axis) -> Self {
Self {
inner,
axis,