Revert "Match PlatformConfiguration properties to PlatformDispatcher ones (#39685)" (flutter/engine#39833)

This reverts commit 4086753035.
This commit is contained in:
Jason Simmons
2023-02-23 18:45:15 -08:00
committed by GitHub
parent 4ff72b9198
commit 904ab9bfce
2 changed files with 14 additions and 36 deletions

View File

@@ -977,7 +977,8 @@ class PlatformDispatcher {
/// This option is used by [EditableTextState] to define its
/// [SpellCheckConfiguration] when a default spell check service
/// is requested.
bool get nativeSpellCheckServiceDefined => configuration.nativeSpellCheckServiceDefined;
bool get nativeSpellCheckServiceDefined => _nativeSpellCheckServiceDefined;
bool _nativeSpellCheckServiceDefined = false;
/// Whether briefly displaying the characters as you type in obscured text
/// fields is enabled in system settings.
@@ -986,7 +987,8 @@ class PlatformDispatcher {
///
/// * [EditableText.obscureText], which when set to true hides the text in
/// the text field.
bool get brieflyShowPassword => configuration.brieflyShowPassword;
bool get brieflyShowPassword => _brieflyShowPassword;
bool _brieflyShowPassword = true;
/// The setting indicating the current brightness mode of the host platform.
/// If the platform has no preference, [platformBrightness] defaults to
@@ -1040,8 +1042,16 @@ class PlatformDispatcher {
final double textScaleFactor = (data['textScaleFactor']! as num).toDouble();
final bool alwaysUse24HourFormat = data['alwaysUse24HourFormat']! as bool;
final bool? nativeSpellCheckServiceDefined = data['nativeSpellCheckServiceDefined'] as bool?;
if (nativeSpellCheckServiceDefined != null) {
_nativeSpellCheckServiceDefined = nativeSpellCheckServiceDefined;
} else {
_nativeSpellCheckServiceDefined = false;
}
// This field is optional.
final bool? brieflyShowPassword = data['brieflyShowPassword'] as bool?;
if (brieflyShowPassword != null) {
_brieflyShowPassword = brieflyShowPassword;
}
final Brightness platformBrightness =
data['platformBrightness']! as String == 'dark' ? Brightness.dark : Brightness.light;
final String? systemFontFamily = data['systemFontFamily'] as String?;
@@ -1058,8 +1068,6 @@ class PlatformDispatcher {
_configuration = previousConfiguration.copyWith(
textScaleFactor: textScaleFactor,
alwaysUse24HourFormat: alwaysUse24HourFormat,
nativeSpellCheckServiceDefined: nativeSpellCheckServiceDefined ?? false,
brieflyShowPassword: brieflyShowPassword,
platformBrightness: platformBrightness,
systemFontFamily: systemFontFamily,
);
@@ -1247,8 +1255,6 @@ class PlatformConfiguration {
this.semanticsEnabled = false,
this.platformBrightness = Brightness.light,
this.textScaleFactor = 1.0,
this.nativeSpellCheckServiceDefined = false,
this.brieflyShowPassword = true,
this.locales = const <Locale>[],
this.defaultRouteName,
this.systemFontFamily,
@@ -1261,8 +1267,6 @@ class PlatformConfiguration {
bool? semanticsEnabled,
Brightness? platformBrightness,
double? textScaleFactor,
bool? nativeSpellCheckServiceDefined,
bool? brieflyShowPassword,
List<Locale>? locales,
String? defaultRouteName,
String? systemFontFamily,
@@ -1273,8 +1277,6 @@ class PlatformConfiguration {
semanticsEnabled: semanticsEnabled ?? this.semanticsEnabled,
platformBrightness: platformBrightness ?? this.platformBrightness,
textScaleFactor: textScaleFactor ?? this.textScaleFactor,
nativeSpellCheckServiceDefined: nativeSpellCheckServiceDefined ?? this.nativeSpellCheckServiceDefined,
brieflyShowPassword: brieflyShowPassword ?? this.brieflyShowPassword,
locales: locales ?? this.locales,
defaultRouteName: defaultRouteName ?? this.defaultRouteName,
systemFontFamily: systemFontFamily ?? this.systemFontFamily,
@@ -1300,22 +1302,6 @@ class PlatformConfiguration {
/// The system-reported text scale.
final double textScaleFactor;
/// Whether the spell check service is supported on the current platform.
///
/// This option is used by [EditableTextState] to define its
/// [SpellCheckConfiguration] when a default spell check service
/// is requested.
final bool nativeSpellCheckServiceDefined;
/// Whether briefly displaying the characters as you type in obscured text
/// fields is enabled in system settings.
///
/// See also:
///
/// * [EditableText.obscureText], which when set to true hides the text in
/// the text field.
final bool brieflyShowPassword;
/// The full system-reported supported locales of the device.
final List<Locale> locales;

View File

@@ -109,9 +109,9 @@ abstract class PlatformDispatcher {
double get textScaleFactor => configuration.textScaleFactor;
bool get nativeSpellCheckServiceDefined => configuration.nativeSpellCheckServiceDefined;
bool get nativeSpellCheckServiceDefined => false;
bool get brieflyShowPassword => configuration.brieflyShowPassword;
bool get brieflyShowPassword => true;
VoidCallback? get onTextScaleFactorChanged;
set onTextScaleFactorChanged(VoidCallback? callback);
@@ -152,8 +152,6 @@ class PlatformConfiguration {
this.semanticsEnabled = false,
this.platformBrightness = Brightness.light,
this.textScaleFactor = 1.0,
this.nativeSpellCheckServiceDefined = false,
this.brieflyShowPassword = true,
this.locales = const <Locale>[],
this.defaultRouteName = '/',
this.systemFontFamily,
@@ -165,8 +163,6 @@ class PlatformConfiguration {
bool? semanticsEnabled,
Brightness? platformBrightness,
double? textScaleFactor,
bool? nativeSpellCheckServiceDefined,
bool? brieflyShowPassword,
List<Locale>? locales,
String? defaultRouteName,
String? systemFontFamily,
@@ -177,8 +173,6 @@ class PlatformConfiguration {
semanticsEnabled: semanticsEnabled ?? this.semanticsEnabled,
platformBrightness: platformBrightness ?? this.platformBrightness,
textScaleFactor: textScaleFactor ?? this.textScaleFactor,
nativeSpellCheckServiceDefined: nativeSpellCheckServiceDefined ?? this.nativeSpellCheckServiceDefined,
brieflyShowPassword: brieflyShowPassword ?? this.brieflyShowPassword,
locales: locales ?? this.locales,
defaultRouteName: defaultRouteName ?? this.defaultRouteName,
systemFontFamily: systemFontFamily ?? this.systemFontFamily,
@@ -190,8 +184,6 @@ class PlatformConfiguration {
final bool semanticsEnabled;
final Brightness platformBrightness;
final double textScaleFactor;
final bool nativeSpellCheckServiceDefined;
final bool brieflyShowPassword;
final List<Locale> locales;
final String defaultRouteName;
final String? systemFontFamily;