SoundPlayerUI.fromTrack constructor

SoundPlayerUI.fromTrack(
  1. Track track, {
  2. bool showTitle = false,
  3. bool enabled = true,
  4. AudioFocus audioFocus = AudioFocus.requestFocusAndKeepOthers,
  5. Color? backgroundColor,
  6. Color iconColor = Colors.black,
  7. Color disabledIconColor = Colors.grey,
  8. TextStyle? textStyle,
  9. TextStyle? titleStyle,
  10. SliderThemeData? sliderThemeData,
})

SoundPlayerUI.fromTrack Constructs a Playbar with a Track. track is the Track that contains the audio to play.

When the user clicks the play the audio held by the Track will be played. If showTitle is true (default is false) then the play bar will also display the track name and album (if set). If enabled is true (the default) then the Player will be enabled. If enabled is false then the player will be disabled and the user will not be able to click the play button. The audioFocus allows you to control what happens to other media that is playing when our player starts. By default we use 'AudioFocus.focusAndHushOthers` which will reduce the volume of any other players.

Implementation

SoundPlayerUI.fromTrack(
  Track track, {
  bool showTitle = false,
  bool enabled = true,
  AudioFocus audioFocus = AudioFocus.requestFocusAndKeepOthers,
  Color? backgroundColor,
  Color iconColor = Colors.black,
  Color disabledIconColor = Colors.grey,
  TextStyle? textStyle,
  TextStyle? titleStyle,
  SliderThemeData? sliderThemeData,
})  : _track = track,
      _showTitle = showTitle,
      _onLoad = null,
      _enabled = enabled,
      _backgroundColor = backgroundColor,
      _iconColor = iconColor,
      _disabledIconColor = disabledIconColor,
      _textStyle = textStyle,
      _titleStyle = titleStyle,
      _sliderThemeData = sliderThemeData;