feat: simplify easter egg to direct URL launch on triple-tap

This commit is contained in:
fiatcode 2026-04-30 18:24:57 +07:00
parent e22a8d5958
commit c8a2fd60d0
No known key found for this signature in database

View file

@ -20,11 +20,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
late int _accuracy; late int _accuracy;
late bool _offlineBuffer; late bool _offlineBuffer;
late bool _stopDetection; late bool _stopDetection;
bool _showEasterEgg = false;
int _tapCount = 0; int _tapCount = 0;
DateTime? _lastTapTime; DateTime? _lastTapTime;
void _handleAppBarTap() { Future<void> _handleAppBarTap() async {
const tripleTapInterval = Duration(milliseconds: 500); const tripleTapInterval = Duration(milliseconds: 500);
final now = DateTime.now(); final now = DateTime.now();
@ -38,18 +37,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
if (_tapCount == 3) { if (_tapCount == 3) {
_tapCount = 0; _tapCount = 0;
setState(() => _showEasterEgg = true);
}
}
Future<void> _triggerEasterEgg() async {
await Future.delayed(const Duration(milliseconds: 1500));
final uri = Uri.parse('https://fiatcode.dev'); final uri = Uri.parse('https://fiatcode.dev');
if (await canLaunchUrl(uri)) { if (await canLaunchUrl(uri)) {
await launchUrl(uri, mode: LaunchMode.externalApplication); await launchUrl(uri, mode: LaunchMode.externalApplication);
} }
if (mounted) {
setState(() => _showEasterEgg = false);
} }
} }
@ -167,9 +158,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
child: Container(height: 1, color: const Color(0xFF2a2a2a)), child: Container(height: 1, color: const Color(0xFF2a2a2a)),
), ),
), ),
body: Stack( body: ListView(
children: [
ListView(
padding: const EdgeInsets.all(20), padding: const EdgeInsets.all(20),
children: [ children: [
_buildSectionHeader('SERVER'), _buildSectionHeader('SERVER'),
@ -208,9 +197,6 @@ class _SettingsScreenState extends State<SettingsScreen> {
const SizedBox(height: 20), const SizedBox(height: 20),
], ],
), ),
if (_showEasterEgg) _buildEasterEggOverlay(),
],
),
); );
} }
@ -441,39 +427,4 @@ class _SettingsScreenState extends State<SettingsScreen> {
), ),
); );
} }
Widget _buildEasterEggOverlay() {
return AnimatedOpacity(
opacity: _showEasterEgg ? 1.0 : 0.0,
duration: const Duration(milliseconds: 300),
onEnd: _triggerEasterEgg,
child: AnimatedScale(
scale: _showEasterEgg ? 1.0 : 0.5,
duration: const Duration(milliseconds: 300),
curve: Curves.easeOutBack,
child: Container(
color: Colors.black.withValues(alpha: 0.85),
width: double.infinity,
height: double.infinity,
child: Center(
child: Text(
'🎉 FIAT CODE! 🎉',
style: TextStyle(
fontFamily: 'monospace',
fontSize: 32,
fontWeight: FontWeight.w700,
color: const Color(0xFF00e676),
shadows: [
Shadow(
color: const Color(0xFF00e676).withValues(alpha: 0.5),
blurRadius: 20,
),
],
),
),
),
),
),
);
}
} }