Skip to content

Instantly share code, notes, and snippets.

@mingsai
Created December 7, 2019 17:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mingsai/b242fd30375ece6d541f9c0031d40540 to your computer and use it in GitHub Desktop.
Save mingsai/b242fd30375ece6d541f9c0031d40540 to your computer and use it in GitHub Desktop.
Flutter Phone Call Sample
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