From 725c396146fe50d06b59f446c8fa3e8983807b80 Mon Sep 17 00:00:00 2001 From: Jpeilx Date: Sat, 9 Mar 2024 19:12:48 +0200 Subject: [PATCH] -fix Play , pause and stop Icon alignment after resizing -customize playpausebuttom loading color --- lib/src/voice_message_view.dart | 5 +++++ lib/src/widgets/loading_widget.dart | 10 ++++++---- lib/src/widgets/play_pause_button.dart | 5 +++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/src/voice_message_view.dart b/lib/src/voice_message_view.dart index f2f8b74..72b5a68 100644 --- a/lib/src/voice_message_view.dart +++ b/lib/src/voice_message_view.dart @@ -48,6 +48,7 @@ class VoiceMessageView extends StatelessWidget { fontSize: 11, fontWeight: FontWeight.w500, ), + this.playPauseButtonLoadingColor = Colors.white }) : super(key: key); /// The controller for the voice message view. @@ -95,6 +96,9 @@ class VoiceMessageView extends StatelessWidget { /// The play Decoration of the play/pause button. final Decoration? playPauseButtonDecoration; + /// The loading Color of the play/pause button. + final Color playPauseButtonLoadingColor ; + @override /// Build voice message view. @@ -127,6 +131,7 @@ class VoiceMessageView extends StatelessWidget { PlayPauseButton( controller: controller, color: color, + loadingColor: playPauseButtonLoadingColor, size: size, refreshIcon: refreshIcon, pauseIcon: pauseIcon, diff --git a/lib/src/widgets/loading_widget.dart b/lib/src/widgets/loading_widget.dart index 1b7bc29..34ee74b 100644 --- a/lib/src/widgets/loading_widget.dart +++ b/lib/src/widgets/loading_widget.dart @@ -4,12 +4,14 @@ class LoadingWidget extends StatefulWidget { final double? progress; final Function onClose; final Widget stopDownloadingIcon ; + final Color loadingColor ; const LoadingWidget({ Key? key, required this.progress, required this.onClose, required this.stopDownloadingIcon, + required this.loadingColor }) : super(key: key); @override @@ -43,7 +45,7 @@ class _LoadingWidgetState extends State padding: const EdgeInsets.all(4.0), child: CircularProgressIndicator( strokeWidth: 2, - color: Colors.white, + color: widget.loadingColor, value: widget.progress ?? 0, ), ), @@ -51,9 +53,9 @@ class _LoadingWidgetState extends State }, ), Positioned( - child: IconButton( - icon: widget.stopDownloadingIcon , - onPressed: () => widget.onClose(), + child: InkWell( + child: widget.stopDownloadingIcon , + onTap: () => widget.onClose(), ), ), ], diff --git a/lib/src/widgets/play_pause_button.dart b/lib/src/widgets/play_pause_button.dart index 3bb3a93..8d9cf35 100644 --- a/lib/src/widgets/play_pause_button.dart +++ b/lib/src/widgets/play_pause_button.dart @@ -15,6 +15,7 @@ class PlayPauseButton extends StatelessWidget { required this.pauseIcon, required this.refreshIcon , required this.stopDownloadingIcon , + required this.loadingColor , this.buttonDecoration , }); @@ -39,6 +40,9 @@ class PlayPauseButton extends StatelessWidget { /// The button stop Downloading Icon final Widget stopDownloadingIcon; + /// The button Loading Color + final Color loadingColor ; + /// The button (container) decoration final Decoration ? buttonDecoration ; @@ -61,6 +65,7 @@ class PlayPauseButton extends StatelessWidget { child: controller.isDownloading ? LoadingWidget( progress: controller.downloadProgress, + loadingColor: loadingColor, onClose: () { controller.cancelDownload(); },