flutter_phone_direct_caller 2.1.1 flutter_phone_direct_caller: ^2.1.1 copied to clipboard
Simple flutter plugin to call a number directly, without going to phone dialer, from app
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_phone_direct_caller/flutter_phone_direct_caller.dart';
void main() => runApp(const MyApp());
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final TextEditingController _numberCtrl = TextEditingController();
@override
void initState() {
super.initState();
_numberCtrl.text = "085921191121";
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(8.0),
child: TextField(
controller: _numberCtrl,
decoration: const InputDecoration(labelText: "Phone Number"),
keyboardType: TextInputType.number,
),
),
ElevatedButton(
child: const Text("Test Call"),
onPressed: () async {
FlutterPhoneDirectCaller.callNumber(_numberCtrl.text);
},
)
],
),
),
);
}
}