Line data Source code
1 : import 'package:unico_check/src/unico/adapter/api/unico.check.builder.dart'; 2 : import 'package:unico_check/src/unico/adapter/api/unico.check.camera.opener.default.dart'; 3 : import 'package:unico_check/src/unico/adapter/api/unico.listener.dart'; 4 : import 'package:unico_check/src/unico/di/injection.dart'; 5 : import 'package:unico_check/src/unico/di/module.dart'; 6 : import 'package:unico_check/src/unico/domain/entities/camera_opener/camera.opener.config.entity.dart'; 7 : import 'package:unico_check/src/unico/domain/entities/unico.config.dart'; 8 : import 'package:unico_check/src/unico/domain/entities/unico.theme.dart'; 9 : 10 : import 'unico.check.camera.opener.dart'; 11 : 12 : ///Unico camera builder 13 : class UnicoCheck extends UnicoCheckBuilder { 14 : UnicoTheme _unicoTheme = UnicoTheme(); 15 : 16 2 : UnicoTheme get unicoTheme => _unicoTheme; 17 : 18 : bool _autoCapture = true; 19 : 20 2 : bool get autoCapture => _autoCapture; 21 : 22 : bool _smartFrame = true; 23 : 24 2 : bool get smartFrame => _smartFrame; 25 : 26 : double _timeoutSession = 45; 27 : 28 2 : double get timeoutSession => _timeoutSession; 29 : 30 : /// Return the camera callback 31 : final UnicoListener listener; 32 : 33 : /// Set credentials of IOS platform 34 : final UnicoConfig unicoConfigIos; 35 : 36 : /// Set credentials of Android platform 37 : final UnicoConfig unicoConfigAndroid; 38 : 39 1 : UnicoCheck( 40 : {required this.listener, 41 : required this.unicoConfigAndroid, 42 : required this.unicoConfigIos}) { 43 1 : Module.initDependencies(); 44 : } 45 : 46 1 : @override 47 : UnicoCheckCameraOpener build() { 48 1 : final cameraOpenerConfig = CameraOpenerConfigEntity( 49 1 : unicoTheme: _unicoTheme, 50 1 : autoCapture: _autoCapture, 51 1 : smartFrame: _smartFrame, 52 1 : timeoutSession: _timeoutSession, 53 1 : unicoConfigAndroid: unicoConfigAndroid, 54 1 : unicoConfigIos: unicoConfigIos, 55 1 : unicoListener: listener, 56 : ); 57 1 : return UnicoCheckCameraOpenerDefault( 58 2 : openCameraUseCase: Injection.I.get(), 59 2 : openCameraRequest: Injection.I.get(), 60 : cameraOpenerConfig: cameraOpenerConfig, 61 2 : unicoCallBackUseCase: Injection.I.get(), 62 2 : openCheckCameraFactory: Injection.I.get(), 63 : ); 64 : } 65 : 66 1 : @override 67 : UnicoCheckBuilder setAutoCapture({required bool autoCapture}) { 68 1 : _autoCapture = autoCapture; 69 : return this; 70 : } 71 : 72 1 : @override 73 : UnicoCheckBuilder setSmartFrame({required bool smartFrame}) { 74 1 : _smartFrame = smartFrame; 75 : return this; 76 : } 77 : 78 1 : @override 79 : UnicoCheckBuilder setTheme({required UnicoTheme unicoTheme}) { 80 1 : _unicoTheme = unicoTheme; 81 : return this; 82 : } 83 : 84 1 : @override 85 : UnicoCheckBuilder setTimeoutSession({required double timeoutSession}) { 86 1 : _timeoutSession = timeoutSession; 87 : return this; 88 : } 89 : }