This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +26
-0
lines changed
shell/platform/darwin/ios/framework/Source Expand file tree Collapse file tree 4 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -771,6 +771,7 @@ class AccessibilityFeatures {
771771 static const int _kBoldTextIndex = 1 << 3 ;
772772 static const int _kReduceMotionIndex = 1 << 4 ;
773773 static const int _kHighContrastIndex = 1 << 5 ;
774+ static const int _kOnOffSwitchLabelsIndex = 1 << 6 ;
774775
775776 // A bitfield which represents each enabled feature.
776777 final int _index;
@@ -803,6 +804,11 @@ class AccessibilityFeatures {
803804 /// Only supported on iOS.
804805 bool get highContrast => _kHighContrastIndex & _index != 0 ;
805806
807+ /// The platform is requesting to show on/off labels inside switches.
808+ ///
809+ /// Only supported on iOS.
810+ bool get onOffSwitchLabels => _kOnOffSwitchLabelsIndex & _index != 0 ;
811+
806812 @override
807813 String toString () {
808814 final List <String > features = < String > [];
@@ -818,6 +824,8 @@ class AccessibilityFeatures {
818824 features.add ('reduceMotion' );
819825 if (highContrast)
820826 features.add ('highContrast' );
827+ if (onOffSwitchLabels)
828+ features.add ('onOffSwitchLabels' );
821829 return 'AccessibilityFeatures$features ' ;
822830 }
823831
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ enum class AccessibilityFeatureFlag : int32_t {
3535 kBoldText = 1 << 3 ,
3636 kReduceMotion = 1 << 4 ,
3737 kHighContrast = 1 << 5 ,
38+ kOnOffSwitchLabels = 1 << 6 ,
3839};
3940
4041// --------------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -148,6 +148,7 @@ class AccessibilityFeatures {
148148 static const int _kBoldTextIndex = 1 << 3 ;
149149 static const int _kReduceMotionIndex = 1 << 4 ;
150150 static const int _kHighContrastIndex = 1 << 5 ;
151+ static const int _kOnOffSwitchLabelsIndex = 1 << 6 ;
151152
152153 // A bitfield which represents each enabled feature.
153154 final int _index;
@@ -158,6 +159,7 @@ class AccessibilityFeatures {
158159 bool get boldText => _kBoldTextIndex & _index != 0 ;
159160 bool get reduceMotion => _kReduceMotionIndex & _index != 0 ;
160161 bool get highContrast => _kHighContrastIndex & _index != 0 ;
162+ bool get onOffSwitchLabels => _kOnOffSwitchLabelsIndex & _index != 0 ;
161163
162164 @override
163165 String toString () {
@@ -180,6 +182,9 @@ class AccessibilityFeatures {
180182 if (highContrast) {
181183 features.add ('highContrast' );
182184 }
185+ if (onOffSwitchLabels) {
186+ features.add ('onOffSwitchLabels' );
187+ }
183188 return 'AccessibilityFeatures$features ' ;
184189 }
185190
Original file line number Diff line number Diff line change @@ -331,6 +331,13 @@ - (void)setupNotificationCenterObservers {
331331 name: UIAccessibilityDarkerSystemColorsStatusDidChangeNotification
332332 object: nil ];
333333
334+ if (@available (iOS 13.0 , *)) {
335+ [center addObserver: self
336+ selector: @selector (onAccessibilityStatusChanged: )
337+ name: UIAccessibilityOnOffSwitchLabelsDidChangeNotification
338+ object: nil ];
339+ }
340+
334341 [center addObserver: self
335342 selector: @selector (onUserSettingsChanged: )
336343 name: UIContentSizeCategoryDidChangeNotification
@@ -1430,6 +1437,11 @@ - (void)onAccessibilityStatusChanged:(NSNotification*)notification {
14301437 if (UIAccessibilityDarkerSystemColorsEnabled ()) {
14311438 flags |= static_cast <int32_t >(flutter::AccessibilityFeatureFlag::kHighContrast );
14321439 }
1440+ if (@available (iOS 13 , *)) {
1441+ if (UIAccessibilityIsOnOffSwitchLabelsEnabled ()) {
1442+ flags |= static_cast <int32_t >(flutter::AccessibilityFeatureFlag::kOnOffSwitchLabels );
1443+ }
1444+ }
14331445#if TARGET_OS_SIMULATOR
14341446 // There doesn't appear to be any way to determine whether the accessibility
14351447 // inspector is enabled on the simulator. We conservatively always turn on the
You can’t perform that action at this time.
0 commit comments