url_launcher 0.1.0 copy "url_launcher: ^0.1.0" to clipboard
url_launcher: ^0.1.0 copied to clipboard

outdatedDart 1 only

Flutter plugin for launching a URL

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';

void main() {
  runApp(new MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'URL Laucher',
      theme: new ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: new MyHomePage(title: 'URL Launcher'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  void _launchUrl() {
    UrlLauncher.launch("https://flutter.io");
  }

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text(widget.title),
      ),
      body: new Center(
        child: new Row(
          mainAxisSize: MainAxisSize.min,
          children: [
            new Padding(
              padding: new EdgeInsets.all(16.0),
              child: new Text("https://flutter.io"),
            ),
            new RaisedButton(
              onPressed: _launchUrl,
              child: new Text("Go"),
            ),
          ],
        ),
      ),
    );
  }
}