|
@@ -1,4 +1,3 @@
|
|
|
-import 'package:camera/camera.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:get/get.dart';
|
|
|
import '../index.dart';
|
|
@@ -10,14 +9,6 @@ class CameraForIdCard extends GetView<FacialRecognitionController> {
|
|
|
Widget build(BuildContext context) {
|
|
|
return Stack(
|
|
|
children: <Widget>[
|
|
|
- Center(
|
|
|
- child: Container(
|
|
|
- color: Colors.black,
|
|
|
- child: Center(
|
|
|
- child: _cameraPreviewWidget(),
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
Align(
|
|
|
alignment: Alignment.center,
|
|
|
child: OverflowBox(
|
|
@@ -42,18 +33,15 @@ class CameraForIdCard extends GetView<FacialRecognitionController> {
|
|
|
),
|
|
|
Align(
|
|
|
alignment: Alignment.centerRight,
|
|
|
- child: Container(
|
|
|
- padding: const EdgeInsets.only(bottom: 20),
|
|
|
- child: _captureButton(),
|
|
|
- ),
|
|
|
+ child: _captureButton(),
|
|
|
),
|
|
|
Align(
|
|
|
alignment: Alignment.bottomCenter,
|
|
|
child: Container(
|
|
|
- padding: const EdgeInsets.only(bottom: 50),
|
|
|
+ padding: const EdgeInsets.only(bottom: 70),
|
|
|
child: const Text(
|
|
|
- '请将身份证置于虚线框内,并确保图像清晰可见,然后按下拍摄键',
|
|
|
- style: TextStyle(color: Colors.white, fontSize: 26),
|
|
|
+ '请将身份证(人像面)置于虚线框内,并确保图像清晰可见,然后按下拍摄键',
|
|
|
+ style: TextStyle(color: Colors.white, fontSize: 22),
|
|
|
),
|
|
|
),
|
|
|
),
|
|
@@ -61,39 +49,9 @@ class CameraForIdCard extends GetView<FacialRecognitionController> {
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- /// Display the preview from the camera (or a message if the preview is not available).
|
|
|
- Widget _cameraPreviewWidget() {
|
|
|
- final CameraController? cameraController = controller.kCameraController;
|
|
|
-
|
|
|
- if (cameraController == null || !cameraController.value.isInitialized) {
|
|
|
- /// 旋转loading
|
|
|
- return const Center(
|
|
|
- child: CircularProgressIndicator(),
|
|
|
- );
|
|
|
- } else {
|
|
|
- return Listener(
|
|
|
- onPointerDown: (_) => controller.pointers++,
|
|
|
- onPointerUp: (_) => controller.pointers--,
|
|
|
- child: CameraPreview(
|
|
|
- cameraController,
|
|
|
- child: LayoutBuilder(
|
|
|
- builder: (BuildContext context, BoxConstraints constraints) {
|
|
|
- return GestureDetector(
|
|
|
- behavior: HitTestBehavior.opaque,
|
|
|
- onScaleStart: controller.handleScaleStart,
|
|
|
- onScaleUpdate: controller.handleScaleUpdate,
|
|
|
- onTapDown: (TapDownDetails details) =>
|
|
|
- controller.onViewFinderTap(details, constraints),
|
|
|
- );
|
|
|
- }),
|
|
|
- ),
|
|
|
- );
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
Widget _captureButton() {
|
|
|
return Container(
|
|
|
- margin: const EdgeInsets.only(right: 30),
|
|
|
+ margin: const EdgeInsets.only(right: 60),
|
|
|
width: 100,
|
|
|
height: 100,
|
|
|
decoration: BoxDecoration(
|
|
@@ -101,9 +59,9 @@ class CameraForIdCard extends GetView<FacialRecognitionController> {
|
|
|
borderRadius: BorderRadius.circular(50),
|
|
|
),
|
|
|
child: IconButton(
|
|
|
- icon: const Icon(Icons.camera_alt, size: 30),
|
|
|
+ icon: const Icon(Icons.camera_alt, size: 40),
|
|
|
color: Colors.blue,
|
|
|
- onPressed: controller.onTakePictureButtonPressed,
|
|
|
+ onPressed: controller.onCaptureIdCardButtonPressed,
|
|
|
),
|
|
|
);
|
|
|
}
|