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

75 lines
2.4 KiB
Dart
Raw Normal View History

2024-04-27 05:12:26 +00:00
import 'package:flutter/material.dart';
2024-04-30 12:31:54 +00:00
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
2024-04-27 05:12:26 +00:00
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(
2024-04-30 12:31:54 +00:00
title: Text(AppLocalizations.of(this)!.chatCallDisconnect),
content: Text(AppLocalizations.of(this)!.chatCallDisconnectConfirm),
2024-04-29 12:22:06 +00:00
actions: [
TextButton(
onPressed: () => Navigator.pop(ctx, false),
2024-04-30 12:31:54 +00:00
child: Text(AppLocalizations.of(this)!.confirmCancel),
2024-04-29 12:22:06 +00:00
),
TextButton(
onPressed: () => Navigator.pop(ctx, true),
2024-04-30 12:31:54 +00:00
child: Text(AppLocalizations.of(this)!.confirmOkay),
2024-04-29 12:22:06 +00:00
),
],
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'),
),
],
),
);
}