import 'package:app/core/i18n/translations.g.dart'; import 'package:app/core/ui/panel.dart'; import 'package:app/modules/settings/modules/app/app_settings_view.dart'; import 'package:app/modules/settings/modules/app/features_settings_view.dart'; import 'package:app/modules/settings/modules/help/feedback_view.dart'; import 'package:app/modules/settings/modules/help/help_view.dart'; import 'package:app/modules/settings/modules/help/legal_view.dart'; import 'package:app/modules/settings/modules/user_data/account_management_view.dart'; import 'package:app/modules/settings/modules/user_data/personal_data_view.dart'; import 'package:flutter/material.dart'; class SettingsView extends StatelessWidget { const SettingsView({super.key}); @override Widget build(BuildContext context) { final t = Translations.of(context); return Scaffold( // appBar: AppBar(title: Text(t.settings.title)), body: PanelNavigator(rootBuilder: (ctx) => _CategoryList()), ); } } /// ----------------- Root panel: Category list ----------------- class _CategoryList extends StatelessWidget { @override Widget build(BuildContext context) { final scheme = Theme.of(context).colorScheme; final t = Translations.of(context); Widget tile(IconData icon, String label, Widget Function() detail) { return Padding( padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), child: InkWell( borderRadius: BorderRadius.circular(14), onTap: () => context.panels.push((_) => detail(), title: label), child: Container( padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10), decoration: BoxDecoration( color: Colors.transparent, borderRadius: BorderRadius.circular(14), ), child: Row( children: [ Icon(icon), const SizedBox(width: 12), Expanded(child: Text(label)), Icon(Icons.chevron_right, color: scheme.outline), ], ), ), ), ); } return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ _SectionHeader(t.settings.sections.app), tile( Icons.tune, t.settings.items.appSettings, () => const AppSettingsView(), ), const SizedBox(height: 12), tile( Icons.tune, t.settings.featureSettings, () => const FeatureSettingsView(), ), const SizedBox(height: 12), _SectionHeader(t.settings.sections.account), tile( Icons.badge_outlined, t.settings.items.personalData, () => const PersonalPanel(), ), tile( Icons.manage_accounts_outlined, t.settings.items.accountManagement, () => const AccountPanel(), ), const SizedBox(height: 12), _SectionHeader(t.settings.sections.help), tile( Icons.help_outline, t.settings.items.helpCenter, () => const HelpPanel(), ), tile( Icons.feedback_outlined, t.settings.items.feedback, () => const FeedbackPanel(), ), tile( Icons.gavel_outlined, t.settings.items.legalPrivacy, // "Rechtliches & Datenschutz" () => const LegalPanel(), ), const SizedBox(height: 24), const Divider(), ListTile( leading: const Icon(Icons.logout), title: Text(t.settings.items.logout), onTap: () { ScaffoldMessenger.of(context).showSnackBar( SnackBar(content: Text(t.settings.messages.logoutNotImplemented)), ); }, ), ], ); } } class _SectionHeader extends StatelessWidget { final String text; const _SectionHeader(this.text); @override Widget build(BuildContext context) => Padding( padding: const EdgeInsets.fromLTRB(16, 12, 16, 6), child: Text( text, style: Theme.of(context).textTheme.labelMedium?.copyWith( fontWeight: FontWeight.w700, letterSpacing: .2, ), ), ); }