microphone_ui.dart 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import 'package:flutter/material.dart';
  2. import 'package:get/get.dart';
  3. import '../index.dart';
  4. import 'widgets.dart';
  5. class MicrophoneUI extends GetView<HardwareDetectionController> {
  6. @override
  7. Widget build(BuildContext context) {
  8. return Obx(() {
  9. if (controller.state.microphoneList.isEmpty) {
  10. return Container();
  11. }
  12. return controller.state.isDisplayMicrophoneWave
  13. ? MicrophoneWave(
  14. isRecording: controller.state.detectingMicrophone,
  15. recorder: controller.flutterRecorder,
  16. onAutoDetectPass: () => controller.setMicrophoneAvailable(true),
  17. width: 250.0,
  18. height: 60.0,
  19. )
  20. : Container(
  21. width: 250,
  22. height: 60,
  23. child: Align(
  24. alignment: Alignment.centerLeft,
  25. child: Text(
  26. "麦克风输入:",
  27. style: TextStyle(
  28. height: 1,
  29. color: Colors.black87,
  30. ),
  31. ),
  32. ),
  33. );
  34. });
  35. }
  36. }