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
fb2467d0
Unverified
Commit
fb2467d0
authored
Jan 17, 2019
by
Jonah Williams
Committed by
GitHub
Jan 17, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add documentation for how to use annotated region (#24989)
parent
3c0a74ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
0 deletions
+54
-0
system_chrome.dart
packages/flutter/lib/src/services/system_chrome.dart
+54
-0
No files found.
packages/flutter/lib/src/services/system_chrome.dart
View file @
fb2467d0
...
...
@@ -333,6 +333,60 @@ class SystemChrome {
/// return /* ... */;
/// }
/// ```
///
/// For more complex control of the system overlay styles, consider using
/// an [AnnotatedRegion] widget instead of calling [setSystemUiOverlayStyle]
/// directly. This widget places a value directly into the layer tree where
/// it can be hit-tested by the framework. On every frame, the framework will
/// hit-test and select the annotated region it finds under the status and
/// navigation bar and synthesize them into a single style. This can be used
/// to configure the system styles when an app bar is not used.
///
/// {@tool snippet --template=stateful_widget}
/// The following example creates a widget that changes the status bar color
/// to a random value on Android.
///
/// ```dart imports
/// import 'package:flutter/services.dart';
/// import 'dart:math' as math;
/// ```
///
/// ```dart
/// final _random = math.Random();
/// SystemUiOverlayStyle _currentStyle = SystemUiOverlayStyle.light;
///
/// void _changeColor() {
/// final color = Color.fromRGBO(
/// _random.nextInt(255),
/// _random.nextInt(255),
/// _random.nextInt(255),
/// 1.0,
/// );
/// setState(() {
/// _currentStyle = SystemUiOverlayStyle.dark.copyWith(
/// statusBarColor: color,
/// );
/// });
/// }
///
/// @override
/// Widget build(BuildContext context) {
/// return Scaffold(
/// body: AnnotatedRegion(
/// value: _currentStyle,
/// child: Center(
/// child: RaisedButton(
/// child: const Text('Change Color'),
/// onPressed: _changeColor,
/// ),
/// ),
/// ),
/// );
/// }
/// {@end-tool}
///
/// See also:
/// * [AnnotatedRegion], the widget used to place data into the layer tree.
static
void
setSystemUIOverlayStyle
(
SystemUiOverlayStyle
style
)
{
assert
(
style
!=
null
);
if
(
_pendingStyle
!=
null
)
{
...
...
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