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
638aae7b
Unverified
Commit
638aae7b
authored
Apr 15, 2022
by
Taha Tesser
Committed by
GitHub
Apr 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add alignment parameter for `persistentFooterButtons` (#101297)
parent
44be0b84
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
1 deletion
+42
-1
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+7
-1
scaffold_test.dart
packages/flutter/test/material/scaffold_test.dart
+35
-0
No files found.
packages/flutter/lib/src/material/scaffold.dart
View file @
638aae7b
...
...
@@ -1463,6 +1463,7 @@ class Scaffold extends StatefulWidget {
this
.
floatingActionButtonLocation
,
this
.
floatingActionButtonAnimator
,
this
.
persistentFooterButtons
,
this
.
persistentFooterAlignment
=
AlignmentDirectional
.
centerEnd
,
this
.
drawer
,
this
.
onDrawerChanged
,
this
.
endDrawer
,
...
...
@@ -1569,6 +1570,11 @@ class Scaffold extends StatefulWidget {
/// [bottomNavigationBar] but below the [body].
final
List
<
Widget
>?
persistentFooterButtons
;
/// The alignment of the [persistentFooterButtons] inside the [OverflowBar].
///
/// Defaults to [AlignmentDirectional.centerEnd].
final
AlignmentDirectional
persistentFooterAlignment
;
/// A panel displayed to the side of the [body], often hidden on mobile
/// devices. Swipes in from either left-to-right ([TextDirection.ltr]) or
/// right-to-left ([TextDirection.rtl])
...
...
@@ -2725,7 +2731,7 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin, Resto
top:
false
,
child:
IntrinsicHeight
(
child:
Container
(
alignment:
AlignmentDirectional
.
centerEnd
,
alignment:
widget
.
persistentFooterAlignment
,
padding:
const
EdgeInsets
.
all
(
8
),
child:
OverflowBar
(
spacing:
8
,
...
...
packages/flutter/test/material/scaffold_test.dart
View file @
638aae7b
...
...
@@ -533,6 +533,41 @@ void main() {
expect
(
didPressButton
,
isTrue
);
});
testWidgets
(
'Persistent bottom buttons alignment'
,
(
WidgetTester
tester
)
async
{
Widget
buildApp
(
AlignmentDirectional
persistentAligment
)
{
return
MaterialApp
(
home:
Scaffold
(
body:
SingleChildScrollView
(
child:
Container
(
color:
Colors
.
amber
[
500
],
height:
5000.0
,
child:
const
Text
(
'body'
),
),
),
persistentFooterAlignment:
persistentAligment
,
persistentFooterButtons:
<
Widget
>[
TextButton
(
onPressed:
()
{
},
child:
const
Text
(
'X'
),
),
],
),
);
}
await
tester
.
pumpWidget
(
buildApp
(
AlignmentDirectional
.
centerEnd
));
Finder
footerButton
=
find
.
byType
(
TextButton
);
expect
(
tester
.
getTopRight
(
footerButton
).
dx
,
800.0
-
8.0
);
await
tester
.
pumpWidget
(
buildApp
(
AlignmentDirectional
.
center
));
footerButton
=
find
.
byType
(
TextButton
);
expect
(
tester
.
getCenter
(
footerButton
).
dx
,
800.0
/
2
);
await
tester
.
pumpWidget
(
buildApp
(
AlignmentDirectional
.
centerStart
));
footerButton
=
find
.
byType
(
TextButton
);
expect
(
tester
.
getTopLeft
(
footerButton
).
dx
,
8.0
);
});
testWidgets
(
'Persistent bottom buttons apply media padding'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
Directionality
(
...
...
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