Atualização de gauge

This commit is contained in:
Carlos Correia
2026-07-14 18:23:03 +01:00
parent 4fcf3a475a
commit 5b25d9bef4
22 changed files with 973 additions and 1441 deletions

View File

@@ -7,12 +7,22 @@ import 'quiz_video_guide.dart';
/// Recorta/zoom numa zona específica de uma foto de rosto (ex.: só a zona
/// dos olhos), também sem precisar de um novo ficheiro de imagem.
Widget _zoomCrop(String path, {Alignment alignment = Alignment.center, double scale = 2.0}) {
Widget _zoomCrop(
String path, {
Alignment alignment = Alignment.center,
double scale = 2.0,
// Alinhamento do próprio Image.asset ao aplicar o BoxFit.cover — separado
// do alignment do Transform.scale acima, porque o cover já decide (antes
// do zoom) que fatia vertical/horizontal da foto original mostrar; se essa
// fatia inicial não incluir a zona pretendida (ex.: queixo cortado fora),
// nenhum scale/alignment do Transform consegue "recuperar" esses pixels.
Alignment imageAlignment = Alignment.center,
}) {
return ClipRect(
child: Transform.scale(
scale: scale,
alignment: alignment,
child: Image.asset(path, fit: BoxFit.cover),
child: Image.asset(path, fit: BoxFit.cover, alignment: imageAlignment),
),
);
}
@@ -30,9 +40,7 @@ MaterialPageRoute<void> quizStartRoute({String? scopeId}) {
'Quando deve procurar um dentista (urgência vs vigilância)',
],
onAdvance: (context) => Navigator.of(context).pushReplacement(
MaterialPageRoute<void>(
builder: (_) => Quiz1Screen(scopeId: scopeId),
),
MaterialPageRoute<void>(builder: (_) => Quiz1Screen(scopeId: scopeId)),
),
),
);
@@ -40,15 +48,19 @@ MaterialPageRoute<void> quizStartRoute({String? scopeId}) {
// Quiz 1: Problemas respiratórios (Yes/No)
class Quiz1Screen extends StatelessWidget {
const Quiz1Screen({super.key, this.currentScore = 0, this.scopeId});
const Quiz1Screen({
super.key,
this.currentScore = const QuizScore(),
this.scopeId,
});
final int currentScore;
final QuizScore currentScore;
final String? scopeId;
@override
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 1/26',
title: 'Quiz 1/27',
category: 'Saúde respiratória',
categoryIcon: Icons.medical_information_rounded,
fallbackIcon: Icons.medical_information_rounded,
@@ -89,13 +101,13 @@ class Quiz1Screen extends StatelessWidget {
class Quiz2Screen extends StatelessWidget {
const Quiz2Screen({super.key, required this.currentScore, this.scopeId});
final int currentScore;
final QuizScore currentScore;
final String? scopeId;
@override
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 2/26',
title: 'Quiz 2/27',
category: 'Respiração',
categoryIcon: Icons.air_rounded,
fallbackIcon: Icons.air_rounded,
@@ -136,13 +148,13 @@ class Quiz2Screen extends StatelessWidget {
class Quiz3Screen extends StatelessWidget {
const Quiz3Screen({super.key, required this.currentScore, this.scopeId});
final int currentScore;
final QuizScore currentScore;
final String? scopeId;
@override
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 3/26',
title: 'Quiz 3/27',
category: 'Sono',
categoryIcon: Icons.bedtime_rounded,
fallbackIcon: Icons.bedtime_rounded,
@@ -183,13 +195,13 @@ class Quiz3Screen extends StatelessWidget {
class Quiz4Screen extends StatelessWidget {
const Quiz4Screen({super.key, required this.currentScore, this.scopeId});
final int currentScore;
final QuizScore currentScore;
final String? scopeId;
@override
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 4/26',
title: 'Quiz 4/27',
category: 'Respiração',
categoryIcon: Icons.sick_rounded,
fallbackIcon: Icons.sick_rounded,
@@ -230,13 +242,13 @@ class Quiz4Screen extends StatelessWidget {
class Quiz5Screen extends StatelessWidget {
const Quiz5Screen({super.key, required this.currentScore, this.scopeId});
final int currentScore;
final QuizScore currentScore;
final String? scopeId;
@override
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 5/26',
title: 'Quiz 5/27',
category: 'Sono',
categoryIcon: Icons.nights_stay_rounded,
fallbackIcon: Icons.nights_stay_rounded,
@@ -279,13 +291,13 @@ class Quiz5Screen extends StatelessWidget {
class Quiz6Screen extends StatelessWidget {
const Quiz6Screen({super.key, required this.currentScore, this.scopeId});
final int currentScore;
final QuizScore currentScore;
final String? scopeId;
@override
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 6/26',
title: 'Quiz 6/27',
category: 'Hábitos noturnos',
categoryIcon: Icons.nights_stay_rounded,
fallbackIcon: Icons.nights_stay_rounded,
@@ -319,13 +331,13 @@ class Quiz6Screen extends StatelessWidget {
class Quiz7Screen extends StatelessWidget {
const Quiz7Screen({super.key, required this.currentScore, this.scopeId});
final int currentScore;
final QuizScore currentScore;
final String? scopeId;
@override
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 7/26',
title: 'Quiz 7/27',
category: 'Saúde geral',
categoryIcon: Icons.local_florist_rounded,
fallbackIcon: Icons.local_florist_rounded,
@@ -366,13 +378,13 @@ class Quiz7Screen extends StatelessWidget {
class Quiz8Screen extends StatelessWidget {
const Quiz8Screen({super.key, required this.currentScore, this.scopeId});
final int currentScore;
final QuizScore currentScore;
final String? scopeId;
@override
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 8/26',
title: 'Quiz 8/27',
category: 'Sono',
categoryIcon: Icons.water_drop_rounded,
fallbackIcon: Icons.water_drop_rounded,
@@ -413,13 +425,13 @@ class Quiz8Screen extends StatelessWidget {
class Quiz9Screen extends StatelessWidget {
const Quiz9Screen({super.key, required this.currentScore, this.scopeId});
final int currentScore;
final QuizScore currentScore;
final String? scopeId;
@override
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 9/26',
title: 'Quiz 9/27',
category: 'Saúde geral',
categoryIcon: Icons.hearing_rounded,
fallbackIcon: Icons.hearing_rounded,
@@ -460,13 +472,13 @@ class Quiz9Screen extends StatelessWidget {
class Quiz10Screen extends StatelessWidget {
const Quiz10Screen({super.key, required this.currentScore, this.scopeId});
final int currentScore;
final QuizScore currentScore;
final String? scopeId;
@override
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 10/26',
title: 'Quiz 10/27',
category: 'Saúde geral',
categoryIcon: Icons.healing_rounded,
fallbackIcon: Icons.healing_rounded,
@@ -507,13 +519,13 @@ class Quiz10Screen extends StatelessWidget {
class Quiz11Screen extends StatelessWidget {
const Quiz11Screen({super.key, required this.currentScore, this.scopeId});
final int currentScore;
final QuizScore currentScore;
final String? scopeId;
@override
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 11/26',
title: 'Quiz 11/27',
category: 'Saúde respiratória',
categoryIcon: Icons.air_rounded,
fallbackIcon: Icons.air_rounded,
@@ -555,13 +567,13 @@ class Quiz11Screen extends StatelessWidget {
class Quiz12Screen extends StatelessWidget {
const Quiz12Screen({super.key, required this.currentScore, this.scopeId});
final int currentScore;
final QuizScore currentScore;
final String? scopeId;
@override
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 12/26',
title: 'Quiz 12/27',
category: 'Hábitos alimentares',
categoryIcon: Icons.restaurant_rounded,
fallbackIcon: Icons.restaurant_rounded,
@@ -595,13 +607,13 @@ class Quiz12Screen extends StatelessWidget {
class Quiz13Screen extends StatelessWidget {
const Quiz13Screen({super.key, required this.currentScore, this.scopeId});
final int currentScore;
final QuizScore currentScore;
final String? scopeId;
@override
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 13/26',
title: 'Quiz 13/27',
category: 'Hábitos alimentares',
categoryIcon: Icons.schedule_rounded,
fallbackIcon: Icons.schedule_rounded,
@@ -635,13 +647,13 @@ class Quiz13Screen extends StatelessWidget {
class Quiz14Screen extends StatelessWidget {
const Quiz14Screen({super.key, required this.currentScore, this.scopeId});
final int currentScore;
final QuizScore currentScore;
final String? scopeId;
@override
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 14/26',
title: 'Quiz 14/27',
category: 'Hábitos alimentares',
categoryIcon: Icons.restaurant_menu_rounded,
fallbackIcon: Icons.restaurant_menu_rounded,
@@ -675,13 +687,13 @@ class Quiz14Screen extends StatelessWidget {
class Quiz15Screen extends StatelessWidget {
const Quiz15Screen({super.key, required this.currentScore, this.scopeId});
final int currentScore;
final QuizScore currentScore;
final String? scopeId;
@override
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 15/26',
title: 'Quiz 15/27',
category: 'Hábitos alimentares',
categoryIcon: Icons.local_drink_rounded,
fallbackIcon: Icons.local_drink_rounded,
@@ -722,13 +734,13 @@ class Quiz15Screen extends StatelessWidget {
class Quiz16Screen extends StatelessWidget {
const Quiz16Screen({super.key, required this.currentScore, this.scopeId});
final int currentScore;
final QuizScore currentScore;
final String? scopeId;
@override
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 16/26',
title: 'Quiz 16/27',
category: 'Hábitos orais',
categoryIcon: Icons.child_care_rounded,
fallbackIcon: Icons.child_care_rounded,
@@ -769,13 +781,13 @@ class Quiz16Screen extends StatelessWidget {
class Quiz17Screen extends StatelessWidget {
const Quiz17Screen({super.key, required this.currentScore, this.scopeId});
final int currentScore;
final QuizScore currentScore;
final String? scopeId;
@override
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 17/26',
title: 'Quiz 17/27',
category: 'Hábitos orais',
categoryIcon: Icons.back_hand_rounded,
fallbackIcon: Icons.back_hand_rounded,
@@ -824,13 +836,13 @@ class Quiz17Screen extends StatelessWidget {
class Quiz18Screen extends StatelessWidget {
const Quiz18Screen({super.key, required this.currentScore, this.scopeId});
final int currentScore;
final QuizScore currentScore;
final String? scopeId;
@override
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 18/26',
title: 'Quiz 18/27',
category: 'Avaliação postural',
categoryIcon: Icons.accessibility_new_rounded,
fallbackIcon: Icons.accessibility_new_rounded,
@@ -870,13 +882,13 @@ class Quiz18Screen extends StatelessWidget {
class Quiz19Screen extends StatelessWidget {
const Quiz19Screen({super.key, required this.currentScore, this.scopeId});
final int currentScore;
final QuizScore currentScore;
final String? scopeId;
@override
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 19/26',
title: 'Quiz 19/27',
category: 'Avaliação facial',
categoryIcon: Icons.face_rounded,
fallbackIcon: Icons.face_rounded,
@@ -935,20 +947,20 @@ class Quiz19Screen extends StatelessWidget {
class Quiz20Screen extends StatelessWidget {
const Quiz20Screen({super.key, required this.currentScore, this.scopeId});
final int currentScore;
final QuizScore currentScore;
final String? scopeId;
@override
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 20/26',
title: 'Quiz 20/27',
category: 'Avaliação facial',
categoryIcon: Icons.sentiment_neutral_rounded,
fallbackIcon: Icons.sentiment_neutral_rounded,
fallbackColor: const Color(0xFF2F9E94),
question: 'Qual é a posição da boca do seu filho/a habitualmente?',
answers: const [
QuizAnswer(
answers: [
const QuizAnswer(
title: 'Boca fechada',
description: 'Boca fechada habitualmente',
weight: 1,
@@ -962,16 +974,17 @@ class Quiz20Screen extends StatelessWidget {
weight: 2,
hideTitle: true,
value: 'boca_entreaberta',
imagePath: 'assets/mockup_images/4.jpeg',
imageBuilder: (context) => _zoomCrop(
'assets/mockup_images/4.jpeg',
alignment: const Alignment(0, 0.45),
scale: 1.8,
),
),
],
currentScore: currentScore,
nextRoute: (context, nextScore) => MaterialPageRoute<void>(
builder: (_) => QuizVideoGuideScreen(
youtubeId: 'msKYr7nPxcw',
extraHeading: 'Observe atentamente a face do seu filho...',
extraSubtitle:
'Vamos precisar da sua ajuda para registrar o que vê no seu filho/a!',
onAdvance: (ctx) => Navigator.of(ctx).pushReplacement(
MaterialPageRoute<void>(
builder: (_) =>
@@ -990,13 +1003,13 @@ class Quiz20Screen extends StatelessWidget {
class Quiz21Screen extends StatelessWidget {
const Quiz21Screen({super.key, required this.currentScore, this.scopeId});
final int currentScore;
final QuizScore currentScore;
final String? scopeId;
@override
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 21/26',
title: 'Quiz 21/27',
category: 'Avaliação facial',
categoryIcon: Icons.visibility_rounded,
fallbackIcon: Icons.visibility_rounded,
@@ -1043,29 +1056,35 @@ class Quiz21Screen extends StatelessWidget {
class Quiz22Screen extends StatelessWidget {
const Quiz22Screen({super.key, required this.currentScore, this.scopeId});
final int currentScore;
final QuizScore currentScore;
final String? scopeId;
@override
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 22/26',
title: 'Quiz 22/27',
category: 'Avaliação facial',
categoryIcon: Icons.face_rounded,
fallbackIcon: Icons.face_rounded,
fallbackColor: const Color(0xFF8E7CC3),
isSignQuestion: true,
question:
'Qual das imagens é mais parecida com o queixo do seu filho/a com a boca fechada?',
answers: const [
answers: [
QuizAnswer(
title: 'Queixo relaxado',
description: 'Queixo liso e relaxado com a boca fechada',
weight: 1,
hideTitle: true,
value: 'queixo_correto',
imagePath: 'assets/mockup_images/5.png',
imageBuilder: (context) => _zoomCrop(
'assets/mockup_images/5.png',
imageAlignment: const Alignment(0, 1),
alignment: const Alignment(0, 1),
scale: 1.8,
),
),
QuizAnswer(
const QuizAnswer(
title: 'Queixo tenso',
description: 'Queixo tenso/franzido com a boca fechada',
weight: 2,
@@ -1088,18 +1107,20 @@ class Quiz22Screen extends StatelessWidget {
class Quiz23Screen extends StatelessWidget {
const Quiz23Screen({super.key, required this.currentScore, this.scopeId});
final int currentScore;
final QuizScore currentScore;
final String? scopeId;
@override
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 23/26',
title: 'Quiz 23/27',
category: 'Avaliação facial',
categoryIcon: Icons.sentiment_neutral_rounded,
fallbackIcon: Icons.sentiment_neutral_rounded,
fallbackColor: const Color(0xFF2F9E94),
question: 'Qual das seguintes imagens se assemelha à boca do seu filho/a?',
isSignQuestion: true,
question:
'Qual das seguintes imagens se assemelha à boca do seu filho/a?',
answers: const [
QuizAnswer(
title: 'Dentição alinhada',
@@ -1107,7 +1128,7 @@ class Quiz23Screen extends StatelessWidget {
weight: 1,
hideTitle: true,
value: 'dentes_alinhados',
imagePath: 'assets/mockup_images/24.png',
imagePath: 'assets/mockup_images/11.png',
),
QuizAnswer(
title: 'Dentição desalinhada',
@@ -1115,7 +1136,7 @@ class Quiz23Screen extends StatelessWidget {
weight: 2,
hideTitle: true,
value: 'dentes_desalinhados',
imagePath: 'assets/mockup_images/23.jpeg',
imagePath: 'assets/mockup_images/13.png',
),
QuizAnswer(
title: 'Dentição sobreposta',
@@ -1123,7 +1144,7 @@ class Quiz23Screen extends StatelessWidget {
weight: 2,
hideTitle: true,
value: 'dentes_sobrepostos',
imagePath: 'assets/mockup_images/14.jpeg',
imagePath: 'assets/mockup_images/10.png',
),
],
currentScore: currentScore,
@@ -1136,17 +1157,71 @@ class Quiz23Screen extends StatelessWidget {
}
}
// Quiz 24: Freio labial (Image-choice)
// Quiz 24: Apinhamento visto de perto (Image-choice)
class Quiz24Screen extends StatelessWidget {
const Quiz24Screen({super.key, required this.currentScore, this.scopeId});
final int currentScore;
final QuizScore currentScore;
final String? scopeId;
@override
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 24/26',
title: 'Quiz 24/27',
category: 'Avaliação facial',
categoryIcon: Icons.zoom_in_rounded,
fallbackIcon: Icons.zoom_in_rounded,
fallbackColor: const Color(0xFF2F9E94),
isSignQuestion: true,
question:
'Qual das seguintes imagens se assemelha à boca do seu filho/a?',
answers: const [
QuizAnswer(
title: 'Ligeiro desalinhamento',
description: 'Pequeno desalinhamento ou espaço entre alguns dentes',
weight: 1,
hideTitle: true,
value: 'apinhamento_leve',
imagePath: 'assets/mockup_images/16.png',
),
QuizAnswer(
title: 'Apinhamento moderado',
description: 'Dentes rodados/desalinhados de forma mais visível',
weight: 2,
hideTitle: true,
value: 'apinhamento_moderado',
imagePath: 'assets/mockup_images/15.png',
),
QuizAnswer(
title: 'Apinhamento acentuado',
description: 'Dentes muito sobrepostos entre si',
weight: 2,
hideTitle: true,
value: 'apinhamento_acentuado',
imagePath: 'assets/mockup_images/14.jpeg',
),
],
currentScore: currentScore,
nextRoute: (context, nextScore) => MaterialPageRoute<void>(
builder: (_) => Quiz25Screen(currentScore: nextScore, scopeId: scopeId),
),
answerType: QuizAnswerType.image,
showBackButton: true,
);
}
}
// Quiz 25: Freio labial (Image-choice)
class Quiz25Screen extends StatelessWidget {
const Quiz25Screen({super.key, required this.currentScore, this.scopeId});
final QuizScore currentScore;
final String? scopeId;
@override
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 25/27',
category: 'Avaliação facial',
categoryIcon: Icons.record_voice_over_rounded,
fallbackIcon: Icons.record_voice_over_rounded,
@@ -1173,7 +1248,7 @@ class Quiz24Screen extends StatelessWidget {
],
currentScore: currentScore,
nextRoute: (context, nextScore) => MaterialPageRoute<void>(
builder: (_) => Quiz25Screen(currentScore: nextScore, scopeId: scopeId),
builder: (_) => Quiz26Screen(currentScore: nextScore, scopeId: scopeId),
),
answerType: QuizAnswerType.image,
showBackButton: true,
@@ -1181,17 +1256,17 @@ class Quiz24Screen extends StatelessWidget {
}
}
// Quiz 25: Freio lingual (Image-choice)
class Quiz25Screen extends StatelessWidget {
const Quiz25Screen({super.key, required this.currentScore, this.scopeId});
// Quiz 26: Freio lingual (Image-choice)
class Quiz26Screen extends StatelessWidget {
const Quiz26Screen({super.key, required this.currentScore, this.scopeId});
final int currentScore;
final QuizScore currentScore;
final String? scopeId;
@override
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 25/26',
title: 'Quiz 26/27',
category: 'Avaliação facial',
categoryIcon: Icons.record_voice_over_rounded,
fallbackIcon: Icons.record_voice_over_rounded,
@@ -1218,7 +1293,7 @@ class Quiz25Screen extends StatelessWidget {
],
currentScore: currentScore,
nextRoute: (context, nextScore) => MaterialPageRoute<void>(
builder: (_) => Quiz26Screen(currentScore: nextScore, scopeId: scopeId),
builder: (_) => Quiz27Screen(currentScore: nextScore, scopeId: scopeId),
),
answerType: QuizAnswerType.image,
showBackButton: true,
@@ -1226,21 +1301,22 @@ class Quiz25Screen extends StatelessWidget {
}
}
// Quiz 26: Céu da boca (Image-choice, final)
class Quiz26Screen extends StatelessWidget {
const Quiz26Screen({super.key, required this.currentScore, this.scopeId});
// Quiz 27: Céu da boca (Image-choice, final)
class Quiz27Screen extends StatelessWidget {
const Quiz27Screen({super.key, required this.currentScore, this.scopeId});
final int currentScore;
final QuizScore currentScore;
final String? scopeId;
@override
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 26/26',
title: 'Quiz 27/27',
category: 'Avaliação facial',
categoryIcon: Icons.architecture_rounded,
fallbackIcon: Icons.architecture_rounded,
fallbackColor: const Color(0xFFFF55A7),
isSignQuestion: true,
question:
'Qual das seguintes imagens se assemelha ao céu da boca do seu filho/a?',
answers: const [
@@ -1263,11 +1339,7 @@ class Quiz26Screen extends StatelessWidget {
],
currentScore: currentScore,
nextRoute: (context, nextScore) => MaterialPageRoute<void>(
builder: (_) => QuizResultScreen(
finalScore: nextScore,
maxScore: 52,
scopeId: scopeId,
),
builder: (_) => QuizResultScreen(finalScore: nextScore, scopeId: scopeId),
),
answerType: QuizAnswerType.image,
isFinal: true,