Apply a Material 3 seed-green palette and rounded components across the home, inventory, quick-add, quantity picker and variety-detail screens. The full-screen photo viewer can now set any photo as the cover (via attachment sort order) and delete after confirmation. Lot forms and packaging surface as choice chips. Extract About out of Settings into its own screen (app version via package_info_plus, website link). Add es/en strings for the new lot types, presentation, home tagline and About. Update Seedees v2 mockups.
90 lines
2.4 KiB
Dart
90 lines
2.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:go_router/go_router.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.settings.aboutOpen),
|
|
subtitle: Text(t.settings.aboutText),
|
|
trailing: const Icon(Icons.chevron_right),
|
|
onTap: () => context.push('/about'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
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: seedGreen,
|
|
fontWeight: FontWeight.w600,
|
|
letterSpacing: 0.4,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
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,
|
|
);
|
|
}
|
|
}
|