mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Merge pull request #351 from abarth/launch_url
Add an example for launching a URL
This commit is contained in:
commit
3def4fdc32
25
examples/widgets/launch_url.dart
Normal file
25
examples/widgets/launch_url.dart
Normal file
@ -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!')
|
||||
)
|
||||
)
|
||||
));
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user