I have written a calculator in Rust and libcosmic, the design is copied from gnome-calculator; I discovered 2 things:
- I don’t like working on UIs.
- I have no idea how to transform
cosmic::widget::button::Builder
to
cosmic::widget::Button
;
this code would be so much cleaner if I could return a button::standard() from a function.
You must log in or register to comment.
You can either return
cosmic::Element<Message>
,impl Into<cosmic::Element<Message>>
, orcosmic::widget::Button<Message>
with your functions.Every widget can
.into()
or.apply(Element::from)
into acosmic::Element
.I’d recommend using the Grid widget so that your buttons can scale with the window.
cosmic::widget::grid() .push(widget1()) .push(widget2()) .push(widget3()) .insert_row() .push(widget4()) .push(widget5()) .push(widget6()) .row_spacing(12) .column_spacing(12) .justify_content(JustifyContent::Stretch) .width(Length::Fill) .height(Length::Fill) .into()
Very nice work! Consider adding your project to COSMIC Project Collection.