Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/ui/window.dart
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,7 @@ class AccessibilityFeatures {
static const int _kInvertColorsIndex = 1 << 1;
static const int _kDisableAnimationsIndex = 1 << 2;
static const int _kBoldTextIndex = 1 << 3;
static const int _kReduceMotionIndex = 1 << 4;

// A bitfield which represents each enabled feature.
final int _index;
Expand All @@ -784,6 +785,12 @@ class AccessibilityFeatures {
/// Only supported on iOS.
bool get boldText => _kBoldTextIndex & _index != 0;

/// The platform is requesting that certain animations be simplified and
/// parallax effects removed.
///
/// Only supported on iOS.
bool get reduceMotion => _kReduceMotionIndex & _index != 0;

@override
String toString() {
final List<String> features = <String>[];
Expand All @@ -795,6 +802,8 @@ class AccessibilityFeatures {
features.add('disableAnimations');
if (boldText)
features.add('boldText');
if (reduceMotion)
features.add('reduceMotion');
return 'AccessibilityFeatures$features';
}

Expand Down
1 change: 1 addition & 0 deletions lib/ui/window/window.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ enum class AccessibilityFeatureFlag : int32_t {
kInvertColors = 1 << 1,
kDisableAnimations = 1 << 2,
kBoldText = 1 << 3,
kReduceMotion = 1 << 4,
};

class WindowClient {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ - (void)onAccessibilityStatusChanged:(NSNotification*)notification {
if (UIAccessibilityIsInvertColorsEnabled())
flags ^= static_cast<int32_t>(blink::AccessibilityFeatureFlag::kInvertColors);
if (UIAccessibilityIsReduceMotionEnabled())
flags ^= static_cast<int32_t>(blink::AccessibilityFeatureFlag::kDisableAnimations);
flags ^= static_cast<int32_t>(blink::AccessibilityFeatureFlag::kReduceMotion);
if (UIAccessibilityIsBoldTextEnabled())
flags ^= static_cast<int32_t>(blink::AccessibilityFeatureFlag::kBoldText);
#if TARGET_OS_SIMULATOR
Expand Down