From 4cb0ae49012e83e3b5b6fb6dd895c7aeebc217f8 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Thu, 12 Nov 2015 17:25:23 -0800 Subject: [PATCH] Add an example for launching a URL --- examples/widgets/launch_url.dart | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 examples/widgets/launch_url.dart diff --git a/examples/widgets/launch_url.dart b/examples/widgets/launch_url.dart new file mode 100644 index 00000000000..52c9307790a --- /dev/null +++ b/examples/widgets/launch_url.dart @@ -0,0 +1,25 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter/widgets.dart'; +import 'package:flutter/services.dart'; + +void main() { + runApp(new GestureDetector( + onTap: () { + Intent intent = new Intent() + ..action = 'android.intent.action.VIEW' + ..url = 'http://flutter.io/'; + activity.startActivity(intent); + }, + child: new Container( + decoration: const BoxDecoration( + backgroundColor: const Color(0xFF006600) + ), + child: new Center( + child: new Text('Tap to launch a URL!') + ) + ) + )); +}