Skip to content

Commit 1c1018c

Browse files
update to internal commit 460c0c40
1 parent 1ea284a commit 1c1018c

File tree

3 files changed

+63
-13
lines changed

3 files changed

+63
-13
lines changed

_includes/sidelist-programming/programming-flutter.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
<li lang="flutter"><a href="{{ site.dbr_flutter_api }}capture-vision-router-lite/camera-enhancer.html" class="otherLinkColour">CameraEnhancer</a></li>
4444
<li lang="flutter"><a href="{{ site.dbr_flutter_api }}capture-vision-router-lite/camera-view.html" class="otherLinkColour">CameraView</a></li>
4545
<li lang="flutter"><a href="{{ site.dbr_flutter_api }}capture-vision-router-lite/torch-button.html" class="otherLinkColour">TorchButton</a></li>
46+
<li lang="flutter"><a href="{{ site.dbr_flutter_api }}capture-vision-router-lite/feedback.html" class="otherLinkColour">FeedBack</a></li>
4647
<li lang="flutter"><a href="{{ site.dbr_flutter_api }}capture-vision-router-lite/license-manager.html" class="otherLinkColour">LicenseManager</a></li>
4748
<li lang="flutter"><a href="{{ site.dbr_flutter_api }}capture-vision-router-lite/parsed-result.html" class="otherLinkColour">ParsedResult</a></li>
4849
<li lang="flutter"><a href="{{ site.dbr_flutter_api }}capture-vision-router-lite/parsed-result-item.html" class="otherLinkColour">ParsedResultItem</a></li>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
layout: default-layout
3+
title: FeedBack Class - Dynamsoft Capture Vision Flutter
4+
description: FeedBack class of DCV Flutter provides API to control the haptic feedback features of a phone.
5+
keywords: haptic, feedback, barcode reader, flutter, capture vision
6+
needGenerateH3Content: true
7+
needAutoGenerateSidebar: true
8+
noTitleIndex: true
9+
---
10+
11+
# FeedBack
12+
13+
The `FeedBack` class allows you to control the haptic feedback features so that the phone can either beep or vibrate when a result is found.
14+
15+
## Definition
16+
17+
*Assembly:* dynamsoft_capture_vision_flutter
18+
19+
```dart
20+
class FeedBack
21+
```
22+
23+
## Methods
24+
25+
### beep
26+
27+
Plays a beep sound when a captured result is found.
28+
29+
```dart
30+
Future<void> beep()
31+
```
32+
33+
### vibrate
34+
35+
Triggers a vibration when a captured result is found.
36+
37+
```dart
38+
Future<void> vibrate()
39+
```
40+
41+
**Code Snippet**
42+
43+
```dart
44+
late final CapturedResultReceiver _receiver = CapturedResultReceiver()
45+
..onDecodedBarcodesReceived = (DecodedBarcodesResult result) async {
46+
if (result.items?.isNotEmpty ?? false) {
47+
FeedBack.beep();
48+
FeedBack.vibrate();
49+
_cvr.stopCapturing();
50+
var displayString = result.items?.map((item) => "Format: ${item.formatString}\nText: ${item.text}").join('\n\n');
51+
showTextDialog("Barcodes Count: ${result.items?.length ?? 0}", displayString ?? "", () {
52+
_cvr.startCapturing(_templateName);
53+
});
54+
}
55+
};
56+
```

programming/flutter/foundational-user-guide.md

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -210,23 +210,16 @@ void initSettings() async {
210210
> [!NOTE]
211211
> To learn how to create your own JSON template, please refer to this [page](https://www.dynamsoft.com/barcode-reader/docs/core/programming/features/use-runtimesettings-or-templates.html?lang=objc,swift#json-template).
212212
213-
### Specify the Scan Region
213+
### UI Customization
214214

215-
You can also limit the scan region of the SDK so that it doesn't exhaust resources trying to read from the entire image or frame. In order to do this, we must use the [`setScanRegion`](api-reference/capture-vision-router-lite/camera-enhancer.md#setscanregion) method of the `CameraEnhancer` class.
215+
If you would like to learn more on how to customize the UI, please refer to the [UI Customization](explore-features/ui-customization.md) guide.
216216

217-
```dart
218-
import 'package:dynamsoft_capture_vision_flutter/dynamsoft_capture_vision_flutter.dart';
217+
### Enabling Haptic Feedback
219218

220-
final CameraEnhancer _camera = CameraEnhancer.instance;
219+
Another feature that the Barcode Reader library offers is the ability to trigger a couple of haptic feedback reactions once a barcode is found. This is done via the [`FeedBack`](api-reference/capture-vision-router-lite/feedback.md) class - and it should be called in the result callback function so that the haptic feedback occurs once a barcode is successfully decoded.
221220

222-
void initSdk() async {
223-
//......
224-
await _cvr.setInput(_camera);
225-
final scanRegion = DSRect(left: 0.1, top: 0.4, right: 0.9, bottom: 0.6, measuredInPercentage: true);
226-
_camera.setScanRegion(scanRegion);
227-
_camera.open();
228-
}
229-
```
221+
> [!NOTE]
222+
> To see how the FeedBack class should be implemented to trigger these haptic feedback reactions once a barcode is found, please visit the [`FeedBack` API](api-reference/capture-vision-router-lite/feedback.md) page.
230223
231224
## Run the Project
232225

0 commit comments

Comments
 (0)