DecoratorRule.email constructor

DecoratorRule.email({
  1. required TextStyle style,
  2. required dynamic onTap(
    1. String
    ),
})

Implementation

factory DecoratorRule.email({
  required TextStyle style,
  required Function(String) onTap,
}) {
  return DecoratorRule(
    style: style,
    regExp: CommonRegExp.email(),
    onTap: (match) {
      String url = match;
      if (!match.startsWith("mailto:")) {
        url = "mailto:$url";
      }
      onTap(url);
    },
    transformMatch: (match) {
      return match;
    },
  );
}