pronta para a pap?

This commit is contained in:
2026-06-15 15:47:24 +01:00
parent 29e887cb14
commit 144a6c71a5

View File

@@ -29,9 +29,8 @@
class _PlacarPageState extends State<PlacarPage> {
late PlacarController _controller;
final GameSharingController _sharingController = GameSharingController();
String? _sessionId;
String? _shareCode;
String _sharedWithName = '';
String? _sessionId;
String? _shareCode;
StreamSubscription? _syncSubscription;
bool _isApplyingRemoteSync = false;
final Set<String> _appliedSyncEventIds = {};
@@ -162,13 +161,10 @@
);
if (activeSession == null) return;
_sessionId = activeSession['id']?.toString();
_shareCode = activeSession['share_code']?.toString();
final sharedWith = activeSession['shared_with_user_id']?.toString();
_sessionId = activeSession['id']?.toString();
_shareCode = activeSession['share_code']?.toString();
if (sharedWith != null && sharedWith.isNotEmpty) {
_sharedWithName = await _resolveUserName(sharedWith);
}
// Partner info intentionally ignored because share label is hidden.
await _setupSyncListener();
setState(() {});
@@ -285,12 +281,10 @@
.eq('session_id', _sessionId!)
.order('created_at', ascending: true);
if (response is List) {
for (final item in response) {
final id = item['id']?.toString();
if (id != null) {
_appliedSyncEventIds.add(id);
}
for (final item in response as List) {
final id = item['id']?.toString();
if (id != null) {
_appliedSyncEventIds.add(id);
}
}
} catch (e) {
@@ -448,37 +442,16 @@
);
if (result != null) {
_sessionId = result['session_id']?.toString();
_shareCode = result['share_code']?.toString();
_sharedWithName = result['creator_name']?.toString() ?? '';
_sessionId = result['session_id']?.toString();
_shareCode = result['share_code']?.toString();
await _setupSyncListener();
setState(() {});
}
}
Widget _buildShareStatus(double sf) {
if (_sessionId == null) return const SizedBox.shrink();
final text = _sharedWithName.isNotEmpty
? 'Partilhado com $_sharedWithName'
: 'Sessão partilhada: $_shareCode';
return Container(
padding: EdgeInsets.symmetric(horizontal: 14 * sf, vertical: 8 * sf),
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.55),
borderRadius: BorderRadius.circular(14 * sf),
border: Border.all(color: Colors.white24),
),
child: Text(
text,
style: TextStyle(
color: Colors.white,
fontSize: 13 * sf,
fontWeight: FontWeight.bold,
),
),
);
// Não mostrar qualquer indicação de partilha (nome ou código).
return const SizedBox.shrink();
}
@override