Min size layout constraints
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use ruin_app::prelude::*;
|
||||
use ruin_ui::{BoxShadow, BoxShadowKind, Point};
|
||||
|
||||
#[ruin_runtime::async_main]
|
||||
async fn main() -> ruin_app::Result<()> {
|
||||
@@ -9,6 +10,8 @@ async fn main() -> ruin_app::Result<()> {
|
||||
Window::new()
|
||||
.title(title)
|
||||
.app_id("dev.ruin.counter")
|
||||
.base_color(Color::rgba(255, 255, 255, 80))
|
||||
.min_size(320.0, 240.0)
|
||||
.size(960.0, 640.0),
|
||||
)
|
||||
.mount(view! {
|
||||
@@ -33,7 +36,7 @@ fn CounterApp(title: &'static str) -> impl IntoView {
|
||||
|
||||
view! {
|
||||
column(gap = 16.0, padding = 24.0) {
|
||||
text(role = TextRole::Heading(1), size = 32.0, weight = FontWeight::Semibold) {
|
||||
text(role = TextRole::Heading(1), size = 32.0, weight = FontWeight::Semibold, color = Color::rgba(0, 0, 0, 255)) {
|
||||
title
|
||||
}
|
||||
|
||||
@@ -42,12 +45,13 @@ fn CounterApp(title: &'static str) -> impl IntoView {
|
||||
block(
|
||||
padding = 16.0,
|
||||
gap = 8.0,
|
||||
background = surfaces::raised(),
|
||||
background = Color::rgba(255, 255, 255, 200),
|
||||
border_radius = 12.0,
|
||||
border = Border::new(2.0, Color::rgb(0, 0, 0))
|
||||
border = Border::new(2.0, Color::rgba(0, 0, 0, 120)),
|
||||
shadow = BoxShadow::new(Point::new(2.0, 2.0), 8.0, 2.0, Color::rgba(0, 0, 0, 60), BoxShadowKind::Outer),
|
||||
) {
|
||||
text(size = 18.0) { "count = "; count.clone() }
|
||||
text(color = colors::muted()) { "double = "; doubled.clone() }
|
||||
text(size = 18.0, color = Color::rgb(0, 0, 0)) { "count = "; count.clone() }
|
||||
text(color = Color::rgba(0, 0, 0, 200)) { "double = "; doubled.clone() }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,8 +60,10 @@ fn CounterApp(title: &'static str) -> impl IntoView {
|
||||
#[component]
|
||||
fn CounterActions(count: Signal<i32>) -> impl IntoView {
|
||||
view! {
|
||||
row(gap = 8.0) {
|
||||
row(gap = 16.0) {
|
||||
button(
|
||||
background = Color::rgba(255, 255, 255, 90),
|
||||
color = Color::rgba(0, 0, 0, 255),
|
||||
on_press = {
|
||||
let count = count.clone();
|
||||
move |_| {
|
||||
@@ -69,6 +75,8 @@ fn CounterActions(count: Signal<i32>) -> impl IntoView {
|
||||
}
|
||||
|
||||
button(
|
||||
background = Color::rgba(255, 255, 255, 90),
|
||||
color = Color::rgba(0, 0, 0, 255),
|
||||
on_press = {
|
||||
let count = count.clone();
|
||||
move |_| {
|
||||
@@ -80,6 +88,8 @@ fn CounterActions(count: Signal<i32>) -> impl IntoView {
|
||||
}
|
||||
|
||||
button(
|
||||
background = Color::rgba(255, 255, 255, 90),
|
||||
color = Color::rgba(0, 0, 0, 255),
|
||||
on_press = {
|
||||
let count = count.clone();
|
||||
move |_| {
|
||||
|
||||
Reference in New Issue
Block a user