|
@@ -25,6 +25,7 @@ class _RemoteScreenState extends State<RemoteScreen> {
|
|
|
int _total = 0;
|
|
int _total = 0;
|
|
|
Uint8List? _slideImage;
|
|
Uint8List? _slideImage;
|
|
|
bool _connected = false;
|
|
bool _connected = false;
|
|
|
|
|
+ bool _presentationOpen = true; // assume open on Windows; Linux server will correct
|
|
|
String? _error;
|
|
String? _error;
|
|
|
|
|
|
|
|
@override
|
|
@override
|
|
@@ -67,12 +68,28 @@ class _RemoteScreenState extends State<RemoteScreen> {
|
|
|
setState(() {
|
|
setState(() {
|
|
|
_current = (msg['current'] as num).toInt();
|
|
_current = (msg['current'] as num).toInt();
|
|
|
_total = (msg['total'] as num).toInt();
|
|
_total = (msg['total'] as num).toInt();
|
|
|
|
|
+ _presentationOpen = true;
|
|
|
});
|
|
});
|
|
|
} else if (event == 'image') {
|
|
} else if (event == 'image') {
|
|
|
final b64 = msg['data'] as String?;
|
|
final b64 = msg['data'] as String?;
|
|
|
if (b64 != null && b64.isNotEmpty) {
|
|
if (b64 != null && b64.isNotEmpty) {
|
|
|
setState(() => _slideImage = base64Decode(b64));
|
|
setState(() => _slideImage = base64Decode(b64));
|
|
|
}
|
|
}
|
|
|
|
|
+ } else if (event == 'presentation') {
|
|
|
|
|
+ final status = msg['status'] as String?;
|
|
|
|
|
+ setState(() {
|
|
|
|
|
+ _presentationOpen = status == 'opened';
|
|
|
|
|
+ if (!_presentationOpen) {
|
|
|
|
|
+ _slideImage = null;
|
|
|
|
|
+ _current = 0;
|
|
|
|
|
+ _total = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ if (status == 'closed') {
|
|
|
|
|
+ ScaffoldMessenger.of(context).showSnackBar(
|
|
|
|
|
+ const SnackBar(content: Text('Presentation closed — waiting for new file...')),
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
} else if (event == 'error') {
|
|
} else if (event == 'error') {
|
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
|
|
SnackBar(content: Text(msg['message'] ?? 'Unknown error')),
|
|
SnackBar(content: Text(msg['message'] ?? 'Unknown error')),
|
|
@@ -124,13 +141,27 @@ class _RemoteScreenState extends State<RemoteScreen> {
|
|
|
child: Column(
|
|
child: Column(
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
children: [
|
|
children: [
|
|
|
- const Icon(Icons.slideshow, size: 80, color: Colors.white24),
|
|
|
|
|
|
|
+ Icon(
|
|
|
|
|
+ _presentationOpen ? Icons.slideshow : Icons.hourglass_empty,
|
|
|
|
|
+ size: 80,
|
|
|
|
|
+ color: Colors.white24,
|
|
|
|
|
+ ),
|
|
|
const SizedBox(height: 12),
|
|
const SizedBox(height: 12),
|
|
|
Text(
|
|
Text(
|
|
|
- _error ?? 'No slide preview',
|
|
|
|
|
|
|
+ _presentationOpen
|
|
|
|
|
+ ? (_error ?? 'No slide preview')
|
|
|
|
|
+ : 'Waiting for presentation\nto be opened on server...',
|
|
|
style: const TextStyle(color: Colors.white38),
|
|
style: const TextStyle(color: Colors.white38),
|
|
|
textAlign: TextAlign.center,
|
|
textAlign: TextAlign.center,
|
|
|
),
|
|
),
|
|
|
|
|
+ if (!_presentationOpen) ...[
|
|
|
|
|
+ const SizedBox(height: 16),
|
|
|
|
|
+ const SizedBox(
|
|
|
|
|
+ width: 24,
|
|
|
|
|
+ height: 24,
|
|
|
|
|
+ child: CircularProgressIndicator(strokeWidth: 2),
|
|
|
|
|
+ ),
|
|
|
|
|
+ ],
|
|
|
],
|
|
],
|
|
|
),
|
|
),
|
|
|
),
|
|
),
|