123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- import 'package:flutter/material.dart';
- import 'package:fis_ui/base_define/page.dart';
- import 'package:get/get.dart';
- import '../index.dart';
- import 'widgets.dart';
- /// 扬声器检测
- class SpeakerDetection extends GetView<HardwareDetectionController>
- implements FPage {
- SpeakerDetection({Key? key}) : super(key: key);
- @override
- String get pageName => "device_detection";
- final smallTitleStyle = TextStyle(
- fontSize: 14,
- fontWeight: FontWeight.bold,
- height: 1,
- );
- /// 副标题行高:[摄像头]、[麦克风]、[扬声器]
- static const _subTitleRowHright = 30.0;
- @override
- Widget build(BuildContext context) {
- return Row(
- children: [
- Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- height: _subTitleRowHright,
- width: 250,
- child: Row(
- children: [
- Text("扬声器", style: smallTitleStyle),
- SizedBox(width: 10),
- Obx(() {
- if (controller.state.speakerAvailable == null)
- return Container();
- return controller.state.speakerAvailable!
- ? CommonWidgets.deviceAvailableTip()
- : CommonWidgets.deviceUnavailableTip();
- }),
- Expanded(child: Container()),
- InkWell(
- onTap: controller.refreshSpeakerList,
- child: Icon(
- Icons.refresh,
- size: 18,
- ),
- )
- ],
- ),
- ),
- _speakerSelector(),
- ],
- ),
- SizedBox(width: 20),
- DetectButton(
- deviceType: HardwareDeviceType.speaker,
- subTitleRowHright: _subTitleRowHright,
- ),
- ],
- );
- }
- /// 扬声器选择器
- Widget _speakerSelector() {
- return Obx(
- () {
- List<HardwareDevice> source = controller.state.speakerList;
- bool noSpeaker = source.isEmpty;
- return noSpeaker
- ? Container(
- width: 250,
- height: 30,
- child: Center(
- child: CommonWidgets.deviceNotFoundTip(),
- ),
- )
- : Container(
- height: 30,
- width: 250,
- child: Row(
- children: [
- Expanded(
- child: Tooltip(
- message: "${source.first.name}",
- child: Center(
- child: Text(
- source.first.name,
- style: TextStyle(
- fontSize: 14,
- color: Colors.black,
- ),
- overflow: TextOverflow.ellipsis,
- ),
- ),
- ),
- ),
- ],
- ),
- );
- },
- );
- }
- }
|