withColor<R> method
- Color? colorResolver(
- BuildContext context
- R block()
Applies colorResolver to text appended in block, then restores the previous resolver.
The resolver runs when the text is rendered, using the consuming widget's context.
Implementation
R withColor<R>(
Color? Function(BuildContext context) colorResolver,
R Function() block,
) {
_colorResolverStack.add(colorResolver);
try {
return block();
} finally {
_colorResolverStack.removeLast();
}
}