Skip to content

Commit

Permalink
-fix Play , pause and stop Icon alignment after resizing -customize p…
Browse files Browse the repository at this point in the history
…laypausebuttom loading color
  • Loading branch information
Jpeilx committed Mar 9, 2024
1 parent d338893 commit 725c396
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
5 changes: 5 additions & 0 deletions lib/src/voice_message_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -127,6 +131,7 @@ class VoiceMessageView extends StatelessWidget {
PlayPauseButton(
controller: controller,
color: color,
loadingColor: playPauseButtonLoadingColor,
size: size,
refreshIcon: refreshIcon,
pauseIcon: pauseIcon,
Expand Down
10 changes: 6 additions & 4 deletions lib/src/widgets/loading_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -43,17 +45,17 @@ class _LoadingWidgetState extends State<LoadingWidget>
padding: const EdgeInsets.all(4.0),
child: CircularProgressIndicator(
strokeWidth: 2,
color: Colors.white,
color: widget.loadingColor,
value: widget.progress ?? 0,
),
),
);
},
),
Positioned(
child: IconButton(
icon: widget.stopDownloadingIcon ,
onPressed: () => widget.onClose(),
child: InkWell(
child: widget.stopDownloadingIcon ,
onTap: () => widget.onClose(),
),
),
],
Expand Down
5 changes: 5 additions & 0 deletions lib/src/widgets/play_pause_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class PlayPauseButton extends StatelessWidget {
required this.pauseIcon,
required this.refreshIcon ,
required this.stopDownloadingIcon ,
required this.loadingColor ,
this.buttonDecoration ,
});

Expand All @@ -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 ;
Expand All @@ -61,6 +65,7 @@ class PlayPauseButton extends StatelessWidget {
child: controller.isDownloading
? LoadingWidget(
progress: controller.downloadProgress,
loadingColor: loadingColor,
onClose: () {
controller.cancelDownload();
},
Expand Down

0 comments on commit 725c396

Please sign in to comment.