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 TextEditingController _heartbeatController;
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); final uri = Uri.parse('https://fiatcode.dev');
} if (await canLaunchUrl(uri)) {
} await launchUrl(uri, mode: LaunchMode.externalApplication);
}
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);
} }
} }
@ -167,48 +158,43 @@ 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(
padding: const EdgeInsets.all(20),
children: [ children: [
ListView( _buildSectionHeader('SERVER'),
padding: const EdgeInsets.all(20), const SizedBox(height: 12),
children: [ _buildTextField('Server URL', _serverUrlController),
_buildSectionHeader('SERVER'), const SizedBox(height: 12),
const SizedBox(height: 12), _buildTextField('Device ID', _deviceIdController),
_buildTextField('Server URL', _serverUrlController), const SizedBox(height: 24),
const SizedBox(height: 12), _buildSectionHeader('LOCATION'),
_buildTextField('Device ID', _deviceIdController), const SizedBox(height: 12),
const SizedBox(height: 24), _buildAccuracyDropdown(),
_buildSectionHeader('LOCATION'), const SizedBox(height: 12),
const SizedBox(height: 12), _buildNumberField('Distance Filter (m)', _distanceFilterController),
_buildAccuracyDropdown(), const SizedBox(height: 12),
const SizedBox(height: 12), _buildNumberField('Update Interval (s)', _intervalController),
_buildNumberField('Distance Filter (m)', _distanceFilterController), const SizedBox(height: 12),
const SizedBox(height: 12), _buildNumberField('Heartbeat (s)', _heartbeatController),
_buildNumberField('Update Interval (s)', _intervalController), const SizedBox(height: 24),
const SizedBox(height: 12), _buildSectionHeader('ADVANCED'),
_buildNumberField('Heartbeat (s)', _heartbeatController), const SizedBox(height: 8),
const SizedBox(height: 24), _buildSwitch(
_buildSectionHeader('ADVANCED'), 'Offline Buffering',
const SizedBox(height: 8), 'Queue locations when network unavailable',
_buildSwitch( _offlineBuffer,
'Offline Buffering', (v) => setState(() => _offlineBuffer = v),
'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),
],
), ),
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,
),
],
),
),
),
),
),
);
}
} }