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
bc763a8c
Unverified
Commit
bc763a8c
authored
Jun 29, 2021
by
Hans Muller
Committed by
GitHub
Jun 29, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed PaginatedDataTable ButtonBar special case (#85547)
parent
b5f9612c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
11 deletions
+29
-11
paginated_data_table.dart
packages/flutter/lib/src/material/paginated_data_table.dart
+1
-11
paginated_data_table_test.dart
...ages/flutter/test/material/paginated_data_table_test.dart
+28
-0
No files found.
packages/flutter/lib/src/material/paginated_data_table.dart
View file @
bc763a8c
...
...
@@ -7,7 +7,6 @@ import 'dart:math' as math;
import
'package:flutter/gestures.dart'
show
DragStartBehavior
;
import
'package:flutter/widgets.dart'
;
import
'button_bar.dart'
;
import
'card.dart'
;
import
'constants.dart'
;
import
'data_table.dart'
;
...
...
@@ -372,17 +371,8 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
// HEADER
final
List
<
Widget
>
headerWidgets
=
<
Widget
>[];
double
startPadding
=
24.0
;
if
(
_selectedRowCount
==
0
&&
widget
.
header
!=
null
)
{
headerWidgets
.
add
(
Expanded
(
child:
widget
.
header
!));
if
(
widget
.
header
is
ButtonBar
)
{
// We adjust the padding when a button bar is present, because the
// ButtonBar introduces 2 pixels of outside padding, plus 2 pixels
// around each button on each side, and the button itself will have 8
// pixels internally on each side, yet we want the left edge of the
// inside of the button to line up with the 24.0 left inset.
startPadding
=
12.0
;
}
}
else
if
(
widget
.
header
!=
null
)
{
headerWidgets
.
add
(
Expanded
(
child:
Text
(
localizations
.
selectedRowCountTitle
(
_selectedRowCount
)),
...
...
@@ -501,7 +491,7 @@ class PaginatedDataTableState extends State<PaginatedDataTable> {
height:
64.0
,
color:
_selectedRowCount
>
0
?
themeData
.
secondaryHeaderColor
:
null
,
child:
Padding
(
padding:
EdgeInsetsDirectional
.
only
(
start:
startPadding
,
end:
14.0
),
padding:
const
EdgeInsetsDirectional
.
only
(
start:
24
,
end:
14.0
),
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
end
,
children:
headerWidgets
,
...
...
packages/flutter/test/material/paginated_data_table_test.dart
View file @
bc763a8c
...
...
@@ -1012,4 +1012,32 @@ void main() {
expect
(
icons
.
elementAt
(
2
).
color
,
arrowHeadColor
);
expect
(
icons
.
elementAt
(
3
).
color
,
arrowHeadColor
);
});
testWidgets
(
'OverflowBar header left alignment'
,
(
WidgetTester
tester
)
async
{
// Test an old special case that tried to align the first child of a ButtonBar
// and the left edge of a Text header widget. Still possible with OverflowBar
// albeit without any special case in the implementation's build method.
Widget
buildFrame
(
Widget
header
)
{
return
MaterialApp
(
home:
PaginatedDataTable
(
header:
header
,
rowsPerPage:
2
,
source
:
TestDataSource
(),
columns:
const
<
DataColumn
>[
DataColumn
(
label:
Text
(
'Name'
)),
DataColumn
(
label:
Text
(
'Calories'
),
numeric:
true
),
DataColumn
(
label:
Text
(
'Generation'
)),
],
),
);
}
await
tester
.
pumpWidget
(
buildFrame
(
const
Text
(
'HEADER'
)));
final
double
headerX
=
tester
.
getTopLeft
(
find
.
text
(
'HEADER'
)).
dx
;
final
Widget
overflowBar
=
OverflowBar
(
children:
<
Widget
>[
ElevatedButton
(
onPressed:
()
{},
child:
const
Text
(
'BUTTON'
))],
);
await
tester
.
pumpWidget
(
buildFrame
(
overflowBar
));
expect
(
headerX
,
tester
.
getTopLeft
(
find
.
byType
(
ElevatedButton
)).
dx
);
});
}
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