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 +29
-0
lines changed
shell/platform/darwin/ios/framework/Source Expand file tree Collapse file tree 4 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -1213,6 +1213,7 @@ class AccessibilityFeatures {
12131213 static const int _kDisableAnimationsIndex = 1 << 2 ;
12141214 static const int _kBoldTextIndex = 1 << 3 ;
12151215 static const int _kReduceMotionIndex = 1 << 4 ;
1216+ static const int _kOnOffSwitchLabelsIndex = 1 << 5 ;
12161217
12171218 // A bitfield which represents each enabled feature.
12181219 final int _index;
@@ -1240,6 +1241,11 @@ class AccessibilityFeatures {
12401241 /// Only supported on iOS.
12411242 bool get reduceMotion => _kReduceMotionIndex & _index != 0 ;
12421243
1244+ /// The platform is requesting that on/off labels be added to switches.
1245+ ///
1246+ /// Only supported on iOS.
1247+ bool get onOffSwitchLabels => _kOnOffSwitchLabelsIndex & _index != 0 ;
1248+
12431249 @override
12441250 String toString () {
12451251 final List <String > features = < String > [];
@@ -1253,6 +1259,8 @@ class AccessibilityFeatures {
12531259 features.add ('boldText' );
12541260 if (reduceMotion)
12551261 features.add ('reduceMotion' );
1262+ if (onOffSwitchLabels)
1263+ features.add ('onOffSwitchLabels' );
12561264 return 'AccessibilityFeatures$features ' ;
12571265 }
12581266
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ enum class AccessibilityFeatureFlag : int32_t {
4444 kDisableAnimations = 1 << 2 ,
4545 kBoldText = 1 << 3 ,
4646 kReduceMotion = 1 << 4 ,
47+ kOnOffSwitchLabels = 1 << 5 ,
4748};
4849
4950class WindowClient {
Original file line number Diff line number Diff line change @@ -995,6 +995,7 @@ class AccessibilityFeatures {
995995 static const int _kDisableAnimationsIndex = 1 << 2 ;
996996 static const int _kBoldTextIndex = 1 << 3 ;
997997 static const int _kReduceMotionIndex = 1 << 4 ;
998+ static const int _kOnOffSwitchLabelsIndex = 1 << 5 ;
998999
9991000 // A bitfield which represents each enabled feature.
10001001 final int _index;
@@ -1022,6 +1023,11 @@ class AccessibilityFeatures {
10221023 /// Only supported on iOS.
10231024 bool get reduceMotion => _kReduceMotionIndex & _index != 0 ;
10241025
1026+ /// The platform is requesting that on/off labels be added to switches.
1027+ ///
1028+ /// Only supported on iOS.
1029+ bool get onOffSwitchLabels => _kOnOffSwitchLabelsIndex & _index != 0 ;
1030+
10251031 @override
10261032 String toString () {
10271033 final List <String > features = < String > [];
@@ -1040,6 +1046,9 @@ class AccessibilityFeatures {
10401046 if (reduceMotion) {
10411047 features.add ('reduceMotion' );
10421048 }
1049+ if (onOffSwitchLabels) {
1050+ features.add ('onOffSwitchLabels' );
1051+ }
10431052 return 'AccessibilityFeatures$features ' ;
10441053 }
10451054
Original file line number Diff line number Diff line change @@ -238,6 +238,13 @@ - (void)setupNotificationCenterObservers {
238238 selector: @selector (onUserSettingsChanged: )
239239 name: UIContentSizeCategoryDidChangeNotification
240240 object: nil ];
241+
242+ if (@available (iOS 13 , *)) {
243+ [center addObserver: self
244+ selector: @selector (onAccessibilityStatusChanged: )
245+ name: UIAccessibilityOnOffSwitchLabelsDidChangeNotification
246+ object: nil ];
247+ }
241248}
242249
243250- (void )setInitialRoute : (NSString *)route {
@@ -889,6 +896,10 @@ - (void)onAccessibilityStatusChanged:(NSNotification*)notification {
889896 flags |= static_cast <int32_t >(flutter::AccessibilityFeatureFlag::kReduceMotion );
890897 if (UIAccessibilityIsBoldTextEnabled ())
891898 flags |= static_cast <int32_t >(flutter::AccessibilityFeatureFlag::kBoldText );
899+ if (@available (iOS 13 , *)) {
900+ if (UIAccessibilityIsOnOffSwitchLabelsEnabled ())
901+ flags |= static_cast <int32_t >(flutter::AccessibilityFeatureFlag::kOnOffSwitchLabels );
902+ }
892903#if TARGET_OS_SIMULATOR
893904 // There doesn't appear to be any way to determine whether the accessibility
894905 // inspector is enabled on the simulator. We conservatively always turn on the
You can’t perform that action at this time.
0 commit comments