mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Don't map iOS reduce motion to disabled animations (flutter/engine#6194)
This commit is contained in:
parent
7ceee12615
commit
e6f0842c50
@ -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;
|
||||
@ -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>[];
|
||||
@ -795,6 +802,8 @@ class AccessibilityFeatures {
|
||||
features.add('disableAnimations');
|
||||
if (boldText)
|
||||
features.add('boldText');
|
||||
if (reduceMotion)
|
||||
features.add('reduceMotion');
|
||||
return 'AccessibilityFeatures$features';
|
||||
}
|
||||
|
||||
|
||||
@ -31,6 +31,7 @@ enum class AccessibilityFeatureFlag : int32_t {
|
||||
kInvertColors = 1 << 1,
|
||||
kDisableAnimations = 1 << 2,
|
||||
kBoldText = 1 << 3,
|
||||
kReduceMotion = 1 << 4,
|
||||
};
|
||||
|
||||
class WindowClient {
|
||||
|
||||
@ -836,7 +836,7 @@ static inline blink::PointerData::DeviceKind DeviceKindFromTouchType(UITouch* to
|
||||
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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user