image_detecting_dialog.dart 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. import 'dart:io';
  2. import 'package:flutter/material.dart';
  3. import 'package:get/get.dart';
  4. import 'package:vitalapp/global.dart';
  5. import '../index.dart';
  6. class ImageDetectingDialog extends GetView<IdCardScanController> {
  7. const ImageDetectingDialog({Key? key}) : super(key: key);
  8. @override
  9. Widget build(BuildContext context) {
  10. return Obx(
  11. () {
  12. if (controller.state.processingImageLocalPath.isEmpty) {
  13. return Container();
  14. }
  15. return Center(
  16. child: Stack(
  17. children: [
  18. ModalBarrier(
  19. color: Colors.black.withOpacity(0.5),
  20. dismissible: false,
  21. ),
  22. Center(
  23. child: Container(
  24. width: 850,
  25. height: 600,
  26. decoration: BoxDecoration(
  27. color: Colors.white,
  28. borderRadius: BorderRadius.circular(10),
  29. ),
  30. clipBehavior: Clip.antiAlias,
  31. padding: const EdgeInsets.all(40),
  32. child: Column(
  33. children: [
  34. Stack(
  35. children: [
  36. Center(
  37. child: Container(
  38. decoration: BoxDecoration(
  39. borderRadius: BorderRadius.circular(10),
  40. ),
  41. clipBehavior: Clip.antiAlias,
  42. child: Image(
  43. image: FileImage(
  44. // kIsOnline ||
  45. // controller.state
  46. // .processingImageUint8List ==
  47. // null
  48. // ?
  49. File(controller
  50. .state.processingImageLocalPath)
  51. // : File.fromRawPath(controller
  52. // .state.processingImageUint8List!),
  53. ),
  54. fit: BoxFit.cover,
  55. ),
  56. ),
  57. ),
  58. ],
  59. ),
  60. const SizedBox(height: 40),
  61. Expanded(
  62. child: Row(
  63. mainAxisAlignment: MainAxisAlignment.center,
  64. children: const [
  65. SizedBox(
  66. height: 20,
  67. width: 20,
  68. child: CircularProgressIndicator(
  69. valueColor:
  70. AlwaysStoppedAnimation<Color>(Colors.blue),
  71. ),
  72. ),
  73. SizedBox(
  74. width: 20,
  75. ),
  76. Text(
  77. '身份证信息识别中,请稍后...',
  78. style: TextStyle(
  79. fontSize: 16, color: Colors.black54),
  80. ),
  81. ],
  82. ),
  83. ),
  84. ],
  85. ),
  86. ),
  87. ),
  88. // 旋转的 loading
  89. ],
  90. ),
  91. );
  92. },
  93. );
  94. }
  95. }