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

Allow Fit Content #342

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/src/data_table_2.dart
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ class DataTable2 extends DataTable {
this.minWidth,
this.scrollController,
this.horizontalScrollController,
this.expandToFitContent = false,
this.isVerticalScrollBarVisible,
this.isHorizontalScrollBarVisible,
this.empty,
Expand Down Expand Up @@ -291,6 +292,9 @@ class DataTable2 extends DataTable {
/// Exposes scroll controller of the SingleChildScrollView that makes data rows horizontally scrollable
final ScrollController? horizontalScrollController;

/// Allow to Avoid the use of the vertical scroll and expand the height content as much as needed
final bool expandToFitContent;

/// Determines whether the vertical scroll bar is visible, for iOS takes value from scrollbarTheme when null
final bool? isVerticalScrollBarVisible;

Expand Down Expand Up @@ -1066,6 +1070,13 @@ class DataTable2 extends DataTable {
(previousValue, value) =>
previousValue + value),
))),
expandToFitContent ?
SingleChildScrollView(
controller: coreHorizontalController,
scrollDirection: Axis.horizontal,
child: addBottomMargin(coreTable),
)
:
Flexible(
fit: FlexFit.tight,
child: Scrollbar(
Expand Down