123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- import 'package:flutter/material.dart';
- import 'package:get/get.dart';
- import '../index.dart';
- class CameraForFace extends GetView<FacialRecognitionController> {
- const CameraForFace({Key? key}) : super(key: key);
- @override
- Widget build(BuildContext context) {
- return Stack(
- children: <Widget>[
- // Align(
- // alignment: Alignment.center,
- // child: OverflowBox(
- // maxHeight: 2000,
- // maxWidth: 2000,
- // child: Container(
- // decoration: BoxDecoration(
- // border: Border.all(
- // color: const Color.fromARGB(80, 0, 0, 0),
- // width: 500,
- // strokeAlign: BorderSide.strokeAlignOutside,
- // ),
- // borderRadius: BorderRadius.circular(50),
- // ),
- // margin: const EdgeInsets.only(bottom: 110),
- // child: const SizedBox(
- // width: 465,
- // height: 430,
- // ),
- // ),
- // ),
- // ),
- Align(
- alignment: Alignment.center,
- child: Container(
- margin: const EdgeInsets.only(top: 80),
- child: const Image(
- image: AssetImage('assets/images/face_rec.png'),
- width: 800,
- ),
- ),
- ),
- Align(
- alignment: Alignment.centerRight,
- child: Obx(() => Container(
- child: controller.state.isRunningFaceRecognition
- ? _recognizing()
- : _captureButton(),
- )),
- ),
- Align(
- alignment: Alignment.bottomCenter,
- child: Container(
- padding: const EdgeInsets.only(bottom: 40),
- child: const Text(
- '请将面部保持在识别框内,并确保面部清晰可见,然后按下识别键',
- style: TextStyle(color: Colors.white, fontSize: 22),
- ),
- ),
- ),
- ],
- );
- }
- /// 拍照按钮
- Widget _captureButton() {
- return Container(
- margin: const EdgeInsets.only(right: 60),
- width: 100,
- height: 100,
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(50),
- ),
- child: IconButton(
- icon: const Icon(Icons.sensor_occupied, size: 50),
- color: Colors.blue,
- onPressed: controller.onCaptureFaceButtonPressed,
- ),
- );
- }
- /// 识别中状态标识
- Widget _recognizing() {
- return Container(
- margin: const EdgeInsets.only(right: 60),
- width: 100,
- height: 100,
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(50),
- ),
- child: const Center(
- child: CircularProgressIndicator(
- color: Colors.blue,
- ),
- ),
- );
- }
- }
|