Fixed horizontal scroll

This commit is contained in:
Marc Rejohn Castillano 2026-02-23 18:55:56 +08:00
parent ee1bf5e113
commit 0b900d3480

View File

@ -230,7 +230,18 @@ class TasQAdaptiveList<T> extends StatelessWidget {
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(
contentWidth,
(columns.length + (rowActions == null ? 0 : 1)) * 140.0,
@ -240,7 +251,15 @@ class TasQAdaptiveList<T> extends StatelessWidget {
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,
child: SizedBox(
width: tableWidth,
@ -261,6 +280,7 @@ class TasQAdaptiveList<T> extends StatelessWidget {
source: dataSource,
),
),
),
);
final summarySection = summaryDashboard == null
@ -277,6 +297,7 @@ class TasQAdaptiveList<T> extends StatelessWidget {
primary: true,
child: Center(
child: SizedBox(
key: const Key('adaptive_list_content'),
width: contentWidth,
child: Column(
mainAxisSize: MainAxisSize.min,