pub trait ContainerStyle {
fn radius(&self) -> f64;
fn padding(&self) -> f64;
fn border_width(&self) -> f64;
fn shadow_offset(&self) -> (f64, f64);
fn shadow_alpha(&self) -> f64;
}
pub struct PlainContainerStyle;
impl Default for PlainContainerStyle {
fn default() -> Self {
Self
}
}
impl ContainerStyle for PlainContainerStyle {
fn radius(&self) -> f64 {
0.0
}
fn padding(&self) -> f64 {
0.0
}
fn border_width(&self) -> f64 {
0.0
}
fn shadow_offset(&self) -> (f64, f64) {
(0.0, 0.0)
}
fn shadow_alpha(&self) -> f64 {
0.0
}
}
pub struct BorderedContainerStyle {
pub radius: f64,
pub padding: f64,
}
impl Default for BorderedContainerStyle {
fn default() -> Self {
Self {
radius: 4.0,
padding: 0.0,
}
}
}
impl ContainerStyle for BorderedContainerStyle {
fn radius(&self) -> f64 {
self.radius
}
fn padding(&self) -> f64 {
self.padding
}
fn border_width(&self) -> f64 {
1.0
}
fn shadow_offset(&self) -> (f64, f64) {
(0.0, 0.0)
}
fn shadow_alpha(&self) -> f64 {
0.0
}
}
pub struct CardContainerStyle {
pub radius: f64,
pub padding: f64,
pub shadow_offset: (f64, f64),
pub shadow_alpha: f64,
}
impl Default for CardContainerStyle {
fn default() -> Self {
Self {
radius: 4.0,
padding: 8.0,
shadow_offset: (2.0, 4.0),
shadow_alpha: 0.4,
}
}
}
impl ContainerStyle for CardContainerStyle {
fn radius(&self) -> f64 {
self.radius
}
fn padding(&self) -> f64 {
self.padding
}
fn border_width(&self) -> f64 {
1.0
}
fn shadow_offset(&self) -> (f64, f64) {
self.shadow_offset
}
fn shadow_alpha(&self) -> f64 {
self.shadow_alpha
}
}
pub struct ClippingContainerStyle {
pub clipping: bool,
}
impl Default for ClippingContainerStyle {
fn default() -> Self {
Self { clipping: true }
}
}
impl ContainerStyle for ClippingContainerStyle {
fn radius(&self) -> f64 {
0.0
}
fn padding(&self) -> f64 {
0.0
}
fn border_width(&self) -> f64 {
0.0
}
fn shadow_offset(&self) -> (f64, f64) {
(0.0, 0.0)
}
fn shadow_alpha(&self) -> f64 {
0.0
}
}
pub struct SectionContainerStyle {
pub header_height: f64,
pub body_padding: f64,
}
impl Default for SectionContainerStyle {
fn default() -> Self {
Self {
header_height: 24.0,
body_padding: 0.0,
}
}
}
impl ContainerStyle for SectionContainerStyle {
fn radius(&self) -> f64 {
0.0
}
fn padding(&self) -> f64 {
self.body_padding
}
fn border_width(&self) -> f64 {
1.0
}
fn shadow_offset(&self) -> (f64, f64) {
(0.0, 0.0)
}
fn shadow_alpha(&self) -> f64 {
0.0
}
}
pub struct PanelContainerStyle {
pub padding: f64,
}
impl Default for PanelContainerStyle {
fn default() -> Self {
Self { padding: 0.0 }
}
}
impl ContainerStyle for PanelContainerStyle {
fn radius(&self) -> f64 {
0.0
}
fn padding(&self) -> f64 {
self.padding
}
fn border_width(&self) -> f64 {
1.0
}
fn shadow_offset(&self) -> (f64, f64) {
(0.0, 0.0)
}
fn shadow_alpha(&self) -> f64 {
0.0
}
}
pub struct DefaultContainerStyle;
impl Default for DefaultContainerStyle {
fn default() -> Self {
Self
}
}
impl ContainerStyle for DefaultContainerStyle {
fn radius(&self) -> f64 {
4.0
}
fn padding(&self) -> f64 {
8.0
}
fn border_width(&self) -> f64 {
1.0
}
fn shadow_offset(&self) -> (f64, f64) {
(0.0, 2.0)
}
fn shadow_alpha(&self) -> f64 {
0.25
}
}