Skip to content

[How to use] Tooltip's with RegExpSpecialText #262

@ServOKio

Description

@ServOKio

Platforms

dart

Description

Hi, can I ask a stupid question? How can I make a tooltip, but so that there is also the ability to select/change the text?

My code

class RegAttentionText extends RegExpSpecialText {
  @override
  InlineSpan finishText(int s, Match m, {TextStyle? textStyle, SpecialTextGestureTapCallback? onTap}){
    return ExtendedWidgetSpan(
      keepVisible: true,
        actualText: m.group(0)!,
        child: Tooltip(
          message: 'Some message',
          child: Text(m.group(0)!, style: textStyle),
        )
    );
  }
  @override
  RegExp get regExp => RegExp(r'(\b[^,\\\[\]():|]+)');
}

Try do it

I tried different methods, but this is the maximum I could do + even so, for some reason, the text is slightly higher than the rest
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions