ikchatbot 1.0.0
ikchatbot: ^1.0.0 copied to clipboard
ikChatBot is a powerful fully customizable chatbot you can add to your flutter project for all plaftorms
example/lib/main.dart
import 'package:example/response.dart';
import 'package:flutter/material.dart';
import 'package:ikchatbot/ikchatbot.dart';
import 'keywords.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
final chatBotConfig = IkChatBotConfig(
userIcon: const Icon(Icons.person,color: Colors.white,),
botIcon: const Icon(Icons.android,color: Colors.white,),
botChatColor: const Color.fromARGB(255, 81, 80, 80),
closingTime: 5, //This is calculated in minutes
delayResponse: 1, //This is calculated in seconds
userChatColor: Colors.blue,
waitingTime: 5, //This is calculated in minutes
keywords: keywords,
responses: responses,
backgroundColor: Colors.white,
backgroundImageUrl: 'https://cdn.wallpapersafari.com/54/0/HluF7g.jpg',
initialGreeting: "👋 Hello! \nWelcome to IkBot\nHow can I assist you today?",
defaultResponse: "Sorry, I didn't understand your response.",
inactivityMessage: "Is there anything else you need help with?",
closingMessage: "This conversation will now close.",
inputHint: 'Send a message',
);
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: MyHomePage(chatBotConfig: chatBotConfig),
);
}
}
class MyHomePage extends StatefulWidget {
final IkChatBotConfig chatBotConfig;
const MyHomePage({Key? key, required this.chatBotConfig}) : super(key: key);
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
bool _chatIsOpened = false;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: const Text('ikChatBot Example'),
),
// floatingActionButton: FloatingActionButton(onPressed: () {
// if(_chatIsOpened = false) {
// setState(() {
// _chatIsOpened = true;
// });
// }else {
// setState(() {
// _chatIsOpened = false;
// });
// }
//
// },
// child: Icon(Icons.chat),),
body: _chatIsOpened ? Center(
child: Text('Welcome to my app,'),
) : IkChatBot(config: widget.chatBotConfig)
);
}
}