Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.

### 🐛 Bug Fixes
- **MagicStarterUserProfileDropdown**: Fixed menu overflow when many profile menu items are registered — wrapped menu items in scrollable `overflow-y-auto` WDiv, keeping header and logout footer fixed (#28)
- **Sidebar Navigation**: Fixed overflow when many nav items exceed viewport height — added `overflow-y-auto` to navigation WDiv so items scroll while brand, team selector, and user menu remain fixed (#29)

## [0.0.1-alpha.11] - 2026-04-07

Expand Down
4 changes: 2 additions & 2 deletions lib/src/ui/layouts/magic_starter_app_layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ class _MagicStarterAppLayoutState extends State<MagicStarterAppLayout> {

// Default fallback: Dashboard + Profile.
return WDiv(
className: 'flex flex-col gap-1 py-2',
className: 'flex flex-col gap-1 py-2 overflow-y-auto',
children: [
_navItem(
context,
Expand Down Expand Up @@ -354,7 +354,7 @@ class _MagicStarterAppLayoutState extends State<MagicStarterAppLayout> {
VoidCallback? onItemTap,
}) {
return WDiv(
className: 'flex flex-col py-2 gap-1 w-full',
className: 'flex flex-col py-2 gap-1 w-full overflow-y-auto',
children: [
// Main navigation items
...config.mainItems.map(
Expand Down
39 changes: 39 additions & 0 deletions test/ui/layouts/magic_starter_app_layout_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -343,4 +343,43 @@ void main() {
},
);
});

group('MagicStarterAppLayout sidebar navigation scroll', () {
testWidgets(
'sidebar does not overflow with many nav items in short viewport',
(tester) async {
// Short viewport to trigger overflow scenario.
tester.view.physicalSize = const Size(1200, 500);
tester.view.devicePixelRatio = 1.0;

addTearDown(() {
tester.view.resetPhysicalSize();
tester.view.resetDevicePixelRatio();
});

// Register 10+ nav items to exceed viewport height.
MagicStarter.useNavigation(
mainItems: [
for (int i = 0; i < 12; i++)
MagicStarterNavItem(
icon: Icons.circle,
labelKey: 'Nav $i',
path: '/nav-$i',
),
],
);

await tester.pumpWidget(
createApp(
child: const SizedBox(),
),
);
await tester.pumpAndSettle();

// No overflow error means the navigation area scrolls correctly.
// Verify that the layout rendered without exceptions.
expect(find.text('Nav 0'), findsOneWidget);
},
);
});
}