Skip to content

Commit

Permalink
Merge pull request #48 from starlitya/master
Browse files Browse the repository at this point in the history
fix: data table is not scrolling horizontally at Web
  • Loading branch information
rodydavis committed Dec 8, 2022
2 parents 90eb3a9 + 88964fa commit f8bda54
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions lib/ui/stateless_datatable.dart
@@ -1,3 +1,5 @@
import 'dart:ui';

import 'package:flutter/gestures.dart' show DragStartBehavior;
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
Expand Down Expand Up @@ -286,11 +288,11 @@ class StatelessDataTable extends StatelessWidget {
),
Expanded(
flex: 8,
child: Scrollbar(
child: ListView(
shrinkWrap: true,
children: <Widget>[
SingleChildScrollView(
child: ScrollConfiguration(
behavior: CustomScrollBehavior(),
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
key: _tableKey,
Expand All @@ -300,8 +302,9 @@ class StatelessDataTable extends StatelessWidget {
onSelectAll: onSelectAll,
rows: _getRows(firstRowIndex, rowsPerPage)),
),
],
))),
),
),
),
DefaultTextStyle(
style: footerTextStyle!,
child: IconTheme.merge(
Expand All @@ -324,3 +327,11 @@ class StatelessDataTable extends StatelessWidget {
);
}
}

class CustomScrollBehavior extends MaterialScrollBehavior {
@override
Set<PointerDeviceKind> get dragDevices => {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
};
}

0 comments on commit f8bda54

Please sign in to comment.