saminsohag / flutter_packages

9 stars 2 forks source link

Links are not working #9

Closed ZainRaza78 closed 3 months ago

ZainRaza78 commented 3 months ago

links " onLinkTab: (url, title) =>" does not return any link a links are not clickable.

saminsohag commented 3 months ago

By the way. If you are using tex_markdown package then It will link tap will not work. Use gpt_markdown package. And also If you are using flutter version 3.13 then Link will not be clickable because there was some issue with flutter in 3.13. If you are using 3.13 please update your flutter version.

ZainRaza78 commented 3 months ago

i am using gpt_markdown but only the links which have these square brackets before link e.g "Amazon" are clickable but which only link but no square brackets e.g "https://www.amazon.com" are not clickable

image

saminsohag commented 3 months ago
  data = data.replaceAllMapped(
      RegExp(
          r"(https:\/\/www\.|http:\/\/www\.|https:\/\/|http:\/\/)?[a-zA-Z0-9]{2,}(\.[a-zA-Z0-9]{2,})(\.[a-zA-Z0-9]{2,})?"),
      (match) => "[${match[0]}](${match[0]})");

Use this function to achieve that method before passing data to TexMarkdown. It will convert https://domain.com to [https://domain.com](https://domain.com).

Currently I am not supporting normal links for a reason. But You can use this method to achieve this feature.

I hove this will be helpful for you.

ZainRaza78 commented 3 months ago

thanks. From where did you learn all of this?

saminsohag commented 3 months ago

I have learned by youtube videos and using the official documentation page. Mostly self learning.