Skip to content

Commit

Permalink
Revert "Match PlatformConfiguration properties to PlatformDispatcher …
Browse files Browse the repository at this point in the history
…ones (flutter#39685)" (flutter#39833)

This reverts commit cad5eec.
  • Loading branch information
jason-simmons authored Feb 24, 2023
1 parent 2f4b81b commit 167c97b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 36 deletions.
38 changes: 12 additions & 26 deletions lib/ui/platform_dispatcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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?;
Expand All @@ -1058,8 +1068,6 @@ class PlatformDispatcher {
_configuration = previousConfiguration.copyWith(
textScaleFactor: textScaleFactor,
alwaysUse24HourFormat: alwaysUse24HourFormat,
nativeSpellCheckServiceDefined: nativeSpellCheckServiceDefined ?? false,
brieflyShowPassword: brieflyShowPassword,
platformBrightness: platformBrightness,
systemFontFamily: systemFontFamily,
);
Expand Down Expand Up @@ -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,
Expand All @@ -1261,8 +1267,6 @@ class PlatformConfiguration {
bool? semanticsEnabled,
Brightness? platformBrightness,
double? textScaleFactor,
bool? nativeSpellCheckServiceDefined,
bool? brieflyShowPassword,
List<Locale>? locales,
String? defaultRouteName,
String? systemFontFamily,
Expand All @@ -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,
Expand All @@ -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;

Expand Down
12 changes: 2 additions & 10 deletions lib/web_ui/lib/platform_dispatcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand All @@ -165,8 +163,6 @@ class PlatformConfiguration {
bool? semanticsEnabled,
Brightness? platformBrightness,
double? textScaleFactor,
bool? nativeSpellCheckServiceDefined,
bool? brieflyShowPassword,
List<Locale>? locales,
String? defaultRouteName,
String? systemFontFamily,
Expand All @@ -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,
Expand All @@ -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;
Expand Down

0 comments on commit 167c97b

Please sign in to comment.