Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import 'package:flutter/material.dart';
import 'package:likeminds_chat_flutter_core/likeminds_chat_flutter_core.dart';

Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
// Call setup function before the runApp() function
// Initialize LikeMinds Chat SDK with the dark theme
await LMChatCore.instance.initialize(
theme: LMChatThemeData.dark(),
);
// run the app
runApp(const MaterialApp(
home: LMSampleChat(),
Expand All @@ -21,10 +28,29 @@ class LMSampleChat extends StatelessWidget {
),
body: Center(
child: ElevatedButton(
onPressed: () async {},
onPressed: () async {
// 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<void> 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'),
),
),
);
}
}
}
36 changes: 36 additions & 0 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,42 @@
import FlutterMacOS
import Foundation

import device_info_plus
import emoji_picker_flutter
import file_picker
import file_selector_macos
import firebase_core
import firebase_database
import firebase_messaging
import media_kit_libs_macos_video
import media_kit_video
import open_file_mac
import package_info_plus
import path_provider_foundation
import pdf_render
import shared_preferences_foundation
import sqflite_darwin
import url_launcher_macos
import volume_controller
import wakelock_plus

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
EmojiPickerFlutterPlugin.register(with: registry.registrar(forPlugin: "EmojiPickerFlutterPlugin"))
FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin"))
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
FLTFirebaseDatabasePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseDatabasePlugin"))
FLTFirebaseMessagingPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseMessagingPlugin"))
MediaKitLibsMacosVideoPlugin.register(with: registry.registrar(forPlugin: "MediaKitLibsMacosVideoPlugin"))
MediaKitVideoPlugin.register(with: registry.registrar(forPlugin: "MediaKitVideoPlugin"))
OpenFilePlugin.register(with: registry.registrar(forPlugin: "OpenFilePlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SwiftPdfRenderPlugin.register(with: registry.registrar(forPlugin: "SwiftPdfRenderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
VolumeControllerPlugin.register(with: registry.registrar(forPlugin: "VolumeControllerPlugin"))
WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin"))
}
Loading