Unverified Commit e6fbdb63 authored by Mouad Debbar's avatar Mouad Debbar Committed by GitHub

[web] Enable material text field tests on web (#79665)

parent 4e039a9a
......@@ -3,6 +3,8 @@
// found in the LICENSE file.
import 'dart:html' as html;
import 'dart:ui' as ui;
import 'platform.dart' as platform;
/// The dart:html implementation of [platform.defaultTargetPlatform].
......@@ -10,9 +12,24 @@ platform.TargetPlatform get defaultTargetPlatform {
// To get a better guess at the targetPlatform we need to be able to reference
// the window, but that won't be available until we fix the platforms
// configuration for Flutter.
return platform.debugDefaultTargetPlatformOverride ?? _browserPlatform;
return platform.debugDefaultTargetPlatformOverride ??
_testPlatform ??
_browserPlatform;
}
final platform.TargetPlatform? _testPlatform = () {
platform.TargetPlatform? result;
assert(() {
// This member is only available in the web's dart:ui implementation.
// ignore: undefined_prefixed_name
if (ui.debugEmulateFlutterTesterEnvironment as bool) {
result = platform.TargetPlatform.android;
}
return true;
}());
return result;
}();
// Lazy-initialized and forever cached current browser platform.
//
// Computing the platform is expensive as it uses `window.matchMedia`, which
......
......@@ -2706,10 +2706,9 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
String text = _value.text;
text = widget.obscuringCharacter * text.length;
// Reveal the latest character in an obscured field only on mobile.
if ((defaultTargetPlatform == TargetPlatform.android ||
defaultTargetPlatform == TargetPlatform.iOS ||
defaultTargetPlatform == TargetPlatform.fuchsia) &&
!kIsWeb) {
if (defaultTargetPlatform == TargetPlatform.android ||
defaultTargetPlatform == TargetPlatform.iOS ||
defaultTargetPlatform == TargetPlatform.fuchsia) {
final int? o =
_obscureShowCharTicksPending > 0 ? _obscureLatestCharIndex : null;
if (o != null && o >= 0 && o < text.length)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment