|
|
@@ -2,14 +2,12 @@ import 'package:flutter/material.dart';
|
|
|
import '../../utils/colors.dart';
|
|
|
import '../../utils/haptic_utils.dart';
|
|
|
import '../../utils/settings_manager.dart';
|
|
|
+import '../../l10n/app_localizations.dart';
|
|
|
|
|
|
class TutorialOverlay extends StatefulWidget {
|
|
|
final VoidCallback onComplete;
|
|
|
|
|
|
- const TutorialOverlay({
|
|
|
- super.key,
|
|
|
- required this.onComplete,
|
|
|
- });
|
|
|
+ const TutorialOverlay({super.key, required this.onComplete});
|
|
|
|
|
|
@override
|
|
|
State<TutorialOverlay> createState() => _TutorialOverlayState();
|
|
|
@@ -25,56 +23,27 @@ class _TutorialOverlayState extends State<TutorialOverlay>
|
|
|
int _currentStep = 0;
|
|
|
final int _totalSteps = 3;
|
|
|
|
|
|
- final List<TutorialStep> _steps = [
|
|
|
- TutorialStep(
|
|
|
- title: 'Welcome to ZenTap!',
|
|
|
- description: 'Tap anywhere on the screen to pop relaxing bubbles',
|
|
|
- icon: Icons.touch_app,
|
|
|
- position: TutorialPosition.center,
|
|
|
- ),
|
|
|
- TutorialStep(
|
|
|
- title: 'Earn Relaxation Points',
|
|
|
- description: 'Each bubble you pop gives you points to track your zen journey',
|
|
|
- icon: Icons.stars,
|
|
|
- position: TutorialPosition.center,
|
|
|
- ),
|
|
|
- TutorialStep(
|
|
|
- title: 'Ready to Relax?',
|
|
|
- description: 'Try Zen Mode for endless peaceful tapping without scores',
|
|
|
- icon: Icons.self_improvement,
|
|
|
- position: TutorialPosition.center,
|
|
|
- ),
|
|
|
- ];
|
|
|
-
|
|
|
@override
|
|
|
void initState() {
|
|
|
super.initState();
|
|
|
-
|
|
|
+
|
|
|
_pulseController = AnimationController(
|
|
|
duration: const Duration(milliseconds: 1500),
|
|
|
vsync: this,
|
|
|
)..repeat(reverse: true);
|
|
|
-
|
|
|
+
|
|
|
_fadeController = AnimationController(
|
|
|
duration: const Duration(milliseconds: 500),
|
|
|
vsync: this,
|
|
|
);
|
|
|
|
|
|
- _pulseAnimation = Tween<double>(
|
|
|
- begin: 0.8,
|
|
|
- end: 1.2,
|
|
|
- ).animate(CurvedAnimation(
|
|
|
- parent: _pulseController,
|
|
|
- curve: Curves.easeInOut,
|
|
|
- ));
|
|
|
-
|
|
|
- _fadeAnimation = Tween<double>(
|
|
|
- begin: 0.0,
|
|
|
- end: 1.0,
|
|
|
- ).animate(CurvedAnimation(
|
|
|
- parent: _fadeController,
|
|
|
- curve: Curves.easeInOut,
|
|
|
- ));
|
|
|
+ _pulseAnimation = Tween<double>(begin: 0.8, end: 1.2).animate(
|
|
|
+ CurvedAnimation(parent: _pulseController, curve: Curves.easeInOut),
|
|
|
+ );
|
|
|
+
|
|
|
+ _fadeAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(
|
|
|
+ CurvedAnimation(parent: _fadeController, curve: Curves.easeInOut),
|
|
|
+ );
|
|
|
|
|
|
_fadeController.forward();
|
|
|
}
|
|
|
@@ -86,10 +55,36 @@ class _TutorialOverlayState extends State<TutorialOverlay>
|
|
|
super.dispose();
|
|
|
}
|
|
|
|
|
|
+ List<TutorialStep> _getSteps(BuildContext context) {
|
|
|
+ final l10n = AppLocalizations.of(context)!;
|
|
|
+ return [
|
|
|
+ TutorialStep(
|
|
|
+ title: l10n.tutorialWelcomeTitle,
|
|
|
+ description: l10n.tutorialWelcomeDescription,
|
|
|
+ icon: Icons.touch_app,
|
|
|
+ position: TutorialPosition.center,
|
|
|
+ ),
|
|
|
+ TutorialStep(
|
|
|
+ title: l10n.tutorialRelaxationTitle,
|
|
|
+ description: l10n.tutorialRelaxationDescription,
|
|
|
+ icon: Icons.stars,
|
|
|
+ position: TutorialPosition.center,
|
|
|
+ ),
|
|
|
+ TutorialStep(
|
|
|
+ title: l10n.tutorialZenTitle,
|
|
|
+ description: l10n.tutorialZenDescription,
|
|
|
+ icon: Icons.self_improvement,
|
|
|
+ position: TutorialPosition.center,
|
|
|
+ ),
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
- final step = _steps[_currentStep];
|
|
|
-
|
|
|
+ final l10n = AppLocalizations.of(context)!;
|
|
|
+ final steps = _getSteps(context);
|
|
|
+ final step = steps[_currentStep];
|
|
|
+
|
|
|
return FadeTransition(
|
|
|
opacity: _fadeAnimation,
|
|
|
child: Container(
|
|
|
@@ -112,7 +107,9 @@ class _TutorialOverlayState extends State<TutorialOverlay>
|
|
|
padding: const EdgeInsets.all(30),
|
|
|
decoration: BoxDecoration(
|
|
|
shape: BoxShape.circle,
|
|
|
- color: ZenColors.buttonBackground.withValues(alpha: 0.2),
|
|
|
+ color: ZenColors.buttonBackground.withValues(
|
|
|
+ alpha: 0.2,
|
|
|
+ ),
|
|
|
border: Border.all(
|
|
|
color: ZenColors.buttonBackground,
|
|
|
width: 2,
|
|
|
@@ -127,9 +124,9 @@ class _TutorialOverlayState extends State<TutorialOverlay>
|
|
|
);
|
|
|
},
|
|
|
),
|
|
|
-
|
|
|
+
|
|
|
const SizedBox(height: 40),
|
|
|
-
|
|
|
+
|
|
|
// Title
|
|
|
Padding(
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 40),
|
|
|
@@ -144,9 +141,9 @@ class _TutorialOverlayState extends State<TutorialOverlay>
|
|
|
textAlign: TextAlign.center,
|
|
|
),
|
|
|
),
|
|
|
-
|
|
|
+
|
|
|
const SizedBox(height: 20),
|
|
|
-
|
|
|
+
|
|
|
// Description
|
|
|
Padding(
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 40),
|
|
|
@@ -160,9 +157,9 @@ class _TutorialOverlayState extends State<TutorialOverlay>
|
|
|
textAlign: TextAlign.center,
|
|
|
),
|
|
|
),
|
|
|
-
|
|
|
+
|
|
|
const SizedBox(height: 60),
|
|
|
-
|
|
|
+
|
|
|
// Progress indicator
|
|
|
Row(
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
@@ -173,16 +170,19 @@ class _TutorialOverlayState extends State<TutorialOverlay>
|
|
|
height: 12,
|
|
|
decoration: BoxDecoration(
|
|
|
shape: BoxShape.circle,
|
|
|
- color: index <= _currentStep
|
|
|
- ? ZenColors.buttonBackground
|
|
|
- : ZenColors.mutedText.withValues(alpha: 0.3),
|
|
|
+ color:
|
|
|
+ index <= _currentStep
|
|
|
+ ? ZenColors.buttonBackground
|
|
|
+ : ZenColors.mutedText.withValues(
|
|
|
+ alpha: 0.3,
|
|
|
+ ),
|
|
|
),
|
|
|
);
|
|
|
}),
|
|
|
),
|
|
|
-
|
|
|
+
|
|
|
const SizedBox(height: 40),
|
|
|
-
|
|
|
+
|
|
|
// Action buttons
|
|
|
Padding(
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 40),
|
|
|
@@ -200,17 +200,19 @@ class _TutorialOverlayState extends State<TutorialOverlay>
|
|
|
shape: RoundedRectangleBorder(
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
),
|
|
|
- padding: const EdgeInsets.symmetric(vertical: 16),
|
|
|
+ padding: const EdgeInsets.symmetric(
|
|
|
+ vertical: 16,
|
|
|
+ ),
|
|
|
),
|
|
|
- child: const Text(
|
|
|
- 'Previous',
|
|
|
- style: TextStyle(fontSize: 16),
|
|
|
+ child: Text(
|
|
|
+ l10n.previous,
|
|
|
+ style: const TextStyle(fontSize: 16),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
-
|
|
|
+
|
|
|
if (_currentStep > 0) const SizedBox(width: 16),
|
|
|
-
|
|
|
+
|
|
|
Expanded(
|
|
|
flex: 2,
|
|
|
child: ElevatedButton(
|
|
|
@@ -221,13 +223,15 @@ class _TutorialOverlayState extends State<TutorialOverlay>
|
|
|
shape: RoundedRectangleBorder(
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
),
|
|
|
- padding: const EdgeInsets.symmetric(vertical: 16),
|
|
|
+ padding: const EdgeInsets.symmetric(
|
|
|
+ vertical: 16,
|
|
|
+ ),
|
|
|
elevation: 4,
|
|
|
),
|
|
|
child: Text(
|
|
|
- _currentStep == _totalSteps - 1
|
|
|
- ? 'Start Relaxing!'
|
|
|
- : 'Continue',
|
|
|
+ _currentStep == _totalSteps - 1
|
|
|
+ ? l10n.startRelaxing
|
|
|
+ : l10n.continueButton,
|
|
|
style: const TextStyle(
|
|
|
fontSize: 16,
|
|
|
fontWeight: FontWeight.w600,
|
|
|
@@ -241,7 +245,7 @@ class _TutorialOverlayState extends State<TutorialOverlay>
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
-
|
|
|
+
|
|
|
// Skip button
|
|
|
Positioned(
|
|
|
top: 20,
|
|
|
@@ -251,10 +255,7 @@ class _TutorialOverlayState extends State<TutorialOverlay>
|
|
|
style: TextButton.styleFrom(
|
|
|
foregroundColor: ZenColors.mutedText,
|
|
|
),
|
|
|
- child: const Text(
|
|
|
- 'Skip',
|
|
|
- style: TextStyle(fontSize: 16),
|
|
|
- ),
|
|
|
+ child: Text(l10n.skip, style: const TextStyle(fontSize: 16)),
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
@@ -318,8 +319,4 @@ class TutorialStep {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-enum TutorialPosition {
|
|
|
- center,
|
|
|
- top,
|
|
|
- bottom,
|
|
|
-}
|
|
|
+enum TutorialPosition { center, top, bottom }
|