2024-01-03 15:27:32 -07:00
|
|
|
use cosmic::{
|
|
|
|
|
app::Core,
|
|
|
|
|
cosmic_theme,
|
2024-01-05 08:55:18 -07:00
|
|
|
iced::{
|
|
|
|
|
alignment::{Horizontal, Vertical},
|
|
|
|
|
Alignment, Length, Point,
|
|
|
|
|
},
|
2024-01-03 15:27:32 -07:00
|
|
|
theme, widget, Element,
|
|
|
|
|
};
|
|
|
|
|
use std::{
|
|
|
|
|
cmp::Ordering,
|
2024-01-04 15:56:01 -07:00
|
|
|
collections::HashMap,
|
2024-01-05 08:55:18 -07:00
|
|
|
fmt, fs,
|
2024-01-03 15:27:32 -07:00
|
|
|
path::PathBuf,
|
|
|
|
|
process,
|
|
|
|
|
time::{Duration, Instant},
|
|
|
|
|
};
|
|
|
|
|
|
2024-01-05 08:55:18 -07:00
|
|
|
use crate::{fl, mime_icon::mime_icon};
|
2024-01-03 15:33:28 -07:00
|
|
|
|
2024-01-03 15:27:32 -07:00
|
|
|
const DOUBLE_CLICK_DURATION: Duration = Duration::from_millis(500);
|
2024-01-05 09:36:16 -07:00
|
|
|
//TODO: configurable
|
|
|
|
|
const ICON_SIZE_LIST: u16 = 32;
|
|
|
|
|
const ICON_SIZE_GRID: u16 = 64;
|
2024-01-03 15:27:32 -07:00
|
|
|
|
2024-01-04 15:56:01 -07:00
|
|
|
lazy_static::lazy_static! {
|
|
|
|
|
static ref SPECIAL_DIRS: HashMap<PathBuf, &'static str> = {
|
|
|
|
|
let mut special_dirs = HashMap::new();
|
|
|
|
|
if let Some(dir) = dirs::document_dir() {
|
|
|
|
|
special_dirs.insert(dir, "folder-documents");
|
|
|
|
|
}
|
|
|
|
|
if let Some(dir) = dirs::download_dir() {
|
|
|
|
|
special_dirs.insert(dir, "folder-download");
|
|
|
|
|
}
|
|
|
|
|
if let Some(dir) = dirs::audio_dir() {
|
|
|
|
|
special_dirs.insert(dir, "folder-music");
|
|
|
|
|
}
|
|
|
|
|
if let Some(dir) = dirs::picture_dir() {
|
|
|
|
|
special_dirs.insert(dir, "folder-pictures");
|
|
|
|
|
}
|
|
|
|
|
if let Some(dir) = dirs::public_dir() {
|
|
|
|
|
special_dirs.insert(dir, "folder-publicshare");
|
|
|
|
|
}
|
|
|
|
|
if let Some(dir) = dirs::template_dir() {
|
|
|
|
|
special_dirs.insert(dir, "folder-templates");
|
|
|
|
|
}
|
|
|
|
|
if let Some(dir) = dirs::video_dir() {
|
|
|
|
|
special_dirs.insert(dir, "folder-videos");
|
|
|
|
|
}
|
|
|
|
|
if let Some(dir) = dirs::desktop_dir() {
|
|
|
|
|
special_dirs.insert(dir, "user-desktop");
|
|
|
|
|
}
|
|
|
|
|
if let Some(dir) = dirs::home_dir() {
|
|
|
|
|
special_dirs.insert(dir, "user-home");
|
|
|
|
|
}
|
|
|
|
|
special_dirs
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-05 09:36:16 -07:00
|
|
|
fn button_style(selected: bool) -> theme::Button {
|
|
|
|
|
//TODO: move to libcosmic
|
|
|
|
|
theme::Button::Custom {
|
|
|
|
|
active: Box::new(move |focused, theme| {
|
|
|
|
|
let mut appearance =
|
|
|
|
|
widget::button::StyleSheet::active(theme, focused, &theme::Button::MenuItem);
|
|
|
|
|
if !selected {
|
|
|
|
|
appearance.background = None;
|
|
|
|
|
}
|
|
|
|
|
appearance
|
|
|
|
|
}),
|
|
|
|
|
disabled: Box::new(move |theme| {
|
|
|
|
|
let mut appearance =
|
|
|
|
|
widget::button::StyleSheet::disabled(theme, &theme::Button::MenuItem);
|
|
|
|
|
if !selected {
|
|
|
|
|
appearance.background = None;
|
|
|
|
|
}
|
|
|
|
|
appearance
|
|
|
|
|
}),
|
|
|
|
|
hovered: Box::new(move |focused, theme| {
|
|
|
|
|
widget::button::StyleSheet::hovered(theme, focused, &theme::Button::MenuItem)
|
|
|
|
|
}),
|
|
|
|
|
pressed: Box::new(move |focused, theme| {
|
|
|
|
|
widget::button::StyleSheet::pressed(theme, focused, &theme::Button::MenuItem)
|
|
|
|
|
}),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-05 08:55:18 -07:00
|
|
|
fn folder_icon(path: &PathBuf, icon_size: u16) -> widget::icon::Handle {
|
2024-01-04 15:56:01 -07:00
|
|
|
widget::icon::from_name(SPECIAL_DIRS.get(path).map_or("folder", |x| *x))
|
|
|
|
|
.size(icon_size)
|
2024-01-05 08:55:18 -07:00
|
|
|
.handle()
|
2024-01-04 15:56:01 -07:00
|
|
|
}
|
|
|
|
|
|
2024-01-04 16:08:22 -07:00
|
|
|
#[cfg(not(target_os = "windows"))]
|
|
|
|
|
fn hidden_attribute(_path: &PathBuf) -> bool {
|
|
|
|
|
false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[cfg(target_os = "windows")]
|
|
|
|
|
fn hidden_attribute(path: &PathBuf) -> bool {
|
|
|
|
|
use std::os::windows::fs::MetadataExt;
|
|
|
|
|
match fs::metadata(path) {
|
|
|
|
|
Ok(metadata) => {
|
|
|
|
|
// https://learn.microsoft.com/en-us/windows/win32/fileio/file-attribute-constants
|
|
|
|
|
const FILE_ATTRIBUTE_HIDDEN: u32 = 2;
|
|
|
|
|
metadata.file_attributes() & FILE_ATTRIBUTE_HIDDEN == FILE_ATTRIBUTE_HIDDEN
|
|
|
|
|
}
|
|
|
|
|
Err(err) => {
|
|
|
|
|
log::warn!("failed to get hidden attribute for {:?}: {}", path, err);
|
|
|
|
|
false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-03 15:41:01 -07:00
|
|
|
#[cfg(target_os = "linux")]
|
2024-01-04 16:08:22 -07:00
|
|
|
fn open_command(path: &PathBuf) -> process::Command {
|
2024-01-03 15:41:01 -07:00
|
|
|
let mut command = process::Command::new("xdg-open");
|
|
|
|
|
command.arg(path);
|
|
|
|
|
command
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[cfg(target_os = "macos")]
|
2024-01-04 16:08:22 -07:00
|
|
|
fn open_command(path: &PathBuf) -> process::Command {
|
2024-01-03 15:41:01 -07:00
|
|
|
let mut command = process::Command::new("open");
|
|
|
|
|
command.arg(path);
|
|
|
|
|
command
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[cfg(target_os = "redox")]
|
2024-01-04 16:08:22 -07:00
|
|
|
fn open_command(path: &PathBuf) -> process::Command {
|
2024-01-03 15:41:01 -07:00
|
|
|
let mut command = process::Command::new("launcher");
|
|
|
|
|
command.arg(path);
|
|
|
|
|
command
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[cfg(target_os = "windows")]
|
2024-01-04 16:08:22 -07:00
|
|
|
fn open_command(path: &PathBuf) -> process::Command {
|
2024-01-03 15:41:01 -07:00
|
|
|
let mut command = process::Command::new("cmd");
|
|
|
|
|
command.arg("/c");
|
|
|
|
|
command.arg("start");
|
|
|
|
|
command.arg(path);
|
|
|
|
|
command
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-05 08:55:18 -07:00
|
|
|
pub fn rescan(tab_path: PathBuf) -> Vec<Item> {
|
|
|
|
|
let mut items = Vec::new();
|
|
|
|
|
match fs::read_dir(&tab_path) {
|
|
|
|
|
Ok(entries) => {
|
|
|
|
|
for entry_res in entries {
|
|
|
|
|
let entry = match entry_res {
|
|
|
|
|
Ok(ok) => ok,
|
|
|
|
|
Err(err) => {
|
|
|
|
|
log::warn!("failed to read entry in {:?}: {}", tab_path, err);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
let name = match entry.file_name().into_string() {
|
|
|
|
|
Ok(some) => some,
|
|
|
|
|
Err(name_os) => {
|
|
|
|
|
log::warn!(
|
|
|
|
|
"failed to parse entry in {:?}: {:?} is not valid UTF-8",
|
|
|
|
|
tab_path,
|
|
|
|
|
name_os,
|
|
|
|
|
);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
let path = entry.path();
|
|
|
|
|
let hidden = name.starts_with(".") || hidden_attribute(&path);
|
|
|
|
|
let is_dir = path.is_dir();
|
|
|
|
|
//TODO: configurable size
|
2024-01-05 09:36:16 -07:00
|
|
|
let (icon_handle_grid, icon_handle_list) = if is_dir {
|
|
|
|
|
(
|
|
|
|
|
folder_icon(&path, ICON_SIZE_GRID),
|
|
|
|
|
folder_icon(&path, ICON_SIZE_LIST),
|
|
|
|
|
)
|
2024-01-05 08:55:18 -07:00
|
|
|
} else {
|
2024-01-05 09:36:16 -07:00
|
|
|
(
|
|
|
|
|
mime_icon(&path, ICON_SIZE_GRID),
|
|
|
|
|
mime_icon(&path, ICON_SIZE_LIST),
|
|
|
|
|
)
|
2024-01-05 08:55:18 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
items.push(Item {
|
|
|
|
|
name,
|
|
|
|
|
path,
|
|
|
|
|
hidden,
|
|
|
|
|
is_dir,
|
2024-01-05 09:36:16 -07:00
|
|
|
icon_handle_grid,
|
|
|
|
|
icon_handle_list,
|
2024-01-05 08:55:18 -07:00
|
|
|
select_time: None,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Err(err) => {
|
|
|
|
|
log::warn!("failed to read directory {:?}: {}", tab_path, err);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
items.sort_by(|a, b| match (a.is_dir, b.is_dir) {
|
|
|
|
|
(true, false) => Ordering::Less,
|
|
|
|
|
(false, true) => Ordering::Greater,
|
2024-01-05 09:44:47 -07:00
|
|
|
_ => lexical_sort::natural_lexical_cmp(&a.name, &b.name),
|
2024-01-05 08:55:18 -07:00
|
|
|
});
|
|
|
|
|
items
|
2024-01-03 15:27:32 -07:00
|
|
|
}
|
|
|
|
|
|
2024-01-05 09:36:16 -07:00
|
|
|
#[derive(Clone, Copy, Debug)]
|
|
|
|
|
pub enum Message {
|
2024-01-05 11:18:38 -07:00
|
|
|
Click(Option<usize>),
|
2024-01-05 09:36:16 -07:00
|
|
|
Home,
|
|
|
|
|
Parent,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
|
pub struct Item {
|
|
|
|
|
pub name: String,
|
|
|
|
|
pub path: PathBuf,
|
|
|
|
|
pub hidden: bool,
|
|
|
|
|
pub is_dir: bool,
|
|
|
|
|
pub icon_handle_grid: widget::icon::Handle,
|
|
|
|
|
pub icon_handle_list: widget::icon::Handle,
|
|
|
|
|
pub select_time: Option<Instant>,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl fmt::Debug for Item {
|
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
|
|
|
f.debug_struct("Item")
|
|
|
|
|
.field("name", &self.name)
|
|
|
|
|
.field("path", &self.path)
|
|
|
|
|
.field("hidden", &self.hidden)
|
|
|
|
|
.field("is_dir", &self.is_dir)
|
|
|
|
|
//icon_handles
|
|
|
|
|
.field("select_time", &self.select_time)
|
|
|
|
|
.finish()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Clone, Copy, Debug)]
|
|
|
|
|
pub enum View {
|
|
|
|
|
Grid,
|
|
|
|
|
List,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Clone, Debug)]
|
|
|
|
|
pub struct Tab {
|
|
|
|
|
pub path: PathBuf,
|
|
|
|
|
//TODO
|
|
|
|
|
pub context_menu: Option<Point>,
|
|
|
|
|
pub items_opt: Option<Vec<Item>>,
|
|
|
|
|
pub view: View,
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-03 15:27:32 -07:00
|
|
|
impl Tab {
|
2024-01-05 08:55:18 -07:00
|
|
|
pub fn new(path: PathBuf) -> Self {
|
|
|
|
|
Self {
|
2024-01-03 17:04:08 -07:00
|
|
|
path: match fs::canonicalize(&path) {
|
|
|
|
|
Ok(absolute) => absolute,
|
|
|
|
|
Err(err) => {
|
|
|
|
|
log::warn!("failed to canonicalize {:?}: {}", path, err);
|
|
|
|
|
path
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-01-03 15:27:32 -07:00
|
|
|
context_menu: None,
|
2024-01-05 08:55:18 -07:00
|
|
|
items_opt: None,
|
2024-01-05 09:36:16 -07:00
|
|
|
view: View::Grid,
|
2024-01-03 15:27:32 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn title(&self) -> String {
|
|
|
|
|
//TODO: better title
|
|
|
|
|
format!("{}", self.path.display())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn update(&mut self, message: Message) -> bool {
|
|
|
|
|
let mut cd = None;
|
|
|
|
|
match message {
|
2024-01-05 11:18:38 -07:00
|
|
|
Message::Click(click_i_opt) => {
|
2024-01-05 08:55:18 -07:00
|
|
|
if let Some(ref mut items) = self.items_opt {
|
|
|
|
|
for (i, item) in items.iter_mut().enumerate() {
|
2024-01-05 11:18:38 -07:00
|
|
|
if Some(i) == click_i_opt {
|
2024-01-05 08:55:18 -07:00
|
|
|
if let Some(select_time) = item.select_time {
|
|
|
|
|
if select_time.elapsed() < DOUBLE_CLICK_DURATION {
|
|
|
|
|
if item.is_dir {
|
|
|
|
|
cd = Some(item.path.clone());
|
|
|
|
|
} else {
|
|
|
|
|
let mut command = open_command(&item.path);
|
|
|
|
|
match command.spawn() {
|
|
|
|
|
Ok(_) => (),
|
|
|
|
|
Err(err) => {
|
|
|
|
|
log::warn!(
|
|
|
|
|
"failed to open {:?}: {}",
|
|
|
|
|
item.path,
|
|
|
|
|
err
|
|
|
|
|
);
|
|
|
|
|
}
|
2024-01-03 15:41:01 -07:00
|
|
|
}
|
|
|
|
|
}
|
2024-01-03 15:27:32 -07:00
|
|
|
}
|
|
|
|
|
}
|
2024-01-05 08:55:18 -07:00
|
|
|
//TODO: prevent triple-click and beyond from opening file
|
|
|
|
|
item.select_time = Some(Instant::now());
|
|
|
|
|
} else {
|
|
|
|
|
item.select_time = None;
|
2024-01-03 15:27:32 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-01-05 11:18:38 -07:00
|
|
|
self.context_menu = None;
|
2024-01-03 15:27:32 -07:00
|
|
|
}
|
2024-01-03 17:04:08 -07:00
|
|
|
Message::Home => {
|
|
|
|
|
cd = Some(crate::home_dir());
|
|
|
|
|
}
|
2024-01-03 15:27:32 -07:00
|
|
|
Message::Parent => {
|
|
|
|
|
if let Some(parent) = self.path.parent() {
|
|
|
|
|
cd = Some(parent.to_owned());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if let Some(path) = cd {
|
|
|
|
|
self.path = path;
|
2024-01-05 08:55:18 -07:00
|
|
|
self.items_opt = None;
|
2024-01-03 15:27:32 -07:00
|
|
|
true
|
|
|
|
|
} else {
|
|
|
|
|
false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-05 09:36:16 -07:00
|
|
|
pub fn empty_view(&self, has_hidden: bool, core: &Core) -> Element<Message> {
|
2024-01-03 15:27:32 -07:00
|
|
|
let cosmic_theme::Spacing { space_xxs, .. } = core.system_theme().cosmic().spacing;
|
|
|
|
|
|
2024-01-05 09:36:16 -07:00
|
|
|
widget::container(
|
|
|
|
|
widget::column::with_children(vec![
|
|
|
|
|
widget::icon::from_name("folder-symbolic")
|
|
|
|
|
.size(64)
|
|
|
|
|
.icon()
|
|
|
|
|
.into(),
|
|
|
|
|
widget::text(if has_hidden {
|
|
|
|
|
fl!("empty-folder-hidden")
|
|
|
|
|
} else {
|
|
|
|
|
fl!("empty-folder")
|
|
|
|
|
})
|
|
|
|
|
.into(),
|
|
|
|
|
])
|
|
|
|
|
.align_items(Alignment::Center)
|
|
|
|
|
.spacing(space_xxs),
|
|
|
|
|
)
|
|
|
|
|
.align_x(Horizontal::Center)
|
|
|
|
|
.align_y(Vertical::Center)
|
|
|
|
|
.height(Length::Fill)
|
|
|
|
|
.width(Length::Fill)
|
|
|
|
|
.into()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn grid_view(&self, core: &Core) -> Element<Message> {
|
|
|
|
|
let cosmic_theme::Spacing { space_xxs, .. } = core.system_theme().cosmic().spacing;
|
|
|
|
|
|
|
|
|
|
let mut children: Vec<Element<_>> = Vec::new();
|
2024-01-05 08:55:18 -07:00
|
|
|
if let Some(ref items) = self.items_opt {
|
|
|
|
|
let mut count = 0;
|
|
|
|
|
let mut hidden = 0;
|
|
|
|
|
for (i, item) in items.iter().enumerate() {
|
|
|
|
|
if item.hidden {
|
|
|
|
|
hidden += 1;
|
|
|
|
|
//TODO: SHOW HIDDEN OPTION
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-05 09:36:16 -07:00
|
|
|
children.push(
|
|
|
|
|
widget::button(
|
|
|
|
|
widget::column::with_children(vec![
|
|
|
|
|
widget::icon::icon(item.icon_handle_grid.clone())
|
|
|
|
|
.size(ICON_SIZE_GRID)
|
|
|
|
|
.into(),
|
|
|
|
|
widget::text(item.name.clone()).into(),
|
|
|
|
|
])
|
|
|
|
|
.align_items(Alignment::Center)
|
|
|
|
|
.spacing(space_xxs)
|
|
|
|
|
//TODO: get from config
|
|
|
|
|
.height(Length::Fixed(128.0))
|
|
|
|
|
.width(Length::Fixed(128.0)),
|
|
|
|
|
)
|
|
|
|
|
.style(button_style(item.select_time.is_some()))
|
2024-01-05 11:18:38 -07:00
|
|
|
.on_press(Message::Click(Some(i)))
|
2024-01-05 09:36:16 -07:00
|
|
|
.into(),
|
|
|
|
|
);
|
|
|
|
|
count += 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if count == 0 {
|
|
|
|
|
return self.empty_view(hidden > 0, core);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
widget::flex_row(children).into()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn list_view(&self, core: &Core) -> Element<Message> {
|
|
|
|
|
let cosmic_theme::Spacing { space_xxs, .. } = core.system_theme().cosmic().spacing;
|
|
|
|
|
|
|
|
|
|
let mut children: Vec<Element<_>> = Vec::new();
|
|
|
|
|
if let Some(ref items) = self.items_opt {
|
|
|
|
|
let mut count = 0;
|
|
|
|
|
let mut hidden = 0;
|
|
|
|
|
for (i, item) in items.iter().enumerate() {
|
|
|
|
|
if item.hidden {
|
|
|
|
|
hidden += 1;
|
|
|
|
|
//TODO: SHOW HIDDEN OPTION
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
children.push(
|
2024-01-05 08:55:18 -07:00
|
|
|
widget::button(
|
|
|
|
|
widget::row::with_children(vec![
|
2024-01-05 09:36:16 -07:00
|
|
|
widget::icon::icon(item.icon_handle_list.clone())
|
|
|
|
|
.size(ICON_SIZE_LIST)
|
|
|
|
|
.into(),
|
2024-01-05 08:55:18 -07:00
|
|
|
widget::text(item.name.clone()).into(),
|
|
|
|
|
])
|
|
|
|
|
.align_items(Alignment::Center)
|
|
|
|
|
.spacing(space_xxs),
|
|
|
|
|
)
|
2024-01-05 09:36:16 -07:00
|
|
|
.style(button_style(item.select_time.is_some()))
|
2024-01-05 08:55:18 -07:00
|
|
|
.width(Length::Fill)
|
2024-01-05 11:18:38 -07:00
|
|
|
.on_press(Message::Click(Some(i)))
|
2024-01-05 09:36:16 -07:00
|
|
|
.into(),
|
2024-01-05 08:55:18 -07:00
|
|
|
);
|
|
|
|
|
count += 1;
|
2024-01-03 15:27:32 -07:00
|
|
|
}
|
|
|
|
|
|
2024-01-05 08:55:18 -07:00
|
|
|
if count == 0 {
|
2024-01-05 09:36:16 -07:00
|
|
|
return self.empty_view(hidden > 0, core);
|
2024-01-05 08:55:18 -07:00
|
|
|
}
|
2024-01-03 15:27:32 -07:00
|
|
|
}
|
2024-01-05 09:36:16 -07:00
|
|
|
widget::column::with_children(children)
|
|
|
|
|
.width(Length::Fill)
|
|
|
|
|
.into()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn view(&self, core: &Core) -> Element<Message> {
|
2024-01-05 11:18:38 -07:00
|
|
|
widget::container(
|
|
|
|
|
widget::scrollable(match self.view {
|
|
|
|
|
View::Grid => self.grid_view(core),
|
|
|
|
|
View::List => self.list_view(core),
|
|
|
|
|
})
|
|
|
|
|
.width(Length::Fill),
|
|
|
|
|
)
|
|
|
|
|
.height(Length::Fill)
|
2024-01-05 09:36:16 -07:00
|
|
|
.width(Length::Fill)
|
|
|
|
|
.into()
|
2024-01-03 15:27:32 -07:00
|
|
|
}
|
|
|
|
|
}
|