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.
This commit is contained in:
parent
17073dd560
commit
02a9d5bf39
11 changed files with 472 additions and 8 deletions
115
apps/app_seeds/lib/ui/app_drawer.dart
Normal file
115
apps/app_seeds/lib/ui/app_drawer.dart
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
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),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
159
apps/app_seeds/lib/ui/home_screen.dart
Normal file
159
apps/app_seeds/lib/ui/home_screen.dart
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
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';
|
||||
import 'seed_glyph.dart';
|
||||
import 'theme.dart';
|
||||
|
||||
/// The main menu (mockup 02): a sprout logo over a faint seed-glyph watermark,
|
||||
/// with the big "open market" (Block 2, coming soon) and "your inventory"
|
||||
/// destinations. The hamburger opens [AppDrawer].
|
||||
class HomeScreen extends StatelessWidget {
|
||||
const HomeScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final t = context.t;
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: Text(t.app.title)),
|
||||
drawer: const AppDrawer(),
|
||||
body: Stack(
|
||||
children: [
|
||||
const Positioned.fill(child: _SeedWatermark()),
|
||||
Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 440),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
const Icon(
|
||||
Symbols.eco,
|
||||
size: 120,
|
||||
color: seedGreen,
|
||||
fill: 1,
|
||||
),
|
||||
const SizedBox(height: 40),
|
||||
_MenuButton(
|
||||
icon: const SeedGlyph(
|
||||
SeedGlyphs.share,
|
||||
size: 26,
|
||||
color: Colors.white,
|
||||
),
|
||||
label: t.home.openMarket,
|
||||
tag: t.common.comingSoon,
|
||||
onTap: null,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_MenuButton(
|
||||
key: const Key('home.inventory'),
|
||||
icon: const Icon(Icons.list, color: Colors.white),
|
||||
label: t.home.yourInventory,
|
||||
onTap: () => context.go('/inventory'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _MenuButton extends StatelessWidget {
|
||||
const _MenuButton({
|
||||
required this.icon,
|
||||
required this.label,
|
||||
this.onTap,
|
||||
this.tag,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final Widget icon;
|
||||
final String label;
|
||||
final VoidCallback? onTap;
|
||||
final String? tag;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final enabled = onTap != null;
|
||||
return Material(
|
||||
color: enabled ? seedGreen : seedGreen.withValues(alpha: 0.45),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 20),
|
||||
child: Row(
|
||||
children: [
|
||||
icon,
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (tag != null)
|
||||
Text(
|
||||
tag!,
|
||||
style: const TextStyle(color: Colors.white70, fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// A faint scatter of seed pictograms behind the menu (like mockup 02).
|
||||
class _SeedWatermark extends StatelessWidget {
|
||||
const _SeedWatermark();
|
||||
|
||||
static const _glyphs = [
|
||||
SeedGlyphs.jars,
|
||||
SeedGlyphs.envelope,
|
||||
SeedGlyphs.bigSpoon,
|
||||
SeedGlyphs.jar,
|
||||
SeedGlyphs.sack,
|
||||
SeedGlyphs.scattered,
|
||||
SeedGlyphs.mug,
|
||||
SeedGlyphs.smallSpoon,
|
||||
];
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return IgnorePointer(
|
||||
child: Opacity(
|
||||
opacity: 0.06,
|
||||
child: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 24),
|
||||
child: Wrap(
|
||||
spacing: 28,
|
||||
runSpacing: 18,
|
||||
alignment: WrapAlignment.center,
|
||||
children: [
|
||||
for (final g in _glyphs)
|
||||
SeedGlyph(g, size: 64, color: seedGreenDark),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@ import 'package:go_router/go_router.dart';
|
|||
import '../data/variety_repository.dart';
|
||||
import '../i18n/strings.g.dart';
|
||||
import '../state/inventory_cubit.dart';
|
||||
import 'app_drawer.dart';
|
||||
import 'quick_add_sheet.dart';
|
||||
import 'seed_glyph.dart';
|
||||
import 'theme.dart';
|
||||
|
|
@ -19,6 +20,7 @@ class InventoryListScreen extends StatelessWidget {
|
|||
final t = context.t;
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: Text(t.inventory.title)),
|
||||
drawer: const AppDrawer(),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
key: const Key('inventory.addFab'),
|
||||
tooltip: t.quickAdd.title,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue