Created
December 7, 2019 17:05
-
-
Save mingsai/b242fd30375ece6d541f9c0031d40540 to your computer and use it in GitHub Desktop.
Flutter Phone Call Sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:url_launcher/url_launcher.dart'; | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return new MaterialApp( | |
title: 'Flutter Demo', | |
home: new Home(), | |
); | |
} | |
} | |
class Home extends StatelessWidget { | |
Home({Key key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) => new Scaffold( | |
appBar: new AppBar( | |
title: new Text("View"), | |
), | |
body: new Center( | |
child: new FlatButton( | |
onPressed: () => launch("tel://21213123123"), | |
child: new Text("Call me")), | |
), | |
); | |
} | |
void main() { | |
runApp( | |
new MyApp(), | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment