helpshift_wrapper 0.0.1
helpshift_wrapper: ^0.0.1 copied to clipboard
Flutter plugin to integrate Helpshift Support SDK into your flutter app.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:helpshift_wrapper/helpshift_wrapper.dart';
import 'package:helpshift_wrapper_example/src/constants.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
setupHelpShiftSdk();
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
.then((_) {
runApp(const MyApp());
});
}
/// configure HelpShift SDK for Native Platforms
void setupHelpShiftSdk() async {
await HelpshiftWrapper.setUpHelpShiftSDK(
helpShiftApiKey: Constants.helpShiftApiKey(),
helpShiftAppId: Constants.helpShiftAppId(),
helpShiftDomain: Constants.helpShiftDomain,
);
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
backgroundColor: const Color.fromARGB(255, 250, 30, 0),
body: Center(
child: Column(
children: [
const SizedBox(
height: 100,
),
const SizedBox(
height: 10,
),
ElevatedButton(
onPressed: () {
HelpshiftWrapper.showAllConversation(
configMap: getConfigmap());
},
child: const Text('Show All Conversation'),
),
ElevatedButton(
onPressed: () {
HelpshiftWrapper.openFAQsScreen(configMap: getConfigmap());
},
child: const Text('FAQs'),
),
ElevatedButton(
onPressed: () {
HelpshiftWrapper.openSingleFAQScreen(
sectionId: "1", configMap: getConfigmap());
},
child: const Text('Order FAQs'),
),
ElevatedButton(
onPressed: () {
HelpshiftWrapper.openSingleFAQScreen(
sectionId: "2", configMap: getConfigmap());
},
child: const Text('Returns and Exchanges FAQs'),
),
ElevatedButton(
onPressed: () {
HelpshiftWrapper.openSingleFAQScreen(
sectionId: "3", configMap: getConfigmap());
},
child: const Text('Shipping and Delivery FAQs'),
),
ElevatedButton(
onPressed: () {
HelpshiftWrapper.openSingleFAQScreen(
sectionId: "4", configMap: getConfigmap());
},
child: const Text('Payment FAQs'),
),
ElevatedButton(
onPressed: () {
HelpshiftWrapper.openSinglePublishedFAQDetail(
publishId: "8", configMap: getConfigmap());
},
child: const Text('What Payment Methods do you accept?'),
),
],
),
),
),
);
}
/// setup your config map according to your need
getConfigmap() {
var config = {};
// set tags for tracking
config["tags"] = ["foo", "bar"];
// set custom issue fields
var cifMap = {};
var isPro = {};
isPro["type"] = "boolean";
isPro["value"] = "true";
cifMap["is_pro"] = isPro;
config["customIssueFields"] = cifMap;
return config;
}
}
// flutter clean
// rm -Rf ios/Pods
// rm -Rf ios/.symlinks
// rm -Rf ios/Flutter/Flutter.framework
// rm -Rf ios/Flutter/Flutter.podspec
// flutter pub get
// cd ios
// pod install
// arch -x86_64 pod install //(On an M1 mac use => arch -x86_64 pod install)
// cd ..
// flutter build ios
// flutter run