en_bot_sdk 1.1.7 en_bot_sdk: ^1.1.7 copied to clipboard
en_bot_sdk plugin is used for integrating ENChatBot mobile SDK into your flutter project.
import 'dart:ffi';
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:en_bot_sdk/en_bot_sdk.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return const MaterialApp(home: HomeWidget());
}
}
class HomeWidget extends StatelessWidget {
const HomeWidget({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('ENBotSDK example flutter app'),
),
body: ListView(
padding: const EdgeInsets.symmetric(horizontal: 30),
children: [
const SizedBox(
height: 200,
),
OutlinedButton(
onPressed: () async {
EnBotSdk sdk = EnBotSdk();
Object? completionObj = await sdk.launchBot(
context,
"YOUR_BOT_KEY",
"BOT_NAME",
"BRANDING_KEY",
"USER_ID",
100,
false,
EnBotSdk_LanguageDirection.defaultDirection,
"fonts/MavenPro.ttf",
"fonts/SofiaProMedium.ttf",
"Assets/Images/ic_card_scroller_right_.png",
);
},
style: ButtonStyle(
foregroundColor: MaterialStateProperty.all(Colors.white),
backgroundColor: MaterialStateProperty.all(Colors.lightBlue),
shape: MaterialStateProperty.all(RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)))),
child: const Text("Launch Bot")),
const SizedBox(
height: 180,
)
],
),
);
}
}