Seperate style and title variables (#537)

Added lj's thought process from https://github.com/ChrisTitusTech/linutil/pull/490

Co-authored-by: Liam <33645555+lj3954@users.noreply.github.com>
This commit is contained in:
JEEVITHA KANNAN K S 2024-09-20 00:11:23 +05:30 committed by GitHub
parent 035aff28eb
commit 176ce1f4b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -237,22 +237,16 @@ impl AppState {
Style::new() Style::new()
}; };
let title = format!(
"Linux Toolbox - {} {}",
env!("BUILD_DATE"),
self.multi_select.then(|| "[Multi-Select]").unwrap_or("")
);
// Create the list widget with items // Create the list widget with items
let list = List::new(items) let list = List::new(items)
.highlight_style(if let Focus::List = self.focus { .highlight_style(style)
Style::default().reversed() .block(Block::default().borders(Borders::ALL).title(title))
} else {
Style::new()
})
.block(Block::default().borders(Borders::ALL).title(format!(
"Linux Toolbox - {} {}",
env!("BUILD_DATE"),
if self.multi_select {
"[Multi-Select]"
} else {
""
}
)))
.scroll_padding(1); .scroll_padding(1);
frame.render_stateful_widget(list, chunks[1], &mut self.selection); frame.render_stateful_widget(list, chunks[1], &mut self.selection);