diff --git a/lib/features/connections/sdui_tree_builder.dart b/lib/features/connections/sdui_tree_builder.dart index 84872c86..7f6b226b 100644 --- a/lib/features/connections/sdui_tree_builder.dart +++ b/lib/features/connections/sdui_tree_builder.dart @@ -263,7 +263,10 @@ class SduiTreeBuilderState extends material.State { return QueryaTreeIndentGuide( depth: depth, - leading: 8.0 + (canExpand ? 0 : 4.0), + // The connection already indents the tree by underConnection, like the + // built-in drivers' trees; an extra 8 here put the first level further + // right than a Postgres or MySQL database list. + leading: canExpand ? 0 : 4.0, child: QueryaConnectionTreeRow( label: node.label, isSelected: isSelected, diff --git a/test/core/sdui/sdui_builders_test.dart b/test/core/sdui/sdui_builders_test.dart index 18415b50..ac4a7bb3 100644 --- a/test/core/sdui/sdui_builders_test.dart +++ b/test/core/sdui/sdui_builders_test.dart @@ -291,6 +291,31 @@ void main() { expect(find.text('analytics'), findsOneWidget); }); + testWidgets('a root row starts at the tree edge, no extra inset (#1822 run)', + (tester) async { + final schema = SduiTreeSchema.fromJson(const { + 'roots': [ + {'id': 'databases', 'label': 'Databases', 'expandable': true}, + ], + }); + await tester.pumpWidget( + queryaThemeTestShell( + child: material.Scaffold( + body: SduiTreeBuilder( + schema: schema, + fetchChildren: (_) async => const [], + ), + ), + ), + ); + + final tree = tester.getTopLeft(find.byType(SduiTreeBuilder)).dx; + final chevron = tester.getTopLeft(find.byIcon(QueryaIcons.expandClosed)).dx; + // The row's own padding (4) and nothing else: the connection supplies + // the indent under it. + expect(chevron - tree, lessThan(8)); + }); + testWidgets('expand chevron uses QueryaMotion tokens (Off = instant)', (tester) async { final schema = SduiTreeSchema.fromJson(const {