aef1fd8804
* signal * request * implement * rename event * ref * adjustments based on review * override subscribed * move events emit * fix subscription state * minor change * update example for permissions demo * format & subscriptionState as computed property * prepare macos build * unsubscribed event when subscription not allowed
158 lines
4.7 KiB
Dart
158 lines
4.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
extension LKExampleExt on BuildContext {
|
|
//
|
|
Future<bool?> showPublishDialog() => showDialog<bool>(
|
|
context: this,
|
|
builder: (ctx) => AlertDialog(
|
|
title: const Text('Publish'),
|
|
content: const Text('Would you like to publish your Camera & Mic ?'),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx, false),
|
|
child: const Text('NO'),
|
|
),
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx, true),
|
|
child: const Text('YES'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
|
|
Future<bool?> showUnPublishDialog() => showDialog<bool>(
|
|
context: this,
|
|
builder: (ctx) => AlertDialog(
|
|
title: const Text('UnPublish'),
|
|
content:
|
|
const Text('Would you like to un-publish your Camera & Mic ?'),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx, false),
|
|
child: const Text('NO'),
|
|
),
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx, true),
|
|
child: const Text('YES'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
|
|
Future<void> showErrorDialog(dynamic exception) => showDialog<void>(
|
|
context: this,
|
|
builder: (ctx) => AlertDialog(
|
|
title: const Text('Error'),
|
|
content: Text(exception.toString()),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx),
|
|
child: const Text('OK'),
|
|
)
|
|
],
|
|
),
|
|
);
|
|
|
|
Future<bool?> showDisconnectDialog() => showDialog<bool>(
|
|
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'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
|
|
Future<bool?> showReconnectDialog() => showDialog<bool>(
|
|
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'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
|
|
Future<void> showReconnectSuccessDialog() => showDialog<void>(
|
|
context: this,
|
|
builder: (ctx) => AlertDialog(
|
|
title: const Text('Reconnect'),
|
|
content: const Text('Reconnection was successful.'),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx),
|
|
child: const Text('OK'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
|
|
Future<bool?> showSendDataDialog() => showDialog<bool>(
|
|
context: this,
|
|
builder: (ctx) => AlertDialog(
|
|
title: const Text('Send data'),
|
|
content: const Text(
|
|
'This will send a sample data to all participants in the room'),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx, false),
|
|
child: const Text('Cancel'),
|
|
),
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx, true),
|
|
child: const Text('Send'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
|
|
Future<bool?> showDataReceivedDialog(String data) => showDialog<bool>(
|
|
context: this,
|
|
builder: (ctx) => AlertDialog(
|
|
title: const Text('Received data'),
|
|
content: Text(data),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx, true),
|
|
child: const Text('OK'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
|
|
Future<bool?> showSubscribePermissionDialog() => showDialog<bool>(
|
|
context: this,
|
|
builder: (ctx) => AlertDialog(
|
|
title: const Text('Allow subscription'),
|
|
content: const Text(
|
|
'Allow all participants to subscribe tracks published by local participant?'),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx, false),
|
|
child: const Text('NO'),
|
|
),
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(ctx, true),
|
|
child: const Text('YES'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|