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 {
1213
1213
static const int _kDisableAnimationsIndex = 1 << 2 ;
1214
1214
static const int _kBoldTextIndex = 1 << 3 ;
1215
1215
static const int _kReduceMotionIndex = 1 << 4 ;
1216
+ static const int _kOnOffSwitchLabelsIndex = 1 << 5 ;
1216
1217
1217
1218
// A bitfield which represents each enabled feature.
1218
1219
final int _index;
@@ -1240,6 +1241,11 @@ class AccessibilityFeatures {
1240
1241
/// Only supported on iOS.
1241
1242
bool get reduceMotion => _kReduceMotionIndex & _index != 0 ;
1242
1243
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
+
1243
1249
@override
1244
1250
String toString () {
1245
1251
final List <String > features = < String > [];
@@ -1253,6 +1259,8 @@ class AccessibilityFeatures {
1253
1259
features.add ('boldText' );
1254
1260
if (reduceMotion)
1255
1261
features.add ('reduceMotion' );
1262
+ if (onOffSwitchLabels)
1263
+ features.add ('onOffSwitchLabels' );
1256
1264
return 'AccessibilityFeatures$features ' ;
1257
1265
}
1258
1266
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ enum class AccessibilityFeatureFlag : int32_t {
44
44
kDisableAnimations = 1 << 2 ,
45
45
kBoldText = 1 << 3 ,
46
46
kReduceMotion = 1 << 4 ,
47
+ kOnOffSwitchLabels = 1 << 5 ,
47
48
};
48
49
49
50
class WindowClient {
Original file line number Diff line number Diff line change @@ -995,6 +995,7 @@ class AccessibilityFeatures {
995
995
static const int _kDisableAnimationsIndex = 1 << 2 ;
996
996
static const int _kBoldTextIndex = 1 << 3 ;
997
997
static const int _kReduceMotionIndex = 1 << 4 ;
998
+ static const int _kOnOffSwitchLabelsIndex = 1 << 5 ;
998
999
999
1000
// A bitfield which represents each enabled feature.
1000
1001
final int _index;
@@ -1022,6 +1023,11 @@ class AccessibilityFeatures {
1022
1023
/// Only supported on iOS.
1023
1024
bool get reduceMotion => _kReduceMotionIndex & _index != 0 ;
1024
1025
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
+
1025
1031
@override
1026
1032
String toString () {
1027
1033
final List <String > features = < String > [];
@@ -1040,6 +1046,9 @@ class AccessibilityFeatures {
1040
1046
if (reduceMotion) {
1041
1047
features.add ('reduceMotion' );
1042
1048
}
1049
+ if (onOffSwitchLabels) {
1050
+ features.add ('onOffSwitchLabels' );
1051
+ }
1043
1052
return 'AccessibilityFeatures$features ' ;
1044
1053
}
1045
1054
Original file line number Diff line number Diff line change @@ -238,6 +238,13 @@ - (void)setupNotificationCenterObservers {
238
238
selector: @selector (onUserSettingsChanged: )
239
239
name: UIContentSizeCategoryDidChangeNotification
240
240
object: nil ];
241
+
242
+ if (@available (iOS 13 , *)) {
243
+ [center addObserver: self
244
+ selector: @selector (onAccessibilityStatusChanged: )
245
+ name: UIAccessibilityOnOffSwitchLabelsDidChangeNotification
246
+ object: nil ];
247
+ }
241
248
}
242
249
243
250
- (void )setInitialRoute : (NSString *)route {
@@ -889,6 +896,10 @@ - (void)onAccessibilityStatusChanged:(NSNotification*)notification {
889
896
flags |= static_cast <int32_t >(flutter::AccessibilityFeatureFlag::kReduceMotion );
890
897
if (UIAccessibilityIsBoldTextEnabled ())
891
898
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
+ }
892
903
#if TARGET_OS_SIMULATOR
893
904
// There doesn't appear to be any way to determine whether the accessibility
894
905
// inspector is enabled on the simulator. We conservatively always turn on the
You can’t perform that action at this time.
0 commit comments