Skip to content

[url_launcher] [Web] Clicking on Link without calling followLink function still takes user to that link. #162927

@aarajput

Description

@aarajput

Steps to reproduce

If you wrap a ElevatedButton with Link widget on web, and don't pass followLink function to ElevatedButton, when you click on that ElevatedButton button, it still takes user to that link.

Expected results

It should only take user to that link when followLink function is called

Actual results

Even i am not passing followLink function to ElevatedButton's onPressed property but Its still opening link that i set in uri of Link widget.

Code sample

Code sample
import 'package:flutter/material.dart';
import 'package:url_launcher/link.dart' as ul;

class GoogleButton extends StatelessWidget {
  const GoogleButton();

  @override
  Widget build(final BuildContext context) {
    return ul.Link(
      uri: Uri.parse('https://google.com'),
      target: ul.LinkTarget.blank,
      builder: (context, followLink) => ElevatedButton(
        onPressed: null,
        child: Text('Open Google'),
      ),
    );
  }
}

Screenshots or Video

No response

Logs

No response

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.27.4, on macOS 15.2 24C101 darwin-arm64, locale en-PK)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.3)
[✓] Connected device (4 available)
[✓] Network resources

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listp: url_launcherPlugin to launch external applicationspackageflutter/packages repository. See also p: labels.platform-webWeb applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-webOwned by Web platform teamtriaged-webTriaged by Web platform team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions