Update docs on various platform APIs (#22060)

This commit is contained in:
Michael Klimushyn 2018-09-24 15:17:54 -07:00 committed by GitHub
parent 6014f29b5a
commit efbd6f604f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 6 deletions

View File

@ -25,11 +25,12 @@ enum TargetPlatform {
///
/// This is the default value of [ThemeData.platform] (hence the name). Widgets
/// from the material library should use [Theme.of] to determine the current
/// platform, rather than using [defaultTargetPlatform]. However, if there is
/// widget behavior that depends on the actual underlying platform (e.g. because
/// it is controlling data being sent to the platform APIs, not just trying to
/// follow the platform's conventions) then depending on [defaultTargetPlatform]
/// makes sense.
/// platform for styling purposes, rather than using [defaultTargetPlatform].
/// However, if there is widget behavior that depends on the actual underlying
/// platform, then depending on [defaultTargetPlatform] makes sense.
/// [dart.io.Platform.environment] should be used directly only when it's
/// critical to actually know the current platform, without any overrides
/// possible (for example, when a system API is about to be called).
///
/// In a test environment, the platform returned is [TargetPlatform.android]
/// regardless of the host platform. (Android was chosen because the tests were

View File

@ -530,7 +530,14 @@ class ThemeData extends Diagnosticable {
/// The platform the material widgets should adapt to target.
///
/// Defaults to the current platform.
/// Defaults to the current platform. This should be used in order to style UI
/// elements according to platform conventions.
///
/// [Platform.defaultTargetPlatform] should be used directly instead only in
/// rare cases where it's necessary to determine behavior based on the
/// platform. [dart.io.Platform.environment] should be used when it's critical
/// to actually know the current platform, without any overrides possible (for
/// example, when a system API is about to be called).
final TargetPlatform platform;
/// Configures the hit test size of certain Material widgets.