-
Notifications
You must be signed in to change notification settings - Fork 568
Open
Description
When I was using druid version 0.7.0, the code worked fine.
[dependencies]
druid = "0.7.0"
reqwest = { version = "0.11", features = ["blocking"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
But when I modify my 0.8.3, I get an error that has nothing to do with my code, as follows
I tried the following operations, and it still didn’t solve the problem after re-running it.
# problem not solved
cargo clean
# problem not solved
rm -rf ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/druid-shell-0.8.3
Thanks ~
run command
cargo run --bin radio
the code
use druid::widget::{Flex, Label, RadioGroup};
use druid::{AppLauncher, Data, Lens, Widget, WidgetExt, WindowDesc};
#[derive(Clone, Data, Lens)]
struct AppData {
choice: String,
}
fn build_ui() -> impl Widget<AppData> {
let choices = vec![
("Option 1".to_string(), "Value 1".to_string()),
("Option 2".to_string(), "Value 2".to_string()),
("Option 3".to_string(), "Value 3".to_string()),
];
let radio = RadioGroup::new(choices).lens(AppData::choice);
let label = Label::new(|data: &AppData, _env: &druid::Env| {
format!("You selected: {}", data.choice)
});
Flex::column()
.with_child(radio)
.with_child(label)
}
fn main() {
let main_window = WindowDesc::new(build_ui)
.title("RadioGroup Example")
.window_size((300.0, 200.0));
let data = AppData { choice: "Value 1".to_string() };
AppLauncher::with_window(main_window)
.use_simple_logger()
.launch(data)
.expect("Failed to launch application");
}
Metadata
Metadata
Assignees
Labels
No labels