make TUI widgets cross framework
This commit is contained in:
1 parent
9a16687bdc
commit
c4c35cb046
33 files changed
+3025
-1091
No files matched your search
@@ -1,6 +1,5 @@
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_html::FormData;
|
||||
use dioxus_tui::prelude::*;
|
||||
use dioxus_tui::Config;
|
||||
|
||||
fn main() {
|
||||
dioxus_tui::launch_cfg(app, Config::new());
|
||||
@@ -18,8 +17,8 @@ fn app(cx: Scope) -> Element {
|
||||
align_items: "center",
|
||||
justify_content: "center",
|
||||
|
||||
Input{
|
||||
oninput: |data: FormData| if &data.value == "good"{
|
||||
input {
|
||||
oninput: |data| if &data.value == "good"{
|
||||
bg_green.set(true);
|
||||
} else{
|
||||
bg_green.set(false);
|
||||
@@ -30,8 +29,8 @@ fn app(cx: Scope) -> Element {
|
||||
height: "10%",
|
||||
checked: "true",
|
||||
}
|
||||
Input{
|
||||
oninput: |data: FormData| if &data.value == "hello world"{
|
||||
input {
|
||||
oninput: |data| if &data.value == "hello world"{
|
||||
bg_green.set(true);
|
||||
} else{
|
||||
bg_green.set(false);
|
||||
@@ -40,8 +39,8 @@ fn app(cx: Scope) -> Element {
|
||||
height: "10%",
|
||||
maxlength: "11",
|
||||
}
|
||||
Input{
|
||||
oninput: |data: FormData| {
|
||||
input {
|
||||
oninput: |data| {
|
||||
if (data.value.parse::<f32>().unwrap() - 40.0).abs() < 5.0 {
|
||||
bg_green.set(true);
|
||||
} else{
|
||||
@@ -54,8 +53,8 @@ fn app(cx: Scope) -> Element {
|
||||
min: "20",
|
||||
max: "80",
|
||||
}
|
||||
Input{
|
||||
oninput: |data: FormData| {
|
||||
input {
|
||||
oninput: |data| {
|
||||
if data.value == "10"{
|
||||
bg_green.set(true);
|
||||
} else{
|
||||
@@ -67,8 +66,8 @@ fn app(cx: Scope) -> Element {
|
||||
height: "10%",
|
||||
maxlength: "4",
|
||||
}
|
||||
Input{
|
||||
oninput: |data: FormData| {
|
||||
input {
|
||||
oninput: |data| {
|
||||
if data.value == "hello world"{
|
||||
bg_green.set(true);
|
||||
} else{
|
||||
@@ -80,8 +79,10 @@ fn app(cx: Scope) -> Element {
|
||||
height: "10%",
|
||||
maxlength: "11",
|
||||
}
|
||||
Input{
|
||||
onclick: |_: FormData| bg_green.set(true),
|
||||
input {
|
||||
oninput: |_| {
|
||||
bg_green.set(true)
|
||||
},
|
||||
r#type: "button",
|
||||
value: "green",
|
||||
width: "50%",
|
||||
|
||||
Reference in new issue
Block a user