Skip to content

Commit c0faeb0

Browse files
Jonah Williamsamirh
authored andcommitted
Don't map iOS reduce motion to disabled animations (flutter#6194)
1 parent f7f7ccb commit c0faeb0

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

lib/ui/window.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,7 @@ class AccessibilityFeatures {
763763
static const int _kInvertColorsIndex = 1 << 1;
764764
static const int _kDisableAnimationsIndex = 1 << 2;
765765
static const int _kBoldTextIndex = 1 << 3;
766+
static const int _kReduceMotionIndex = 1 << 4;
766767

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

788+
/// The platform is requesting that certain animations be simplified and
789+
/// parallax effects removed.
790+
///
791+
/// Only supported on iOS.
792+
bool get reduceMotion => _kReduceMotionIndex & _index != 0;
793+
787794
@override
788795
String toString() {
789796
final List<String> features = <String>[];
@@ -795,6 +802,8 @@ class AccessibilityFeatures {
795802
features.add('disableAnimations');
796803
if (boldText)
797804
features.add('boldText');
805+
if (reduceMotion)
806+
features.add('reduceMotion');
798807
return 'AccessibilityFeatures$features';
799808
}
800809

lib/ui/window/window.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ enum class AccessibilityFeatureFlag : int32_t {
3131
kInvertColors = 1 << 1,
3232
kDisableAnimations = 1 << 2,
3333
kBoldText = 1 << 3,
34+
kReduceMotion = 1 << 4,
3435
};
3536

3637
class WindowClient {

shell/platform/darwin/ios/framework/Source/FlutterViewController.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ - (void)onAccessibilityStatusChanged:(NSNotification*)notification {
836836
if (UIAccessibilityIsInvertColorsEnabled())
837837
flags ^= static_cast<int32_t>(blink::AccessibilityFeatureFlag::kInvertColors);
838838
if (UIAccessibilityIsReduceMotionEnabled())
839-
flags ^= static_cast<int32_t>(blink::AccessibilityFeatureFlag::kDisableAnimations);
839+
flags ^= static_cast<int32_t>(blink::AccessibilityFeatureFlag::kReduceMotion);
840840
if (UIAccessibilityIsBoldTextEnabled())
841841
flags ^= static_cast<int32_t>(blink::AccessibilityFeatureFlag::kBoldText);
842842
#if TARGET_OS_SIMULATOR

0 commit comments

Comments
 (0)