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

How to make the table take up 100% width #811

Open
mdddj opened this issue Aug 24, 2021 · 4 comments
Open

How to make the table take up 100% width #811

mdddj opened this issue Aug 24, 2021 · 4 comments
Labels
question <table> Issues with table rendering

Comments

@mdddj
Copy link

mdddj commented Aug 24, 2021

image

@mdddj mdddj added the question label Aug 24, 2021
@itsdani121
Copy link

have you found answer?

@tneotia
Copy link
Collaborator

tneotia commented Aug 30, 2021

You might be able to use customRender ( see second example for customRender in readme), but I don't know for sure if it will expand the table to fill the width. If not you might also be able to modify the HTML to specify width of table as 100%.

@itsdani121
Copy link

@tneotia its not work

@erickok
Copy link
Collaborator

erickok commented Sep 1, 2021

I took a deeper look at this, which is why it took a while to respond. As it stands, this isn't so easy to achieve.

If you use percentage-based column widgtes such as via a <colgroup> then you can have full-width tables already. Of course you would need to set a percentage yourself for each column, so it's probably not (always) what you want. Also, you have to do this from the html.

Although we said we support css width and height properties, we actually didn't. I created a PR for that. But this is not sufficient for your issue, because it still does not implement/support percentage-based widths or heights. It would be possible but quite a bunch of work to do this. For example - and specifically for tables - you can't just tell a Container to size it's children to some percentage.

On top of this, the table currently uses the intrinsic content sizes to size itself using https://pub.dev/packages/flutter_layout_grid and sizes the table (the grid) using GridFit.loose. But in your case, where you have only columns that size itself via the content, you want to use GridFit.expand instead. There is currently no way to do that yourself, bar writing a full custom render and copying all the code.

Even if we merge the css-based width/height support, it remains to be seen if percentage-based widths can be supported reliably. I want to support your case but it is really not so easy.

@Sub6Resources Sub6Resources added the <table> Issues with table rendering label May 17, 2023
@Sub6Resources Sub6Resources added this to the Priority Goals milestone May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question <table> Issues with table rendering
Projects
Status: Todo
Development

No branches or pull requests

5 participants