fix(drawer): scroll destinations, pin the utility footer
The drawer was a single Column with a Spacer pinning intro/Settings/About to the bottom. Once Calendar was added it overflowed a short screen (~94px), so Settings and About fell off-screen and their navigation tests couldn't tap them. Put the destinations in a scrolling ListView and keep the header and the utility footer pinned, so Settings/About stay reachable at any height. Fixes the about_screen/home_screen drawer navigation tests.
This commit is contained in:
parent
62ed4f79b3
commit
4af90876f4
1 changed files with 80 additions and 68 deletions
|
|
@ -27,78 +27,90 @@ class AppDrawer extends StatelessWidget {
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
const _DrawerHeader(),
|
const _DrawerHeader(),
|
||||||
_DrawerItem(
|
// The destinations scroll; the header above and the utility footer
|
||||||
icon: const SeedGlyph(SeedGlyphs.jars, size: 23),
|
// below stay pinned, so Settings/About are always reachable even on
|
||||||
label: t.menu.inventory,
|
// a short screen (drawer used to overflow once Calendar was added).
|
||||||
onTap: () {
|
Expanded(
|
||||||
Navigator.of(context).pop();
|
child: ListView(
|
||||||
context.push('/inventory');
|
padding: EdgeInsets.zero,
|
||||||
},
|
children: [
|
||||||
),
|
_DrawerItem(
|
||||||
// Local, works offline — a reproduction-commitment ledger.
|
icon: const SeedGlyph(SeedGlyphs.jars, size: 23),
|
||||||
_DrawerItem(
|
label: t.menu.inventory,
|
||||||
icon: const Icon(Icons.volunteer_activism_outlined),
|
onTap: () {
|
||||||
label: t.menu.plantares,
|
|
||||||
onTap: () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
context.push('/plantares');
|
|
||||||
},
|
|
||||||
),
|
|
||||||
// Local sales ledger — also offline.
|
|
||||||
_DrawerItem(
|
|
||||||
icon: const Icon(Icons.sell_outlined),
|
|
||||||
label: t.menu.sales,
|
|
||||||
onTap: () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
context.push('/sales');
|
|
||||||
},
|
|
||||||
),
|
|
||||||
// "What's due this month" — the aggregate crop calendar, offline.
|
|
||||||
_DrawerItem(
|
|
||||||
icon: const Icon(Icons.calendar_month),
|
|
||||||
label: t.menu.calendar,
|
|
||||||
onTap: () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
context.push('/calendar');
|
|
||||||
},
|
|
||||||
),
|
|
||||||
_DrawerItem(
|
|
||||||
icon: const Icon(Symbols.storefront),
|
|
||||||
label: t.menu.market,
|
|
||||||
divider: true,
|
|
||||||
onTap: marketEnabled
|
|
||||||
? () {
|
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.push('/market');
|
context.push('/inventory');
|
||||||
}
|
},
|
||||||
: null,
|
),
|
||||||
),
|
// Local, works offline — a reproduction-commitment ledger.
|
||||||
_DrawerItem(
|
_DrawerItem(
|
||||||
icon: const Icon(Icons.person),
|
icon: const Icon(Icons.volunteer_activism_outlined),
|
||||||
label: t.menu.profile,
|
label: t.menu.plantares,
|
||||||
onTap: marketEnabled
|
onTap: () {
|
||||||
? () {
|
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.push('/profile');
|
context.push('/plantares');
|
||||||
}
|
},
|
||||||
: null,
|
),
|
||||||
),
|
// Local sales ledger — also offline.
|
||||||
_DrawerItem(
|
_DrawerItem(
|
||||||
icon: const UnreadBadge(child: Icon(Icons.chat_bubble)),
|
icon: const Icon(Icons.sell_outlined),
|
||||||
label: t.menu.chat,
|
label: t.menu.sales,
|
||||||
onTap: marketEnabled
|
onTap: () {
|
||||||
? () {
|
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
context.push('/messages');
|
context.push('/sales');
|
||||||
}
|
},
|
||||||
: null,
|
),
|
||||||
|
// "What's due this month" — the aggregate crop calendar.
|
||||||
|
_DrawerItem(
|
||||||
|
icon: const Icon(Icons.calendar_month),
|
||||||
|
label: t.menu.calendar,
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
context.push('/calendar');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
_DrawerItem(
|
||||||
|
icon: const Icon(Symbols.storefront),
|
||||||
|
label: t.menu.market,
|
||||||
|
divider: true,
|
||||||
|
onTap: marketEnabled
|
||||||
|
? () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
context.push('/market');
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
_DrawerItem(
|
||||||
|
icon: const Icon(Icons.person),
|
||||||
|
label: t.menu.profile,
|
||||||
|
onTap: marketEnabled
|
||||||
|
? () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
context.push('/profile');
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
_DrawerItem(
|
||||||
|
icon: const UnreadBadge(child: Icon(Icons.chat_bubble)),
|
||||||
|
label: t.menu.chat,
|
||||||
|
onTap: marketEnabled
|
||||||
|
? () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
context.push('/messages');
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
),
|
||||||
|
_DrawerItem(
|
||||||
|
icon: const Icon(Icons.favorite),
|
||||||
|
label: t.menu.wishlist,
|
||||||
|
),
|
||||||
|
_DrawerItem(
|
||||||
|
icon: const Icon(Icons.group),
|
||||||
|
label: t.menu.following,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
_DrawerItem(
|
|
||||||
icon: const Icon(Icons.favorite),
|
|
||||||
label: t.menu.wishlist,
|
|
||||||
),
|
|
||||||
_DrawerItem(icon: const Icon(Icons.group), label: t.menu.following),
|
|
||||||
const Spacer(),
|
|
||||||
const Divider(height: 1),
|
const Divider(height: 1),
|
||||||
_DrawerItem(
|
_DrawerItem(
|
||||||
icon: const Icon(Icons.auto_stories_outlined),
|
icon: const Icon(Icons.auto_stories_outlined),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue