Skip to content

Commit 33c0859

Browse files
committed
Add flutter_dtmf.
1 parent 775ec05 commit 33c0859

File tree

1 file changed

+39
-35
lines changed

1 file changed

+39
-35
lines changed

example/lib/src/callscreen.dart

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import 'dart:async';
2+
import 'package:flutter/foundation.dart';
23
import 'package:flutter/material.dart';
34
import 'package:flutter_webrtc/flutter_webrtc.dart';
5+
import 'package:flutter_dtmf/flutter_dtmf.dart';
46

57
import 'widgets/action_button.dart';
68
import 'package:sip_ua/sip_ua.dart';
@@ -270,6 +272,9 @@ class _MyCallScreenWidget extends State<CallScreenWidget>
270272

271273
void _handleDtmf(String tone) {
272274
print('Dtmf tone => $tone');
275+
if (WebRTC.platformIsMobile) {
276+
FlutterDtmf.playTone(digits: tone);
277+
}
273278
call.sendDTMF(tone);
274279
}
275280

@@ -485,41 +490,40 @@ class _MyCallScreenWidget extends State<CallScreenWidget>
485490
}
486491

487492
stackWidgets.addAll([
488-
Positioned(
489-
top: voiceonly ? 48 : 6,
490-
left: 0,
491-
right: 0,
492-
child: Center(
493-
child: Column(
494-
crossAxisAlignment: CrossAxisAlignment.center,
495-
mainAxisAlignment: MainAxisAlignment.center,
496-
children: <Widget>[
497-
Center(
498-
child: Padding(
499-
padding: const EdgeInsets.all(6),
500-
child: Text(
501-
(voiceonly ? 'VOICE CALL' : 'VIDEO CALL') +
502-
(_hold
503-
? ' PAUSED BY ${this._holdOriginator.toUpperCase()}'
504-
: ''),
505-
style: TextStyle(fontSize: 24, color: Colors.black54),
506-
))),
507-
Center(
508-
child: Padding(
509-
padding: const EdgeInsets.all(6),
510-
child: Text(
511-
'$remote_identity',
512-
style: TextStyle(fontSize: 18, color: Colors.black54),
513-
))),
514-
Center(
515-
child: Padding(
516-
padding: const EdgeInsets.all(6),
517-
child: Text(_timeLabel,
518-
style:
519-
TextStyle(fontSize: 14, color: Colors.black54))))
520-
],
521-
)),
522-
),
493+
Positioned(
494+
top: voiceonly ? 48 : 6,
495+
left: 0,
496+
right: 0,
497+
child: Center(
498+
child: Column(
499+
crossAxisAlignment: CrossAxisAlignment.center,
500+
mainAxisAlignment: MainAxisAlignment.center,
501+
children: <Widget>[
502+
Center(
503+
child: Padding(
504+
padding: const EdgeInsets.all(6),
505+
child: Text(
506+
(voiceonly ? 'VOICE CALL' : 'VIDEO CALL') +
507+
(_hold
508+
? ' PAUSED BY ${this._holdOriginator.toUpperCase()}'
509+
: ''),
510+
style: TextStyle(fontSize: 24, color: Colors.black54),
511+
))),
512+
Center(
513+
child: Padding(
514+
padding: const EdgeInsets.all(6),
515+
child: Text(
516+
'$remote_identity',
517+
style: TextStyle(fontSize: 18, color: Colors.black54),
518+
))),
519+
Center(
520+
child: Padding(
521+
padding: const EdgeInsets.all(6),
522+
child: Text(_timeLabel,
523+
style: TextStyle(fontSize: 14, color: Colors.black54))))
524+
],
525+
)),
526+
),
523527
]);
524528

525529
return Stack(

0 commit comments

Comments
 (0)