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
21de8505
Unverified
Commit
21de8505
authored
Feb 11, 2022
by
Taha Tesser
Committed by
GitHub
Feb 11, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix NavigationRail Indicator alignment for `NavigationRailLabelType.none` (#98028)
parent
ef803a2b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
6 deletions
+52
-6
navigation_rail.dart
packages/flutter/lib/src/material/navigation_rail.dart
+8
-6
navigation_rail_test.dart
packages/flutter/test/material/navigation_rail_test.dart
+44
-0
No files found.
packages/flutter/lib/src/material/navigation_rail.dart
View file @
21de8505
...
...
@@ -579,12 +579,14 @@ class _RailDestination extends StatelessWidget {
final
Widget
iconPart
=
SizedBox
(
width:
minWidth
,
height:
minWidth
,
child:
_AddIndicator
(
addIndicator:
useIndicator
,
indicatorColor:
indicatorColor
,
isCircular:
true
,
indicatorAnimation:
destinationAnimation
,
child:
themedIcon
,
child:
Center
(
child:
_AddIndicator
(
addIndicator:
useIndicator
,
indicatorColor:
indicatorColor
,
isCircular:
true
,
indicatorAnimation:
destinationAnimation
,
child:
themedIcon
,
),
),
);
if
(
extendedTransitionAnimation
.
value
==
0
)
{
...
...
packages/flutter/test/material/navigation_rail_test.dart
View file @
21de8505
...
...
@@ -2349,6 +2349,50 @@ void main() {
expect
(
indicator
.
width
,
56
);
expect
(
indicator
.
height
,
32
);
});
testWidgets
(
'NavigationRailDestination has center aligned indicator - [labelType]=none'
,
(
WidgetTester
tester
)
async
{
// This is a regression test for
// https://github.com/flutter/flutter/issues/97753
await
_pumpNavigationRail
(
tester
,
navigationRail:
NavigationRail
(
labelType:
NavigationRailLabelType
.
none
,
selectedIndex:
0
,
destinations:
<
NavigationRailDestination
>[
NavigationRailDestination
(
icon:
Stack
(
children:
const
<
Widget
>[
Icon
(
Icons
.
umbrella
),
Positioned
(
top:
0
,
right:
0
,
child:
Text
(
'Text'
,
style:
TextStyle
(
fontSize:
10
,
color:
Colors
.
red
),
),
),
],
),
label:
const
Text
(
'Abc'
),
),
const
NavigationRailDestination
(
icon:
Icon
(
Icons
.
umbrella
),
label:
Text
(
'Def'
),
),
const
NavigationRailDestination
(
icon:
Icon
(
Icons
.
bookmark_border
),
label:
Text
(
'Ghi'
),
),
],
),
);
// Indicator with Stack widget
final
RenderBox
firstIndicator
=
tester
.
renderObject
(
find
.
byType
(
Icon
).
first
);
expect
(
firstIndicator
.
localToGlobal
(
Offset
.
zero
).
dx
,
24.0
);
// Indicator without Stack widget
final
RenderBox
lastIndicator
=
tester
.
renderObject
(
find
.
byType
(
Icon
).
last
);
expect
(
lastIndicator
.
localToGlobal
(
Offset
.
zero
).
dx
,
24.0
);
});
}
TestSemantics
_expectedSemantics
(
)
{
...
...
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