Skip to content

Commit

Permalink
Adding customization option for stop donwloading icon for PlayPause b…
Browse files Browse the repository at this point in the history
…otton
  • Loading branch information
Jpeilx committed Mar 3, 2024
1 parent 0eb06e4 commit d338893
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 13 deletions.
41 changes: 32 additions & 9 deletions lib/src/voice_message_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,23 @@ class VoiceMessageView extends StatelessWidget {
this.innerPadding = 12,
this.cornerRadius = 20,
this.size = 38,
this.refreshIcon = const Icon( Icons.refresh , color: Colors.white,) ,
this.pauseIcon = const Icon( Icons.pause_rounded , color: Colors.white,) ,
this.playIcon = const Icon( Icons.play_arrow_rounded, color: Colors.white,) ,
this.playPauseButtonDecoration ,
this.refreshIcon = const Icon(
Icons.refresh,
color: Colors.white,
),
this.pauseIcon = const Icon(
Icons.pause_rounded,
color: Colors.white,
),
this.playIcon = const Icon(
Icons.play_arrow_rounded,
color: Colors.white,
),
this.stopDownloadingIcon = const Icon(
Icons.close,
color: Colors.white,
),
this.playPauseButtonDecoration,
this.circlesTextStyle = const TextStyle(
color: Colors.white,
fontSize: 10,
Expand Down Expand Up @@ -75,11 +88,12 @@ class VoiceMessageView extends StatelessWidget {

/// The play icon of the play/pause button.
final Widget playIcon;

/// The play Decoration of the play/pause button.
final Decoration ? playPauseButtonDecoration ;


/// The stop downloading icon of the play/pause button.
final Widget stopDownloadingIcon;

/// The play Decoration of the play/pause button.
final Decoration? playPauseButtonDecoration;

@override

Expand Down Expand Up @@ -110,7 +124,16 @@ class VoiceMessageView extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
/// play pause button
PlayPauseButton(controller: controller, color: color, size: size , refreshIcon: refreshIcon, pauseIcon: pauseIcon, playIcon: playIcon, buttonDecoration: playPauseButtonDecoration,),
PlayPauseButton(
controller: controller,
color: color,
size: size,
refreshIcon: refreshIcon,
pauseIcon: pauseIcon,
playIcon: playIcon,
stopDownloadingIcon: stopDownloadingIcon,
buttonDecoration: playPauseButtonDecoration,
),

///
const SizedBox(width: 10),
Expand Down
7 changes: 3 additions & 4 deletions lib/src/widgets/loading_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import 'package:flutter/material.dart';
class LoadingWidget extends StatefulWidget {
final double? progress;
final Function onClose;
final Widget stopDownloadingIcon ;

const LoadingWidget({
Key? key,
required this.progress,
required this.onClose,
required this.stopDownloadingIcon,
}) : super(key: key);

@override
Expand Down Expand Up @@ -50,10 +52,7 @@ class _LoadingWidgetState extends State<LoadingWidget>
),
Positioned(
child: IconButton(
icon: const Icon(
Icons.close,
color: Colors.white,
),
icon: widget.stopDownloadingIcon ,
onPressed: () => widget.onClose(),
),
),
Expand Down
6 changes: 6 additions & 0 deletions lib/src/widgets/play_pause_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class PlayPauseButton extends StatelessWidget {
required this.playIcon,
required this.pauseIcon,
required this.refreshIcon ,
required this.stopDownloadingIcon ,
this.buttonDecoration ,
});

Expand All @@ -34,6 +35,10 @@ class PlayPauseButton extends StatelessWidget {

/// The button pause Icon
final Widget refreshIcon;

/// The button stop Downloading Icon
final Widget stopDownloadingIcon;


/// The button (container) decoration
final Decoration ? buttonDecoration ;
Expand All @@ -59,6 +64,7 @@ class PlayPauseButton extends StatelessWidget {
onClose: () {
controller.cancelDownload();
},
stopDownloadingIcon: stopDownloadingIcon,
)
:

Expand Down

0 comments on commit d338893

Please sign in to comment.