import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../index.dart';
import 'speaker_wave.dart';

class SpeakerUI extends GetView<HardwareDetectionController> {
  final double fontsize;
  SpeakerUI({Key? key, this.fontsize = 16.0}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Obx(() {
      if (controller.state.speakerList.isEmpty) {
        return Container();
      }
      return controller.state.isDisplaySpeakerWave
          ? SpeakerWave(
              audioPlayer: controller.flutterSound,
              isPlaying: controller.state.detectingSpeaker,
              width: 300.0,
              height: 40.0,
              fontsize: fontsize,
            )
          : Container();
    });
  }
}
