My libcosmic calculator is now an MVP.
My libcosmic calculator is now an MVP.
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.
2
comments
Very nice work! Consider adding your project to COSMIC Project Collection.
4 0 ReplyYou 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()
3 0 Reply