mirror of
https://github.com/FoggedLens/deflock-app.git
synced 2026-09-04 09:00:44 +02:00
languages and about get their own section
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../services/localization_service.dart';
|
||||
|
||||
class AboutScreen extends StatelessWidget {
|
||||
const AboutScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final locService = LocalizationService.instance;
|
||||
|
||||
return AnimatedBuilder(
|
||||
animation: LocalizationService.instance,
|
||||
builder: (context, child) => Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(locService.t('settings.aboutThisApp')),
|
||||
),
|
||||
body: FutureBuilder<String>(
|
||||
future: DefaultAssetBundle.of(context).loadString('assets/info.txt'),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
}
|
||||
|
||||
if (snapshot.hasError) {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Text(
|
||||
'Error loading info: ${snapshot.error}',
|
||||
style: Theme.of(context).textTheme.bodyLarge,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Text(
|
||||
snapshot.data ?? 'No info available.',
|
||||
style: Theme.of(context).textTheme.bodyLarge,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'settings/sections/language_section.dart';
|
||||
import '../services/localization_service.dart';
|
||||
|
||||
class LanguageSettingsScreen extends StatelessWidget {
|
||||
const LanguageSettingsScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final locService = LocalizationService.instance;
|
||||
|
||||
return AnimatedBuilder(
|
||||
animation: LocalizationService.instance,
|
||||
builder: (context, child) => Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(locService.t('settings.language')),
|
||||
),
|
||||
body: const Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: LanguageSection(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -57,11 +57,6 @@ class _LanguageSectionState extends State<LanguageSection> {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
locService.t('settings.language'),
|
||||
style: Theme.of(context).textTheme.titleMedium,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
// System Default option
|
||||
RadioListTile<String?>(
|
||||
title: Text(locService.t('settings.systemDefault')),
|
||||
|
||||
@@ -99,7 +99,7 @@ class _ProximityAlertsSectionState extends State<ProximityAlertsSection> {
|
||||
subtitle: Text(
|
||||
'${locService.t('proximityAlerts.batteryUsage')}\n'
|
||||
'${_notificationsEnabled ? locService.t('proximityAlerts.notificationsEnabled') : locService.t('proximityAlerts.notificationsDisabled')}',
|
||||
style: const TextStyle(fontSize: 12),
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
value: appState.proximityAlertsEnabled,
|
||||
onChanged: (enabled) {
|
||||
@@ -131,14 +131,14 @@ class _ProximityAlertsSectionState extends State<ProximityAlertsSection> {
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
locService.t('proximityAlerts.permissionRequired'),
|
||||
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||
style: TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
locService.t('proximityAlerts.permissionExplanation'),
|
||||
style: const TextStyle(fontSize: 12),
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
ElevatedButton.icon(
|
||||
@@ -158,15 +158,15 @@ class _ProximityAlertsSectionState extends State<ProximityAlertsSection> {
|
||||
// Loading indicator
|
||||
if (_checkingPermissions) ...[
|
||||
const SizedBox(height: 8),
|
||||
const Row(
|
||||
Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
const SizedBox(
|
||||
width: 16,
|
||||
height: 16,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Text(locService.t('proximityAlerts.checkingPermissions'), style: const TextStyle(fontSize: 12)),
|
||||
const SizedBox(width: 8),
|
||||
Text(locService.t('proximityAlerts.checkingPermissions'), style: TextStyle(fontSize: 12)),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
||||
@@ -2,8 +2,6 @@ import 'package:flutter/material.dart';
|
||||
import 'settings/sections/auth_section.dart';
|
||||
import 'settings/sections/upload_mode_section.dart';
|
||||
import 'settings/sections/queue_section.dart';
|
||||
import 'settings/sections/about_section.dart';
|
||||
import 'settings/sections/language_section.dart';
|
||||
import '../services/localization_service.dart';
|
||||
import '../dev_config.dart';
|
||||
|
||||
@@ -59,9 +57,22 @@ class SettingsScreen extends StatelessWidget {
|
||||
),
|
||||
const Divider(),
|
||||
|
||||
const LanguageSection(),
|
||||
_buildNavigationTile(
|
||||
context,
|
||||
icon: Icons.language,
|
||||
title: locService.t('settings.language'),
|
||||
subtitle: locService.t('settings.languageSubtitle'),
|
||||
onTap: () => Navigator.pushNamed(context, '/settings/language'),
|
||||
),
|
||||
const Divider(),
|
||||
const AboutSection(),
|
||||
|
||||
_buildNavigationTile(
|
||||
context,
|
||||
icon: Icons.info_outline,
|
||||
title: locService.t('settings.aboutInfo'),
|
||||
subtitle: locService.t('settings.aboutSubtitle'),
|
||||
onTap: () => Navigator.pushNamed(context, '/settings/about'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user