Atualização do quiz e videos(incompleto)
This commit is contained in:
@@ -62,17 +62,20 @@ class _QuizResultScreenState extends State<QuizResultScreen> {
|
||||
scope.startsWith('${userId}_')) {
|
||||
final childId = scope.substring(userId.length + 1).trim();
|
||||
if (childId.isNotEmpty) {
|
||||
await FirebaseFirestore.instance
|
||||
.collection('users')
|
||||
.doc(userId)
|
||||
.collection('children')
|
||||
.doc(childId)
|
||||
.set({
|
||||
'lastScore': widget.finalScore,
|
||||
'lastMaxScore': widget.maxScore,
|
||||
'lastQuizAt': FieldValue.serverTimestamp(),
|
||||
}, SetOptions(merge: true))
|
||||
.catchError((_) {});
|
||||
// Fire-and-forget: avoid blocking UI on Firestore (may hang offline).
|
||||
unawaited(
|
||||
FirebaseFirestore.instance
|
||||
.collection('users')
|
||||
.doc(userId)
|
||||
.collection('children')
|
||||
.doc(childId)
|
||||
.set({
|
||||
'lastScore': widget.finalScore,
|
||||
'lastMaxScore': widget.maxScore,
|
||||
'lastQuizAt': FieldValue.serverTimestamp(),
|
||||
}, SetOptions(merge: true))
|
||||
.catchError((_) {}),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -222,8 +225,11 @@ class _QuizResultScreenState extends State<QuizResultScreen> {
|
||||
fontWeight: FontWeight.w900,
|
||||
),
|
||||
),
|
||||
onPressed: () =>
|
||||
Navigator.of(context).popUntil((r) => r.isFirst),
|
||||
onPressed: () async {
|
||||
await _saveResultFuture;
|
||||
if (!context.mounted) return;
|
||||
Navigator.of(context).popUntil((r) => r.isFirst);
|
||||
},
|
||||
child: const Text('Avançar'),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user