|
| 1 | +--- |
| 2 | +layout: default-layout |
| 3 | +title: UI Customization (Foundational Edition) - Dynamsoft Barcode Reader Flutter Edition |
| 4 | +description: The UI customization guide for the foundational edition of Dynamsoft Barcode Reader Flutter. |
| 5 | +keywords: ui, customization, foundational, Flutter, barcode reader |
| 6 | +needAutoGenerateSidebar: true |
| 7 | +noTitleIndex: true |
| 8 | +--- |
| 9 | + |
| 10 | +# UI Customization Guide (Foundational Edition) |
| 11 | + |
| 12 | +One of the advantages of using the foundational edition of the Barcode Reader is that you can customize the UI however you see fit. In this guide we will walk through some of the ways in which you can customize the scanner UI using the Barcode Reader Foundational API. |
| 13 | + |
| 14 | +## Specifying a Scan Region |
| 15 | + |
| 16 | +Use the [`setScanRegion`]({{ site.dce_flutter_api }}camera-enhancer.html#setscanregion) method to limit the scan area: |
| 17 | + |
| 18 | +```js |
| 19 | +let scanRegion = { |
| 20 | + top: 0.35, |
| 21 | + bottom: 0.65, |
| 22 | + left: 0.15, |
| 23 | + right: 0.85, |
| 24 | + measuredInPercentage: true |
| 25 | +} |
| 26 | +camera.setScanRegion(scanRegion); |
| 27 | +``` |
| 28 | + |
| 29 | +The scan region is displayed with a mask by default. To hide it, set [`scanRegionMaskVisible`]({{ site.dce_flutter_api }}camera-view.html#scanregionmaskvisible) to `false`. |
| 30 | + |
| 31 | +## Customizing the Camera View |
| 32 | + |
| 33 | +Customizable UI elements on the CameraView include: |
| 34 | + |
| 35 | +- `cameraToggleButton`: A button for switching between front and back facing cameras. |
| 36 | +- `scanLaser`: A vertical laser that moves within the scan region. |
| 37 | +- `scanRegionMask`: A mask covered outside the scan region. |
| 38 | +- `torchButton`: A button for switching on and off the torch. |
| 39 | + |
| 40 | +**Code Snippet** |
| 41 | + |
| 42 | +```js |
| 43 | +<SafeAreaView style={StyleSheet.absoluteFill}> |
| 44 | + <CameraView |
| 45 | + style={StyleSheet.absoluteFill} |
| 46 | + ref={cameraView} |
| 47 | + // Add a camera toggle button with default position and image. |
| 48 | + cameraToggleButtonVisible={true} |
| 49 | + // Display the scan laser. |
| 50 | + scanLaserVisible={true} |
| 51 | + // Scan region mask is displayed by default if you set a scan region. |
| 52 | + scanRegionMaskVisible={true} |
| 53 | + // Add a torch button with default position and image. |
| 54 | + torchButtonVisible={true} |
| 55 | + /> |
| 56 | +</SafeAreaView> |
| 57 | +``` |
0 commit comments