From ff38defd9bdd76857814f8fb1580b1f2f8165c4e Mon Sep 17 00:00:00 2001 From: zarzet <42882290+zarzet@users.noreply.github.com> Date: Wed, 7 Oct 2026 00:47:20 +0700 Subject: [PATCH] fix(mornye): show provider checkmark spacing only when selected --- lib/widgets/download_service_picker.dart | 18 ++++-------------- test/download_service_picker_drag_test.dart | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/widgets/download_service_picker.dart b/lib/widgets/download_service_picker.dart index 8eb36eb1..7ffc0ac9 100644 --- a/lib/widgets/download_service_picker.dart +++ b/lib/widgets/download_service_picker.dart @@ -453,20 +453,10 @@ class _ServiceChip extends StatelessWidget { child: Row( mainAxisSize: MainAxisSize.min, children: [ - // Reserve selection space so switching sources never reflows - // the chips and changes the sheet height under the finger. - SizedBox( - width: 18, - height: 18, - child: isSelected - ? Icon( - CupertinoIcons.checkmark, - color: foreground, - size: 18, - ) - : null, - ), - const SizedBox(width: 8), + if (isSelected) ...[ + Icon(CupertinoIcons.checkmark, color: foreground, size: 18), + const SizedBox(width: 8), + ], if (iconPath != null) ...[ ClipRRect( borderRadius: BorderRadius.circular(4), diff --git a/test/download_service_picker_drag_test.dart b/test/download_service_picker_drag_test.dart index 38179e8f..16343cad 100644 --- a/test/download_service_picker_drag_test.dart +++ b/test/download_service_picker_drag_test.dart @@ -179,7 +179,7 @@ void main() { for (final brightness in Brightness.values) { testWidgets( - 'source status stays local and selection keeps chip geometry in $brightness', + 'source status stays local and checkmark space appears only on selection in $brightness', (tester) async { tester.view.physicalSize = const Size(393, 852); tester.view.devicePixelRatio = 1; @@ -226,6 +226,10 @@ void main() { matching: find.byType(CupertinoButton), ); final sourceRects = [tester.getRect(source1), tester.getRect(source2)]; + expect( + tester.getTopLeft(find.text('Source 1')).dx - sourceRects[1].left, + 16, + ); extensions.publishHealth('example', 'offline'); await tester.pumpAndSettle(); expect(find.byTooltip('Service offline'), findsOneWidget); @@ -247,7 +251,13 @@ void main() { expect(extensions.healthRequests, ['example', 'example-1']); await tester.tap(find.text('Source 1')); await tester.pumpAndSettle(); - expect([tester.getRect(source1), tester.getRect(source2)], sourceRects); + expect(tester.getSize(source1).width, sourceRects[0].width - 26); + expect(tester.getSize(source2).width, sourceRects[1].width + 26); + expect( + tester.getTopLeft(find.text('Source 1')).dx - + tester.getTopLeft(source2).dx, + 42, + ); await tester.tap(find.text('Quality 1')); await tester.pumpAndSettle(); expect(selection, ('1', 'example-1'));