- splash → intro → 5-step quiz → result screen - Plus Jakarta Sans typography, indigo brand system - animated quiz rows, multi-select concerns, progress bar - Shaynee mascot reveal on result screen only - flutter_animate for all transitions
110 lines
3.4 KiB
Dart
110 lines
3.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
import '../theme.dart';
|
|
|
|
class QuizOptionRow extends StatelessWidget {
|
|
final IconData icon;
|
|
final String label;
|
|
final String sub;
|
|
final bool isSelected;
|
|
final VoidCallback onTap;
|
|
|
|
const QuizOptionRow({
|
|
super.key,
|
|
required this.icon,
|
|
required this.label,
|
|
required this.isSelected,
|
|
required this.onTap,
|
|
this.sub = '',
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GestureDetector(
|
|
onTap: () {
|
|
HapticFeedback.selectionClick();
|
|
onTap();
|
|
},
|
|
child: AnimatedContainer(
|
|
duration: const Duration(milliseconds: 200),
|
|
curve: Curves.easeOut,
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
|
decoration: BoxDecoration(
|
|
color: isSelected ? SColors.primary.withAlpha(13) : SColors.surface,
|
|
borderRadius: BorderRadius.circular(18),
|
|
border: Border.all(
|
|
color: isSelected ? SColors.primary.withAlpha(128) : SColors.border,
|
|
width: 1.5,
|
|
),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
AnimatedContainer(
|
|
duration: const Duration(milliseconds: 200),
|
|
width: 52,
|
|
height: 52,
|
|
decoration: BoxDecoration(
|
|
color: isSelected
|
|
? SColors.primary.withAlpha(26)
|
|
: SColors.skyTint.withAlpha(140),
|
|
borderRadius: BorderRadius.circular(14),
|
|
),
|
|
child: Icon(
|
|
icon,
|
|
size: 26,
|
|
color: isSelected ? SColors.primary : SColors.textSecondary,
|
|
),
|
|
),
|
|
const SizedBox(width: 14),
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
label,
|
|
style: GoogleFonts.plusJakartaSans(
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w600,
|
|
color: isSelected ? SColors.primary : SColors.textPrimary,
|
|
),
|
|
),
|
|
if (sub.isNotEmpty) ...[
|
|
const SizedBox(height: 2),
|
|
Text(
|
|
sub,
|
|
style: GoogleFonts.plusJakartaSans(
|
|
fontSize: 13,
|
|
color: SColors.textSecondary,
|
|
),
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
const SizedBox(width: 12),
|
|
AnimatedContainer(
|
|
duration: const Duration(milliseconds: 200),
|
|
width: 22,
|
|
height: 22,
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
color: isSelected ? SColors.primary : Colors.transparent,
|
|
border: Border.all(
|
|
color: isSelected ? SColors.primary : SColors.border,
|
|
width: 1.5,
|
|
),
|
|
),
|
|
child: isSelected
|
|
? const Icon(Icons.check, size: 13, color: Colors.white)
|
|
: null,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|