1dede9eb78
- Removed AppColors class and migrated all references to AppPalette. - Updated VaultAccessScreen, MenuDrawer, NoteCard, SearchAppBar, and other widgets to use AppPalette for color management. - Introduced AppPalette to handle light and dark themes with appropriate color schemes. - Adjusted theme application in AppTheme to utilize AppPalette extensions. - Updated tests to reflect changes in theme structure and color references.
132 lines
4.6 KiB
Dart
132 lines
4.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:notas/theme/app_palette.dart';
|
|
|
|
class BiometricGateScreen extends StatefulWidget {
|
|
const BiometricGateScreen({
|
|
super.key,
|
|
required this.isBusy,
|
|
required this.onUnlockRequested,
|
|
});
|
|
|
|
final bool isBusy;
|
|
final Future<void> Function() onUnlockRequested;
|
|
|
|
@override
|
|
State<BiometricGateScreen> createState() => _BiometricGateScreenState();
|
|
}
|
|
|
|
class _BiometricGateScreenState extends State<BiometricGateScreen> {
|
|
bool _autoRequested = false;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
if (mounted) {
|
|
_requestUnlockOnce();
|
|
}
|
|
});
|
|
}
|
|
|
|
Future<void> _requestUnlockOnce() async {
|
|
if (_autoRequested || widget.isBusy) {
|
|
return;
|
|
}
|
|
|
|
_autoRequested = true;
|
|
await widget.onUnlockRequested();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final AppPalette palette = Theme.of(context).extension<AppPalette>()!;
|
|
|
|
return Scaffold(
|
|
body: Container(
|
|
decoration: BoxDecoration(gradient: palette.backdropGradient),
|
|
child: SafeArea(
|
|
child: Column(
|
|
children: [
|
|
Expanded(
|
|
child: Center(
|
|
child: SingleChildScrollView(
|
|
padding: const EdgeInsets.all(24),
|
|
child: ConstrainedBox(
|
|
constraints: const BoxConstraints(maxWidth: 460),
|
|
child: Container(
|
|
padding: const EdgeInsets.all(24),
|
|
decoration: BoxDecoration(
|
|
color: palette.cardBackground,
|
|
borderRadius: BorderRadius.circular(24),
|
|
border: Border.all(color: palette.border),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: palette.shadowSoft,
|
|
blurRadius: 30,
|
|
offset: const Offset(0, 18),
|
|
),
|
|
],
|
|
),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
Icon(
|
|
Icons.fingerprint,
|
|
size: 44,
|
|
color: IconTheme.of(context).color,
|
|
),
|
|
const SizedBox(height: 16),
|
|
const Text(
|
|
'Desbloqueo biométrico',
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 28,
|
|
fontWeight: FontWeight.w700,
|
|
),
|
|
),
|
|
const SizedBox(height: 10),
|
|
Text(
|
|
'Pon tu huella o cara para entrar a tus notas.',
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
color: palette.textSecondary,
|
|
height: 1.4,
|
|
),
|
|
),
|
|
const SizedBox(height: 22),
|
|
FilledButton(
|
|
onPressed: widget.isBusy
|
|
? null
|
|
: widget.onUnlockRequested,
|
|
style: FilledButton.styleFrom(
|
|
padding: const EdgeInsets.symmetric(
|
|
vertical: 14,
|
|
),
|
|
),
|
|
child: widget.isBusy
|
|
? const SizedBox(
|
|
width: 18,
|
|
height: 18,
|
|
child: CircularProgressIndicator(
|
|
strokeWidth: 2,
|
|
),
|
|
)
|
|
: const Text('Desbloquear'),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|