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
164e19be
Unverified
Commit
164e19be
authored
Jan 19, 2021
by
Kate Lovett
Committed by
GitHub
Jan 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove deprecated actionsForegroundColor (#73745)
parent
cd57af14
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
104 deletions
+44
-104
nav_bar.dart
packages/flutter/lib/src/cupertino/nav_bar.dart
+43
-103
nav_bar_test.dart
packages/flutter/test/cupertino/nav_bar_test.dart
+1
-1
No files found.
packages/flutter/lib/src/cupertino/nav_bar.dart
View file @
164e19be
...
...
@@ -130,21 +130,6 @@ Widget _wrapWithBackground({
);
}
// This exists to support backward compatibility with arguments like
// `actionsForegroundColor`. CupertinoThemes can be used to support these
// scenarios now. To support `actionsForegroundColor`, the nav bar rewraps
// its children with a CupertinoTheme.
Widget
_wrapActiveColor
(
Color
?
color
,
BuildContext
context
,
Widget
child
)
{
if
(
color
==
null
)
{
return
child
;
}
return
CupertinoTheme
(
data:
CupertinoTheme
.
of
(
context
).
copyWith
(
primaryColor:
color
),
child:
child
,
);
}
// Whether the current route supports nav bar hero transitions from or to.
bool
_isTransitionable
(
BuildContext
context
)
{
final
ModalRoute
<
dynamic
>?
route
=
ModalRoute
.
of
(
context
);
...
...
@@ -244,7 +229,6 @@ class CupertinoNavigationBar extends StatefulWidget implements ObstructingPrefer
this
.
backgroundColor
,
this
.
brightness
,
this
.
padding
,
this
.
actionsForegroundColor
,
this
.
transitionBetweenRoutes
=
true
,
this
.
heroTag
=
_defaultHeroTag
,
})
:
assert
(
automaticallyImplyLeading
!=
null
),
...
...
@@ -372,21 +356,6 @@ class CupertinoNavigationBar extends StatefulWidget implements ObstructingPrefer
/// {@endtemplate}
final
Border
?
border
;
/// {@template flutter.cupertino.CupertinoNavigationBar.actionsForegroundColor}
/// Default color used for text and icons of the [leading] and [trailing]
/// widgets in the navigation bar.
///
/// Defaults to the `primaryColor` of the [CupertinoTheme] when null.
/// {@endtemplate}
///
/// The default color for text in the [middle] slot is always black, as per
/// iOS standard design.
@Deprecated
(
'Use CupertinoTheme and primaryColor to propagate color. '
'This feature was deprecated after v1.1.2.'
)
final
Color
?
actionsForegroundColor
;
/// {@template flutter.cupertino.CupertinoNavigationBar.transitionBetweenRoutes}
/// Whether to transition between navigation bars.
///
...
...
@@ -486,20 +455,12 @@ class _CupertinoNavigationBarState extends State<CupertinoNavigationBar> {
),
);
final
Color
?
actionsForegroundColor
=
CupertinoDynamicColor
.
maybeResolve
(
widget
.
actionsForegroundColor
,
context
,
);
if
(!
widget
.
transitionBetweenRoutes
||
!
_isTransitionable
(
context
))
{
// Lint ignore to maintain backward compatibility.
return
_wrapActiveColor
(
actionsForegroundColor
,
context
,
navBar
)
;
return
navBar
;
}
return
_wrapActiveColor
(
// Lint ignore to maintain backward compatibility.
actionsForegroundColor
,
context
,
Builder
(
return
Builder
(
// Get the context that might have a possibly changed CupertinoTheme.
builder:
(
BuildContext
context
)
{
return
Hero
(
...
...
@@ -523,7 +484,6 @@ class _CupertinoNavigationBarState extends State<CupertinoNavigationBar> {
),
);
},
),
);
}
}
...
...
@@ -604,7 +564,6 @@ class CupertinoSliverNavigationBar extends StatefulWidget {
this
.
backgroundColor
,
this
.
brightness
,
this
.
padding
,
this
.
actionsForegroundColor
,
this
.
transitionBetweenRoutes
=
true
,
this
.
heroTag
=
_defaultHeroTag
,
this
.
stretch
=
true
,
...
...
@@ -686,16 +645,6 @@ class CupertinoSliverNavigationBar extends StatefulWidget {
/// {@macro flutter.cupertino.CupertinoNavigationBar.border}
final
Border
?
border
;
/// {@macro flutter.cupertino.CupertinoNavigationBar.actionsForegroundColor}
///
/// The default color for text in the [largeTitle] slot is always black, as per
/// iOS standard design.
@Deprecated
(
'Use CupertinoTheme and primaryColor to propagate color. '
'This feature was deprecated after v1.1.2.'
)
final
Color
?
actionsForegroundColor
;
/// {@macro flutter.cupertino.CupertinoNavigationBar.transitionBetweenRoutes}
final
bool
transitionBetweenRoutes
;
...
...
@@ -730,10 +679,6 @@ class _CupertinoSliverNavigationBarState extends State<CupertinoSliverNavigation
@override
Widget
build
(
BuildContext
context
)
{
// Lint ignore to maintain backward compatibility.
final
Color
actionsForegroundColor
=
CupertinoDynamicColor
.
maybeResolve
(
widget
.
actionsForegroundColor
,
context
)
??
CupertinoTheme
.
of
(
context
).
primaryColor
;
final
_NavigationBarStaticComponents
components
=
_NavigationBarStaticComponents
(
keys:
keys
,
route:
ModalRoute
.
of
(
context
),
...
...
@@ -748,11 +693,7 @@ class _CupertinoSliverNavigationBarState extends State<CupertinoSliverNavigation
large:
true
,
);
return
_wrapActiveColor
(
// Lint ignore to maintain backward compatibility.
actionsForegroundColor
,
context
,
MediaQuery
(
return
MediaQuery
(
data:
MediaQuery
.
of
(
context
).
copyWith
(
textScaleFactor:
1
),
child:
SliverPersistentHeader
(
pinned:
true
,
// iOS navigation bars are always pinned.
...
...
@@ -764,7 +705,7 @@ class _CupertinoSliverNavigationBarState extends State<CupertinoSliverNavigation
brightness:
widget
.
brightness
,
border:
widget
.
border
,
padding:
widget
.
padding
,
actionsForegroundColor:
actionsForeground
Color
,
actionsForegroundColor:
CupertinoTheme
.
of
(
context
).
primary
Color
,
transitionBetweenRoutes:
widget
.
transitionBetweenRoutes
,
heroTag:
widget
.
heroTag
,
persistentHeight:
_kNavBarPersistentHeight
+
MediaQuery
.
of
(
context
).
padding
.
top
,
...
...
@@ -772,7 +713,6 @@ class _CupertinoSliverNavigationBarState extends State<CupertinoSliverNavigation
stretchConfiguration:
widget
.
stretch
?
OverScrollHeaderStretchConfiguration
()
:
null
,
),
),
),
);
}
}
...
...
packages/flutter/test/cupertino/nav_bar_test.dart
View file @
164e19be
...
...
@@ -309,6 +309,7 @@ void main() {
count
=
0x000000
;
await
tester
.
pumpWidget
(
CupertinoApp
(
theme:
const
CupertinoThemeData
(
primaryColor:
Color
(
0xFF001122
)),
home:
CupertinoNavigationBar
(
leading:
CupertinoButton
(
onPressed:
()
{
},
...
...
@@ -319,7 +320,6 @@ void main() {
onPressed:
()
{
},
child:
const
_ExpectStyles
(
color:
Color
(
0xFF001122
),
index:
0x010000
),
),
actionsForegroundColor:
const
Color
(
0xFF001122
),
),
),
);
...
...
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