feat: add more easter eggs

This commit is contained in:
2026-10-26 23:54:06 +01:00
parent 08f4847800
commit 4d9ba67eb1
18 changed files with 695 additions and 36 deletions
+26
View File
@@ -4,6 +4,7 @@ import 'package:provider/provider.dart';
import '../l10n/app_localizations.dart';
import '../l10n/app_localizations_helpers.dart';
import '../models/app_error.dart';
import '../utils/easter_eggs.dart';
import '../viewmodels/pin_lock_view_model.dart';
enum PinEntryMode { unlock, create, change }
@@ -53,6 +54,9 @@ class _PinEntryViewState extends State<PinEntryView> {
bool _isConfirmStep = false;
bool _isSubmitting = false;
String? _localError;
/// A cheeky remark for a lazy PIN, shown instead of an error.
bool _showLazyPinRemark = false;
bool _shake = false;
bool get _isChangeFlow => widget.mode == PinEntryMode.change;
@@ -94,6 +98,7 @@ class _PinEntryViewState extends State<PinEntryView> {
setState(() {
_digits += digit;
_localError = null;
if (_digits.length == 1) _showLazyPinRemark = false;
});
if (_digits.length == _pinLength) {
@@ -119,6 +124,7 @@ class _PinEntryViewState extends State<PinEntryView> {
_firstEntry = entered;
_isConfirmStep = true;
_digits = '';
_showLazyPinRemark = isLazyPin(entered);
});
return;
}
@@ -164,6 +170,16 @@ class _PinEntryViewState extends State<PinEntryView> {
_currentPin = _digits;
_digits = '';
});
} else if (isLazyPin(_digits)) {
// Correct, but let them see the raised eyebrow before moving on.
setState(() {
_showLazyPinRemark = true;
_isSubmitting = true;
});
await Future<void>.delayed(const Duration(milliseconds: 900));
if (!mounted) return;
setState(() => _isSubmitting = false);
widget.onSuccess?.call();
} else {
widget.onSuccess?.call();
}
@@ -203,6 +219,7 @@ class _PinEntryViewState extends State<PinEntryView> {
void _fail(String message) {
setState(() {
_localError = message;
_showLazyPinRemark = false;
_digits = '';
_shake = true;
});
@@ -262,6 +279,15 @@ class _PinEntryViewState extends State<PinEntryView> {
_localError!,
style: TextStyle(color: scheme.error, fontSize: 13),
)
: _showLazyPinRemark
? Text(
l10n.lazyPinRemark,
style: TextStyle(
color: scheme.onSurface.withValues(alpha: 0.7),
fontSize: 13,
fontWeight: FontWeight.w600,
),
)
: const SizedBox.shrink(),
),
const Spacer(flex: 2),