mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-30 04:54:15 +00:00
hide counter on empty input
This commit is contained in:
parent
f3a2a31872
commit
b4074e46c3
@ -38,7 +38,7 @@ impl Control {
|
|||||||
// Actions
|
// Actions
|
||||||
pub fn update(&self, is_empty: bool, bytes_left: Option<usize>) {
|
pub fn update(&self, is_empty: bool, bytes_left: Option<usize>) {
|
||||||
// Update children components
|
// Update children components
|
||||||
self.counter.update(bytes_left);
|
self.counter.update(is_empty, bytes_left);
|
||||||
self.send.update(match bytes_left {
|
self.send.update(match bytes_left {
|
||||||
Some(left) => !is_empty && left > 0,
|
Some(left) => !is_empty && left > 0,
|
||||||
None => false,
|
None => false,
|
||||||
|
@ -23,7 +23,7 @@ impl Counter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
pub fn update(&self, bytes_left: Option<usize>) {
|
pub fn update(&self, is_empty: bool, bytes_left: Option<usize>) {
|
||||||
self.widget.update(bytes_left);
|
self.widget.update(is_empty, bytes_left);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ impl Widget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
pub fn update(&self, bytes_left: Option<usize>) {
|
pub fn update(&self, is_empty: bool, bytes_left: Option<usize>) {
|
||||||
match bytes_left {
|
match bytes_left {
|
||||||
Some(value) => {
|
Some(value) => {
|
||||||
// Update color on chars left reached
|
// Update color on chars left reached
|
||||||
@ -30,7 +30,7 @@ impl Widget {
|
|||||||
self.label.set_label(&value.to_string());
|
self.label.set_label(&value.to_string());
|
||||||
|
|
||||||
// Toggle visibility on chars left provided
|
// Toggle visibility on chars left provided
|
||||||
self.label.set_visible(true);
|
self.label.set_visible(!is_empty);
|
||||||
}
|
}
|
||||||
None => self.label.set_visible(false),
|
None => self.label.set_visible(false),
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user