12345678910111213141516171819202122232425262728293031323334353637 |
- import 'package:camera/camera.dart';
- import 'package:flutter/material.dart';
- import 'package:get/get.dart';
- import '../index.dart';
- import 'widgets.dart';
- /// 摄像头预览
- class CameraUI extends GetView<HardwareDetectionController> {
- @override
- Widget build(BuildContext context) {
- return Obx(
- () {
- if (controller.state.cameraList.isEmpty) {
- return Container();
- }
- return ExpandableContainer(
- expanded: controller.state.isDisplayCameraWindow,
- child: controller.state.isDisplayCameraWindow
- ? CameraPreview(controller.cameraController)
- : Container(
- decoration: BoxDecoration(
- border: Border.all(color: Colors.grey[300]!),
- borderRadius: BorderRadius.circular(5),
- color: Colors.grey[200],
- ),
- child: Center(
- child: Icon(
- Icons.photo_camera_outlined,
- color: Colors.black54,
- ),
- ),
- ),
- );
- },
- );
- }
- }
|