Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
4a3ab682
Unverified
Commit
4a3ab682
authored
Sep 11, 2023
by
Chinmay Kabi
Committed by
GitHub
Sep 11, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix DataTable example not being scrollable (#131556)
parent
0770c60a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
4 deletions
+33
-4
check_code_samples.dart
dev/bots/check_code_samples.dart
+0
-1
data_table.1.dart
examples/api/lib/material/data_table/data_table.1.dart
+2
-3
data_table.1_test.dart
examples/api/test/material/data_table/data_table.1_test.dart
+24
-0
data_table.dart
packages/flutter/lib/src/material/data_table.dart
+7
-0
No files found.
dev/bots/check_code_samples.dart
View file @
4a3ab682
...
...
@@ -292,7 +292,6 @@ final Set<String> _knownMissingTests = <String>{
'examples/api/test/material/stepper/stepper.controls_builder.0_test.dart'
,
'examples/api/test/material/stepper/stepper.0_test.dart'
,
'examples/api/test/material/flexible_space_bar/flexible_space_bar.0_test.dart'
,
'examples/api/test/material/data_table/data_table.1_test.dart'
,
'examples/api/test/material/data_table/data_table.0_test.dart'
,
'examples/api/test/material/floating_action_button_location/standard_fab_location.0_test.dart'
,
'examples/api/test/material/chip/deletable_chip_attributes.on_deleted.0_test.dart'
,
...
...
examples/api/lib/material/data_table/data_table.1.dart
View file @
4a3ab682
...
...
@@ -30,13 +30,12 @@ class DataTableExample extends StatefulWidget {
}
class
_DataTableExampleState
extends
State
<
DataTableExample
>
{
static
const
int
numItems
=
1
0
;
static
const
int
numItems
=
2
0
;
List
<
bool
>
selected
=
List
<
bool
>.
generate
(
numItems
,
(
int
index
)
=>
false
);
@override
Widget
build
(
BuildContext
context
)
{
return
SizedBox
(
width:
double
.
infinity
,
return
SingleChildScrollView
(
child:
DataTable
(
columns:
const
<
DataColumn
>[
DataColumn
(
...
...
examples/api/test/material/data_table/data_table.1_test.dart
0 → 100644
View file @
4a3ab682
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/material.dart'
;
import
'package:flutter_api_samples/material/data_table/data_table.1.dart'
as
example
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'DataTable is scrollable'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
example
.
DataTableExampleApp
(),
);
expect
(
find
.
byType
(
SingleChildScrollView
),
findsOneWidget
);
expect
(
tester
.
getTopLeft
(
find
.
text
(
'Row 5'
)),
const
Offset
(
66.0
,
366.0
));
await
tester
.
drag
(
find
.
byType
(
SingleChildScrollView
),
const
Offset
(
0.0
,
-
200.0
));
await
tester
.
pumpAndSettle
();
expect
(
tester
.
getTopLeft
(
find
.
text
(
'Row 5'
)),
const
Offset
(
66.0
,
186.0
));
});
}
packages/flutter/lib/src/material/data_table.dart
View file @
4a3ab682
...
...
@@ -357,6 +357,13 @@ class DataCell {
/// [PaginatedDataTable] which automatically splits the data into
/// multiple pages.
///
/// ## Performance considerations when wrapping [DataTable] with [SingleChildScrollView]
///
/// Wrapping a [DataTable] with [SingleChildScrollView] is expensive as [SingleChildScrollView]
/// mounts and paints the entire [DataTable] even when only some rows are visible. If scrolling in
/// one direction is necessary, then consider using a [CustomScrollView], otherwise use [PaginatedDataTable]
/// to split the data into smaller pages.
///
/// {@tool dartpad}
/// This sample shows how to display a [DataTable] with three columns: name, age, and
/// role. The columns are defined by three [DataColumn] objects. The table
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment