Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

feat: Implementation of basic box-model widgets. #8

Closed
wants to merge 4 commits into from

Conversation

xanahopper
Copy link
Contributor

@xanahopper xanahopper commented Oct 31, 2022

Widgets

  • ConstrainedBox
  • UncontrainedBox
  • ColoredBox
  • SizedBox

Traits

  • BoxLayoutWidget, common for box-model measure and layout
  • ChildWidget, widgets with children.

@toiglak
Copy link
Member

toiglak commented Nov 2, 2022

Sorry to keep you waiting.

You added the BoxLayoutWidget trait, but we lay out widgets using “box constraints'' by default in Frui. You can see this in the layout method of RenderWidget which takes the Constraints argument – the same as in RenderBox in Flutter.

As for the compute_max_intrinsic_width method and the similar, I think we can add them directly to the RenderWidget. Alternatively (and I really would like to try this option out) we could implement the measure method from Xilem, which seems to do the exact thing we need here!

@xanahopper
Copy link
Contributor Author

Yes, adding toRenderWidget directly and splitting the layout into measure and layout are considered.
BoxLayoutWidget is declared because I want to keep a position for the Scrolling/Sliver model, but now it seems unnecessary.

And I'm trying some patterns to simulate the OOP abstraction design and defined some default behaviors that can be overridden, but I think it's not suitable for Rust.

I'll change these directly to RenderWidget later in this PR.

@xanahopper
Copy link
Contributor Author

@toiglak BoxLayoutWidget has been removed, and methods in this move to RenderWidget with the default implementation.

@xanahopper
Copy link
Contributor Author

Flex PR #9 is based on this.

@xanahopper xanahopper closed this Nov 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants