getSemanticsLabel method

String getSemanticsLabel(
  1. BuildContext context
)

Implementation

String getSemanticsLabel(BuildContext context) {
  final Color backgroundColor = isActive
      ? theme.getSelectedTabIndicatorBackgroundColor(context)
      : theme.getUnselectedTabIndicatorBackgroundColor(context);

  final TextStyle? textStyle = isActive
      ? theme.getSelectedIndicatorTabTextStyle(context)
      : theme.getUnselectedIndicatorTabTextStyle(context);

  final semanticProperties = SemanticProperties([
    SemanticProperty('backgroundColor', backgroundColor.toHex()),
    SemanticProperty('textStyle', textStyle?.toJsonString() ?? "null"),
  ]);

  final String label = jsonEncode(semanticProperties.toJson());

  return Courier.shared.isUITestsActive ? label : 'CourierTabContent';
}