Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SizeBox .w & .h percentage of their Containing box. #67

Closed
natgross opened this issue Jan 28, 2021 · 4 comments
Closed

SizeBox .w & .h percentage of their Containing box. #67

natgross opened this issue Jan 28, 2021 · 4 comments

Comments

@natgross
Copy link

It's great to have percentage sizes of the screen for VxBox. BUT, what good is it for nested boxes? Say if I have two boxes in an HStack, .wOneFourth and .wThreeFourths, and in those boxes I have of course more boxes/containers. I need to specify the inner boxes as percentages of their outer box, not a percentage of the entire screen.
Can we do this with the current version?
Or, am I being silly and there is a simple formula/function to do this, based on percentage of entire screen?
tnx

@iampawan
Copy link
Owner

iampawan commented Jan 28, 2021 via email

@natgross
Copy link
Author

I don't see how that will help.
MediaQuery gives me Size of the screen, but I need size of container of inner boxes, in order to set relative size of inner boxes.

body:VxBox( //the outermost box
        child:HStack([
          //left side hold 2 vertical boxes
          VxBox(
            child: VStack([
              VxBox().make(),  //this box should a percentage of VxBox holding it
              VxBox().make(), //this box should a percentage of VxBox holding it
            ])
          ).purple300 .make().wThreeForth(context),
          //right side 1 box, top to bottom.
          VxBox(
            child: Container(),    
          ).green300.make().wOneForth(context)  
        ]),
      ).blue300.make()

@iampawan
Copy link
Owner

iampawan commented Jan 28, 2021 via email

@natgross
Copy link
Author

Earlier this week, I watched the entire VelocityX playlist! Hope this info is in the sizedbox video. If not I need to wait for the new docs:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants