fix(ui): refine track action spacing

This commit is contained in:
zarzet
2026-07-30 14:42:26 +07:00
parent 49d0bd6a99
commit 5357e14b06
6 changed files with 50 additions and 4 deletions
+25
View File
@@ -431,6 +431,31 @@ void main() {
expect(card.color, Colors.transparent);
});
testWidgets('flat style keeps trailing actions near the card edge', (
tester,
) async {
const trailingKey = Key('flat-trailing');
await tester.pumpWidget(
host(
const SizedBox(
width: 320,
child: TrackCard(
leading: SizedBox(width: 24),
title: 'Song',
style: TrackCardStyle.flat,
trailing: SizedBox(key: trailingKey, width: 48, height: 48),
),
),
),
);
final cardRect = tester.getRect(find.byType(Card));
final trailingRect = tester.getRect(find.byKey(trailingKey));
// Card's render box includes its 8dp flat-row margin; content itself is
// inset another 6dp from the painted card edge.
expect(cardRect.right - trailingRect.right, 14);
});
testWidgets('grid variant is a real button with a semantic label', (
tester,
) async {
+18
View File
@@ -6,6 +6,7 @@ import 'package:spotiflac_android/l10n/l10n.dart';
import 'package:spotiflac_android/models/track.dart';
import 'package:spotiflac_android/providers/music_player_provider.dart';
import 'package:spotiflac_android/widgets/preview_button.dart';
import 'package:spotiflac_android/widgets/track_collection_quick_actions.dart';
void main() {
const track = Track(
@@ -66,4 +67,21 @@ void main() {
);
expectCenteredHitbox(tester, Icons.play_circle_fill_rounded);
});
testWidgets('overflow menu icon is centered in its adjacent hitbox', (
tester,
) async {
await tester.pumpWidget(
const ProviderScope(
child: MaterialApp(
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
home: Scaffold(body: TrackCollectionQuickActions(track: track)),
),
),
);
await tester.pump();
expectCenteredHitbox(tester, Icons.more_vert);
});
}