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
472bbccf
Unverified
Commit
472bbccf
authored
Jun 27, 2018
by
Jonah Williams
Committed by
GitHub
Jun 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix both platform system chrome definitions (#18808)
parent
43e63721
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
89 additions
and
10 deletions
+89
-10
contacts_demo.dart
examples/flutter_gallery/lib/demo/contacts_demo.dart
+1
-1
home.dart
examples/flutter_gallery/lib/gallery/home.dart
+1
-1
app_bar.dart
packages/flutter/lib/src/material/app_bar.dart
+2
-2
system_chrome.dart
packages/flutter/lib/src/services/system_chrome.dart
+10
-6
nav_bar_test.dart
packages/flutter/test/cupertino/nav_bar_test.dart
+42
-0
app_bar_test.dart
packages/flutter/test/material/app_bar_test.dart
+33
-0
No files found.
examples/flutter_gallery/lib/demo/contacts_demo.dart
View file @
472bbccf
...
...
@@ -184,7 +184,7 @@ class ContactsDemoState extends State<ContactsDemo> {
new
SliverList
(
delegate:
new
SliverChildListDelegate
(<
Widget
>[
new
AnnotatedRegion
<
SystemUiOverlayStyle
>(
value:
SystemUiOverlayStyle
.
light
,
value:
SystemUiOverlayStyle
.
dark
,
child:
new
_ContactCategory
(
icon:
Icons
.
call
,
children:
<
Widget
>[
...
...
examples/flutter_gallery/lib/gallery/home.dart
View file @
472bbccf
...
...
@@ -402,7 +402,7 @@ class _GalleryHomeState extends State<GalleryHome> with SingleTickerProviderStat
}
home
=
new
AnnotatedRegion
<
SystemUiOverlayStyle
>(
child:
home
,
value:
SystemUiOverlayStyle
.
dark
value:
SystemUiOverlayStyle
.
light
);
return
home
;
...
...
packages/flutter/lib/src/material/app_bar.dart
View file @
472bbccf
...
...
@@ -478,8 +478,8 @@ class _AppBarState extends State<AppBar> {
}
final
Brightness
brightness
=
widget
.
brightness
??
themeData
.
primaryColorBrightness
;
final
SystemUiOverlayStyle
overlayStyle
=
brightness
==
Brightness
.
dark
?
SystemUiOverlayStyle
.
dark
:
SystemUiOverlayStyle
.
light
;
?
SystemUiOverlayStyle
.
light
:
SystemUiOverlayStyle
.
dark
;
return
new
Semantics
(
container:
true
,
...
...
packages/flutter/lib/src/services/system_chrome.dart
View file @
472bbccf
...
...
@@ -100,12 +100,12 @@ class SystemUiOverlayStyle {
/// System overlays should be drawn with a light color. Intended for
/// applications with a dark background.
static
const
SystemUiOverlayStyle
light
=
const
SystemUiOverlayStyle
(
systemNavigationBarColor:
const
Color
(
0xFF
FFFFFF
),
systemNavigationBarColor:
const
Color
(
0xFF
000000
),
systemNavigationBarDividerColor:
null
,
statusBarColor:
null
,
systemNavigationBarIconBrightness:
Brightness
.
dark
,
statusBarIconBrightness:
Brightness
.
dark
,
statusBarBrightness:
Brightness
.
light
,
systemNavigationBarIconBrightness:
Brightness
.
light
,
statusBarIconBrightness:
Brightness
.
light
,
statusBarBrightness:
Brightness
.
dark
,
);
/// System overlays should be drawn with a dark color. Intended for
...
...
@@ -115,8 +115,8 @@ class SystemUiOverlayStyle {
systemNavigationBarDividerColor:
null
,
statusBarColor:
null
,
systemNavigationBarIconBrightness:
Brightness
.
light
,
statusBarIconBrightness:
Brightness
.
light
,
statusBarBrightness:
Brightness
.
dark
,
statusBarIconBrightness:
Brightness
.
dark
,
statusBarBrightness:
Brightness
.
light
,
);
/// Creates a new [SystemUiOverlayStyle].
...
...
@@ -330,5 +330,9 @@ class SystemChrome {
}
static
SystemUiOverlayStyle
_pendingStyle
;
/// The last style that was set using [SystemChrome.setSystemUIOverlayStyle].
@visibleForTesting
static
SystemUiOverlayStyle
get
latestStyle
=>
_latestStyle
;
static
SystemUiOverlayStyle
_latestStyle
;
}
packages/flutter/test/cupertino/nav_bar_test.dart
View file @
472bbccf
...
...
@@ -6,6 +6,7 @@ import 'dart:io';
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'../widgets/semantics_tester.dart'
;
...
...
@@ -752,6 +753,47 @@ void main() {
// is fixed.
skip:
!
Platform
.
isLinux
,
);
testWidgets
(
'NavBar draws a light system bar for a dark background'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
new
WidgetsApp
(
color:
const
Color
(
0xFFFFFFFF
),
onGenerateRoute:
(
RouteSettings
settings
)
{
return
new
CupertinoPageRoute
<
void
>(
settings:
settings
,
builder:
(
BuildContext
context
)
{
return
const
CupertinoNavigationBar
(
middle:
const
Text
(
'Test'
),
backgroundColor:
const
Color
(
0xFF000000
),
);
},
);
},
),
);
expect
(
SystemChrome
.
latestStyle
,
SystemUiOverlayStyle
.
light
);
});
testWidgets
(
'NavBar draws a dark system bar for a light background'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
new
WidgetsApp
(
color:
const
Color
(
0xFFFFFFFF
),
onGenerateRoute:
(
RouteSettings
settings
)
{
return
new
CupertinoPageRoute
<
void
>(
settings:
settings
,
builder:
(
BuildContext
context
)
{
return
const
CupertinoNavigationBar
(
middle:
const
Text
(
'Test'
),
backgroundColor:
const
Color
(
0xFFFFFFFF
),
);
},
);
},
),
);
expect
(
SystemChrome
.
latestStyle
,
SystemUiOverlayStyle
.
dark
);
});
}
class
_ExpectStyles
extends
StatelessWidget
{
...
...
packages/flutter/test/material/app_bar_test.dart
View file @
472bbccf
...
...
@@ -4,6 +4,7 @@
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'../widgets/semantics_tester.dart'
;
...
...
@@ -1340,4 +1341,36 @@ void main() {
semantics
.
dispose
();
});
testWidgets
(
'AppBar draws a light system bar for a dark background'
,
(
WidgetTester
tester
)
async
{
final
ThemeData
darkTheme
=
new
ThemeData
.
dark
();
await
tester
.
pumpWidget
(
new
MaterialApp
(
theme:
darkTheme
,
home:
Scaffold
(
appBar:
new
AppBar
(
title:
const
Text
(
'test'
))
),
));
expect
(
darkTheme
.
primaryColorBrightness
,
Brightness
.
dark
);
expect
(
SystemChrome
.
latestStyle
,
const
SystemUiOverlayStyle
(
statusBarBrightness:
Brightness
.
dark
,
statusBarIconBrightness:
Brightness
.
light
,
));
});
testWidgets
(
'AppBar draws a dark system bar for a light background'
,
(
WidgetTester
tester
)
async
{
final
ThemeData
lightTheme
=
new
ThemeData
(
primaryColor:
Colors
.
white
);
await
tester
.
pumpWidget
(
new
MaterialApp
(
theme:
lightTheme
,
home:
Scaffold
(
appBar:
new
AppBar
(
title:
const
Text
(
'test'
))
),
));
expect
(
lightTheme
.
primaryColorBrightness
,
Brightness
.
light
);
expect
(
SystemChrome
.
latestStyle
,
const
SystemUiOverlayStyle
(
statusBarBrightness:
Brightness
.
light
,
statusBarIconBrightness:
Brightness
.
dark
,
));
});
}
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