scanDocument method
Implementation
@override
Future<bool> scanDocument(DocumentScannerConfiguration scanConfig) {
var dataToPass = <String, dynamic>{
'allowCaptureModeSetting': scanConfig.allowCaptureModeSetting,
'autoCapture': scanConfig.autoCapture,
'defaultScanFilter': scanConfig.defaultScanFilter.value,
'allowPageRotation': scanConfig.pageEditConfig.allowPageRotation,
'allowPageFilter': scanConfig.pageEditConfig.allowPageFilter,
'allowPageArrangement': scanConfig.pageEditConfig.allowPageArrangement,
'allowPageCropping': scanConfig.pageEditConfig.allowPageCropping,
'pageArrangementShowDeleteButton':
scanConfig.pageEditConfig.pageArrangementShowDeleteButton,
'pageArrangementShowPageNumber':
scanConfig.pageEditConfig.pageArrangementShowPageNumber,
'onboardingImageSource': scanConfig.onboardingImageSource,
'source': scanConfig.source.index,
'sourceImages': scanConfig.sourceImages,
'autoCrop': scanConfig.autoCrop,
'multiPage': scanConfig.multiPage,
'preCaptureFocus': scanConfig.preCaptureFocus,
'colorPrimaryLight': scanConfig.colorConfig.colorPrimary?.item1.value,
'colorPrimaryDark': scanConfig.colorConfig.colorPrimary?.item2.value,
'colorSecondaryLight': scanConfig.colorConfig.colorSecondary?.item1.value,
'colorSecondaryDark': scanConfig.colorConfig.colorSecondary?.item2.value,
'colorOnSecondaryLight':
scanConfig.colorConfig.colorOnSecondary?.item1.value,
'colorOnSecondaryDark':
scanConfig.colorConfig.colorOnSecondary?.item2.value,
'colorScanButtonsLayoutBackgroundLight':
scanConfig.colorConfig.colorScanButtonsLayoutBackground?.item1.value,
'colorScanButtonsLayoutBackgroundDark':
scanConfig.colorConfig.colorScanButtonsLayoutBackground?.item2.value,
'colorScanButtonsForegroundLight':
scanConfig.colorConfig.colorScanButtonsForeground?.item1.value,
'colorScanButtonsForegroundDark':
scanConfig.colorConfig.colorScanButtonsForeground?.item2.value,
'colorScanPolygonLight':
scanConfig.colorConfig.colorScanPolygon?.item1.value,
'colorScanPolygonDark':
scanConfig.colorConfig.colorScanPolygon?.item2.value,
'colorBottomBarBackgroundLight':
scanConfig.colorConfig.colorBottomBarBackground?.item1.value,
'colorBottomBarBackgroundDark':
scanConfig.colorConfig.colorBottomBarBackground?.item2.value,
'colorBottomBarForegroundLight':
scanConfig.colorConfig.colorBottomBarForeground?.item1.value,
'colorBottomBarForegroundDark':
scanConfig.colorConfig.colorBottomBarForeground?.item2.value,
'colorTopBarBackgroundLight':
scanConfig.colorConfig.colorTopBarBackground?.item1.value,
'colorTopBarBackgroundDark':
scanConfig.colorConfig.colorTopBarBackground?.item2.value,
'colorTopBarForegroundLight':
scanConfig.colorConfig.colorTopBarForeground?.item1.value,
'colorTopBarForegroundDark':
scanConfig.colorConfig.colorTopBarForeground?.item2.value
};
return methodChannel
.invokeMethod<bool>('scanDocument', dataToPass)
.then<bool>((bool? value) => value ?? false);
}