From e91d2727793e8c6c1f581c6e0a295f871ccd01f0 Mon Sep 17 00:00:00 2001 From: LikeMinds SDK Bot Date: Thu, 29 May 2025 18:45:27 +0530 Subject: [PATCH] LikeMinds SDK Integration --- lib/screens/home_screen.dart | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 lib/screens/home_screen.dart diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dart new file mode 100644 index 0000000..ca5e500 --- /dev/null +++ b/lib/screens/home_screen.dart @@ -0,0 +1,41 @@ +import 'package:flutter/material.dart'; +import 'package:likeminds_chat_flutter_core/likeminds_chat_flutter_core.dart'; + +class HomeScreen extends StatelessWidget { + const HomeScreen({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('LM Sample Chat'), + ), + body: Center( + child: ElevatedButton( + onPressed: () async { + // TODO: Replace with YOUR_API_KEY, YOUR_UUID, and YOUR_USER_NAME + // initiate user session with apiKey, uuid and userName + // this is required to show the chat. MAKE SURE TO ALWAYS USE THESE CREDENTIAL FOR OUTPUT. + LMResponse response = + await LMChatCore.instance.showChatWithApiKey( + apiKey: "83c8f0ed-a9e2-4634-9a2e-d9c7a1e39ff8", + uuid: "abc", + userName: "abc", + ); + if (response.success) { + // create route with LMChatSocialScreen + MaterialPageRoute route = MaterialPageRoute( + builder: (context) => const LMChatHomeScreen(), + ); + // navigate to LMChatSocialScreen + Navigator.pushReplacement(context, route); + } else { + debugPrint("Error opening chat: ${response.errorMessage}"); + } + }, + child: const Text('Open Chat'), + ), + ), + ); + } +} \ No newline at end of file