[mob][photos] Add hook to show cast devices
This commit is contained in:
parent
db95de8829
commit
f645fff31c
2 changed files with 47 additions and 0 deletions
|
@ -105,5 +105,14 @@
|
|||
<true/>
|
||||
<key>UIApplicationSupportsIndirectInputEvents</key>
|
||||
<true/>
|
||||
<key>NSBonjourServices</key>
|
||||
<array>
|
||||
<string>_googlecast._tcp</string>
|
||||
<string>F5BCEC64._googlecast._tcp</string>
|
||||
</array>
|
||||
|
||||
<key>NSLocalNetworkUsageDescription</key>
|
||||
<string>${PRODUCT_NAME} uses the local network to discover Cast-enabled devices on your WiFi
|
||||
network.</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
@ -2,6 +2,8 @@ import 'dart:async';
|
|||
import 'dart:io';
|
||||
import 'dart:math' as math;
|
||||
|
||||
import "package:cast/device.dart";
|
||||
import "package:cast/discovery_service.dart";
|
||||
import "package:flutter/cupertino.dart";
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:logging/logging.dart';
|
||||
|
@ -576,6 +578,9 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
|
|||
),
|
||||
);
|
||||
}
|
||||
if (widget.collection != null) {
|
||||
actions.add(castWidget(context));
|
||||
}
|
||||
if (items.isNotEmpty) {
|
||||
actions.add(
|
||||
PopupMenuButton(
|
||||
|
@ -642,6 +647,39 @@ class _GalleryAppBarWidgetState extends State<GalleryAppBarWidget> {
|
|||
return actions;
|
||||
}
|
||||
|
||||
Widget castWidget(BuildContext context) {
|
||||
return FutureBuilder<List<CastDevice>>(
|
||||
future: CastDiscoveryService().search(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasError) {
|
||||
return Center(
|
||||
child: Text(
|
||||
'Error: ${snapshot.error.toString()}',
|
||||
),
|
||||
);
|
||||
} else if (!snapshot.hasData) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
|
||||
if (snapshot.data!.isEmpty) {
|
||||
return const Text('No device');
|
||||
}
|
||||
|
||||
return Column(
|
||||
children: snapshot.data!.map((device) {
|
||||
return Text(device.name);
|
||||
|
||||
}).toList(),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _connectToYourApp(
|
||||
BuildContext contect, CastDevice device,) async {}
|
||||
|
||||
Future<void> onCleanUncategorizedClick(BuildContext buildContext) async {
|
||||
final actionResult = await showChoiceActionSheet(
|
||||
context,
|
||||
|
|
Loading…
Add table
Reference in a new issue