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

@ -19,12 +19,11 @@ class _SettingsScreenState extends State<SettingsScreen> {
late TextEditingController _heartbeatController;
late int _accuracy;
late bool _offlineBuffer;
late bool _stopDetection;
bool _showEasterEgg = false;
late bool _stopDetection;
int _tapCount = 0;
DateTime? _lastTapTime;
void _handleAppBarTap() {
Future<void> _handleAppBarTap() async {
const tripleTapInterval = Duration(milliseconds: 500);
final now = DateTime.now();
@ -38,18 +37,10 @@ class _SettingsScreenState extends State<SettingsScreen> {
if (_tapCount == 3) {
_tapCount = 0;
setState(() => _showEasterEgg = true);
}
}
Future<void> _triggerEasterEgg() async {
await Future.delayed(const Duration(milliseconds: 1500));
final uri = Uri.parse('https://fiatcode.dev');
if (await canLaunchUrl(uri)) {
await launchUrl(uri, mode: LaunchMode.externalApplication);
}
if (mounted) {
setState(() => _showEasterEgg = false);
final uri = Uri.parse('https://fiatcode.dev');
if (await canLaunchUrl(uri)) {
await launchUrl(uri, mode: LaunchMode.externalApplication);
}
}
}
@ -167,48 +158,43 @@ class _SettingsScreenState extends State<SettingsScreen> {
child: Container(height: 1, color: const Color(0xFF2a2a2a)),
),
),
body: Stack(
body: ListView(
padding: const EdgeInsets.all(20),
children: [
ListView(
padding: const EdgeInsets.all(20),
children: [
_buildSectionHeader('SERVER'),
const SizedBox(height: 12),
_buildTextField('Server URL', _serverUrlController),
const SizedBox(height: 12),
_buildTextField('Device ID', _deviceIdController),
const SizedBox(height: 24),
_buildSectionHeader('LOCATION'),
const SizedBox(height: 12),
_buildAccuracyDropdown(),
const SizedBox(height: 12),
_buildNumberField('Distance Filter (m)', _distanceFilterController),
const SizedBox(height: 12),
_buildNumberField('Update Interval (s)', _intervalController),
const SizedBox(height: 12),
_buildNumberField('Heartbeat (s)', _heartbeatController),
const SizedBox(height: 24),
_buildSectionHeader('ADVANCED'),
const SizedBox(height: 8),
_buildSwitch(
'Offline Buffering',
'Queue locations when network unavailable',
_offlineBuffer,
(v) => setState(() => _offlineBuffer = v),
),
const SizedBox(height: 4),
_buildSwitch(
'Stop Detection',
'Auto-stop tracking when stationary',
_stopDetection,
(v) => setState(() => _stopDetection = v),
),
const SizedBox(height: 32),
_buildSaveButton(),
const SizedBox(height: 20),
],
_buildSectionHeader('SERVER'),
const SizedBox(height: 12),
_buildTextField('Server URL', _serverUrlController),
const SizedBox(height: 12),
_buildTextField('Device ID', _deviceIdController),
const SizedBox(height: 24),
_buildSectionHeader('LOCATION'),
const SizedBox(height: 12),
_buildAccuracyDropdown(),
const SizedBox(height: 12),
_buildNumberField('Distance Filter (m)', _distanceFilterController),
const SizedBox(height: 12),
_buildNumberField('Update Interval (s)', _intervalController),
const SizedBox(height: 12),
_buildNumberField('Heartbeat (s)', _heartbeatController),
const SizedBox(height: 24),
_buildSectionHeader('ADVANCED'),
const SizedBox(height: 8),
_buildSwitch(
'Offline Buffering',
'Queue locations when network unavailable',
_offlineBuffer,
(v) => setState(() => _offlineBuffer = v),
),
if (_showEasterEgg) _buildEasterEggOverlay(),
const SizedBox(height: 4),
_buildSwitch(
'Stop Detection',
'Auto-stop tracking when stationary',
_stopDetection,
(v) => setState(() => _stopDetection = v),
),
const SizedBox(height: 32),
_buildSaveButton(),
const SizedBox(height: 20),
],
),
);
@ -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,
),
],
),
),
),
),
),
);
}
}