Solian/lib/widgets/chat/call/exts.dart

74 lines
2.2 KiB
Dart
Raw Normal View History

2024-04-27 05:12:26 +00:00
import 'package:flutter/material.dart';
extension SolianCallExt on BuildContext {
Future<bool?> showPlayAudioManuallyDialog() => showDialog<bool>(
2024-04-29 12:22:06 +00:00
context: this,
builder: (ctx) => AlertDialog(
title: const Text('Play Audio'),
content: const Text(
'You need to manually activate audio PlayBack for iOS Safari!',
),
actions: [
TextButton(
onPressed: () => Navigator.pop(ctx, false),
child: const Text('Ignore'),
),
TextButton(
onPressed: () => Navigator.pop(ctx, true),
child: const Text('Play Audio'),
),
],
2024-04-27 05:12:26 +00:00
),
2024-04-29 12:22:06 +00:00
);
2024-04-27 05:12:26 +00:00
Future<bool?> showDisconnectDialog() => showDialog<bool>(
2024-04-29 12:22:06 +00:00
context: this,
builder: (ctx) => AlertDialog(
title: const Text('Disconnect'),
content: const Text('Are you sure to disconnect?'),
actions: [
TextButton(
onPressed: () => Navigator.pop(ctx, false),
child: const Text('Cancel'),
),
TextButton(
onPressed: () => Navigator.pop(ctx, true),
child: const Text('Disconnect'),
),
],
2024-04-27 05:12:26 +00:00
),
2024-04-29 12:22:06 +00:00
);
2024-04-27 05:12:26 +00:00
Future<bool?> showReconnectDialog() => showDialog<bool>(
2024-04-29 12:22:06 +00:00
context: this,
builder: (ctx) => AlertDialog(
title: const Text('Reconnect'),
content: const Text('This will force a reconnection'),
actions: [
TextButton(
onPressed: () => Navigator.pop(ctx, false),
child: const Text('Cancel'),
),
TextButton(
onPressed: () => Navigator.pop(ctx, true),
child: const Text('Reconnect'),
),
],
2024-04-27 05:12:26 +00:00
),
2024-04-29 12:22:06 +00:00
);
2024-04-27 05:12:26 +00:00
Future<void> showReconnectSuccessDialog() => showDialog<void>(
context: this,
builder: (ctx) => AlertDialog(
2024-04-29 12:22:06 +00:00
title: const Text('Reconnect'),
content: const Text('Reconnection was successful.'),
2024-04-27 05:12:26 +00:00
actions: [
TextButton(
2024-04-29 12:22:06 +00:00
onPressed: () => Navigator.pop(ctx),
2024-04-27 05:12:26 +00:00
child: const Text('OK'),
),
],
),
);
}