Skip to content

Conversation

@GaryQian
Copy link
Contributor

We should both inform users that SystemChrome system UI elements may be force changed by the platform as well as provide a way to regain the desired UI overlays.

This adds the restoreSystemUIOverlays method to SystemChrome.

Pending changes on the engine side to implement functionality.

Copy link
Member

@cbracken cbracken Sep 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

necessary.

Though I'd be tempted to phrase These settings may be overridden by the platform at runtime.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe lead with For example,?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nessecary

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enable the navigation bar

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless the Android docs specify this explicitly, I'd leave out the rationale for this behaviour from our docs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe: to the last settings provided via [setEnabledSystemUIOverlays].

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd drop the second sentence, which mostly repeats the one-line summary above, then merge into the paragraph below.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe lead with: Note: On Android ...

Similar comment to above about commenting on the rationale for this behaviour.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I just gave the opposite comment!

We try to avoid "Note" and "Note that" and so on in the docs, since it doesn't add anything.

@GaryQian GaryQian force-pushed the restoreoverlays branch 3 times, most recently from b9b3a3d to 8a1056b Compare September 24, 2018 18:07
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove "Note:"

@Hixie
Copy link
Contributor

Hixie commented Sep 24, 2018

Should we be calling this API automatically from our keyboard logic?

@GaryQian
Copy link
Contributor Author

#22061

@GaryQian
Copy link
Contributor Author

So the current native behavior is that once the overlays are forced to appear by the keyboard, the overlays stay until manually disabled again.

In addition, we would have to delay roughly one second before calling this API, and that may cause unexpected behavior when the view readjusts itself without the developer asking it to. This would probably lead to developer surprise, especially if they are testing on some of the android versions that have slightly different keyboard-appearing behavior (eg, android 27 does not force the status bar from appearing)

Also, the PR for the engine side: flutter/engine#6322

GaryQian added a commit to flutter/engine that referenced this pull request Sep 25, 2018
This will not be active on the Framework until flutter/flutter#22221 lands.
@GaryQian
Copy link
Contributor Author

GaryQian commented Oct 1, 2018

@Hixie Is this API addition ok to go?

///
/// On Android, the system UI cannot be changed until 1 second after the previous
/// change. This is to prevent malware from permanently hiding navigation buttons.
static Future<Null> restoreSystemUIOverlays() async {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should use Future<void> rather than Future<Null>. (I believe you can make this change without it being a breaking API change, too.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this apply for the setSystemUIOverlays() also?

Copy link
Contributor Author

@GaryQian GaryQian Oct 1, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually there seems to be many Future<Null> returns around here, I'll put it in as a separate PR.

@Hixie
Copy link
Contributor

Hixie commented Oct 1, 2018

tests?

@Hixie
Copy link
Contributor

Hixie commented Oct 1, 2018

LGTM modulo comments above

@adrianvintu
Copy link

(How) Can we hook to the onHideEvent of the keyboard to call SystemChrome.restoreSystemUIOverlays(), or when can we call the restore?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants