when method
Determines whether the current TextDirection matches the specified direction.
Returns true if the TextDirection obtained from the context matches the
direction associated with this variant, and false otherwise.
Implementation
@override
bool when(BuildContext context) {
return Directionality.of(context) == direction;
}