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