From 2d3697216bb72342188482551fba2f06eb43d197 Mon Sep 17 00:00:00 2001 From: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com> Date: Wed, 23 Oct 2024 16:22:15 -0700 Subject: [PATCH] Turn `brieflyShowPassword` back on on iOS (#157466) Fixes https://github.com/flutter/flutter/issues/115359 This patch should restore the `brieflyShowPassword` behavior on iOS before https://github.com/flutter/flutter/pull/104335. On iOS new characters are still temporarily revealed if the user is entering using the software keyboard (potentially because it's easy to fat finger using on screen keyboards?). --- packages/flutter/lib/src/widgets/editable_text.dart | 4 +--- packages/flutter/test/widgets/editable_text_test.dart | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/flutter/lib/src/widgets/editable_text.dart b/packages/flutter/lib/src/widgets/editable_text.dart index 8b03bfedde..9ae6d0f600 100644 --- a/packages/flutter/lib/src/widgets/editable_text.dart +++ b/packages/flutter/lib/src/widgets/editable_text.dart @@ -5357,10 +5357,8 @@ class EditableTextState extends State with AutomaticKeepAliveClien String text = _value.text; text = widget.obscuringCharacter * text.length; // Reveal the latest character in an obscured field only on mobile. - // Newer versions of iOS (iOS 15+) no longer reveal the most recently - // entered character. const Set mobilePlatforms = { - TargetPlatform.android, TargetPlatform.fuchsia, + TargetPlatform.android, TargetPlatform.fuchsia, TargetPlatform.iOS, }; final bool brieflyShowPassword = WidgetsBinding.instance.platformDispatcher.brieflyShowPassword && mobilePlatforms.contains(defaultTargetPlatform); diff --git a/packages/flutter/test/widgets/editable_text_test.dart b/packages/flutter/test/widgets/editable_text_test.dart index 7abbadb37f..84e4d1923b 100644 --- a/packages/flutter/test/widgets/editable_text_test.dart +++ b/packages/flutter/test/widgets/editable_text_test.dart @@ -4980,7 +4980,7 @@ void main() { await tester.pump(const Duration(milliseconds: 500)); await tester.pump(const Duration(milliseconds: 500)); expect((findRenderEditable(tester).text! as TextSpan).text, '•••'); - }); + }, variant: const TargetPlatformVariant({ TargetPlatform.iOS, TargetPlatform.android, TargetPlatform.fuchsia, })); group('a11y copy/cut/paste', () { Future buildApp(MockTextSelectionControls controls, WidgetTester tester) {