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
7 changes: 7 additions & 0 deletions lib/feature/sound/playback/sound_player_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ typedef PlaySoundFile = Future<void> Function(
Duration from,
});

/// The gap between back, play and next.
const double _transportGap = 8;

/// The bar below the sound files that plays the [SoundPlaybackController]'s
/// current file: back, play or pause, next, its name, the waveform to jump
/// in, its time, a file picked by weight like in the game, and closing.
Expand Down Expand Up @@ -272,10 +275,14 @@ class _SoundPlayerBarState extends State<SoundPlayerBar>
onPressed: index > 0 ? () => _step(-1) : null,
icon: const Icon(Icons.skip_previous),
),
// Without a gap the hover circles of the three buttons
// touch, in the compact density of the desktop.
const SizedBox(width: _transportGap),
_PlayPauseButton(
status: _controller.status,
onPressed: () => _playPause(current),
),
const SizedBox(width: _transportGap),
IconButton(
key: const Key('sound_player_next'),
tooltip: l10n.sound_player_next,
Expand Down
18 changes: 18 additions & 0 deletions test/feature/sound/playback/sound_player_bar_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,24 @@ void main() {
expect(find.text('vulpes:step/b'), findsNothing);
});

testWidgets(
'keeps a gap between back, play and next, so their highlights do not '
'touch in the compact desktop density',
(tester) async {
await pumpBar(tester);
await start(tester, a);

Rect rectOf(String key) => tester.getRect(find.byKey(Key(key)));
final previous = rectOf('sound_player_previous');
final play = rectOf('sound_player_play_pause');
final next = rectOf('sound_player_next');

expect(play.left - previous.right, greaterThanOrEqualTo(8));
expect(next.left - play.right, greaterThanOrEqualTo(8));
},
variant: TargetPlatformVariant.only(TargetPlatform.macOS),
);

testWidgets('keeps the waveform in the middle', (tester) async {
await pumpBar(tester);
await start(tester, a);
Expand Down
Loading