Munça da UI de inicio | escovagem semanal adicionada | quantidade de videos assistidos | todos os videos na nuvem | possibilidade de continuar o video de onde parou

This commit is contained in:
Carlos Correia
2026-07-09 15:31:59 +01:00
parent 67b580778a
commit 9fb2840529
14 changed files with 1584 additions and 381 deletions

View File

@@ -14,6 +14,8 @@ class Quiz1Screen extends StatelessWidget {
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 1/25',
category: 'Avaliação facial',
categoryIcon: Icons.face_rounded,
question: 'O rosto do seu filho/a se parece com o desta imagem?',
questionImagePaths: const ['assets/mockup_images/2.jpeg'],
suggestedYoutubeId: '', // TODO: colar o ID do YouTube do Episódio 1
@@ -53,6 +55,8 @@ class Quiz2Screen extends StatelessWidget {
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 2/25',
category: 'Avaliação facial',
categoryIcon: Icons.sentiment_neutral_rounded,
question:
'A boca do seu filho/a fica habitualmente na posição desta imagem (entreaberta)?',
questionImagePaths: const ['assets/mockup_images/4.jpeg'],
@@ -93,6 +97,8 @@ class Quiz3Screen extends StatelessWidget {
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 3/25',
category: 'Avaliação facial',
categoryIcon: Icons.visibility_rounded,
question: 'O seu filho/a tem olheiras semelhantes às desta imagem?',
questionImagePaths: const ['assets/mockup_images/8.jpeg'],
suggestedYoutubeId: '', // TODO: colar o ID do YouTube do Episódio 3
@@ -132,6 +138,8 @@ class Quiz4Screen extends StatelessWidget {
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 4/25',
category: 'Avaliação facial',
categoryIcon: Icons.face_rounded,
question:
'Com a boca fechada, o queixo do seu filho/a se parece com o desta imagem?',
questionImagePaths: const ['assets/mockup_images/6.jpeg'],
@@ -172,6 +180,10 @@ class Quiz5Screen extends StatelessWidget {
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 5/25',
category: 'Contagem de dentes',
categoryIcon: Icons.numbers_rounded,
fallbackIcon: Icons.numbers_rounded,
fallbackColor: const Color(0xFF2F9E94),
question: 'Quantos dentes tem o seu filho/a em cima na boca?',
answers: const [],
currentScore: currentScore,
@@ -195,6 +207,10 @@ class Quiz6Screen extends StatelessWidget {
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 6/25',
category: 'Contagem de dentes',
categoryIcon: Icons.numbers_rounded,
fallbackIcon: Icons.numbers_rounded,
fallbackColor: const Color(0xFF2F9E94),
question: 'Quantos dentes tem o seu filho/a em baixo na boca?',
answers: const [],
currentScore: currentScore,
@@ -218,6 +234,8 @@ class Quiz7Screen extends StatelessWidget {
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 7/25',
category: 'Avaliação facial',
categoryIcon: Icons.sentiment_neutral_rounded,
question: 'A boca do seu filho/a se parece com a desta imagem?',
questionImagePaths: const ['assets/mockup_images/14.jpeg'],
suggestedYoutubeId: '', // TODO: colar o ID do YouTube do Episódio 5
@@ -257,6 +275,8 @@ class Quiz8Screen extends StatelessWidget {
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 8/25',
category: 'Avaliação facial',
categoryIcon: Icons.record_voice_over_rounded,
question:
'O frénulo (freio) da língua do seu filho/a se parece com o desta imagem?',
questionImagePaths: const ['assets/mockup_images/17.png'],
@@ -297,6 +317,10 @@ class Quiz9Screen extends StatelessWidget {
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 9/25',
category: 'Saúde respiratória',
categoryIcon: Icons.medical_information_rounded,
fallbackIcon: Icons.medical_information_rounded,
fallbackColor: const Color(0xFFFF55A7),
question: 'O seu filho/a tem problemas respiratórios diagnosticados?',
answers: const [
QuizAnswer(
@@ -311,6 +335,12 @@ class Quiz9Screen extends StatelessWidget {
weight: 1,
value: 'nao',
),
QuizAnswer(
title: 'Não sei',
description: 'Não tenho a certeza',
weight: 1,
value: 'nao_sei',
),
],
currentScore: currentScore,
nextRoute: (context, nextScore) => MaterialPageRoute<void>(
@@ -333,6 +363,10 @@ class Quiz10Screen extends StatelessWidget {
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 10/25',
category: 'Respiração',
categoryIcon: Icons.air_rounded,
fallbackIcon: Icons.air_rounded,
fallbackColor: const Color(0xFF2F9E94),
question: 'O seu filho/a respira habitualmente pela boca?',
answers: const [
QuizAnswer(
@@ -347,6 +381,12 @@ class Quiz10Screen extends StatelessWidget {
weight: 1,
value: 'nao',
),
QuizAnswer(
title: 'Não sei',
description: 'Não tenho a certeza',
weight: 1,
value: 'nao_sei',
),
],
currentScore: currentScore,
nextRoute: (context, nextScore) => MaterialPageRoute<void>(
@@ -369,6 +409,10 @@ class Quiz11Screen extends StatelessWidget {
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 11/25',
category: 'Sono',
categoryIcon: Icons.bedtime_rounded,
fallbackIcon: Icons.bedtime_rounded,
fallbackColor: const Color(0xFF8E7CC3),
question: 'O seu filho/a ressona habitualmente durante a noite?',
answers: const [
QuizAnswer(
@@ -383,6 +427,12 @@ class Quiz11Screen extends StatelessWidget {
weight: 1,
value: 'nao',
),
QuizAnswer(
title: 'Não sei',
description: 'Não tenho a certeza',
weight: 1,
value: 'nao_sei',
),
],
currentScore: currentScore,
nextRoute: (context, nextScore) => MaterialPageRoute<void>(
@@ -405,6 +455,10 @@ class Quiz12Screen extends StatelessWidget {
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 12/25',
category: 'Respiração',
categoryIcon: Icons.sick_rounded,
fallbackIcon: Icons.sick_rounded,
fallbackColor: const Color(0xFFFF55A7),
question: 'O seu filho/a sente habitualmente o nariz "tapado"?',
answers: const [
QuizAnswer(
@@ -419,6 +473,12 @@ class Quiz12Screen extends StatelessWidget {
weight: 1,
value: 'nao',
),
QuizAnswer(
title: 'Não sei',
description: 'Não tenho a certeza',
weight: 1,
value: 'nao_sei',
),
],
currentScore: currentScore,
nextRoute: (context, nextScore) => MaterialPageRoute<void>(
@@ -441,6 +501,10 @@ class Quiz13Screen extends StatelessWidget {
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 13/25',
category: 'Sono',
categoryIcon: Icons.nights_stay_rounded,
fallbackIcon: Icons.nights_stay_rounded,
fallbackColor: const Color(0xFF8E7CC3),
question:
'Durante o sono, o seu filho/a tem habitualmente interrupções da respiração?',
answers: const [
@@ -457,6 +521,12 @@ class Quiz13Screen extends StatelessWidget {
weight: 1,
value: 'nao',
),
QuizAnswer(
title: 'Não sei',
description: 'Não tenho a certeza',
weight: 1,
value: 'nao_sei',
),
],
currentScore: currentScore,
nextRoute: (context, nextScore) => MaterialPageRoute<void>(
@@ -479,6 +549,10 @@ class Quiz14Screen extends StatelessWidget {
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 14/25',
category: 'Hábitos noturnos',
categoryIcon: Icons.nights_stay_rounded,
fallbackIcon: Icons.nights_stay_rounded,
fallbackColor: const Color(0xFF2F9E94),
question: 'O seu filho/a range os dentes com frequência?',
answers: const [
QuizAnswer(
@@ -493,6 +567,12 @@ class Quiz14Screen extends StatelessWidget {
weight: 1,
value: 'nao',
),
QuizAnswer(
title: 'Não sei',
description: 'Não tenho a certeza',
weight: 1,
value: 'nao_sei',
),
],
currentScore: currentScore,
nextRoute: (context, nextScore) => MaterialPageRoute<void>(
@@ -515,6 +595,10 @@ class Quiz15Screen extends StatelessWidget {
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 15/25',
category: 'Saúde geral',
categoryIcon: Icons.local_florist_rounded,
fallbackIcon: Icons.local_florist_rounded,
fallbackColor: const Color(0xFFFF55A7),
question: 'O seu filho/a habitualmente tem alergias sazonais?',
answers: const [
QuizAnswer(
@@ -529,6 +613,12 @@ class Quiz15Screen extends StatelessWidget {
weight: 1,
value: 'nao',
),
QuizAnswer(
title: 'Não sei',
description: 'Não tenho a certeza',
weight: 1,
value: 'nao_sei',
),
],
currentScore: currentScore,
nextRoute: (context, nextScore) => MaterialPageRoute<void>(
@@ -551,6 +641,10 @@ class Quiz16Screen extends StatelessWidget {
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 16/25',
category: 'Sono',
categoryIcon: Icons.water_drop_rounded,
fallbackIcon: Icons.water_drop_rounded,
fallbackColor: const Color(0xFF8E7CC3),
question: 'O seu filho/a acorda com saliva seca na cara ou na almofada?',
answers: const [
QuizAnswer(
@@ -565,6 +659,12 @@ class Quiz16Screen extends StatelessWidget {
weight: 1,
value: 'nao',
),
QuizAnswer(
title: 'Não sei',
description: 'Não tenho a certeza',
weight: 1,
value: 'nao_sei',
),
],
currentScore: currentScore,
nextRoute: (context, nextScore) => MaterialPageRoute<void>(
@@ -587,6 +687,10 @@ class Quiz17Screen extends StatelessWidget {
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 17/25',
category: 'Saúde geral',
categoryIcon: Icons.hearing_rounded,
fallbackIcon: Icons.hearing_rounded,
fallbackColor: const Color(0xFF2F9E94),
question: 'O seu filho/a teve ou costuma ter com frequência otites?',
answers: const [
QuizAnswer(
@@ -601,6 +705,12 @@ class Quiz17Screen extends StatelessWidget {
weight: 1,
value: 'nao',
),
QuizAnswer(
title: 'Não sei',
description: 'Não tenho a certeza',
weight: 1,
value: 'nao_sei',
),
],
currentScore: currentScore,
nextRoute: (context, nextScore) => MaterialPageRoute<void>(
@@ -623,6 +733,10 @@ class Quiz18Screen extends StatelessWidget {
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 18/25',
category: 'Saúde geral',
categoryIcon: Icons.healing_rounded,
fallbackIcon: Icons.healing_rounded,
fallbackColor: const Color(0xFFFF55A7),
question: 'O seu filho/a teve ou costuma ter com frequência amigdalites?',
answers: const [
QuizAnswer(
@@ -637,6 +751,12 @@ class Quiz18Screen extends StatelessWidget {
weight: 1,
value: 'nao',
),
QuizAnswer(
title: 'Não sei',
description: 'Não tenho a certeza',
weight: 1,
value: 'nao_sei',
),
],
currentScore: currentScore,
nextRoute: (context, nextScore) => MaterialPageRoute<void>(
@@ -659,6 +779,10 @@ class Quiz19Screen extends StatelessWidget {
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 19/25',
category: 'Saúde respiratória',
categoryIcon: Icons.air_rounded,
fallbackIcon: Icons.air_rounded,
fallbackColor: const Color(0xFF2F9E94),
question:
'O seu filho/a teve ou costuma ter com frequência bronquiolites?',
answers: const [
@@ -674,6 +798,12 @@ class Quiz19Screen extends StatelessWidget {
weight: 1,
value: 'nao',
),
QuizAnswer(
title: 'Não sei',
description: 'Não tenho a certeza',
weight: 1,
value: 'nao_sei',
),
],
currentScore: currentScore,
nextRoute: (context, nextScore) => MaterialPageRoute<void>(
@@ -696,6 +826,10 @@ class Quiz20Screen extends StatelessWidget {
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 20/25',
category: 'Hábitos alimentares',
categoryIcon: Icons.restaurant_rounded,
fallbackIcon: Icons.restaurant_rounded,
fallbackColor: const Color(0xFFFF55A7),
question: 'O seu filho/a apresenta dificuldades a mastigar?',
answers: const [
QuizAnswer(
@@ -710,6 +844,12 @@ class Quiz20Screen extends StatelessWidget {
weight: 1,
value: 'nao',
),
QuizAnswer(
title: 'Não sei',
description: 'Não tenho a certeza',
weight: 1,
value: 'nao_sei',
),
],
currentScore: currentScore,
nextRoute: (context, nextScore) => MaterialPageRoute<void>(
@@ -732,6 +872,10 @@ class Quiz21Screen extends StatelessWidget {
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 21/25',
category: 'Hábitos alimentares',
categoryIcon: Icons.schedule_rounded,
fallbackIcon: Icons.schedule_rounded,
fallbackColor: const Color(0xFF2F9E94),
question: 'O seu filho/a habitualmente é lento a comer?',
answers: const [
QuizAnswer(
@@ -746,6 +890,12 @@ class Quiz21Screen extends StatelessWidget {
weight: 1,
value: 'nao',
),
QuizAnswer(
title: 'Não sei',
description: 'Não tenho a certeza',
weight: 1,
value: 'nao_sei',
),
],
currentScore: currentScore,
nextRoute: (context, nextScore) => MaterialPageRoute<void>(
@@ -768,6 +918,10 @@ class Quiz22Screen extends StatelessWidget {
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 22/25',
category: 'Hábitos alimentares',
categoryIcon: Icons.restaurant_menu_rounded,
fallbackIcon: Icons.restaurant_menu_rounded,
fallbackColor: const Color(0xFF8E7CC3),
question: 'O seu filho/a habitualmente prefere comer alimentos moles?',
answers: const [
QuizAnswer(
@@ -782,6 +936,12 @@ class Quiz22Screen extends StatelessWidget {
weight: 1,
value: 'nao',
),
QuizAnswer(
title: 'Não sei',
description: 'Não tenho a certeza',
weight: 1,
value: 'nao_sei',
),
],
currentScore: currentScore,
nextRoute: (context, nextScore) => MaterialPageRoute<void>(
@@ -804,6 +964,10 @@ class Quiz23Screen extends StatelessWidget {
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 23/25',
category: 'Hábitos alimentares',
categoryIcon: Icons.local_drink_rounded,
fallbackIcon: Icons.local_drink_rounded,
fallbackColor: const Color(0xFFFF55A7),
question: 'Em bebé apenas foi alimentado por biberão?',
answers: const [
QuizAnswer(
@@ -818,6 +982,12 @@ class Quiz23Screen extends StatelessWidget {
weight: 1,
value: 'nao',
),
QuizAnswer(
title: 'Não sei',
description: 'Não tenho a certeza',
weight: 1,
value: 'nao_sei',
),
],
currentScore: currentScore,
nextRoute: (context, nextScore) => MaterialPageRoute<void>(
@@ -840,6 +1010,10 @@ class Quiz24Screen extends StatelessWidget {
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 24/25',
category: 'Hábitos orais',
categoryIcon: Icons.child_care_rounded,
fallbackIcon: Icons.child_care_rounded,
fallbackColor: const Color(0xFF2F9E94),
question: 'O seu filho/a usa ou usou chupeta com frequência?',
answers: const [
QuizAnswer(
@@ -854,6 +1028,12 @@ class Quiz24Screen extends StatelessWidget {
weight: 1,
value: 'nao',
),
QuizAnswer(
title: 'Não sei',
description: 'Não tenho a certeza',
weight: 1,
value: 'nao_sei',
),
],
currentScore: currentScore,
nextRoute: (context, nextScore) => MaterialPageRoute<void>(
@@ -876,6 +1056,10 @@ class Quiz25Screen extends StatelessWidget {
Widget build(BuildContext context) {
return QuizQuestionScreen(
title: 'Quiz 25/25',
category: 'Hábitos orais',
categoryIcon: Icons.back_hand_rounded,
fallbackIcon: Icons.back_hand_rounded,
fallbackColor: const Color(0xFF8E7CC3),
question: 'O seu filho/a chucha ou já chuchou o dedo com frequência?',
answers: const [
QuizAnswer(
@@ -890,6 +1074,12 @@ class Quiz25Screen extends StatelessWidget {
weight: 1,
value: 'nao',
),
QuizAnswer(
title: 'Não sei',
description: 'Não tenho a certeza',
weight: 1,
value: 'nao_sei',
),
],
currentScore: currentScore,
nextRoute: (context, nextScore) => MaterialPageRoute<void>(

View File

@@ -45,6 +45,10 @@ class QuizQuestionScreen extends StatefulWidget {
this.suggestedVideoPath,
this.suggestedYoutubeId,
this.suggestedVideoTitle,
this.category,
this.categoryIcon,
this.fallbackIcon,
this.fallbackColor,
});
final String title;
@@ -61,6 +65,16 @@ class QuizQuestionScreen extends StatefulWidget {
final String? suggestedYoutubeId;
final String? suggestedVideoTitle;
/// Rótulo pequeno do tema da pergunta (ex.: "Avaliação facial"), mostrado
/// num badge acima da imagem/pergunta.
final String? category;
final IconData? categoryIcon;
/// Usados só quando [questionImagePaths] está vazio: em vez de o bloco de
/// imagem colapsar, mostra-se um bloco colorido com este ícone.
final IconData? fallbackIcon;
final Color? fallbackColor;
@override
State<QuizQuestionScreen> createState() => _QuizQuestionScreenState();
}
@@ -74,8 +88,24 @@ class _QuizQuestionScreenState extends State<QuizQuestionScreen> {
int? _selected;
TextEditingController? _numberController;
int? _numberValue;
bool _numberDontKnow = false;
bool _navigating = false;
/// O título ainda chega como texto livre ("Quiz 3/25") em vez de números
/// separados — extraímos daqui em vez de acrescentar mais dois parâmetros
/// obrigatórios a cada uma das 25 telas de pergunta.
static final RegExp _progressPattern = RegExp(r'(\d+)\s*/\s*(\d+)');
int get _questionIndex {
final match = _progressPattern.firstMatch(widget.title);
return int.tryParse(match?.group(1) ?? '') ?? 1;
}
int get _totalQuestions {
final match = _progressPattern.firstMatch(widget.title);
return int.tryParse(match?.group(2) ?? '') ?? 1;
}
@override
void initState() {
super.initState();
@@ -96,10 +126,11 @@ class _QuizQuestionScreenState extends State<QuizQuestionScreen> {
bool canProceed = _selected != null && !_navigating;
if (widget.answerType == QuizAnswerType.number) {
canProceed =
_numberValue != null &&
_numberValue! >= 0 &&
_numberValue! <= _maxTeethCount &&
!_navigating;
!_navigating &&
(_numberDontKnow ||
(_numberValue != null &&
_numberValue! >= 0 &&
_numberValue! <= _maxTeethCount));
}
final bool hasSuggestedVideo =
@@ -146,49 +177,103 @@ class _QuizQuestionScreenState extends State<QuizQuestionScreen> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
SizedBox(
height: 44,
child: Stack(
alignment: Alignment.center,
Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 4),
child: Row(
children: [
Text(
widget.title,
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.black.withValues(alpha: 0.55),
fontWeight: FontWeight.w800,
),
),
if (widget.showBackButton)
Positioned(
left: 4,
child: TapBounce(
scale: 0.9,
child: Material(
color: Colors.white.withValues(alpha: 0.85),
shape: const CircleBorder(),
elevation: 4,
shadowColor: Colors.black.withValues(
alpha: 0.15,
),
child: InkWell(
customBorder: const CircleBorder(),
onTap: () => Navigator.of(context).maybePop(),
child: const Padding(
padding: EdgeInsets.all(10),
child: Icon(
Icons.arrow_back_rounded,
color: Color(0xFF2F9E94),
size: 22,
),
TapBounce(
scale: 0.9,
child: Material(
color: Colors.white.withValues(alpha: 0.85),
shape: const CircleBorder(),
elevation: 4,
shadowColor: Colors.black.withValues(alpha: 0.15),
child: InkWell(
customBorder: const CircleBorder(),
onTap: () => Navigator.of(context).maybePop(),
child: const Padding(
padding: EdgeInsets.all(9),
child: Icon(
Icons.arrow_back_rounded,
color: Color(0xFF2F9E94),
size: 20,
),
),
),
),
)
else
const SizedBox(width: 38),
const SizedBox(width: 12),
Expanded(
child: ClipRRect(
borderRadius: BorderRadius.circular(999),
child: LinearProgressIndicator(
value: (_questionIndex / _totalQuestions).clamp(
0.0,
1.0,
),
minHeight: 8,
backgroundColor: const Color(
0xFFFF55A7,
).withValues(alpha: 0.15),
valueColor: const AlwaysStoppedAnimation<Color>(
Color(0xFFFF55A7),
),
),
),
),
const SizedBox(width: 10),
Text(
'$_questionIndex/$_totalQuestions',
style: TextStyle(
color: Colors.black.withValues(alpha: 0.55),
fontWeight: FontWeight.w800,
fontSize: 13,
),
),
],
),
),
if ((widget.category ?? '').isNotEmpty)
Padding(
padding: const EdgeInsets.fromLTRB(16, 8, 16, 0),
child: Align(
alignment: Alignment.centerLeft,
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 6,
),
decoration: BoxDecoration(
color: Colors.white.withValues(alpha: 0.75),
borderRadius: BorderRadius.circular(999),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (widget.categoryIcon != null) ...[
Icon(
widget.categoryIcon,
size: 15,
color: const Color(0xFF2F9E94),
),
const SizedBox(width: 6),
],
Text(
widget.category!,
style: const TextStyle(
fontWeight: FontWeight.w800,
fontSize: 12,
color: Color(0xFF2F9E94),
),
),
],
),
),
),
),
Expanded(
child: LayoutBuilder(
builder: (context, constraints) {
@@ -224,16 +309,21 @@ class _QuizQuestionScreenState extends State<QuizQuestionScreen> {
crossAxisAlignment:
CrossAxisAlignment.stretch,
children: [
if (widget
.questionImagePaths
.isNotEmpty) ...[
const SizedBox(height: 6),
_QuestionReferenceImages(
paths:
widget.questionImagePaths,
),
const SizedBox(height: 10),
],
const SizedBox(height: 6),
widget.questionImagePaths.isNotEmpty
? _QuestionReferenceImages(
paths: widget
.questionImagePaths,
)
: _FallbackIconBlock(
icon:
widget.fallbackIcon ??
Icons.info_outline_rounded,
color:
widget.fallbackColor ??
const Color(0xFF2F9E94),
),
const SizedBox(height: 10),
if (hasSuggestedVideo) ...[
TextButton.icon(
onPressed: () =>
@@ -324,15 +414,38 @@ class _QuizQuestionScreenState extends State<QuizQuestionScreen> {
delay: Duration(
milliseconds: 60 * i,
),
child: _QuizAnswerTile(
answer:
widget.answers[i],
selected:
_selected == i,
onTap: () => setState(
() => _selected = i,
),
),
child:
widget.answerType ==
QuizAnswerType
.yesNo &&
widget
.answers[i]
.imagePath ==
null
? _QuizAnswerPill(
answer: widget
.answers[i],
selected:
_selected == i,
onTap: () =>
setState(
() =>
_selected =
i,
),
)
: _QuizAnswerTile(
answer: widget
.answers[i],
selected:
_selected == i,
onTap: () =>
setState(
() =>
_selected =
i,
),
),
),
],
],
@@ -357,7 +470,7 @@ class _QuizQuestionScreenState extends State<QuizQuestionScreen> {
FilledButton.styleFrom(
backgroundColor:
const Color(
0xFF2F9E94,
0xFFFF55A7,
),
foregroundColor:
Colors.white,
@@ -426,8 +539,10 @@ class _QuizQuestionScreenState extends State<QuizQuestionScreen> {
nextScore =
widget
.currentScore +
(_numberValue ??
0);
(_numberDontKnow
? 0
: (_numberValue ??
0));
} else {
final picked = widget
.answers[_selected!];
@@ -474,44 +589,21 @@ class _QuizQuestionScreenState extends State<QuizQuestionScreen> {
),
),
),
const SizedBox(height: 10),
TapBounce(
child: SizedBox(
width: size.width * 0.62,
height: 42,
child: OutlinedButton(
style:
OutlinedButton.styleFrom(
foregroundColor:
const Color(
0xFF2F9E94,
),
side: const BorderSide(
color: Color(
0xFF2F9E94,
),
width: 1.3,
),
shape:
const StadiumBorder(),
textStyle:
const TextStyle(
fontWeight:
FontWeight
.w900,
),
),
onPressed: () =>
Navigator.of(
context,
).popUntil(
(route) =>
route.isFirst,
),
child: const Text(
'Voltar para homepage',
),
const SizedBox(height: 6),
TextButton(
style: TextButton.styleFrom(
foregroundColor: const Color(
0xFF2F9E94,
),
textStyle: const TextStyle(
fontWeight: FontWeight.w800,
),
),
onPressed: () => Navigator.of(
context,
).popUntil((route) => route.isFirst),
child: const Text(
'Voltar para homepage',
),
),
],
@@ -540,54 +632,62 @@ class _QuizQuestionScreenState extends State<QuizQuestionScreen> {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 150,
decoration: BoxDecoration(
color: Colors.white.withValues(alpha: 0.70),
borderRadius: BorderRadius.circular(16),
border: Border.all(
color: Colors.black.withValues(alpha: 0.12),
width: 1.0,
),
boxShadow: [
BoxShadow(
color: Colors.black.withValues(alpha: 0.06),
blurRadius: 18,
offset: const Offset(0, 10),
Opacity(
opacity: _numberDontKnow ? 0.4 : 1,
child: IgnorePointer(
ignoring: _numberDontKnow,
child: Container(
width: 150,
decoration: BoxDecoration(
color: Colors.white.withValues(alpha: 0.70),
borderRadius: BorderRadius.circular(16),
border: Border.all(
color: Colors.black.withValues(alpha: 0.12),
width: 1.0,
),
boxShadow: [
BoxShadow(
color: Colors.black.withValues(alpha: 0.06),
blurRadius: 18,
offset: const Offset(0, 10),
),
],
),
],
),
child: TextField(
controller: _numberController,
keyboardType: TextInputType.number,
textAlign: TextAlign.center,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
LengthLimitingTextInputFormatter(2),
],
style: const TextStyle(
fontSize: 24,
fontWeight: FontWeight.w900,
color: Color(0xFF2F9E94),
),
decoration: const InputDecoration(
border: InputBorder.none,
hintText: '0',
hintStyle: TextStyle(
fontSize: 24,
fontWeight: FontWeight.w900,
color: Colors.grey,
child: TextField(
controller: _numberController,
keyboardType: TextInputType.number,
textAlign: TextAlign.center,
inputFormatters: [
FilteringTextInputFormatter.digitsOnly,
LengthLimitingTextInputFormatter(2),
],
style: const TextStyle(
fontSize: 24,
fontWeight: FontWeight.w900,
color: Color(0xFF2F9E94),
),
decoration: const InputDecoration(
border: InputBorder.none,
hintText: '0',
hintStyle: TextStyle(
fontSize: 24,
fontWeight: FontWeight.w900,
color: Colors.grey,
),
contentPadding: EdgeInsets.symmetric(vertical: 20),
),
onChanged: (value) {
setState(() {
_numberValue = int.tryParse(value);
});
},
),
contentPadding: EdgeInsets.symmetric(vertical: 20),
),
onChanged: (value) {
setState(() {
_numberValue = int.tryParse(value);
});
},
),
),
if (_numberValue != null && _numberValue! > _maxTeethCount) ...[
if (_numberValue != null &&
_numberValue! > _maxTeethCount &&
!_numberDontKnow) ...[
const SizedBox(height: 10),
Text(
'Um número tão alto assim não é possível.\nO máximo é $_maxTeethCount.',
@@ -599,6 +699,62 @@ class _QuizQuestionScreenState extends State<QuizQuestionScreen> {
),
),
],
const SizedBox(height: 14),
TapBounce(
scale: 0.97,
child: InkWell(
borderRadius: BorderRadius.circular(999),
onTap: () {
setState(() {
_numberDontKnow = !_numberDontKnow;
if (_numberDontKnow) {
_numberController?.clear();
_numberValue = null;
}
});
},
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: 14,
vertical: 8,
),
decoration: BoxDecoration(
color: _numberDontKnow
? const Color(0xFF2F9E94)
: Colors.white.withValues(alpha: 0.70),
borderRadius: BorderRadius.circular(999),
border: Border.all(
color: _numberDontKnow
? const Color(0xFF2F9E94)
: Colors.black.withValues(alpha: 0.12),
),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.help_outline_rounded,
size: 16,
color: _numberDontKnow
? Colors.white
: Colors.black.withValues(alpha: 0.55),
),
const SizedBox(width: 6),
Text(
'Não sei',
style: TextStyle(
fontWeight: FontWeight.w800,
fontSize: 13,
color: _numberDontKnow
? Colors.white
: Colors.black.withValues(alpha: 0.55),
),
),
],
),
),
),
),
],
),
);
@@ -745,11 +901,38 @@ class _QuestionReferenceImages extends StatelessWidget {
borderRadius: BorderRadius.circular(14),
child: AspectRatio(
aspectRatio: 16 / 9,
child: Image.asset(
paths.first,
fit: BoxFit.cover,
cacheWidth: 800,
errorBuilder: (context, error, stackTrace) => _placeholder(),
child: Stack(
fit: StackFit.expand,
children: [
Image.asset(
paths.first,
fit: BoxFit.cover,
cacheWidth: 800,
errorBuilder: (context, error, stackTrace) => _placeholder(),
),
Positioned(
left: 8,
bottom: 8,
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 4,
),
decoration: BoxDecoration(
color: Colors.black.withValues(alpha: 0.55),
borderRadius: BorderRadius.circular(999),
),
child: const Text(
'Imagem de referência',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w700,
fontSize: 10.5,
),
),
),
),
],
),
),
);
@@ -787,3 +970,150 @@ class _QuestionReferenceImages extends StatelessWidget {
);
}
}
/// Mostrado quando a pergunta não tem imagem de referência — em vez de o
/// bloco colapsar (como acontecia antes), mostra um pequeno ícone colorido
/// relevante ao tema, sem ocupar a largura toda (esse destaque é reservado
/// para as perguntas que realmente têm imagem).
class _FallbackIconBlock extends StatelessWidget {
const _FallbackIconBlock({required this.icon, required this.color});
final IconData icon;
final Color color;
@override
Widget build(BuildContext context) {
return Center(
child: Container(
width: 64,
height: 64,
decoration: BoxDecoration(
color: color,
borderRadius: BorderRadius.circular(18),
),
child: Icon(icon, size: 32, color: Colors.white),
),
);
}
}
/// Resposta Sim/Não em formato de pílula horizontal: círculo colorido +
/// texto + indicador circular à direita que preenche quando selecionado.
class _QuizAnswerPill extends StatelessWidget {
const _QuizAnswerPill({
required this.answer,
required this.selected,
required this.onTap,
});
final QuizAnswer answer;
final bool selected;
final VoidCallback onTap;
bool get _isYes => (answer.value ?? '').trim().toLowerCase() == 'sim';
bool get _isNo => (answer.value ?? '').trim().toLowerCase() == 'nao';
@override
Widget build(BuildContext context) {
final accent = _isYes
? const Color(0xFF2F9E94)
: _isNo
? const Color(0xFFFF55A7)
: Colors.black.withValues(alpha: 0.35);
final borderColor = selected
? const Color(0xFF2F9E94)
: Colors.black.withValues(alpha: 0.10);
return TapBounce(
scale: 0.97,
child: AnimatedContainer(
duration: const Duration(milliseconds: 220),
curve: Curves.easeOutCubic,
decoration: BoxDecoration(
color: selected
? Colors.white.withValues(alpha: 0.92)
: Colors.white.withValues(alpha: 0.70),
borderRadius: BorderRadius.circular(999),
border: Border.all(color: borderColor, width: selected ? 1.4 : 1.0),
boxShadow: [
BoxShadow(
color: Colors.black.withValues(alpha: 0.06),
blurRadius: 14,
offset: const Offset(0, 8),
),
],
),
child: Material(
color: Colors.transparent,
child: InkWell(
borderRadius: BorderRadius.circular(999),
onTap: onTap,
splashFactory: InkSparkle.splashFactory,
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 14,
vertical: 10,
),
child: Row(
children: [
Container(
width: 28,
height: 28,
decoration: BoxDecoration(
color: accent,
shape: BoxShape.circle,
),
child: Icon(
_isYes
? Icons.check_rounded
: _isNo
? Icons.close_rounded
: Icons.help_outline_rounded,
color: Colors.white,
size: 17,
),
),
const SizedBox(width: 12),
Expanded(
child: Text(
answer.title,
style: const TextStyle(
fontWeight: FontWeight.w800,
fontSize: 15,
color: Color(0xFF2F9E94),
),
),
),
AnimatedContainer(
duration: const Duration(milliseconds: 220),
width: 22,
height: 22,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: selected
? const Color(0xFF2F9E94)
: Colors.transparent,
border: Border.all(
color: selected
? const Color(0xFF2F9E94)
: Colors.black.withValues(alpha: 0.25),
width: 1.6,
),
),
child: selected
? const Icon(
Icons.check_rounded,
size: 14,
color: Colors.white,
)
: null,
),
],
),
),
),
),
),
);
}
}