import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../index.dart';

class CameraForFace extends GetView<IdCardScanController> {
  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: Container(
            child: _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,
      ),
    );
  }
}
