xLayout_Builder_AudioArea method

Widget xLayout_Builder_AudioArea(
  1. XMediaItem? audio,
  2. bool isPreview
)

Override per cambiare il Widget per la visualizzazione degli Audio nella Lista degli XMedia

Implementation

Widget xLayout_Builder_AudioArea(XMediaItem? audio, bool isPreview) {
  if (playerController.waveformData.isEmpty) {
    isPreview ? _preparePlayer_WhenInPreview(audio!) : _preparePlayer(audio!);
  }
  return Align(
      alignment: Alignment.centerLeft,
      child: Container(
          padding: EdgeInsets.only(bottom: 6, right: 10, top: 6),
          margin: EdgeInsets.symmetric(vertical: 8, horizontal: 12),
          decoration: BoxDecoration(
            borderRadius: BorderRadius.circular(10),
            color: Color(0xFF343145),
          ),
          child: Row(mainAxisSize: MainAxisSize.min, children: [
            // if (!controller.playerState.isStopped)
            IconButton(
                onPressed: () async {
                  if (playerController.playerState.isPlaying.not())
                    await playerController.startPlayer(finishMode: FinishMode.pause);
                  else
                    await playerController.pausePlayer();
                },
                icon: Icon(playerController.playerState.isPlaying ? Icons.stop : Icons.play_arrow),
                color: Colors.white,
                splashColor: Colors.transparent,
                highlightColor: Colors.transparent),
            Expanded(
                child: AudioFileWaveforms(
              size: Size(MediaQuery.of(context).size.width / 2, 70),
              playerController: playerController,
              enableSeekGesture: true,
              waveformType: WaveformType.fitWidth,
              playerWaveStyle: PlayerWaveStyle(
                fixedWaveColor: Colors.white54,
                liveWaveColor: Colors.blueAccent,
                spacing: 6,
                showBottom: true,
                showSeekLine: true,
                showTop: true,
              ),
            ))
          ])));
}