build method

  1. @override
Widget build(
  1. BuildContext context
)
override

Build voice message view.

Implementation

@override

/// Build voice message view.
Widget build(BuildContext context) {
  final ThemeData theme = Theme.of(context);
  final color = circlesColor;
  final newTHeme = theme.copyWith(
    sliderTheme: SliderThemeData(
      trackShape: CustomTrackShape(),
      thumbShape: SliderComponentShape.noThumb,
      minThumbSeparation: 0,
    ),
    splashColor: Colors.transparent,
  );

  return Container(
    width: 160 + (controller.noiseCount * .72.w()),
    padding: EdgeInsets.all(innerPadding),
    decoration: BoxDecoration(
      color: backgroundColor,
      borderRadius: BorderRadius.circular(cornerRadius),
    ),
    child: ValueListenableBuilder(
      /// update ui when change play status
      valueListenable: controller.updater,
      builder: (context, value, child) {
        return Row(
          mainAxisSize: MainAxisSize.min,
          children: [
            /// play pause button
            PlayPauseButton(
              controller: controller,
              color: color,
              loadingColor: playPauseButtonLoadingColor,
              size: size,
              refreshIcon: refreshIcon,
              pauseIcon: pauseIcon,
              playIcon: playIcon,
              stopDownloadingIcon: stopDownloadingIcon,
              buttonDecoration: playPauseButtonDecoration,
            ),

            ///
            const SizedBox(width: 10),

            /// slider & noises
            Expanded(
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  const SizedBox(height: 8),
                  _noises(newTHeme),
                  const SizedBox(height: 4),
                  Text(controller.remindingTime, style: counterTextStyle),
                ],
              ),
            ),

            ///
            const SizedBox(width: 12),

            /// speed button
            _changeSpeedButton(color),

            ///
            const SizedBox(width: 10),
          ],
        );
      },
    ),
  );
}