customerpulse_flutter 1.2.0
customerpulse_flutter: ^1.2.0 copied to clipboard
A Flutter plugin to integrate UAE customer pulse functionality.
CustomerPulse Flutter Plugin #
This repository provides the CustomerPulse Flutter Plugin for integrating UAE customer pulse functionality directly into your Flutter applications.
Features #
- Collect real-time user feedback.
- Easy integration with Flutter projects.
- Fully customizable feedback forms.
Installation #
-
Add the following dependency to your
pubspec.yaml:dependencies: customerpulse_flutter: ^1.2.0or use github link:
customerpulse_flutter: git: https://github.com/KalvadTech/CustomerPulse-flutter.git -
Install the package:
flutter pub get
Usage #
1. Import the Plugin #
import 'package:customerpulse_flutter/customerpulse_flutter.dart';
2. Full page survey #
Use the following code to display the survey form in a full page:
CustomerPulseFlutter().showSurveyPage(
context,
appId: 'com.kalvad.example',
linkOrToken: 'F/AH/'
);
3. Bottom sheet survey #
Use the following code to display the survey form in a bottom sheet:
CustomerPulseFlutter().showSurveyBottomSheet(
context,
appId: 'com.kalvad.example',
linkOrToken: 'F/AH/'
);
Parameters #
| Name | Type | Description | Default |
|---|---|---|---|
context |
BuildContext |
Widget context used for navigation | |
appId |
String |
Application ID provided by the Customer Pulse Survey provider | |
linkOrToken |
String |
Link ID or token provided by the Customer Pulse Survey provider | |
options |
Map<String, String> |
Options such as language (lang) for the survey |
Example Usage of options:
CustomerPulseFlutter().showSurveyPage(
context,
appId: 'com.kalvad.example',
linkOrToken: 'F/AH/',
options: {'lang': 'en'}
);
Survey events #
Both showSurveyPage and showSurveyBottomSheet accept three optional
lifecycle callbacks so the host app can react to the survey. They are fully
backward compatible — omitting them behaves exactly as before.
CustomerPulseFlutter().showSurveyPage(
context,
appId: 'com.kalvad.example',
linkOrToken: 'F/AH/',
onCompleted: () => debugPrint('Survey completed'),
onError: () => debugPrint('Survey error'),
onDismissed: () => debugPrint('Survey dismissed'),
);
| Callback | Type | Fires when |
|---|---|---|
onCompleted |
VoidCallback? |
The survey is submitted successfully. Fires once, then the survey closes. |
onError |
VoidCallback? |
The survey reports an error. The survey stays open (matches the native SDKs). |
onDismissed |
VoidCallback? |
The survey is closed without completing (drag-down, back/AppBar, barrier tap, or in-survey close). |
onDismissed fires exactly once and never after onCompleted.
Event mapping
The web survey emits string events through the Android JavaScript handler.
They map onto the callbacks as follows:
| Web event | Callback | Closes the survey? |
|---|---|---|
so-widget-completed |
onCompleted |
Yes |
so-widget-error |
onError |
No |
so-widget-closed |
onDismissed |
Yes |
open |
— | No (no-op) |
A user-driven dismiss (drag-down, back button, AppBar close, or barrier tap)
that does not emit so-widget-completed also fires onDismissed once.
Contributions #
We welcome contributions! Feel free to submit issues or pull requests with improvements or bug fixes.
License #
This project is licensed under the MIT License. See the LICENSE file for more details.