Commit 02dfd6be authored by Sarah Zakarias's avatar Sarah Zakarias Committed by GitHub

Use url_launcher plugin in Flutter Gallery (#9751)

parent 20da5c1b
package io.flutter.examples.gallery; package io.flutter.examples.gallery;
import android.os.Bundle; import android.os.Bundle;
import io.flutter.app.FlutterActivity; import io.flutter.app.FlutterActivity;
import io.flutter.plugins.PluginRegistry; import io.flutter.plugins.PluginRegistry;
......
...@@ -7,14 +7,15 @@ import 'dart:math' as math; ...@@ -7,14 +7,15 @@ import 'dart:math' as math;
import 'package:flutter/foundation.dart' show defaultTargetPlatform, required; import 'package:flutter/foundation.dart' show defaultTargetPlatform, required;
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:url_launcher/url_launcher.dart';
class LinkTextSpan extends TextSpan { class LinkTextSpan extends TextSpan {
LinkTextSpan({ TextStyle style, String url, String text }) : super( LinkTextSpan({ TextStyle style, String url, String text }) : super(
style: style, style: style,
text: text ?? url, text: text ?? url,
recognizer: new TapGestureRecognizer()..onTap = () { recognizer: new TapGestureRecognizer()..onTap = () {
UrlLauncher.launch(url); launch(url);
} }
); );
} }
...@@ -203,7 +204,7 @@ class GalleryDrawer extends StatelessWidget { ...@@ -203,7 +204,7 @@ class GalleryDrawer extends StatelessWidget {
leading: const Icon(Icons.report), leading: const Icon(Icons.report),
title: const Text('Send feedback'), title: const Text('Send feedback'),
onTap: onSendFeedback ?? () { onTap: onSendFeedback ?? () {
UrlLauncher.launch('https://github.com/flutter/flutter/issues/new'); launch('https://github.com/flutter/flutter/issues/new');
}, },
); );
......
...@@ -6,6 +6,7 @@ dependencies: ...@@ -6,6 +6,7 @@ dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
url_launcher: ^0.3.1
# Also update dev/benchmarks/complex_layout/pubspec.yaml # Also update dev/benchmarks/complex_layout/pubspec.yaml
flutter_gallery_assets: flutter_gallery_assets:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment