Fixed sidebar responsiveness
- Created new widget `scrollbar` which can adopt COSMIC styling. - Increased sidebar icon size by 4 pixels to improve visibility. - Added padding inside the navigation bar to prevent collision with the scrollbar. - Increased the max width of the condensed navbar for the scrollbar.
This commit is contained in:
parent
8b73478c57
commit
4ae03278cc
4 changed files with 36 additions and 13 deletions
|
|
@ -15,3 +15,6 @@ pub use nav::*;
|
|||
|
||||
mod toggler;
|
||||
pub use toggler::*;
|
||||
|
||||
mod scrollbar;
|
||||
pub use scrollbar::*;
|
||||
|
|
@ -9,12 +9,14 @@ use iced::{
|
|||
macro_rules! nav_bar {
|
||||
($($x:expr),+ $(,)?) => (
|
||||
$crate::iced::widget::Container::new(
|
||||
$crate::iced::widget::scrollable(
|
||||
$crate::iced::widget::Column::with_children(
|
||||
vec![$($crate::iced::Element::from($x)),+]
|
||||
)
|
||||
.spacing(12)
|
||||
.padding([0,20,0,0])
|
||||
$crate::scrollbar!(
|
||||
$crate::iced::widget::row![
|
||||
$crate::iced::widget::Column::with_children(
|
||||
vec![$($crate::iced::Element::from($x)),+]
|
||||
)
|
||||
.spacing(12)
|
||||
.padding(12),
|
||||
]
|
||||
)
|
||||
)
|
||||
.max_width(300)
|
||||
|
|
@ -43,12 +45,12 @@ macro_rules! nav_button {
|
|||
($icon: expr, $title:expr, $condensed:expr) => ({
|
||||
if $condensed {
|
||||
$crate::iced::widget::Button::new(
|
||||
$crate::widget::icon($icon, 16)
|
||||
$crate::widget::icon($icon, 20)
|
||||
)
|
||||
.padding(8)
|
||||
} else {
|
||||
$crate::widget::button!(
|
||||
$crate::widget::icon($icon, 16),
|
||||
$crate::widget::icon($icon, 20),
|
||||
$crate::iced::widget::Text::new($title),
|
||||
$crate::iced::widget::horizontal_space(
|
||||
$crate::iced::Length::Fill
|
||||
|
|
|
|||
8
src/widget/scrollbar.rs
Normal file
8
src/widget/scrollbar.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#[macro_export]
|
||||
macro_rules! scrollbar {
|
||||
($x:expr) => (
|
||||
$crate::iced::widget::scrollable($x)
|
||||
.scrollbar_width(8)
|
||||
.scroller_width(8)
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue