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

If the table has only Two columns, table can not fit into width #25

Open
avinashyalgonde opened this issue Jun 30, 2020 · 4 comments
Open

Comments

@avinashyalgonde
Copy link

I want table to be fit to the screen width even if table has less number of columns than expected

@apgapg
Copy link
Owner

apgapg commented Jun 30, 2020

Yes its not possible as i kept horizontal scrollview as table wrapper

@sumitbhanushali
Copy link

@apgapg can you suggest any workaround for this?

@apgapg
Copy link
Owner

apgapg commented Aug 14, 2020

Even i myself facing this issue.
The issue is Scrollview has no way to center the content if its short in height/width.

Screenshot 2020-08-13 at 11 33 50 PM

@sumitbhanushali
Copy link

@apgapg currently I am using ConstrainedBox, and MediaQuery to achieve full width

var colCount = 3;
colCount = columns.length < colCount ? columns.length : colCount;
.
.
.
tableHeaderBuilder: (header) {
    return ConstrainedBox(
    constraints: BoxConstraints(
        minWidth: MediaQuery.of(context).size.width / colCount,
    ),
    child: Container(
        padding: EdgeInsets.symmetric(horizontal: 4.0, vertical: 2.0),
        decoration: BoxDecoration(
        border: Border.all(width: 0.5),
        ),
        child: Text(
        header,
        style: TextStyle(
            fontWeight: FontWeight.w700,
            fontSize: 14.0,
            color: Colors.black87,
        ),
        ),
    ),
    );
},

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

3 participants