12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- import 'dart:io';
- import 'package:flutter/material.dart';
- import 'package:get/get.dart';
- import '../index.dart';
- class ImageDetectingDialog extends GetView<FacialRecognitionController> {
- const ImageDetectingDialog({Key? key}) : super(key: key);
- @override
- Widget build(BuildContext context) {
- return Obx(
- () {
- if (controller.state.processingImageLocalPath.isEmpty) {
- return Container();
- }
- // 是否需要左右翻转
- final needMirror = controller.state.isUsingFrontCamera;
- return Center(
- child: Stack(
- children: [
- ModalBarrier(
- color: Colors.black.withOpacity(0.5),
- dismissible: false,
- ),
- Center(
- child: Container(
- width: 850,
- height: 600,
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(10),
- ),
- clipBehavior: Clip.antiAlias,
- padding: const EdgeInsets.all(40),
- child: Column(
- children: [
- Stack(
- children: [
- Center(
- child: Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(10),
- ),
- clipBehavior: Clip.antiAlias,
- child: Transform(
- alignment: Alignment.center,
- transform: Matrix4.rotationY(
- needMirror ? 3.1415926 : 0),
- child: Image(
- image: FileImage(
- File(controller
- .state.processingImageLocalPath),
- ),
- fit: BoxFit.cover,
- ),
- ),
- ),
- ),
- ],
- ),
- const SizedBox(height: 40),
- Expanded(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: const [
- SizedBox(
- height: 20,
- width: 20,
- child: CircularProgressIndicator(
- valueColor:
- AlwaysStoppedAnimation<Color>(Colors.blue),
- ),
- ),
- SizedBox(
- width: 20,
- ),
- Text(
- '人脸信息识别中,请稍后...',
- style: TextStyle(
- fontSize: 16, color: Colors.black54),
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- ),
- // 旋转的 loading
- ],
- ),
- );
- },
- );
- }
- }
|