Skip to content

Commit

Permalink
Display loader around Play/Pause button when buffering
Browse files Browse the repository at this point in the history
  • Loading branch information
erdemyerebasmaz committed May 13, 2024
1 parent bd64088 commit 2618d89
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 39 deletions.
69 changes: 36 additions & 33 deletions lib/routes/podcast/transport_controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -199,46 +199,49 @@ class _PlayButton extends StatelessWidget {

// in case we are buffering show progress indicator.
final translations = L.of(context);
if (buffering) {
return Tooltip(

return Stack(
alignment: AlignmentDirectional.center,
children: [
if (buffering)
SpinKitRing(
lineWidth: 2.0,
color: themeData.colorScheme.secondary,
size: 84,
),
if (!buffering)
const SizedBox(
height: 84,
width: 84,
),
Tooltip(
message: playing ? translations.pause_button_label : translations.play_button_label,
child: TextButton(
style: TextButton.styleFrom(
shape: const CircleBorder(),
shape: CircleBorder(
side: BorderSide(color: themeData.highlightColor, width: 0.0),
),
backgroundColor: themeData.primaryColor,
padding: const EdgeInsets.all(8.0),
),
onPressed: null,
child: SpinKitRing(
lineWidth: 2.0,
color: themeData.colorScheme.secondary,
size: 60,
onPressed: buffering
? null
: () {
if (playing) {
onPause();
} else {
onPlay();
}
},
child: AnimatedIcon(
size: 60.0,
icon: AnimatedIcons.play_pause,
color: Colors.white,
progress: playPauseController,
),
));
}

return Tooltip(
message: playing ? translations.pause_button_label : translations.play_button_label,
child: TextButton(
style: TextButton.styleFrom(
shape: CircleBorder(
side: BorderSide(color: themeData.highlightColor, width: 0.0),
),
backgroundColor: themeData.primaryColor,
padding: const EdgeInsets.all(8.0),
),
onPressed: () {
if (playing) {
onPause();
} else {
onPlay();
}
},
child: AnimatedIcon(
size: 60.0,
icon: AnimatedIcons.play_pause,
color: Colors.white,
progress: playPauseController,
),
),
],
);
}
}
8 changes: 4 additions & 4 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ packages:
dependency: "direct main"
description:
path: "."
ref: c30de552580d8e64233c4372a7e438b0550de64e
resolved-ref: c30de552580d8e64233c4372a7e438b0550de64e
ref: "7ae0038eb14e1ebaa1eb8a26ae144a795e0b787d"
resolved-ref: "7ae0038eb14e1ebaa1eb8a26ae144a795e0b787d"
url: "https://github.com/breez/anytime_podcast_player.git"
source: git
version: "1.2.1+74-breez"
Expand Down Expand Up @@ -2094,10 +2094,10 @@ packages:
dependency: "direct main"
description:
name: webdav_client
sha256: b3f5afee27e7db5635817ddd79d57f56d43fdc6dad4c6bc93b0703261f96064c
sha256: "682fffc50b61dc0e8f46717171db03bf9caaa17347be41c0c91e297553bf86b2"
url: "https://pub.dev"
source: hosted
version: "1.2.1"
version: "1.2.2"
webfeed:
dependency: transitive
description:
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ dependencies:
url_launcher: <=6.1.11 # Requires Flutter 3.10
uuid: <=4.2.2 # Requires Flutter 3.10
validators: ^3.0.0
webdav_client: ^1.2.1
webdav_client: ^1.2.2
webview_flutter: <=4.4.2 # Requires Flutter 3.10
webview_flutter_android: <=3.12.1 # Requires Flutter 3.10

anytime:
git:
url: https://github.com/breez/anytime_podcast_player.git
ref: c30de552580d8e64233c4372a7e438b0550de64e
ref: 7ae0038eb14e1ebaa1eb8a26ae144a795e0b787d
flutter_downloader:
git:
url: https://github.com/breez/flutter_downloader.git
Expand Down

0 comments on commit 2618d89

Please sign in to comment.