Files
submanager/lib/screens/app_lock_screen.dart
2025-12-07 21:14:54 +09:00

76 lines
2.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../l10n/app_localizations.dart';
import '../providers/app_lock_provider.dart';
// import '../theme/app_colors.dart';
class AppLockScreen extends StatelessWidget {
const AppLockScreen({super.key});
@override
Widget build(BuildContext context) {
final loc = AppLocalizations.of(context);
return Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.lock_outline,
size: 80,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
const SizedBox(height: 24),
Text(
loc.appLocked,
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.onSurface,
),
),
const SizedBox(height: 16),
Text(
loc.appLockDesc,
style: TextStyle(
fontSize: 16,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
const SizedBox(height: 32),
ElevatedButton.icon(
onPressed: () async {
final appLock = context.read<AppLockProvider>();
final success = await appLock.authenticate();
if (!success && context.mounted) {
final cs = Theme.of(context).colorScheme;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(
loc.authenticationFailed,
style: TextStyle(
color: cs.onPrimary,
),
),
backgroundColor: cs.error,
),
);
}
},
icon: const Icon(Icons.fingerprint),
label: Text(loc.unlockWithBiometric),
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(
horizontal: 24,
vertical: 12,
),
),
),
],
),
),
);
}
}