inferSemanticRole function
Implementation
String inferSemanticRole(Element element, String type) {
final widget = element.widget;
if (widget is Semantics) {
final properties = widget.properties;
if (properties.button == true) return 'button';
if (properties.textField == true) return 'textField';
if (properties.slider == true) return 'slider';
if (properties.checked != null) return 'checkbox';
}
if (_selfOrAncestor<Checkbox>(element) != null) return 'checkbox';
if (_selfOrAncestor<Switch>(element) != null ||
_selfOrAncestor<CupertinoSwitch>(element) != null) {
return 'switch';
}
if (_selfOrAncestor<Slider>(element) != null) return 'slider';
if (type == 'textInput') return 'textField';
return type;
}