tane/apps/app_seeds/lib/ui/app_drawer.dart
vjrj 02a9d5bf39 feat(shell): home menu + navigation drawer (mockups 02/03)
The app now opens on a main menu instead of straight into the list:
- HomeScreen (mockup 02): sprout logo over a faint seed-glyph watermark, with
  big "Your inventory" (→ /inventory) and "Open market" (Block 2, "coming soon")
  destinations.
- AppDrawer (mockup 03): Inventory is live; the social items (market, profile,
  chat, wishlist, following, settings) are shown disabled with a "coming soon"
  tag so the roadmap is visible. Drawer is available on home and inventory.
- Routing: / → home, /inventory → list, /variety/:id → detail.

Tests: home shows the menu + navigates; drawer opens + navigates. quick-add flow
updated to go home → inventory. 50 green; Linux runs.
2026-07-08 12:22:42 +02:00

115 lines
3.1 KiB
Dart

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 'seed_glyph.dart';
import 'theme.dart';
/// The app's navigation drawer (mockup 03). Inventory is live; the social items
/// (market, profile, chat…) belong to Block 2 and are shown disabled with a
/// "coming soon" tag so the roadmap is visible.
class AppDrawer extends StatelessWidget {
const AppDrawer({super.key});
@override
Widget build(BuildContext context) {
final t = context.t;
return Drawer(
backgroundColor: Colors.white,
child: SafeArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const _DrawerHeader(),
_ActiveItem(
icon: const SeedGlyph(SeedGlyphs.jars, size: 22),
label: t.menu.inventory,
onTap: () {
Navigator.of(context).pop();
context.go('/inventory');
},
),
_SoonItem(icon: Symbols.storefront, label: t.menu.market),
const Divider(),
_SoonItem(icon: Icons.person_outline, label: t.menu.profile),
_SoonItem(icon: Icons.chat_bubble_outline, label: t.menu.chat),
_SoonItem(icon: Icons.favorite_border, label: t.menu.wishlist),
_SoonItem(icon: Icons.group_outlined, label: t.menu.following),
const Spacer(),
const Divider(),
_SoonItem(icon: Icons.settings_outlined, label: t.menu.settings),
],
),
),
);
}
}
class _DrawerHeader extends StatelessWidget {
const _DrawerHeader();
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.fromLTRB(16, 12, 16, 12),
child: Row(
children: [
const Icon(Symbols.eco, color: seedGreen, size: 32),
const SizedBox(width: 12),
Text(
context.t.app.title,
style: Theme.of(context).textTheme.titleLarge?.copyWith(
color: seedGreenDark,
fontWeight: FontWeight.bold,
),
),
],
),
);
}
}
class _ActiveItem extends StatelessWidget {
const _ActiveItem({
required this.icon,
required this.label,
required this.onTap,
});
final Widget icon;
final String label;
final VoidCallback onTap;
@override
Widget build(BuildContext context) {
return ListTile(
leading: SizedBox(width: 24, child: Center(child: icon)),
title: Text(label),
onTap: onTap,
);
}
}
/// A disabled Block-2 destination with a subtle "coming soon" tag.
class _SoonItem extends StatelessWidget {
const _SoonItem({required this.icon, required this.label});
final IconData icon;
final String label;
@override
Widget build(BuildContext context) {
return ListTile(
enabled: false,
leading: Icon(icon),
title: Text(label),
trailing: Text(
context.t.common.comingSoon,
style: Theme.of(
context,
).textTheme.labelSmall?.copyWith(color: Colors.black38),
),
);
}
}