make mlb scrollable

This commit is contained in:
death916 2026-03-12 05:57:07 -07:00
parent 6c8e0413ca
commit 06964a28e1

View file

@ -4,7 +4,7 @@ use chrono::Local;
use iced::Border; use iced::Border;
use iced::Element; use iced::Element;
use iced::Fill; use iced::Fill;
use iced::widget::{column, container, image, pane_grid, row, text}; use iced::widget::{column, container, image, pane_grid, row, text,scrollable};
use sports::Game; use sports::Game;
pub fn main() -> iced::Result { pub fn main() -> iced::Result {
iced::run(State::update, State::view) iced::run(State::update, State::view)
@ -12,12 +12,12 @@ pub fn main() -> iced::Result {
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
enum PaneType { enum PaneType {
Main,
MlbPane, MlbPane,
NflPane, NflPane,
NbaPane, NbaPane,
Weather, Weather,
Clock, Clock,
News,
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
@ -96,9 +96,10 @@ impl State {
.into() .into()
} }
PaneType::NflPane => text("NFL").into(), PaneType::NflPane => text("NFL").into(),
PaneType::News => text("News").into(),
PaneType::MlbPane => { PaneType::MlbPane => {
let games = &state.mlb_scores; let games = &state.mlb_scores;
column(games.iter().map(|game| { scrollable(column(games.iter().map(|game| {
container( container(
column![ column![
row![ row![
@ -133,11 +134,9 @@ impl State {
}, },
}) })
.into() .into()
})) })))
.padding(0)
.into() .into()
} }
PaneType::Main => text("Main").into(),
PaneType::Clock => text("clock").into(), PaneType::Clock => text("clock").into(),
PaneType::Weather => { PaneType::Weather => {
let weather_img = image::Handle::from_bytes(state.weather.clone()); let weather_img = image::Handle::from_bytes(state.weather.clone());