createLocalizedSemantics method
- BuildContext context,
- String label,
- String hint,
- String l10nKey,
- TextStyle style,
Crea un widget Semantics
con el texto traducido y accesibilidad.
Este método genera un widget Semantics
que incluye las traducciones
correspondientes a los parámetros proporcionados (etiqueta)
y representa con un Text()
con estilos.
context
El contexto para obtener las traducciones.
label
La clave de la etiqueta de accesibilidad.
hint
La clave del hint de accesibilidad.
l10nKey
La clave para obtener la traducción del texto mostrado.
style
El estilo del texto.
Implementation
Semantics createLocalizedSemantics(BuildContext context, String label,
String hint, String l10nKey, TextStyle style) {
// OBTIENE LAS TRADUCCIONES DEL CONTEXTO
final l10n = AppLocalizations.of(context)!;
return Semantics(
label: _getLocalizedString(l10n, label),
hint: _getLocalizedString(l10n, hint),
child: Text(_getLocalizedString(l10n, l10nKey), style: style),
);
}