fix sidebar icon rail overflow
The rail was a fixed Row(center, max) — one button per tab — so adding the Search tab pushed it 54px past its width and threw a RenderFlex overflow. Center the icons when they fit and scroll horizontally when they don't (LayoutBuilder + SingleChildScrollView + a minWidth floor), so the rail stays correct at any tab count. (T-200) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -349,6 +349,28 @@ void main() {
|
||||
await tester.tap(find.bySemanticsLabel('B'));
|
||||
expect(selected, 'b');
|
||||
});
|
||||
|
||||
testWidgets('scrolls instead of overflowing when items exceed the width', (tester) async {
|
||||
await tester.pumpWidget(harness(
|
||||
f,
|
||||
SizedBox(
|
||||
width: 120,
|
||||
height: 30,
|
||||
child: ClideIconRail(
|
||||
items: [
|
||||
for (var i = 0; i < 10; i++) ClideIconRailItem(id: '$i', icon: PhosphorIcons.folder, tooltip: 'Tab $i'),
|
||||
],
|
||||
activeId: '0',
|
||||
onSelect: (_) {},
|
||||
),
|
||||
),
|
||||
));
|
||||
await tester.pumpAndSettle();
|
||||
// No RenderFlex overflow (would surface as a thrown FlutterError),
|
||||
// and the rail is horizontally scrollable.
|
||||
expect(tester.takeException(), isNull);
|
||||
expect(find.byType(SingleChildScrollView), findsWidgets);
|
||||
});
|
||||
});
|
||||
|
||||
group('ClideSpine', () {
|
||||
|
||||
Reference in New Issue
Block a user