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
390ef609
Unverified
Commit
390ef609
authored
Sep 16, 2019
by
LongCatIsLooong
Committed by
GitHub
Sep 16, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CupertinoNavigationBar Dark Mode(#40189)
parent
67e35d61
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
15 deletions
+41
-15
goldens.version
bin/internal/goldens.version
+1
-1
nav_bar.dart
packages/flutter/lib/src/cupertino/nav_bar.dart
+16
-10
nav_bar_test.dart
packages/flutter/test/cupertino/nav_bar_test.dart
+24
-4
No files found.
bin/internal/goldens.version
View file @
390ef609
49f8198b72f6e12c65fe1db2e46162de0204e671
ae7615ce466a548b41a0f7b9860ec453646f73e9
packages/flutter/lib/src/cupertino/nav_bar.dart
View file @
390ef609
...
...
@@ -11,6 +11,7 @@ import 'package:flutter/services.dart';
import
'package:flutter/widgets.dart'
;
import
'button.dart'
;
import
'colors.dart'
;
import
'constants.dart'
;
import
'icons.dart'
;
import
'page_scaffold.dart'
;
...
...
@@ -37,7 +38,7 @@ const double _kNavBarBackButtonTapWidth = 50.0;
/// Title text transfer fade.
const
Duration
_kNavBarTitleFadeDuration
=
Duration
(
milliseconds:
150
);
const
Color
_kDefaultNavBarBorderColor
=
Color
(
0x4
C
000000
);
const
Color
_kDefaultNavBarBorderColor
=
Color
(
0x4
D
000000
);
const
Border
_kDefaultNavBarBorder
=
Border
(
bottom:
BorderSide
(
...
...
@@ -399,7 +400,7 @@ class _CupertinoNavigationBarState extends State<CupertinoNavigationBar> {
@override
Widget
build
(
BuildContext
context
)
{
final
Color
backgroundColor
=
widget
.
backgroundColor
??
CupertinoTheme
.
of
(
context
).
barBackgroundColor
;
CupertinoDynamicColor
.
resolve
(
widget
.
backgroundColor
,
context
)
??
CupertinoTheme
.
of
(
context
).
barBackgroundColor
;
final
_NavigationBarStaticComponents
components
=
_NavigationBarStaticComponents
(
keys:
keys
,
...
...
@@ -427,14 +428,18 @@ class _CupertinoNavigationBarState extends State<CupertinoNavigationBar> {
),
);
final
Color
actionsForegroundColor
=
CupertinoDynamicColor
.
resolve
(
widget
.
actionsForegroundColor
,
// ignore: deprecated_member_use_from_same_package
context
,
);
if
(!
widget
.
transitionBetweenRoutes
||
!
_isTransitionable
(
context
))
{
// Lint ignore to maintain backward compatibility.
return
_wrapActiveColor
(
widget
.
actionsForegroundColor
,
context
,
navBar
);
// ignore: deprecated_member_use_from_same_package
return
_wrapActiveColor
(
actionsForegroundColor
,
context
,
navBar
);
}
return
_wrapActiveColor
(
// Lint ignore to maintain backward compatibility.
widget
.
actionsForegroundColor
,
// ignore: deprecated_member_use_from_same_package
actionsForegroundColor
,
context
,
Builder
(
// Get the context that might have a possibly changed CupertinoTheme.
...
...
@@ -648,7 +653,8 @@ class _CupertinoSliverNavigationBarState extends State<CupertinoSliverNavigation
@override
Widget
build
(
BuildContext
context
)
{
// Lint ignore to maintain backward compatibility.
final
Color
actionsForegroundColor
=
widget
.
actionsForegroundColor
??
CupertinoTheme
.
of
(
context
).
primaryColor
;
// ignore: deprecated_member_use_from_same_package
final
Color
actionsForegroundColor
=
CupertinoDynamicColor
.
resolve
(
widget
.
actionsForegroundColor
,
context
)
// ignore: deprecated_member_use_from_same_package
??
CupertinoTheme
.
of
(
context
).
primaryColor
;
final
_NavigationBarStaticComponents
components
=
_NavigationBarStaticComponents
(
keys:
keys
,
...
...
@@ -666,7 +672,7 @@ class _CupertinoSliverNavigationBarState extends State<CupertinoSliverNavigation
return
_wrapActiveColor
(
// Lint ignore to maintain backward compatibility.
widget
.
actionsForegroundColor
,
// ignore: deprecated_member_use_from_same_package
actionsForegroundColor
,
context
,
MediaQuery
(
data:
MediaQuery
.
of
(
context
).
copyWith
(
textScaleFactor:
1
),
...
...
@@ -676,7 +682,7 @@ class _CupertinoSliverNavigationBarState extends State<CupertinoSliverNavigation
keys:
keys
,
components:
components
,
userMiddle:
widget
.
middle
,
backgroundColor:
widget
.
backgroundColor
??
CupertinoTheme
.
of
(
context
).
barBackgroundColor
,
backgroundColor:
CupertinoDynamicColor
.
resolve
(
widget
.
backgroundColor
,
context
)
??
CupertinoTheme
.
of
(
context
).
barBackgroundColor
,
border:
widget
.
border
,
padding:
widget
.
padding
,
actionsForegroundColor:
actionsForegroundColor
,
...
...
@@ -742,7 +748,7 @@ class _LargeTitleNavigationBarSliverDelegate
final
Widget
navBar
=
_wrapWithBackground
(
border:
border
,
backgroundColor:
backgroundColor
,
backgroundColor:
CupertinoDynamicColor
.
resolve
(
backgroundColor
,
context
)
,
child:
DefaultTextStyle
(
style:
CupertinoTheme
.
of
(
context
).
textTheme
.
textStyle
,
child:
Stack
(
...
...
@@ -815,7 +821,7 @@ class _LargeTitleNavigationBarSliverDelegate
// needs to wrap the top level RenderBox rather than a RenderSliver.
child:
_TransitionableNavigationBar
(
componentsKeys:
keys
,
backgroundColor:
backgroundColor
,
backgroundColor:
CupertinoDynamicColor
.
resolve
(
backgroundColor
,
context
)
,
backButtonTextStyle:
CupertinoTheme
.
of
(
context
).
textTheme
.
navActionTextStyle
,
titleTextStyle:
CupertinoTheme
.
of
(
context
).
textTheme
.
navTitleTextStyle
,
largeTitleTextStyle:
CupertinoTheme
.
of
(
context
).
textTheme
.
navLargeTitleTextStyle
,
...
...
@@ -1274,7 +1280,7 @@ class CupertinoNavigationBarBackButton extends StatelessWidget {
TextStyle
actionTextStyle
=
CupertinoTheme
.
of
(
context
).
textTheme
.
navActionTextStyle
;
if
(
color
!=
null
)
{
actionTextStyle
=
actionTextStyle
.
copyWith
(
color:
color
);
actionTextStyle
=
actionTextStyle
.
copyWith
(
color:
CupertinoDynamicColor
.
resolve
(
color
,
context
)
);
}
return
CupertinoButton
(
...
...
packages/flutter/test/cupertino/nav_bar_test.dart
View file @
390ef609
...
...
@@ -7,6 +7,7 @@ import 'package:flutter/rendering.dart';
import
'package:flutter/services.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'../rendering/mock_canvas.dart'
;
import
'../widgets/semantics_tester.dart'
;
int
count
=
0
;
...
...
@@ -50,16 +51,35 @@ void main() {
expect
(
tester
.
getCenter
(
find
.
text
(
'Page 2'
)).
dx
,
400.0
);
});
testWidgets
(
'Opaque background does not add blur effects'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Opaque background does not add blur effects, non-opaque background adds blur effects'
,
(
WidgetTester
tester
)
async
{
const
CupertinoDynamicColor
background
=
CupertinoDynamicColor
.
withBrightness
(
color:
Color
(
0xFFE5E5E5
),
darkColor:
Color
(
0xF3E5E5E5
),
);
await
tester
.
pumpWidget
(
const
CupertinoApp
(
theme:
CupertinoThemeData
(
brightness:
Brightness
.
light
),
home:
CupertinoNavigationBar
(
middle:
Text
(
'Title'
),
backgroundColor:
Color
(
0xFFE5E5E5
)
,
backgroundColor:
background
,
),
),
);
expect
(
find
.
byType
(
BackdropFilter
),
findsNothing
);
expect
(
find
.
byType
(
CupertinoNavigationBar
),
paints
..
rect
(
color:
background
.
color
));
await
tester
.
pumpWidget
(
const
CupertinoApp
(
theme:
CupertinoThemeData
(
brightness:
Brightness
.
dark
),
home:
CupertinoNavigationBar
(
middle:
Text
(
'Title'
),
backgroundColor:
background
,
),
),
);
expect
(
find
.
byType
(
BackdropFilter
),
findsOneWidget
);
expect
(
find
.
byType
(
CupertinoNavigationBar
),
paints
..
rect
(
color:
background
.
darkColor
));
});
testWidgets
(
'Non-opaque background adds blur effects'
,
(
WidgetTester
tester
)
async
{
...
...
@@ -801,7 +821,7 @@ void main() {
find
.
byType
(
RepaintBoundary
).
last
,
matchesGoldenFile
(
'nav_bar_test.standard_title.png'
,
version:
1
,
version:
2
,
),
);
},
...
...
@@ -835,7 +855,7 @@ void main() {
find
.
byType
(
RepaintBoundary
).
last
,
matchesGoldenFile
(
'nav_bar_test.large_title.png'
,
version:
1
,
version:
2
,
),
);
},
...
...
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