Skip to content

MediaQuery highContrast is always false #48418

@miquelbeltran

Description

@miquelbeltran

The value in MediaQuery.of(context).highContrast is always false no matter which setting the user has in the Increase Contrast accessibility setting in iOS 13.3 on the Simulator.

I could not test on a real device as I currently don't have one.

After exploring Flutter's code, I've saw that the value is set to false by default but never assigned to other value. Only set to true in some tests.

Steps to Reproduce

  1. Use an iOS Simulator with iOS 13. In my case, iPhone 11 with 13.3
  2. Create a new Flutter app that reads the MediaQuery.of(context).highContrast
  3. Open in the device Settings -> Accessibility -> Display & Text Size -> Increase Contrast and set to true.
  4. Check again the value of highContrast

This code should be enough to reproduce the issue:

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'HighContrast',
      home: HighContrastWidget(),
    );
  }
}

class HighContrastWidget extends StatelessWidget {
  const HighContrastWidget({
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Text(
          MediaQuery.of(context).highContrast.toString(),
        ),
      ),
    );
  }
}

The highContrast value is always false.

Target Platform: iOS
Target OS version/browser: 13.3
Devices: Simulator, iPhone 11 with 13.3

Logs

Logs display nothing.

Analyze display nothing.

flutter doctor -v
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57, locale en-DE)
    • Flutter version 1.12.13+hotfix.5 at /Users/miquel/dev/tools/flutter
    • Framework revision 27321ebbad (4 weeks ago), 2019-12-10 18:15:01 -0800
    • Engine revision 2994f7e1e6
    • Dart version 2.7.0


[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/miquel/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Users/miquel/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/191.6010548/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3, Build version 11C29
    • CocoaPods version 1.8.4

[✓] Android Studio (version 3.5)
    • Android Studio at /Users/miquel/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/191.6010548/Android Studio.app/Contents
    • Flutter plugin version 36.0.1
    • Dart plugin version 183.6270
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[!] IntelliJ IDEA Ultimate Edition (version 2019.3)
    • IntelliJ at /Users/miquel/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • For information about installing plugins, see
      https://flutter.dev/intellij-setup/#installing-the-plugins

[✓] Connected device (1 available)
    • iPhone 11 Pro Max • F3E9319A-9753-40E5-B327-7BAE03027258 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)frameworkflutter/packages/flutter repository. See also f: labels.platform-iosiOS applications specifically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions