json_table
json_table copied to clipboard
If the table has only Two columns, table can not fit into width
I want table to be fit to the screen width even if table has less number of columns than expected
Yes its not possible as i kept horizontal scrollview as table wrapper
@apgapg can you suggest any workaround for this?
Even i myself facing this issue. The issue is Scrollview has no way to center the content if its short in height/width.

@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,
),
),
),
);
},