Skip to content

Commit

Permalink
fix Feature Request: Spacebar Starts and Stops Audio Playback (#489)
Browse files Browse the repository at this point in the history
Fixes #488
  • Loading branch information
Feichtmeier authored Feb 4, 2024
1 parent 6e02cfd commit 7b0bb2f
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 34 deletions.
74 changes: 43 additions & 31 deletions lib/src/app/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:io';

import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:provider/provider.dart';
import 'package:ubuntu_service/ubuntu_service.dart';
import 'package:yaru_widgets/yaru_widgets.dart';
Expand Down Expand Up @@ -138,42 +139,53 @@ class _AppState extends State<App> with WidgetsBindingObserver {
// AppModel
final isFullScreen = context.select((AppModel m) => m.fullScreen);

return Stack(
alignment: Alignment.center,
children: [
Row(
children: [
Expanded(
child: Column(
children: [
Expanded(
child: MasterDetailPage(
countryCode: _countryCode,
),
),
if (!playerToTheRight)
const PlayerView(
playerViewMode: PlayerViewMode.bottom,
final playerModel = context.read<PlayerModel>();

return KeyboardListener(
focusNode: FocusNode(),
onKeyEvent: (value) {
if (value.runtimeType == KeyDownEvent &&
value.logicalKey == LogicalKeyboardKey.space) {
playerModel.playOrPause();
}
},
child: Stack(
alignment: Alignment.center,
children: [
Row(
children: [
Expanded(
child: Column(
children: [
Expanded(
child: MasterDetailPage(
countryCode: _countryCode,
),
),
],
if (!playerToTheRight)
const PlayerView(
playerViewMode: PlayerViewMode.bottom,
),
],
),
),
),
if (playerToTheRight)
const SizedBox(
width: kSideBarPlayerWidth,
child: PlayerView(
playerViewMode: PlayerViewMode.sideBar,
if (playerToTheRight)
const SizedBox(
width: kSideBarPlayerWidth,
child: PlayerView(
playerViewMode: PlayerViewMode.sideBar,
),
),
],
),
if (isFullScreen == true)
const Scaffold(
body: PlayerView(
playerViewMode: PlayerViewMode.fullWindow,
),
],
),
if (isFullScreen == true)
const Scaffold(
body: PlayerView(
playerViewMode: PlayerViewMode.fullWindow,
),
),
],
],
),
);
}
}
22 changes: 19 additions & 3 deletions lib/src/patch_notes/patch_notes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,24 @@ const kPatchNotes20240115 = 'Hello MusicPod Users 💙🐧🧡\n\n'
'\n\nIf you like MusicPod please consider sponsoring me 🙏:'
'\n';

const kRecentPatchNotesDisposed = kPatchNotes20240115disposed;
const kRecentPatchNotesTitle = kPatchNotesTitle20240115;
const kRecentPatchNotes = kPatchNotes20240115;
// 2024 02 04
const kPatchNotes20240204disposed = 'patchNotes20240204disposed';
const kPatchNotesTitle20240204 = 'Patch notes: 2024-02-04';
const kPatchNotes20240204 = 'Hello MusicPod Users 💙🐧🧡\n'
'\n* albums now do not include a trailing space'
'\n* sadly this means you need to re-pin'
'\n your favorite albums again :('
'\n* new settings dialog, in which you can'
'\n* change the theme'
'\n* switch to podcast index with your own api key/secret'
'\n* MusicPod can now be used to open any audio/video on your computer'
'\n* loading your local music at start now happens faster'
'\n* the space key now toggles between play and pause'
'\n\nIf you like MusicPod please consider sponsoring me 🙏:'
'\n';

const kRecentPatchNotesDisposed = kPatchNotes20240204disposed;
const kRecentPatchNotesTitle = kPatchNotesTitle20240204;
const kRecentPatchNotes = kPatchNotes20240204;

const kPatchNotesDisposed = 'kPatchNotesDisposed';

0 comments on commit 7b0bb2f

Please sign in to comment.