trParams method
Creates a Text widget with a localized string obtained from the given context and formatted with parameters.
This method is similar to tr, but it allows for dynamic substitution of parameters within the
localized string. This is useful for strings that need to be formatted with specific values,
such as user names, dates, numbers, etc.
Parameters:
- context: The BuildContext to access the localization provider.
- params: A map of parameters to replace placeholders in the localized string.
- style: An optional TextStyle to apply to the Text widget. Inherits the style from the original Text widget if not specified.
- textAlign: An optional TextAlign to define how the text is aligned. Inherits the alignment from the original Text widget if not specified.
- overflow: How visual overflow should be handled. Inherits the overflow setting from the original Text widget if not specified.
Returns: A Text widget displaying the localized string with parameters.
Implementation
Text trParams(
{required Map<String, dynamic> namedArgs, BuildContext? context}) {
return Text(
data!.trParams(namedArgs, context),
style: style,
textAlign: textAlign,
overflow: overflow,
);
}