feat(shell): real sprout logo on home + basic Settings screen
- Bundle the real sprout logo (docs/logo.png → assets/logo.png) and show it on the home menu instead of a Material icon. - Settings screen: switch language (Español / English / system) via slang, plus an About tile (logo, app name, one-line description). Drawer "Settings" is now active and routes to /settings. Tests: drawer Settings opens the screen and shows the language options. 54 green.
This commit is contained in:
parent
46ef2c61cd
commit
4b209d6752
12 changed files with 196 additions and 9 deletions
|
|
@ -38,7 +38,14 @@ class AppDrawer extends StatelessWidget {
|
|||
_SoonItem(icon: Icons.group_outlined, label: t.menu.following),
|
||||
const Spacer(),
|
||||
const Divider(),
|
||||
_SoonItem(icon: Icons.settings_outlined, label: t.menu.settings),
|
||||
_ActiveItem(
|
||||
icon: const Icon(Icons.settings_outlined),
|
||||
label: t.menu.settings,
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
context.go('/settings');
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
|
||||
import '../i18n/strings.g.dart';
|
||||
import 'app_drawer.dart';
|
||||
|
|
@ -31,11 +30,10 @@ class HomeScreen extends StatelessWidget {
|
|||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
const Icon(
|
||||
Symbols.eco,
|
||||
size: 120,
|
||||
color: seedGreen,
|
||||
fill: 1,
|
||||
Image.asset(
|
||||
'assets/logo.png',
|
||||
height: 140,
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
const SizedBox(height: 40),
|
||||
_MenuButton(
|
||||
|
|
|
|||
86
apps/app_seeds/lib/ui/settings_screen.dart
Normal file
86
apps/app_seeds/lib/ui/settings_screen.dart
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../i18n/strings.g.dart';
|
||||
import 'theme.dart';
|
||||
|
||||
/// Basic settings: app language and an "about" section.
|
||||
class SettingsScreen extends StatelessWidget {
|
||||
const SettingsScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final t = context.t;
|
||||
final current = TranslationProvider.of(context).flutterLocale.languageCode;
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: Text(t.menu.settings)),
|
||||
body: ListView(
|
||||
children: [
|
||||
_SectionHeader(t.settings.language),
|
||||
_LanguageTile(
|
||||
label: t.settings.langEs,
|
||||
selected: current == 'es',
|
||||
onTap: () => LocaleSettings.setLocale(AppLocale.es),
|
||||
),
|
||||
_LanguageTile(
|
||||
label: t.settings.langEn,
|
||||
selected: current == 'en',
|
||||
onTap: () => LocaleSettings.setLocale(AppLocale.en),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.smartphone_outlined),
|
||||
title: Text(t.settings.systemLanguage),
|
||||
onTap: () => LocaleSettings.useDeviceLocale(),
|
||||
),
|
||||
const Divider(),
|
||||
_SectionHeader(t.settings.about),
|
||||
ListTile(
|
||||
leading: Image.asset('assets/logo.png', width: 32),
|
||||
title: Text(t.app.title),
|
||||
subtitle: Text(t.settings.aboutText),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _SectionHeader extends StatelessWidget {
|
||||
const _SectionHeader(this.text);
|
||||
|
||||
final String text;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 16, 16, 4),
|
||||
child: Text(
|
||||
text,
|
||||
style: Theme.of(context).textTheme.titleSmall?.copyWith(
|
||||
color: seedGreenDark,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _LanguageTile extends StatelessWidget {
|
||||
const _LanguageTile({
|
||||
required this.label,
|
||||
required this.selected,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
final String label;
|
||||
final bool selected;
|
||||
final VoidCallback onTap;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
title: Text(label),
|
||||
trailing: selected ? const Icon(Icons.check, color: seedGreen) : null,
|
||||
onTap: onTap,
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue