getAccessibilityLabel function
Implementation
String? getAccessibilityLabel(Widget widget) {
if (widget is TextField) {
final decoration = widget.decoration;
if (decoration is InputDecoration) {
if (decoration.labelText != null) {
return decoration.labelText;
} else if (decoration.hintText != null) {
return decoration.hintText;
}
}
return 'TextField';
} else if (widget is Text) {
return widget.data ?? 'Text';
}
return null;
}