Cretezy / linkify

Low-level link (text, URLs, emails) parsing library in Dart
https://pub.dartlang.org/packages/linkify
MIT License
62 stars 50 forks source link

Not able to detect Multiple URL. #22

Closed iavsm closed 3 years ago

iavsm commented 4 years ago

I am trying two display two URLs with the below code but it's detecting only the first one. This is how it's displaying in the application.

Screenshot 2020-06-09 at 5 20 22 PM

Linkify(
          onOpen: (link) async => {
            if (await canLaunch(link.url))
              {
                await launch(link.url),
              }
            else
              {
                throw 'Could not launch $link',
              }
          },
          text: message,
          style: TextStyle(
            color: color,
            fontSize: fontSize,
            fontWeight: fontWeight,
            fontFamily: Fonts.TITLE,
          ),
          options: LinkifyOptions(humanize: false),
        ),

flutter_linkify: ^3.1.3

[✓] Flutter (Channel stable, v1.17.0, on Mac OS X 10.14.5 18F132, locale en-IN)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2) [✓] Xcode - develop for iOS and macOS (Xcode 11.3.1) [✓] Android Studio (version 3.6) [✓] VS Code (version 1.45.1) [✓] Connected device (1 available)

Cretezy commented 4 years ago

Can you give a full code example?

iavsm commented 4 years ago
Padding getBuildedText(String message, AppColors appColors,
      FontWeight fontWeight, double fontSize, Color color) {
    return Padding(
      padding: const EdgeInsets.all(8.0),
      child: Container(
        width: MediaQuery.of(context).size.width,
        child: Linkify(
          onOpen: (link) async => {
            if (await canLaunch(link.url))
              {
                await launch(link.url),
              }
            else
              {
                throw 'Could not launch $link',
              }
          },
          text: message,
          style: TextStyle(
            color: color,
            fontSize: fontSize,
            fontWeight: fontWeight,
            fontFamily: Fonts.TITLE,
          ),
        ),
      ),
    );
  }
iavsm commented 4 years ago

Can you give a full code example?

This method gets a link from the server. I doubled checked links are coming as expected. I also attach the method responsible for it.

iavsm commented 4 years ago

This is what i am getting in response. "https://www.google.co.in/?client=safari&channel=mac_bm\r\nhttps://www.google.co.in/?client=safari&channel=mac_bm"

Cretezy commented 4 years ago

Going to move to parsing library and will address shortly

Cretezy commented 3 years ago

This should have been fixed in v3.0.0. Please try again!

Feel free to reopen