mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-12 23:45:18 +00:00

* feat: add connect server support * feat: add ability discover and connect to same network Spotube(s) and sync queue * feat(connect): add player controls, shuffle, loop, progress bar and queue support * feat: make control page adaptive * feat: add volume control support * cd: upgrade macos runner version * chore: upgrade inappwebview version to 6 * feat: customized devices button * feat: add user icon next to devices button * feat: add play in remote device support * feat: show alert when new client connects * fix: ignore the device itself from broadcast list * fix: volume control not working * feat: add ability to select current device's output speaker
71 lines
2.0 KiB
Dart
71 lines
2.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:spotube/extensions/context.dart';
|
|
import 'package:spotube/provider/connect/clients.dart';
|
|
|
|
class SelectDeviceDialog extends HookConsumerWidget {
|
|
const SelectDeviceDialog({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context, ref) {
|
|
final isRemoteService = useState(false);
|
|
|
|
final connectClients = ref.watch(connectClientsProvider);
|
|
final remoteService = connectClients.asData!.value.resolvedService!;
|
|
|
|
return AlertDialog(
|
|
title: const Text("Choose the device:"),
|
|
insetPadding: const EdgeInsets.all(16),
|
|
content: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
const Text(
|
|
"There are multiple device connected.\n"
|
|
"Choose the device you want this action to take place",
|
|
),
|
|
RadioListTile.adaptive(
|
|
title: Text(remoteService.name),
|
|
value: true,
|
|
groupValue: isRemoteService.value,
|
|
onChanged: (value) {
|
|
isRemoteService.value = value!;
|
|
},
|
|
),
|
|
RadioListTile.adaptive(
|
|
title: const Text("This Device"),
|
|
value: false,
|
|
groupValue: isRemoteService.value,
|
|
onChanged: (value) {
|
|
isRemoteService.value = !value!;
|
|
},
|
|
),
|
|
],
|
|
),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () {
|
|
Navigator.of(context).pop(isRemoteService.value);
|
|
},
|
|
child: Text(context.l10n.select),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|
|
|
|
Future<bool> showSelectDeviceDialog(BuildContext context, WidgetRef ref) async {
|
|
final connectClients = ref.read(connectClientsProvider);
|
|
|
|
if (connectClients.asData?.value.resolvedService == null) {
|
|
return false;
|
|
}
|
|
|
|
final isRemote = await showDialog<bool>(
|
|
context: context,
|
|
builder: (context) => const SelectDeviceDialog(),
|
|
);
|
|
|
|
return isRemote ?? false;
|
|
}
|