image_detecting_dialog.dart 3.1 KB

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