camera_for_id_card.dart 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import 'package:flutter/material.dart';
  2. import 'package:get/get.dart';
  3. import '../index.dart';
  4. class CameraForIdCard extends GetView<FacialRecognitionController> {
  5. const CameraForIdCard({Key? key}) : super(key: key);
  6. @override
  7. Widget build(BuildContext context) {
  8. return Stack(
  9. children: <Widget>[
  10. Align(
  11. alignment: Alignment.center,
  12. child: OverflowBox(
  13. maxHeight: 2000,
  14. maxWidth: 2000,
  15. child: Container(
  16. decoration: BoxDecoration(
  17. border: Border.all(
  18. color: const Color.fromARGB(90, 0, 0, 0),
  19. width: 400,
  20. strokeAlign: BorderSide.strokeAlignOutside,
  21. ),
  22. borderRadius: BorderRadius.circular(50),
  23. ),
  24. padding: const EdgeInsets.all(20),
  25. child: const Image(
  26. image: AssetImage('assets/images/id_card.png'),
  27. width: 600,
  28. ),
  29. ),
  30. ),
  31. ),
  32. Align(
  33. alignment: Alignment.centerRight,
  34. child: _captureButton(),
  35. ),
  36. Align(
  37. alignment: Alignment.bottomCenter,
  38. child: Container(
  39. padding: const EdgeInsets.only(bottom: 70),
  40. child: const Text(
  41. '请将身份证(人像面)置于虚线框内,并确保图像清晰可见,然后按下拍摄键',
  42. style: TextStyle(color: Colors.white, fontSize: 22),
  43. ),
  44. ),
  45. ),
  46. ],
  47. );
  48. }
  49. Widget _captureButton() {
  50. return Container(
  51. margin: const EdgeInsets.only(right: 60),
  52. width: 100,
  53. height: 100,
  54. decoration: BoxDecoration(
  55. color: Colors.white,
  56. borderRadius: BorderRadius.circular(50),
  57. ),
  58. child: IconButton(
  59. icon: const Icon(Icons.camera_alt, size: 40),
  60. color: Colors.blue,
  61. onPressed: controller.onCaptureIdCardButtonPressed,
  62. ),
  63. );
  64. }
  65. }