Fixed horizontal scroll
This commit is contained in:
parent
ee1bf5e113
commit
0b900d3480
|
|
@ -230,7 +230,18 @@ class TasQAdaptiveList<T> extends StatelessWidget {
|
||||||
onRowTap: onRowTap,
|
onRowTap: onRowTap,
|
||||||
);
|
);
|
||||||
|
|
||||||
final contentWidth = constraints.maxWidth * 0.8;
|
// Use progressively smaller fractions of the viewport on larger screens
|
||||||
|
// so that content doesn't stretch too widely, but also consume as much
|
||||||
|
// width as possible when the display is more modest.
|
||||||
|
double contentFactor;
|
||||||
|
if (constraints.maxWidth < 1200) {
|
||||||
|
contentFactor = 0.95; // not-so-wide monitors
|
||||||
|
} else if (constraints.maxWidth < 1800) {
|
||||||
|
contentFactor = 0.85; // wide monitors
|
||||||
|
} else {
|
||||||
|
contentFactor = 0.75; // ultra-wide monitors
|
||||||
|
}
|
||||||
|
final contentWidth = constraints.maxWidth * contentFactor;
|
||||||
final tableWidth = math.max(
|
final tableWidth = math.max(
|
||||||
contentWidth,
|
contentWidth,
|
||||||
(columns.length + (rowActions == null ? 0 : 1)) * 140.0,
|
(columns.length + (rowActions == null ? 0 : 1)) * 140.0,
|
||||||
|
|
@ -240,7 +251,15 @@ class TasQAdaptiveList<T> extends StatelessWidget {
|
||||||
math.max(1, items.length),
|
math.max(1, items.length),
|
||||||
);
|
);
|
||||||
|
|
||||||
final tableWidget = SingleChildScrollView(
|
// wrap horizontal scroll with a visible scrollbar on desktop. the
|
||||||
|
// ScrollController is shared so the scrollbar has something to observe.
|
||||||
|
final horizontalController = ScrollController();
|
||||||
|
final tableWidget = Scrollbar(
|
||||||
|
controller: horizontalController,
|
||||||
|
thumbVisibility: true,
|
||||||
|
trackVisibility: true,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
controller: horizontalController,
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: tableWidth,
|
width: tableWidth,
|
||||||
|
|
@ -261,6 +280,7 @@ class TasQAdaptiveList<T> extends StatelessWidget {
|
||||||
source: dataSource,
|
source: dataSource,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
final summarySection = summaryDashboard == null
|
final summarySection = summaryDashboard == null
|
||||||
|
|
@ -277,6 +297,7 @@ class TasQAdaptiveList<T> extends StatelessWidget {
|
||||||
primary: true,
|
primary: true,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
|
key: const Key('adaptive_list_content'),
|
||||||
width: contentWidth,
|
width: contentWidth,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user