130 lines
3.6 KiB
Dart
130 lines
3.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../../core/theme.dart';
|
|
import '../../core/auth.dart';
|
|
|
|
/// Settings screen
|
|
class SettingsScreen extends StatefulWidget {
|
|
const SettingsScreen({super.key});
|
|
|
|
@override
|
|
State<SettingsScreen> createState() => _SettingsScreenState();
|
|
}
|
|
|
|
class _SettingsScreenState extends State<SettingsScreen> {
|
|
final AuthService _authService = AuthService();
|
|
bool _biometricsEnabled = false;
|
|
bool _biometricsAvailable = false;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_checkBiometrics();
|
|
}
|
|
|
|
Future<void> _checkBiometrics() async {
|
|
final available = await _authService.isBiometricsAvailable();
|
|
setState(() {
|
|
_biometricsAvailable = available;
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('Settings'),
|
|
centerTitle: true,
|
|
),
|
|
body: ListView(
|
|
children: [
|
|
_buildSection(
|
|
title: 'Security',
|
|
children: [
|
|
SwitchListTile(
|
|
title: const Text('Biometric Authentication'),
|
|
subtitle: Text(
|
|
_biometricsAvailable
|
|
? 'Use fingerprint or face to unlock'
|
|
: 'Not available on this device',
|
|
),
|
|
value: _biometricsEnabled && _biometricsAvailable,
|
|
onChanged: _biometricsAvailable
|
|
? (value) {
|
|
setState(() {
|
|
_biometricsEnabled = value;
|
|
});
|
|
}
|
|
: null,
|
|
activeColor: AppTheme.primaryColor,
|
|
),
|
|
],
|
|
),
|
|
_buildSection(
|
|
title: 'Input',
|
|
children: [
|
|
ListTile(
|
|
leading: const Icon(Icons.camera_alt),
|
|
title: const Text('Camera Permissions'),
|
|
trailing: const Icon(Icons.chevron_right),
|
|
onTap: () {
|
|
// TODO: Open camera permissions
|
|
},
|
|
),
|
|
ListTile(
|
|
leading: const Icon(Icons.mic),
|
|
title: const Text('Microphone Permissions'),
|
|
trailing: const Icon(Icons.chevron_right),
|
|
onTap: () {
|
|
// TODO: Open microphone permissions
|
|
},
|
|
),
|
|
],
|
|
),
|
|
_buildSection(
|
|
title: 'About',
|
|
children: [
|
|
const ListTile(
|
|
leading: Icon(Icons.info_outline),
|
|
title: Text('Version'),
|
|
trailing: Text('1.0.0'),
|
|
),
|
|
ListTile(
|
|
leading: const Icon(Icons.code),
|
|
title: const Text('Open Source Licenses'),
|
|
trailing: const Icon(Icons.chevron_right),
|
|
onTap: () {
|
|
showLicensePage(context: context);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildSection({
|
|
required String title,
|
|
required List<Widget> children,
|
|
}) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(16, 24, 16, 8),
|
|
child: Text(
|
|
title,
|
|
style: TextStyle(
|
|
color: AppTheme.primaryColor,
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 14,
|
|
),
|
|
),
|
|
),
|
|
...children,
|
|
const Divider(),
|
|
],
|
|
);
|
|
}
|
|
}
|