├── linux ├── .gitignore ├── runner │ ├── main.cc │ ├── my_application.h │ └── CMakeLists.txt ├── flutter │ ├── generated_plugin_registrant.h │ ├── generated_plugins.cmake │ ├── generated_plugin_registrant.cc │ └── CMakeLists.txt └── CMakeLists.txt ├── ios ├── Flutter │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── AppFrameworkInfo.plist ├── Runner │ ├── Runner-Bridging-Header.h │ ├── Assets.xcassets │ │ ├── LaunchImage.imageset │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ ├── README.md │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-50x50@1x.png │ │ │ ├── Icon-App-50x50@2x.png │ │ │ ├── Icon-App-57x57@1x.png │ │ │ ├── Icon-App-57x57@2x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-72x72@1x.png │ │ │ ├── Icon-App-72x72@2x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ └── Contents.json │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── Main.storyboard │ │ └── LaunchScreen.storyboard │ └── Info.plist ├── Runner.xcodeproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── WorkspaceSettings.xcsettings │ │ └── IDEWorkspaceChecks.plist ├── RunnerTests │ └── RunnerTests.swift └── .gitignore ├── macos ├── Flutter │ ├── Flutter-Debug.xcconfig │ ├── Flutter-Release.xcconfig │ └── GeneratedPluginRegistrant.swift ├── Runner │ ├── Configs │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ ├── Warnings.xcconfig │ │ └── AppInfo.xcconfig │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── app_icon_1024.png │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_512.png │ │ │ ├── app_icon_64.png │ │ │ └── Contents.json │ ├── Release.entitlements │ ├── AppDelegate.swift │ ├── DebugProfile.entitlements │ ├── MainFlutterWindow.swift │ └── Info.plist ├── .gitignore ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── Runner.xcodeproj │ ├── project.xcworkspace │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme └── RunnerTests │ └── RunnerTests.swift ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── manifest.json └── index.html ├── assets ├── logo │ ├── logo.png │ ├── 2.Small.png │ ├── 3.Medium.png │ ├── 4.Large.png │ ├── logoBorder.png │ └── 1.ExtraSmall.png ├── banners │ └── banner.jpg └── promos │ ├── NativeChat1.png │ └── NativeChat2.jpg ├── windows ├── runner │ ├── resources │ │ └── app_icon.ico │ ├── resource.h │ ├── runner.exe.manifest │ ├── utils.h │ ├── flutter_window.h │ ├── main.cpp │ ├── CMakeLists.txt │ ├── utils.cpp │ ├── flutter_window.cpp │ ├── Runner.rc │ └── win32_window.h ├── .gitignore ├── flutter │ ├── generated_plugin_registrant.h │ ├── generated_plugins.cmake │ ├── generated_plugin_registrant.cc │ └── CMakeLists.txt └── CMakeLists.txt ├── android ├── app │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── launcher_icon.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── launcher_icon.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── launcher_icon.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── launcher_icon.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ └── launcher_icon.png │ │ │ │ ├── drawable │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── drawable-v21 │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── values │ │ │ │ │ └── styles.xml │ │ │ │ └── values-night │ │ │ │ │ └── styles.xml │ │ │ └── kotlin │ │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── nativechat │ │ │ │ └── MainActivity.kt │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ └── profile │ │ │ └── AndroidManifest.xml │ └── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── .gitignore ├── call_log │ └── build.gradle ├── build.gradle └── settings.gradle ├── lib ├── constants │ ├── urls.dart │ └── remarks.dart ├── utils │ ├── copy_to_clipboard.dart │ ├── open_image_fullscreen.dart │ ├── tts.dart │ ├── toggles.dart │ └── show_toast.dart ├── models │ ├── memories.dart │ ├── settings.dart │ ├── chat_session.dart │ ├── memories.g.dart │ ├── chat_session.g.dart │ └── settings.g.dart ├── components │ ├── chat_feed │ │ ├── dashed_border_exracted.dart │ │ ├── circle_loading_animation.dart │ │ ├── circle_dot.dart │ │ ├── chat_image_container.dart │ │ ├── attached_file_container.dart │ │ ├── ai_response.dart │ │ └── user_input.dart │ ├── chat_history_drawer │ │ ├── no_chat_history.dart │ │ ├── chat_history_drawer_footer.dart │ │ ├── search_chat_history.dart │ │ ├── chat_history_drawer_header.dart │ │ └── chat_history_drawer.dart │ ├── input_box │ │ ├── send_input_button.dart │ │ ├── input_mic_button.dart │ │ ├── main_text_field.dart │ │ ├── voice_mode_button.dart │ │ └── input_box.dart │ ├── attach_file_popup_menu │ │ ├── attach_file_button.dart │ │ ├── each_popup_menu_item.dart │ │ └── attach_file_popup_menu.dart │ ├── attachment_preview │ │ ├── remove_attachment_button.dart │ │ ├── attachment_preview.dart │ │ ├── attached_file_preview.dart │ │ └── attached_image_preview.dart │ ├── remarks.dart │ ├── home_appbar.dart │ ├── settings_components │ │ ├── dark_mode_toggle_button.dart │ │ ├── memories_buttons.dart │ │ ├── each_memory.dart │ │ ├── one_sided_chat_toggle_button.dart │ │ └── memories_bottom_sheet.dart │ ├── system_response.dart │ └── prompt_suggestions.dart ├── ai │ ├── function_calls │ │ ├── ai_memory │ │ │ ├── get_memories.dart │ │ │ ├── save_memory.dart │ │ │ ├── forget_memories.dart │ │ │ └── forget_one_memory.dart │ │ └── api_calls.dart │ ├── prompt_suggestions.dart │ └── system_prompt.dart ├── pages │ ├── full_screen_code.dart │ └── settings_page.dart ├── state │ └── is_one_sided_chat_mode_notifier.dart └── main.dart ├── .gitignore ├── LICENSE ├── test └── widget_test.dart ├── analysis_options.yaml ├── .metadata └── README.md /linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/web/favicon.png -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /assets/logo/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/assets/logo/logo.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/web/icons/Icon-512.png -------------------------------------------------------------------------------- /assets/banners/banner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/assets/banners/banner.jpg -------------------------------------------------------------------------------- /assets/logo/2.Small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/assets/logo/2.Small.png -------------------------------------------------------------------------------- /assets/logo/3.Medium.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/assets/logo/3.Medium.png -------------------------------------------------------------------------------- /assets/logo/4.Large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/assets/logo/4.Large.png -------------------------------------------------------------------------------- /assets/logo/logoBorder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/assets/logo/logoBorder.png -------------------------------------------------------------------------------- /assets/logo/1.ExtraSmall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/assets/logo/1.ExtraSmall.png -------------------------------------------------------------------------------- /assets/promos/NativeChat1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/assets/promos/NativeChat1.png -------------------------------------------------------------------------------- /assets/promos/NativeChat2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/assets/promos/NativeChat2.jpg -------------------------------------------------------------------------------- /macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/android/app/src/main/res/mipmap-hdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/android/app/src/main/res/mipmap-mdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /lib/constants/urls.dart: -------------------------------------------------------------------------------- 1 | final String googleAIStudioURL = "https://aistudio.google.com/app/apikey"; 2 | final String github = "https://github.com/dagmawibabi/NativeChat"; 3 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /lib/utils/copy_to_clipboard.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | 3 | Future copyToClipboard(content) async { 4 | await Clipboard.setData(ClipboardData(text: content)); 5 | } 6 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dagmawibabi/NativeChat/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/nativechat/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.nativechat 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() 6 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /lib/models/memories.dart: -------------------------------------------------------------------------------- 1 | import 'package:hive/hive.dart'; 2 | 3 | part 'memories.g.dart'; 4 | 5 | @HiveType(typeId: 2) 6 | class Memories extends HiveObject { 7 | @HiveField(0) 8 | List memories = []; 9 | } 10 | -------------------------------------------------------------------------------- /linux/runner/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip 6 | -------------------------------------------------------------------------------- /lib/utils/open_image_fullscreen.dart: -------------------------------------------------------------------------------- 1 | import 'package:easy_image_viewer/easy_image_viewer.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | void openImage(context, image) async { 5 | final imageProvider = Image.memory(image).image; 6 | await showImageViewer(context, imageProvider); 7 | } 8 | -------------------------------------------------------------------------------- /macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/to/reference-keystore 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /lib/components/chat_feed/dashed_border_exracted.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import "package:mobkit_dashed_border/mobkit_dashed_border.dart"; 3 | 4 | DashedBorder dashedBorderExtracted = DashedBorder( 5 | dashLength: 6.0, 6 | spaceRatio: 1.0, 7 | left: BorderSide( 8 | color: Colors.grey[800]!, 9 | width: 0.6, 10 | ), 11 | ); 12 | -------------------------------------------------------------------------------- /ios/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /macos/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /android/call_log/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | } 6 | } 7 | 8 | apply plugin: 'com.android.library' 9 | 10 | android { 11 | namespace 'com.example.call_log' 12 | compileSdkVersion 33 13 | 14 | defaultConfig { 15 | minSdkVersion 16 16 | targetSdkVersion 33 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /lib/constants/remarks.dart: -------------------------------------------------------------------------------- 1 | final String remarks = 2 | "This uses Gemini 2.0 Flash from google with a 1 million token context window. You can get a free api key from their website which will be sufficient for most of your tasks. \n\nUsing the free tier lets Google access your conversation history and private information so if you'd like a private version consider switching to a paid tier"; 3 | -------------------------------------------------------------------------------- /macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @main 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | 10 | override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { 11 | return true 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /lib/ai/function_calls/ai_memory/get_memories.dart: -------------------------------------------------------------------------------- 1 | import 'package:hive_flutter/hive_flutter.dart'; 2 | 3 | Future getMemories() async { 4 | Box memoryBox = await Hive.openBox("memories"); 5 | 6 | // Get Old Memories 7 | var oldMemories = await memoryBox.get("memories") ?? []; 8 | 9 | // Close 10 | await memoryBox.close(); 11 | 12 | // Return 13 | return oldMemories; 14 | } 15 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | allprojects { 2 | repositories { 3 | google() 4 | mavenCentral() 5 | } 6 | } 7 | 8 | rootProject.buildDir = "../build" 9 | subprojects { 10 | project.buildDir = "${rootProject.buildDir}/${project.name}" 11 | } 12 | subprojects { 13 | project.evaluationDependsOn(":app") 14 | } 15 | 16 | tasks.register("clean", Delete) { 17 | delete rootProject.buildDir 18 | } 19 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /lib/models/settings.dart: -------------------------------------------------------------------------------- 1 | import 'package:hive/hive.dart'; 2 | 3 | part 'settings.g.dart'; 4 | 5 | @HiveType(typeId: 0) 6 | class Settings extends HiveObject { 7 | @HiveField(0) 8 | late bool isDarkMode; 9 | 10 | @HiveField(1) 11 | bool isOneSidedChatMode = true; 12 | 13 | @HiveField(2) 14 | String apikey = ""; 15 | 16 | @HiveField(3) 17 | int currentLightThemeIndex = 0; 18 | 19 | @HiveField(4) 20 | int currentDarkThemeIndex = 0; 21 | } 22 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | 4 | @main 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /lib/ai/function_calls/ai_memory/save_memory.dart: -------------------------------------------------------------------------------- 1 | import 'package:hive_flutter/hive_flutter.dart'; 2 | 3 | Future saveMemory(memory) async { 4 | Box memoryBox = await Hive.openBox("memories"); 5 | 6 | // Get Old Memories 7 | var oldMemories = await memoryBox.get("memories") ?? []; 8 | 9 | // Save New Memory 10 | var newMemories = [...oldMemories, memory]; 11 | await memoryBox.put("memories", newMemories); 12 | 13 | // Close 14 | await memoryBox.close(); 15 | } 16 | -------------------------------------------------------------------------------- /lib/utils/tts.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_tts/flutter_tts.dart'; 2 | 3 | FlutterTts flutterTts = FlutterTts(); 4 | void speak(message, {stopSpeaking = false}) async { 5 | if (stopSpeaking) { 6 | await flutterTts.stop(); 7 | } else { 8 | await flutterTts.setLanguage("en-US"); 9 | await flutterTts.setSpeechRate(0.8); 10 | await flutterTts.setVolume(1.0); 11 | await flutterTts.setPitch(0.7); 12 | await flutterTts.speak(message.toString()); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /linux/runner/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /lib/utils/toggles.dart: -------------------------------------------------------------------------------- 1 | import 'package:hive_flutter/hive_flutter.dart'; 2 | 3 | // dynamic isOneSidedChatMode = true; 4 | void toggleOneSidedChatMode(isOneSidedChatMode) async { 5 | Box settingBox = await Hive.openBox("settings"); 6 | isOneSidedChatMode = await settingBox.get("isOneSidedChatMode") ?? true; 7 | 8 | isOneSidedChatMode = !isOneSidedChatMode; 9 | // setState(() { 10 | // }); 11 | await settingBox.put("isOneSidedChatMode", isOneSidedChatMode); 12 | settingBox.close(); 13 | } 14 | -------------------------------------------------------------------------------- /lib/ai/function_calls/ai_memory/forget_memories.dart: -------------------------------------------------------------------------------- 1 | import 'package:hive_flutter/hive_flutter.dart'; 2 | 3 | Future forgetMemory() async { 4 | Box memoryBox = await Hive.openBox("memories"); 5 | 6 | // Save Empty Memory 7 | await memoryBox.put("memories", []); 8 | 9 | // Close 10 | await memoryBox.close(); 11 | 12 | // Context 13 | var advancedContext = 14 | "YOU HAVE REMOVED EVERYTHING YOU REMEMBERED ABOUT THE USER."; 15 | 16 | // Return 17 | return advancedContext; 18 | } 19 | -------------------------------------------------------------------------------- /windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /lib/models/chat_session.dart: -------------------------------------------------------------------------------- 1 | import 'package:hive/hive.dart'; 2 | import 'package:uuid/uuid.dart'; 3 | 4 | part 'chat_session.g.dart'; 5 | 6 | @HiveType(typeId: 1) 7 | class ChatSessionModel extends HiveObject { 8 | @HiveField(0) 9 | String id; 10 | 11 | @HiveField(1) 12 | String title; 13 | 14 | @HiveField(2) 15 | List> messages; 16 | 17 | @HiveField(3) 18 | DateTime? createdAt; 19 | 20 | ChatSessionModel({ 21 | String? id, 22 | required this.title, 23 | required this.messages, 24 | DateTime? createdAt, 25 | }) : id = id ?? const Uuid().v4(), 26 | createdAt = createdAt ?? DateTime.now(); 27 | } 28 | -------------------------------------------------------------------------------- /macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = nativechat 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.nativechat 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2025 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /lib/ai/function_calls/ai_memory/forget_one_memory.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: empty_catches 2 | 3 | import 'package:hive_flutter/hive_flutter.dart'; 4 | 5 | Future forgetOneMemory(memory) async { 6 | Box memoryBox = await Hive.openBox("memories"); 7 | 8 | // Get OLD memories 9 | var oldMemories = await memoryBox.get("memories") ?? []; 10 | 11 | // Remove one memory 12 | try { 13 | oldMemories.remove(memory); 14 | } catch (e) {} 15 | 16 | // Save Updated Memory 17 | await memoryBox.put("memories", oldMemories); 18 | 19 | // Close 20 | await memoryBox.close(); 21 | 22 | // Context 23 | var advancedContext = "YOU HAVE UPDATED YOUR MEMORIES."; 24 | 25 | // Return 26 | return advancedContext; 27 | } 28 | -------------------------------------------------------------------------------- /lib/components/chat_feed/circle_loading_animation.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:loading_animation_widget/loading_animation_widget.dart'; 3 | 4 | class CircleLoadingAnimation extends StatefulWidget { 5 | const CircleLoadingAnimation({super.key}); 6 | 7 | @override 8 | State createState() => _CircleLoadingAnimationState(); 9 | } 10 | 11 | class _CircleLoadingAnimationState extends State { 12 | @override 13 | Widget build(BuildContext context) { 14 | return Container( 15 | padding: const EdgeInsets.only(left: 18.0), 16 | child: LoadingAnimationWidget.beat( 17 | color: Colors.grey[600]!, 18 | size: 14, 19 | ), 20 | ); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /lib/components/chat_history_drawer/no_chat_history.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:theme_provider/theme_provider.dart'; 3 | 4 | class NoChatHistory extends StatefulWidget { 5 | const NoChatHistory({super.key}); 6 | 7 | @override 8 | State createState() => _NoChatHistoryState(); 9 | } 10 | 11 | class _NoChatHistoryState extends State { 12 | @override 13 | Widget build(BuildContext context) { 14 | return Center( 15 | child: Text( 16 | "No chat history", 17 | style: TextStyle( 18 | color: ThemeProvider.themeOf(context).id == "light_theme" 19 | ? Colors.black 20 | : Colors.white, 21 | ), 22 | ), 23 | ); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | def flutterSdkPath = { 3 | def properties = new Properties() 4 | file("local.properties").withInputStream { properties.load(it) } 5 | def flutterSdkPath = properties.getProperty("flutter.sdk") 6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 7 | return flutterSdkPath 8 | }() 9 | 10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") 11 | 12 | repositories { 13 | google() 14 | mavenCentral() 15 | gradlePluginPortal() 16 | } 17 | } 18 | 19 | plugins { 20 | id "dev.flutter.flutter-plugin-loader" version "1.0.0" 21 | id "com.android.application" version "8.1.0" apply false 22 | id "org.jetbrains.kotlin.android" version "1.8.22" apply false 23 | } 24 | 25 | include ":app" 26 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 12.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .build/ 9 | .buildlog/ 10 | .history 11 | .svn/ 12 | .swiftpm/ 13 | migrate_working_dir/ 14 | 15 | # IntelliJ related 16 | *.iml 17 | *.ipr 18 | *.iws 19 | .idea/ 20 | 21 | # The .vscode folder contains launch configuration and tasks you configure in 22 | # VS Code which you may wish to be included in version control, so this line 23 | # is commented out by default. 24 | #.vscode/ 25 | 26 | # Flutter/Dart/Pub related 27 | **/doc/api/ 28 | **/ios/Flutter/.last_build_id 29 | .dart_tool/ 30 | .flutter-plugins 31 | .flutter-plugins-dependencies 32 | .pub-cache/ 33 | .pub/ 34 | /build/ 35 | 36 | # Symbolication related 37 | app.*.symbols 38 | 39 | # Obfuscation related 40 | app.*.map.json 41 | 42 | # Android Studio will place build artifacts here 43 | /android/app/debug 44 | /android/app/profile 45 | /android/app/release 46 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | call_log_new 7 | file_selector_linux 8 | url_launcher_linux 9 | ) 10 | 11 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 12 | ) 13 | 14 | set(PLUGIN_BUNDLED_LIBRARIES) 15 | 16 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 17 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 18 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 20 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 21 | endforeach(plugin) 22 | 23 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 24 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 25 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 26 | endforeach(ffi_plugin) 27 | -------------------------------------------------------------------------------- /lib/components/chat_feed/circle_dot.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:ionicons/ionicons.dart'; 3 | import 'package:theme_provider/theme_provider.dart'; 4 | 5 | class CircleDot extends StatefulWidget { 6 | const CircleDot({super.key, required this.leftPadding}); 7 | 8 | final double leftPadding; 9 | 10 | @override 11 | State createState() => _CircleDotState(); 12 | } 13 | 14 | class _CircleDotState extends State { 15 | @override 16 | Widget build(BuildContext context) { 17 | return Container( 18 | alignment: Alignment.centerLeft, 19 | padding: EdgeInsets.only( 20 | left: widget.leftPadding, 21 | ), 22 | child: Icon( 23 | Ionicons.ellipse, 24 | size: 18.0, 25 | color: ThemeProvider.themeOf(context).id == "light_theme" 26 | ? Colors.grey[400] 27 | : Colors.grey[800], 28 | ), 29 | ); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/utils/show_toast.dart: -------------------------------------------------------------------------------- 1 | import 'package:cherry_toast/cherry_toast.dart'; 2 | import 'package:cherry_toast/resources/arrays.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:theme_provider/theme_provider.dart'; 5 | 6 | void showToast(context, title) { 7 | CherryToast.success( 8 | title: Text( 9 | title.toString().trim(), 10 | style: TextStyle( 11 | color: ThemeProvider.themeOf(context).id == "light_theme" 12 | ? Colors.black 13 | : Colors.white, 14 | ), 15 | ), 16 | animationType: AnimationType.fromTop, 17 | toastDuration: Duration(milliseconds: 1400), 18 | backgroundColor: ThemeProvider.themeOf(context).id == "light_theme" 19 | ? Colors.white 20 | : const Color(0xff1a1a1a), 21 | shadowColor: ThemeProvider.themeOf(context).id == "light_theme" 22 | ? Colors.grey[200]! 23 | : Colors.grey[900]!, 24 | ).show(context); 25 | } 26 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | battery_plus 7 | call_log_new 8 | file_selector_windows 9 | flutter_tts 10 | geolocator_windows 11 | permission_handler_windows 12 | url_launcher_windows 13 | ) 14 | 15 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 16 | ) 17 | 18 | set(PLUGIN_BUNDLED_LIBRARIES) 19 | 20 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 22 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 24 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 25 | endforeach(plugin) 26 | 27 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 28 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 29 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 30 | endforeach(ffi_plugin) 31 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nativechat", 3 | "short_name": "nativechat", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#hexcode", 7 | "theme_color": "#hexcode", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | void fl_register_plugins(FlPluginRegistry* registry) { 14 | g_autoptr(FlPluginRegistrar) call_log_new_registrar = 15 | fl_plugin_registry_get_registrar_for_plugin(registry, "CallLogPlugin"); 16 | call_log_plugin_register_with_registrar(call_log_new_registrar); 17 | g_autoptr(FlPluginRegistrar) file_selector_linux_registrar = 18 | fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin"); 19 | file_selector_plugin_register_with_registrar(file_selector_linux_registrar); 20 | g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = 21 | fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); 22 | url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); 23 | } 24 | -------------------------------------------------------------------------------- /lib/components/input_box/send_input_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:ionicons/ionicons.dart'; 3 | 4 | class SendInputButton extends StatefulWidget { 5 | const SendInputButton({ 6 | super.key, 7 | required this.isSummarizeInContext, 8 | required this.summarizeText, 9 | required this.chatWithAI, 10 | }); 11 | 12 | final bool isSummarizeInContext; 13 | final Function summarizeText; 14 | final Function chatWithAI; 15 | 16 | @override 17 | State createState() => _SendInputButtonState(); 18 | } 19 | 20 | class _SendInputButtonState extends State { 21 | @override 22 | Widget build(BuildContext context) { 23 | return IconButton( 24 | onPressed: () { 25 | widget.isSummarizeInContext 26 | ? widget.summarizeText(fromUserInput: true) 27 | : widget.chatWithAI(); 28 | }, 29 | icon: Icon( 30 | Ionicons.paper_plane_outline, 31 | size: 22.0, 32 | color: Theme.of(context).iconTheme.color, 33 | ), 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /linux/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.13) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} 10 | "main.cc" 11 | "my_application.cc" 12 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 13 | ) 14 | 15 | # Apply the standard set of build settings. This can be removed for applications 16 | # that need different build settings. 17 | apply_standard_settings(${BINARY_NAME}) 18 | 19 | # Add preprocessor definitions for the application ID. 20 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 21 | 22 | # Add dependency libraries. Add any application-specific dependencies here. 23 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 24 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 25 | 26 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 27 | -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /lib/pages/full_screen_code.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:nativechat/components/chat_feed/codeblock.dart'; 3 | 4 | class FullScreenCode extends StatefulWidget { 5 | const FullScreenCode({ 6 | super.key, 7 | required this.code, 8 | required this.name, 9 | }); 10 | 11 | final String code; 12 | final String name; 13 | 14 | @override 15 | State createState() => _FullScreenCodeState(); 16 | } 17 | 18 | class _FullScreenCodeState extends State { 19 | @override 20 | Widget build(BuildContext context) { 21 | return Scaffold( 22 | body: SafeArea( 23 | child: ListView( 24 | children: [ 25 | Padding( 26 | padding: 27 | const EdgeInsets.symmetric(horizontal: 8.0, vertical: 10.0), 28 | child: Codeblock( 29 | code: widget.code, 30 | name: widget.name, 31 | isFullscreen: true, 32 | ), 33 | ), 34 | ], 35 | ), 36 | ), 37 | ); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/components/attach_file_popup_menu/attach_file_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:ionicons/ionicons.dart'; 3 | 4 | class AttachFileButton extends StatefulWidget { 5 | const AttachFileButton({super.key}); 6 | 7 | @override 8 | State createState() => _AttachFileButtonState(); 9 | } 10 | 11 | class _AttachFileButtonState extends State { 12 | @override 13 | Widget build(BuildContext context) { 14 | return Container( 15 | padding: const EdgeInsets.all( 16 | 7.0, 17 | ), 18 | decoration: BoxDecoration( 19 | border: Border.all( 20 | color: Theme.of(context).iconTheme.color!.withAlpha(100), 21 | ), 22 | borderRadius: BorderRadius.circular(100.0), 23 | ), 24 | child: Row( 25 | mainAxisSize: MainAxisSize.min, 26 | children: [ 27 | Icon( 28 | Ionicons.folder_open_outline, 29 | color: Theme.of(context).iconTheme.color, 30 | size: 21.0, 31 | ), 32 | ], 33 | ), 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Dagmawi Babi 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility in the flutter_test package. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:nativechat/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(const MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /lib/state/is_one_sided_chat_mode_notifier.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:hive_flutter/hive_flutter.dart'; 3 | 4 | class IsOneSidedChatModeNotifier { 5 | static final IsOneSidedChatModeNotifier _instance = 6 | IsOneSidedChatModeNotifier._internal(); 7 | factory IsOneSidedChatModeNotifier() { 8 | return _instance; 9 | } 10 | IsOneSidedChatModeNotifier._internal(); 11 | 12 | final ValueNotifier isOneSidedChatMode = ValueNotifier(true); 13 | 14 | // Is One Sided Chat Mode 15 | void getIsOneSidedMode() async { 16 | Box settingBox = await Hive.openBox("settings"); 17 | isOneSidedChatMode.value = 18 | await settingBox.get("isOneSidedChatMode") ?? true; 19 | settingBox.close(); 20 | } 21 | 22 | // Toggle One Sided Mode 23 | void toggle() async { 24 | isOneSidedChatMode.value = !isOneSidedChatMode.value; 25 | 26 | Box settingBox = await Hive.openBox("settings"); 27 | await settingBox.put( 28 | "isOneSidedChatMode", 29 | isOneSidedChatMode.value, 30 | ); 31 | settingBox.close(); 32 | } 33 | 34 | // Dispose 35 | void dispose() { 36 | isOneSidedChatMode.dispose(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /lib/models/memories.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'memories.dart'; 4 | 5 | // ************************************************************************** 6 | // TypeAdapterGenerator 7 | // ************************************************************************** 8 | 9 | class MemoriesAdapter extends TypeAdapter { 10 | @override 11 | final int typeId = 2; 12 | 13 | @override 14 | Memories read(BinaryReader reader) { 15 | final numOfFields = reader.readByte(); 16 | final fields = { 17 | for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), 18 | }; 19 | return Memories()..memories = (fields[0] as List).cast(); 20 | } 21 | 22 | @override 23 | void write(BinaryWriter writer, Memories obj) { 24 | writer 25 | ..writeByte(1) 26 | ..writeByte(0) 27 | ..write(obj.memories); 28 | } 29 | 30 | @override 31 | int get hashCode => typeId.hashCode; 32 | 33 | @override 34 | bool operator ==(Object other) => 35 | identical(this, other) || 36 | other is MemoriesAdapter && 37 | runtimeType == other.runtimeType && 38 | typeId == other.typeId; 39 | } 40 | -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | nativechat 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /lib/components/attachment_preview/remove_attachment_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:theme_provider/theme_provider.dart'; 3 | 4 | class RemoveAttachmentButton extends StatefulWidget { 5 | const RemoveAttachmentButton({ 6 | super.key, 7 | required this.removeAttachment, 8 | this.isCircular = false, 9 | }); 10 | 11 | final VoidCallback removeAttachment; 12 | final bool isCircular; 13 | 14 | @override 15 | State createState() => _RemoveAttachmentButtonState(); 16 | } 17 | 18 | class _RemoveAttachmentButtonState extends State { 19 | @override 20 | Widget build(BuildContext context) { 21 | return InkWell( 22 | onTap: widget.removeAttachment, 23 | borderRadius: BorderRadius.circular(20.0), 24 | child: Container( 25 | padding: const EdgeInsets.all(4.0), 26 | decoration: widget.isCircular 27 | ? BoxDecoration( 28 | shape: BoxShape.circle, 29 | color: ThemeProvider.themeOf(context).id == "light_theme" 30 | ? Colors.grey[300] 31 | : Colors.grey[900], 32 | ) 33 | : null, 34 | child: Icon( 35 | Icons.close, 36 | size: 18.0, 37 | color: Theme.of(context).iconTheme.color, 38 | ), 39 | ), 40 | ); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/components/input_box/input_mic_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:speech_to_text/speech_to_text.dart'; 3 | import 'package:theme_provider/theme_provider.dart'; 4 | 5 | class InputMicButton extends StatefulWidget { 6 | const InputMicButton( 7 | {super.key, 8 | required this.speechToText, 9 | required this.startListening, 10 | required this.stopListening}); 11 | 12 | final SpeechToText speechToText; 13 | final Function startListening; 14 | final Function stopListening; 15 | 16 | @override 17 | State createState() => _InputMicButtonState(); 18 | } 19 | 20 | class _InputMicButtonState extends State { 21 | @override 22 | Widget build(BuildContext context) { 23 | return IconButton( 24 | onPressed: () { 25 | widget.speechToText.isNotListening 26 | ? widget.startListening() 27 | : widget.stopListening(); 28 | }, 29 | icon: Icon( 30 | widget.speechToText.isNotListening 31 | ? Icons.mic_off_outlined 32 | : Icons.mic_none_outlined, 33 | color: widget.speechToText.isNotListening 34 | ? Theme.of(context).iconTheme.color 35 | : ThemeProvider.themeOf(context).id == "light_theme" 36 | ? Colors.green[600] 37 | : Colors.greenAccent, 38 | ), 39 | ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.Create(L"nativechat", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | void RegisterPlugins(flutter::PluginRegistry* registry) { 18 | BatteryPlusWindowsPluginRegisterWithRegistrar( 19 | registry->GetRegistrarForPlugin("BatteryPlusWindowsPlugin")); 20 | CallLogPluginCApiRegisterWithRegistrar( 21 | registry->GetRegistrarForPlugin("CallLogPluginCApi")); 22 | FileSelectorWindowsRegisterWithRegistrar( 23 | registry->GetRegistrarForPlugin("FileSelectorWindows")); 24 | FlutterTtsPluginRegisterWithRegistrar( 25 | registry->GetRegistrarForPlugin("FlutterTtsPlugin")); 26 | GeolocatorWindowsRegisterWithRegistrar( 27 | registry->GetRegistrarForPlugin("GeolocatorWindows")); 28 | PermissionHandlerWindowsPluginRegisterWithRegistrar( 29 | registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); 30 | UrlLauncherWindowsRegisterWithRegistrar( 31 | registry->GetRegistrarForPlugin("UrlLauncherWindows")); 32 | } 33 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at https://dart.dev/lints. 17 | # 18 | # Instead of disabling a lint rule for the entire project in the 19 | # section below, it can also be suppressed for a single line of code 20 | # or a specific dart file by using the `// ignore: name_of_lint` and 21 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 22 | # producing the lint. 23 | rules: 24 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 25 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 26 | 27 | # Additional information about this file can be found at 28 | # https://dart.dev/guides/language/analysis-options 29 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "com.android.application" 3 | id "kotlin-android" 4 | // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. 5 | id "dev.flutter.flutter-gradle-plugin" 6 | } 7 | 8 | android { 9 | namespace = "com.example.nativechat" 10 | compileSdk = flutter.compileSdkVersion 11 | ndkVersion = flutter.ndkVersion 12 | 13 | compileOptions { 14 | sourceCompatibility = JavaVersion.VERSION_1_8 15 | targetCompatibility = JavaVersion.VERSION_1_8 16 | } 17 | 18 | kotlinOptions { 19 | jvmTarget = JavaVersion.VERSION_1_8 20 | } 21 | 22 | defaultConfig { 23 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 24 | applicationId = "com.example.nativechat" 25 | // You can update the following values to match your application needs. 26 | // For more information, see: https://flutter.dev/to/review-gradle-config. 27 | minSdk = flutter.minSdkVersion 28 | targetSdk = flutter.targetSdkVersion 29 | versionCode = flutter.versionCode 30 | versionName = flutter.versionName 31 | } 32 | 33 | buildTypes { 34 | release { 35 | // TODO: Add your own signing config for the release build. 36 | // Signing with the debug keys for now, so `flutter run --release` works. 37 | signingConfig = signingConfigs.debug 38 | } 39 | } 40 | } 41 | 42 | flutter { 43 | source = "../.." 44 | } 45 | -------------------------------------------------------------------------------- /lib/ai/function_calls/api_calls.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:dio/dio.dart'; 4 | import 'package:geolocator/geolocator.dart'; 5 | import 'package:permission_handler/permission_handler.dart'; 6 | 7 | // Reddit 8 | Future getReddit(parameters) async { 9 | var subreddit = parameters['subreddit'].toString().trim(); 10 | var time = parameters['time'].toString().trim(); 11 | var listing = parameters['listing'].toString().trim(); 12 | var baseURL = 13 | 'https://www.reddit.com/r/$subreddit/$listing.json?t=$time&limit=20'; 14 | 15 | var dio = Dio(); 16 | var result = await dio.get(baseURL); 17 | var feed = result.data['data']['children']; 18 | 19 | var advancedContext = 20 | "HERE'S THE CONTENT FROM THE SUBREDDIT $subreddit: $feed"; 21 | return advancedContext; 22 | } 23 | 24 | // OPEN STREET MAP 25 | Future getCurrentLocation() async { 26 | await Permission.location.request(); 27 | 28 | Position position = await Geolocator.getCurrentPosition(); 29 | var latitude = position.latitude; 30 | var longitude = position.longitude; 31 | 32 | var baseURL = 33 | "https://nominatim.openstreetmap.org/reverse?format=json&lat=$latitude&lon=$longitude"; 34 | 35 | var dio = Dio(); 36 | var result = await dio.get(baseURL); 37 | dynamic address = result.data; 38 | 39 | var advancedContext = 40 | "BASED ON THE CURRENT LATITUDE AND LONGITUDE OF ($latitude,$longitude) YOUR ADDRESS IS ${jsonEncode(address)}. IF ADDRESS IS IDENTIFIED STATE THAT THE DATA WAS OBTAINED FROM [OPENSTREETMAP](openstreetmap.org/copyright)"; 41 | return advancedContext; 42 | } 43 | -------------------------------------------------------------------------------- /lib/models/chat_session.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'chat_session.dart'; 4 | 5 | // ************************************************************************** 6 | // TypeAdapterGenerator 7 | // ************************************************************************** 8 | 9 | class ChatSessionModelAdapter extends TypeAdapter { 10 | @override 11 | final int typeId = 1; 12 | 13 | @override 14 | ChatSessionModel read(BinaryReader reader) { 15 | final numOfFields = reader.readByte(); 16 | final fields = { 17 | for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), 18 | }; 19 | return ChatSessionModel( 20 | id: fields[0] as String?, 21 | title: fields[1] as String, 22 | messages: (fields[2] as List) 23 | .map((dynamic e) => (e as Map).cast()) 24 | .toList(), 25 | createdAt: fields[3] as DateTime?, 26 | ); 27 | } 28 | 29 | @override 30 | void write(BinaryWriter writer, ChatSessionModel obj) { 31 | writer 32 | ..writeByte(4) 33 | ..writeByte(0) 34 | ..write(obj.id) 35 | ..writeByte(1) 36 | ..write(obj.title) 37 | ..writeByte(2) 38 | ..write(obj.messages) 39 | ..writeByte(3) 40 | ..write(obj.createdAt); 41 | } 42 | 43 | @override 44 | int get hashCode => typeId.hashCode; 45 | 46 | @override 47 | bool operator ==(Object other) => 48 | identical(this, other) || 49 | other is ChatSessionModelAdapter && 50 | runtimeType == other.runtimeType && 51 | typeId == other.typeId; 52 | } 53 | -------------------------------------------------------------------------------- /lib/models/settings.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'settings.dart'; 4 | 5 | // ************************************************************************** 6 | // TypeAdapterGenerator 7 | // ************************************************************************** 8 | 9 | class SettingsAdapter extends TypeAdapter { 10 | @override 11 | final int typeId = 0; 12 | 13 | @override 14 | Settings read(BinaryReader reader) { 15 | final numOfFields = reader.readByte(); 16 | final fields = { 17 | for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), 18 | }; 19 | return Settings() 20 | ..isDarkMode = fields[0] as bool 21 | ..isOneSidedChatMode = fields[1] as bool 22 | ..apikey = fields[2] as String 23 | ..currentLightThemeIndex = fields[3] as int 24 | ..currentDarkThemeIndex = fields[4] as int; 25 | } 26 | 27 | @override 28 | void write(BinaryWriter writer, Settings obj) { 29 | writer 30 | ..writeByte(5) 31 | ..writeByte(0) 32 | ..write(obj.isDarkMode) 33 | ..writeByte(1) 34 | ..write(obj.isOneSidedChatMode) 35 | ..writeByte(2) 36 | ..write(obj.apikey) 37 | ..writeByte(3) 38 | ..write(obj.currentLightThemeIndex) 39 | ..writeByte(4) 40 | ..write(obj.currentDarkThemeIndex); 41 | } 42 | 43 | @override 44 | int get hashCode => typeId.hashCode; 45 | 46 | @override 47 | bool operator ==(Object other) => 48 | identical(this, other) || 49 | other is SettingsAdapter && 50 | runtimeType == other.runtimeType && 51 | typeId == other.typeId; 52 | } 53 | -------------------------------------------------------------------------------- /macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import battery_plus 9 | import call_log_new 10 | import device_info_plus 11 | import file_picker 12 | import file_selector_macos 13 | import flutter_tts 14 | import geolocator_apple 15 | import network_info_plus 16 | import path_provider_foundation 17 | import shared_preferences_foundation 18 | import speech_to_text 19 | import url_launcher_macos 20 | 21 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 22 | BatteryPlusMacosPlugin.register(with: registry.registrar(forPlugin: "BatteryPlusMacosPlugin")) 23 | CallLogPlugin.register(with: registry.registrar(forPlugin: "CallLogPlugin")) 24 | DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) 25 | FilePickerPlugin.register(with: registry.registrar(forPlugin: "FilePickerPlugin")) 26 | FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) 27 | FlutterTtsPlugin.register(with: registry.registrar(forPlugin: "FlutterTtsPlugin")) 28 | GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin")) 29 | NetworkInfoPlusPlugin.register(with: registry.registrar(forPlugin: "NetworkInfoPlusPlugin")) 30 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) 31 | SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) 32 | SpeechToTextPlugin.register(with: registry.registrar(forPlugin: "SpeechToTextPlugin")) 33 | UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) 34 | } 35 | -------------------------------------------------------------------------------- /lib/components/attach_file_popup_menu/each_popup_menu_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:nativechat/components/attach_file_popup_menu/attach_file_popup_menu.dart'; 3 | import 'package:theme_provider/theme_provider.dart'; 4 | 5 | class EachPopupMenuItem extends PopupMenuEntry { 6 | const EachPopupMenuItem( 7 | {super.key, 8 | required this.attachmentOption, 9 | required this.icon, 10 | required this.title}); 11 | 12 | final AttachmentOption attachmentOption; 13 | final IconData icon; 14 | final String title; 15 | 16 | @override 17 | double get height => kMinInteractiveDimension; 18 | 19 | @override 20 | bool represents(AttachmentOption? value) => value == attachmentOption; 21 | 22 | @override 23 | // ignore: library_private_types_in_public_api 24 | _EachPopupMenuItemState createState() => _EachPopupMenuItemState(); 25 | } 26 | 27 | class _EachPopupMenuItemState extends State { 28 | @override 29 | Widget build(BuildContext context) { 30 | var color = ThemeProvider.themeOf(context).id == "light_theme" 31 | ? Colors.black 32 | : Colors.white; 33 | return PopupMenuItem( 34 | value: widget.attachmentOption, 35 | padding: const EdgeInsets.symmetric( 36 | horizontal: 18.0, 37 | ), 38 | child: ListTile( 39 | leading: Icon( 40 | widget.icon, 41 | size: 20.0, 42 | color: color, 43 | ), 44 | title: Text( 45 | widget.title, 46 | style: TextStyle( 47 | color: color, 48 | ), 49 | ), 50 | ), 51 | ); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /lib/ai/prompt_suggestions.dart: -------------------------------------------------------------------------------- 1 | final List promptSuggestions = [ 2 | "Change the theme", 3 | "Turn on dark mode", 4 | "Toggle one sided chat mode", 5 | "What's the latest news", 6 | "Show me some memes", 7 | "What's the top post on r/AskReddit", 8 | "What are some side projects being built?", 9 | "Get my network state and information", 10 | "Show me 3 beautiful math equations", 11 | "Show me my device's specs in table form", 12 | 'Tell me my unread text messages?', 13 | 'How many cores does my phone have?', 14 | 'What is the longest call I had?', 15 | 'Is my phone charging?', 16 | 'Do I have any recent missed calls?', 17 | 'What is the sweetest text I got recently?', 18 | 'How many apps do I have?', 19 | 'Write code to find the Fibonacci sequence in Zig?', 20 | "Write a Python script to check if a number is prime", 21 | "Show me the latest quotes from famous philosophers", 22 | "Generate a workout plan for a beginner", 23 | "Tell me a fun fact about space exploration", 24 | "How much storage is available on my device?", 25 | "Generate a random inspirational quote", 26 | "Write a JavaScript function to reverse a string", 27 | "Give me a brief history of AI development", 28 | "Show me the calorie count of a cheeseburger", 29 | "CSS snippet to create a responsive navigation bar", 30 | "Generate a to-do list with time slots for productivity.", 31 | "Give me a summary of the apps I've installed recently", 32 | "What was the total duration of all calls made today?", 33 | "Tell me the time zone of my device", 34 | "How many unread messages do I have?", 35 | "Summarize my last 3 call in a table?", 36 | "Give me a summary of my last 5 text messages", 37 | "Let's play a game", 38 | ]; 39 | -------------------------------------------------------------------------------- /lib/pages/settings_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:nativechat/components/settings_components/dark_mode_toggle_button.dart'; 3 | import 'package:nativechat/components/settings_components/memories_buttons.dart'; 4 | import 'package:nativechat/components/settings_components/one_sided_chat_toggle_button.dart'; 5 | import 'package:nativechat/state/is_one_sided_chat_mode_notifier.dart'; 6 | 7 | class SettingsPage extends StatefulWidget { 8 | const SettingsPage({ 9 | super.key, 10 | }); 11 | 12 | @override 13 | State createState() => _SettingsPageState(); 14 | } 15 | 16 | class _SettingsPageState extends State { 17 | var isOneSidedChatModeNotifier = IsOneSidedChatModeNotifier(); 18 | 19 | @override 20 | void initState() { 21 | super.initState(); 22 | isOneSidedChatModeNotifier.getIsOneSidedMode(); 23 | } 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return Scaffold( 28 | appBar: AppBar( 29 | title: const Text('Settings'), 30 | ), 31 | body: ListView( 32 | padding: const EdgeInsets.symmetric( 33 | horizontal: 16.0, 34 | vertical: 10.0, 35 | ), 36 | children: [ 37 | Row( 38 | spacing: 10.0, 39 | mainAxisAlignment: MainAxisAlignment.center, 40 | children: [DarkModeToggleButton(), OneSidedChatToggleButton()], 41 | ), 42 | SizedBox(height: 10.0), 43 | Row( 44 | spacing: 10.0, 45 | mainAxisAlignment: MainAxisAlignment.center, 46 | children: [ 47 | MemoriesButtons(), 48 | ], 49 | ), 50 | ], 51 | ), 52 | ); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /lib/components/input_box/main_text_field.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:theme_provider/theme_provider.dart'; 3 | 4 | class MainTextField extends StatefulWidget { 5 | const MainTextField({ 6 | super.key, 7 | required this.userMessageController, 8 | }); 9 | 10 | final TextEditingController userMessageController; 11 | 12 | @override 13 | State createState() => _MainTextFieldState(); 14 | } 15 | 16 | class _MainTextFieldState extends State { 17 | @override 18 | Widget build(BuildContext context) { 19 | return Row( 20 | children: [ 21 | Expanded( 22 | child: TextField( 23 | controller: widget.userMessageController, 24 | cursorColor: ThemeProvider.themeOf(context).id == "light_theme" 25 | ? Colors.black 26 | : Colors.white, 27 | style: TextStyle( 28 | color: ThemeProvider.themeOf(context).id == "light_theme" 29 | ? Colors.black 30 | : Colors.white, 31 | ), 32 | minLines: 1, 33 | maxLines: 5, 34 | decoration: InputDecoration( 35 | hintText: "ask about anything...", 36 | hintStyle: TextStyle( 37 | color: ThemeProvider.themeOf(context).id == "light_theme" 38 | ? Colors.black 39 | : Colors.grey[500], 40 | ), 41 | border: InputBorder.none, 42 | filled: true, 43 | fillColor: ThemeProvider.themeOf(context).id == "light_theme" 44 | ? const Color(0xfff2f2f2) 45 | : const Color(0xff1a1a1a), 46 | ), 47 | ), 48 | ), 49 | ], 50 | ); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Nativechat 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | nativechat 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | CADisableMinimumFrameDurationOnPhone 45 | 46 | UIApplicationSupportsIndirectInputEvents 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: "d8a9f9a52e5af486f80d932e838ee93861ffd863" 8 | channel: "stable" 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 17 | base_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 18 | - platform: android 19 | create_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 20 | base_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 21 | - platform: ios 22 | create_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 23 | base_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 24 | - platform: linux 25 | create_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 26 | base_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 27 | - platform: macos 28 | create_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 29 | base_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 30 | - platform: web 31 | create_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 32 | base_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 33 | - platform: windows 34 | create_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 35 | base_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 36 | 37 | # User provided section 38 | 39 | # List of Local paths (relative to this file) that should be 40 | # ignored by the migrate tool. 41 | # 42 | # Files that are not part of the templates will be ignored by default. 43 | unmanaged_files: 44 | - 'lib/main.dart' 45 | - 'ios/Runner.xcodeproj/project.pbxproj' 46 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "version": 1, 4 | "author": "xcode" 5 | }, 6 | "images": [ 7 | { 8 | "size": "16x16", 9 | "idiom": "mac", 10 | "filename": "app_icon_16.png", 11 | "scale": "1x" 12 | }, 13 | { 14 | "size": "16x16", 15 | "idiom": "mac", 16 | "filename": "app_icon_32.png", 17 | "scale": "2x" 18 | }, 19 | { 20 | "size": "32x32", 21 | "idiom": "mac", 22 | "filename": "app_icon_32.png", 23 | "scale": "1x" 24 | }, 25 | { 26 | "size": "32x32", 27 | "idiom": "mac", 28 | "filename": "app_icon_64.png", 29 | "scale": "2x" 30 | }, 31 | { 32 | "size": "128x128", 33 | "idiom": "mac", 34 | "filename": "app_icon_128.png", 35 | "scale": "1x" 36 | }, 37 | { 38 | "size": "128x128", 39 | "idiom": "mac", 40 | "filename": "app_icon_256.png", 41 | "scale": "2x" 42 | }, 43 | { 44 | "size": "256x256", 45 | "idiom": "mac", 46 | "filename": "app_icon_256.png", 47 | "scale": "1x" 48 | }, 49 | { 50 | "size": "256x256", 51 | "idiom": "mac", 52 | "filename": "app_icon_512.png", 53 | "scale": "2x" 54 | }, 55 | { 56 | "size": "512x512", 57 | "idiom": "mac", 58 | "filename": "app_icon_512.png", 59 | "scale": "1x" 60 | }, 61 | { 62 | "size": "512x512", 63 | "idiom": "mac", 64 | "filename": "app_icon_1024.png", 65 | "scale": "2x" 66 | } 67 | ] 68 | } -------------------------------------------------------------------------------- /lib/components/chat_feed/chat_image_container.dart: -------------------------------------------------------------------------------- 1 | // dart 2 | // File: lib/components/chat_image_container.dart 3 | import 'dart:typed_data'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:nativechat/state/is_one_sided_chat_mode_notifier.dart'; 6 | import 'package:nativechat/utils/open_image_fullscreen.dart'; 7 | 8 | class ChatImageContainer extends StatefulWidget { 9 | const ChatImageContainer({ 10 | super.key, 11 | required this.image, 12 | }); 13 | 14 | final Uint8List image; 15 | 16 | @override 17 | State createState() => _ChatImageContainerState(); 18 | } 19 | 20 | class _ChatImageContainerState extends State { 21 | var isOneSidedChatModeNotifier = IsOneSidedChatModeNotifier(); 22 | 23 | @override 24 | Widget build(BuildContext context) { 25 | return ValueListenableBuilder( 26 | valueListenable: isOneSidedChatModeNotifier.isOneSidedChatMode, 27 | builder: (context, value, child) { 28 | return Align( 29 | alignment: value ? Alignment.centerLeft : Alignment.centerRight, 30 | child: Padding( 31 | padding: const EdgeInsets.symmetric( 32 | vertical: 8.0, 33 | horizontal: 12.0, 34 | ), 35 | child: SizedBox( 36 | height: 150.0, 37 | width: 150.0, 38 | child: GestureDetector( 39 | onTap: () => openImage(context, widget.image), 40 | child: ClipRRect( 41 | clipBehavior: Clip.hardEdge, 42 | borderRadius: BorderRadius.circular(12.0), 43 | child: Image.memory( 44 | widget.image, 45 | fit: BoxFit.cover, 46 | // height: 200, 47 | ), 48 | ), 49 | ), 50 | ), 51 | ), 52 | ); 53 | }, 54 | ); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Add preprocessor definitions for the build version. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") 25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") 26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") 27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") 28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") 29 | 30 | # Disable Windows macros that collide with C++ standard library functions. 31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 32 | 33 | # Add dependency libraries and include directories. Add any application-specific 34 | # dependencies here. 35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 36 | target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") 37 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 38 | 39 | # Run the Flutter tool portions of the build. This must not be removed. 40 | add_dependencies(${BINARY_NAME} flutter_assemble) 41 | -------------------------------------------------------------------------------- /lib/components/remarks.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:nativechat/constants/remarks.dart'; 3 | import 'package:nativechat/constants/urls.dart'; 4 | import 'package:url_launcher/url_launcher.dart'; 5 | 6 | class Remarks extends StatefulWidget { 7 | const Remarks({super.key}); 8 | 9 | @override 10 | State createState() => _RemarksState(); 11 | } 12 | 13 | class _RemarksState extends State { 14 | @override 15 | Widget build(BuildContext context) { 16 | return Expanded( 17 | child: Container( 18 | padding: const EdgeInsets.only( 19 | left: 10.0, 20 | right: 10.0, 21 | bottom: 30.0, 22 | ), 23 | child: ListView( 24 | reverse: true, 25 | children: [ 26 | Column( 27 | spacing: 30.0, 28 | children: [ 29 | Image.asset( 30 | 'assets/logo/logoBorder.png', 31 | height: 80.0, 32 | ), 33 | Text( 34 | remarks, 35 | textAlign: TextAlign.center, 36 | style: TextStyle( 37 | color: Colors.grey[600]!, 38 | ), 39 | ), 40 | GestureDetector( 41 | onTap: () async { 42 | // Open the project source code in a browser 43 | await launchUrl(Uri.parse(github)); 44 | }, 45 | child: Text( 46 | "This project is free and open source. Click here to star, contribute or view the project source code.", 47 | textAlign: TextAlign.center, 48 | style: TextStyle( 49 | color: Colors.blueAccent, 50 | ), 51 | ), 52 | ), 53 | ], 54 | ), 55 | ], 56 | ), 57 | ), 58 | ); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /lib/components/attachment_preview/attachment_preview.dart: -------------------------------------------------------------------------------- 1 | // dart 2 | import 'dart:typed_data'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:nativechat/components/attachment_preview/attached_file_preview.dart'; 5 | import 'package:nativechat/components/attachment_preview/attached_image_preview.dart'; 6 | 7 | class AttachmentPreview extends StatelessWidget { 8 | final Uint8List? attachedFileBytes; 9 | final Uint8List? attachedImageBytes; 10 | final String? attachedMime; 11 | final String? attachedFileName; 12 | final VoidCallback removeAttachment; 13 | 14 | const AttachmentPreview({ 15 | super.key, 16 | required this.attachedFileBytes, 17 | required this.attachedImageBytes, 18 | required this.attachedMime, 19 | this.attachedFileName, 20 | required this.removeAttachment, 21 | }); 22 | 23 | @override 24 | Widget build(BuildContext context) { 25 | // File Content 26 | final Uint8List? previewBytes = attachedFileBytes ?? attachedImageBytes; 27 | if (previewBytes == null) return const SizedBox.shrink(); 28 | 29 | // Check if the attached file is an image or audio file. 30 | final bool isImage = 31 | attachedMime != null && attachedMime!.startsWith('image/'); 32 | final bool isAudio = 33 | attachedMime != null && attachedMime!.startsWith('audio/'); 34 | 35 | // Use the actual file name if provided and non-empty, otherwise fallback. 36 | final String displayName = 37 | (attachedFileName != null && attachedFileName!.isNotEmpty) 38 | ? attachedFileName! 39 | : (isAudio ? 'Audio File Attached' : 'Preview File'); 40 | 41 | return isImage 42 | ? AttachedImagePreview( 43 | previewBytes: previewBytes, 44 | removeAttachment: removeAttachment, 45 | ) 46 | : AttachedFilePreview( 47 | isAudio: isAudio, 48 | displayName: displayName, 49 | removeAttachment: removeAttachment, 50 | ); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | unsigned int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr) 51 | -1; // remove the trailing null character 52 | int input_length = (int)wcslen(utf16_string); 53 | std::string utf8_string; 54 | if (target_length == 0 || target_length > utf8_string.max_size()) { 55 | return utf8_string; 56 | } 57 | utf8_string.resize(target_length); 58 | int converted_length = ::WideCharToMultiByte( 59 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 60 | input_length, utf8_string.data(), target_length, nullptr, nullptr); 61 | if (converted_length == 0) { 62 | return std::string(); 63 | } 64 | return utf8_string; 65 | } 66 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | {"images":[{"size":"20x20","idiom":"iphone","filename":"Icon-App-20x20@2x.png","scale":"2x"},{"size":"20x20","idiom":"iphone","filename":"Icon-App-20x20@3x.png","scale":"3x"},{"size":"29x29","idiom":"iphone","filename":"Icon-App-29x29@1x.png","scale":"1x"},{"size":"29x29","idiom":"iphone","filename":"Icon-App-29x29@2x.png","scale":"2x"},{"size":"29x29","idiom":"iphone","filename":"Icon-App-29x29@3x.png","scale":"3x"},{"size":"40x40","idiom":"iphone","filename":"Icon-App-40x40@2x.png","scale":"2x"},{"size":"40x40","idiom":"iphone","filename":"Icon-App-40x40@3x.png","scale":"3x"},{"size":"57x57","idiom":"iphone","filename":"Icon-App-57x57@1x.png","scale":"1x"},{"size":"57x57","idiom":"iphone","filename":"Icon-App-57x57@2x.png","scale":"2x"},{"size":"60x60","idiom":"iphone","filename":"Icon-App-60x60@2x.png","scale":"2x"},{"size":"60x60","idiom":"iphone","filename":"Icon-App-60x60@3x.png","scale":"3x"},{"size":"20x20","idiom":"ipad","filename":"Icon-App-20x20@1x.png","scale":"1x"},{"size":"20x20","idiom":"ipad","filename":"Icon-App-20x20@2x.png","scale":"2x"},{"size":"29x29","idiom":"ipad","filename":"Icon-App-29x29@1x.png","scale":"1x"},{"size":"29x29","idiom":"ipad","filename":"Icon-App-29x29@2x.png","scale":"2x"},{"size":"40x40","idiom":"ipad","filename":"Icon-App-40x40@1x.png","scale":"1x"},{"size":"40x40","idiom":"ipad","filename":"Icon-App-40x40@2x.png","scale":"2x"},{"size":"50x50","idiom":"ipad","filename":"Icon-App-50x50@1x.png","scale":"1x"},{"size":"50x50","idiom":"ipad","filename":"Icon-App-50x50@2x.png","scale":"2x"},{"size":"72x72","idiom":"ipad","filename":"Icon-App-72x72@1x.png","scale":"1x"},{"size":"72x72","idiom":"ipad","filename":"Icon-App-72x72@2x.png","scale":"2x"},{"size":"76x76","idiom":"ipad","filename":"Icon-App-76x76@1x.png","scale":"1x"},{"size":"76x76","idiom":"ipad","filename":"Icon-App-76x76@2x.png","scale":"2x"},{"size":"83.5x83.5","idiom":"ipad","filename":"Icon-App-83.5x83.5@2x.png","scale":"2x"},{"size":"1024x1024","idiom":"ios-marketing","filename":"Icon-App-1024x1024@1x.png","scale":"1x"}],"info":{"version":1,"author":"xcode"}} -------------------------------------------------------------------------------- /lib/components/home_appbar.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:ionicons/ionicons.dart'; 3 | 4 | class HomeAppbar extends StatefulWidget implements PreferredSizeWidget { 5 | const HomeAppbar({ 6 | super.key, 7 | required this.openDrawer, 8 | required this.creatSession, 9 | required this.toggleAPIKey, 10 | required this.clearConversation, 11 | }); 12 | 13 | final VoidCallback openDrawer; 14 | final VoidCallback creatSession; 15 | final VoidCallback toggleAPIKey; 16 | final VoidCallback clearConversation; 17 | 18 | @override 19 | State createState() => _HomeAppbarState(); 20 | 21 | @override 22 | Size get preferredSize => Size.fromHeight(kToolbarHeight); 23 | } 24 | 25 | class _HomeAppbarState extends State { 26 | @override 27 | Widget build(BuildContext context) { 28 | return AppBar( 29 | leadingWidth: 100, 30 | leading: Row( 31 | children: [ 32 | IconButton( 33 | onPressed: widget.openDrawer, 34 | icon: Icon( 35 | Icons.history, 36 | size: 20.0, 37 | color: Theme.of(context).iconTheme.color, 38 | ), 39 | ), 40 | ], 41 | ), 42 | actions: [ 43 | // API Key 44 | IconButton( 45 | onPressed: widget.toggleAPIKey, 46 | icon: Icon( 47 | Ionicons.key_outline, 48 | size: 18.0, 49 | color: Theme.of(context).iconTheme.color, 50 | ), 51 | ), 52 | 53 | // Clear Chat 54 | IconButton( 55 | onPressed: widget.clearConversation, 56 | icon: Icon( 57 | Ionicons.trash_outline, 58 | size: 18.0, 59 | color: Theme.of(context).iconTheme.color, 60 | ), 61 | ), 62 | 63 | // Start New Chat 64 | IconButton( 65 | onPressed: widget.creatSession, 66 | icon: Icon( 67 | Icons.add, 68 | size: 20.0, 69 | color: Theme.of(context).iconTheme.color, 70 | ), 71 | ), 72 | ], 73 | ); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /lib/components/settings_components/dark_mode_toggle_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:theme_provider/theme_provider.dart'; 3 | 4 | class DarkModeToggleButton extends StatefulWidget { 5 | const DarkModeToggleButton({ 6 | super.key, 7 | }); 8 | 9 | @override 10 | State createState() => _DarkModeToggleButtonState(); 11 | } 12 | 13 | class _DarkModeToggleButtonState extends State { 14 | @override 15 | Widget build(BuildContext context) { 16 | return Expanded( 17 | child: GestureDetector( 18 | onTap: () { 19 | ThemeProvider.controllerOf(context).nextTheme(); 20 | }, 21 | child: Container( 22 | padding: const EdgeInsets.symmetric( 23 | vertical: 14.0, 24 | ), 25 | decoration: BoxDecoration( 26 | color: ThemeProvider.themeOf(context).id == "light_theme" 27 | ? Colors.grey[200]! 28 | : Colors.grey[900]!, 29 | borderRadius: BorderRadius.circular(10.0), 30 | border: Border.all( 31 | color: ThemeProvider.themeOf(context).id == "light_theme" 32 | ? Colors.grey[400]! 33 | : Colors.grey[800]!, 34 | ), 35 | ), 36 | child: Column( 37 | spacing: 10.0, 38 | children: [ 39 | Icon( 40 | ThemeProvider.themeOf(context).id == "light_theme" 41 | ? Icons.dark_mode_outlined 42 | : Icons.wb_sunny_outlined, 43 | size: 22.0, 44 | color: ThemeProvider.themeOf(context).id == "dark_theme" 45 | ? Colors.white 46 | : Colors.black, 47 | ), 48 | Text( 49 | "Dark Mode", 50 | style: TextStyle( 51 | color: ThemeProvider.themeOf(context).id == "dark_theme" 52 | ? Colors.white 53 | : Colors.black, 54 | ), 55 | ), 56 | ], 57 | ), 58 | ), 59 | ), 60 | ); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /lib/components/chat_history_drawer/chat_history_drawer_footer.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:hive/hive.dart'; 3 | import 'package:ionicons/ionicons.dart'; 4 | import 'package:nativechat/models/chat_session.dart'; 5 | import 'package:nativechat/pages/settings_page.dart'; 6 | import 'package:nativechat/utils/show_toast.dart'; 7 | 8 | class ChatHistoryDrawerFooter extends StatefulWidget { 9 | const ChatHistoryDrawerFooter({ 10 | super.key, 11 | required this.chatBox, 12 | }); 13 | 14 | final Box? chatBox; 15 | 16 | @override 17 | State createState() => 18 | _ChatHistoryDrawerFooterState(); 19 | } 20 | 21 | class _ChatHistoryDrawerFooterState extends State { 22 | @override 23 | Widget build(BuildContext context) { 24 | return Padding( 25 | padding: const EdgeInsets.only( 26 | left: 5.0, 27 | right: 5.0, 28 | bottom: 10.0, 29 | ), 30 | child: Row( 31 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 32 | children: [ 33 | // Delete All Chats 34 | Align( 35 | alignment: Alignment.bottomLeft, 36 | child: IconButton( 37 | icon: Icon( 38 | Icons.delete_sweep_outlined, 39 | size: 25.0, 40 | color: Theme.of(context).iconTheme.color, 41 | ), 42 | onPressed: () { 43 | widget.chatBox?.clear(); 44 | setState(() {}); 45 | showToast(context, "Deleted All Chat History"); 46 | }, 47 | ), 48 | ), 49 | 50 | // Settings 51 | IconButton( 52 | onPressed: () { 53 | Navigator.push( 54 | context, 55 | MaterialPageRoute(builder: (context) { 56 | return SettingsPage(); 57 | }), 58 | ); 59 | }, 60 | icon: Icon( 61 | Ionicons.settings_outline, 62 | size: 20.0, 63 | color: Theme.of(context).iconTheme.color, 64 | ), 65 | ), 66 | ], 67 | ), 68 | ); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /lib/components/chat_history_drawer/search_chat_history.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:theme_provider/theme_provider.dart'; 3 | 4 | class SearchChatHistory extends StatefulWidget { 5 | const SearchChatHistory( 6 | {super.key, 7 | required this.searchController, 8 | required this.onSearchChanged}); 9 | 10 | final TextEditingController searchController; 11 | final Function(String) onSearchChanged; 12 | 13 | @override 14 | State createState() => _SearchChatHistoryState(); 15 | } 16 | 17 | class _SearchChatHistoryState extends State { 18 | @override 19 | Widget build(BuildContext context) { 20 | return Container( 21 | padding: const EdgeInsets.only(left: 5.0, bottom: 20.0), 22 | child: TextField( 23 | controller: widget.searchController, 24 | onChanged: widget.onSearchChanged, 25 | cursorColor: ThemeProvider.themeOf(context).id == "light_theme" 26 | ? Colors.black 27 | : Colors.white, 28 | decoration: InputDecoration( 29 | contentPadding: const EdgeInsets.only(top: 10.0, left: 15.0), 30 | // prefixIcon: Icon( 31 | // Icons.search, 32 | // size: 20.0, 33 | // color: ThemeProvider.themeOf(context).id == "light_theme" 34 | // ? Colors.grey[600] 35 | // : Colors.grey[400], 36 | // ), 37 | hintText: "Search chats", 38 | hintStyle: TextStyle( 39 | color: ThemeProvider.themeOf(context).id == "light_theme" 40 | ? Colors.grey[600] 41 | : Colors.grey[500], 42 | ), 43 | border: OutlineInputBorder( 44 | borderRadius: BorderRadius.circular(20.0), 45 | borderSide: BorderSide.none, 46 | ), 47 | filled: true, 48 | fillColor: ThemeProvider.themeOf(context).id == "light_theme" 49 | ? Colors.grey[100] 50 | : Colors.grey[900], 51 | ), 52 | style: TextStyle( 53 | color: ThemeProvider.themeOf(context).id == "light_theme" 54 | ? Colors.black 55 | : Colors.white, 56 | ), 57 | ), 58 | ); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /lib/components/settings_components/memories_buttons.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:nativechat/components/settings_components/memories_bottom_sheet.dart'; 3 | import 'package:theme_provider/theme_provider.dart'; 4 | 5 | class MemoriesButtons extends StatefulWidget { 6 | const MemoriesButtons({super.key}); 7 | 8 | @override 9 | State createState() => _MemoriesButtonsState(); 10 | } 11 | 12 | class _MemoriesButtonsState extends State { 13 | void showMemories() { 14 | showModalBottomSheet( 15 | context: context, 16 | builder: (context) { 17 | return MemoriesBottomSheet(); 18 | }, 19 | ); 20 | } 21 | 22 | @override 23 | Widget build(BuildContext context) { 24 | return Expanded( 25 | child: GestureDetector( 26 | onTap: () { 27 | showMemories(); 28 | }, 29 | child: Container( 30 | padding: const EdgeInsets.symmetric( 31 | vertical: 14.0, 32 | ), 33 | decoration: BoxDecoration( 34 | color: ThemeProvider.themeOf(context).id == "light_theme" 35 | ? Colors.grey[200]! 36 | : Colors.grey[900]!, 37 | borderRadius: BorderRadius.circular(10.0), 38 | border: Border.all( 39 | color: ThemeProvider.themeOf(context).id == "light_theme" 40 | ? Colors.grey[400]! 41 | : Colors.grey[800]!, 42 | ), 43 | ), 44 | child: Column( 45 | spacing: 10.0, 46 | children: [ 47 | Icon( 48 | Icons.memory_outlined, 49 | size: 22.0, 50 | color: ThemeProvider.themeOf(context).id == "dark_theme" 51 | ? Colors.white 52 | : Colors.black, 53 | ), 54 | Text( 55 | "Memories", 56 | style: TextStyle( 57 | color: ThemeProvider.themeOf(context).id == "dark_theme" 58 | ? Colors.white 59 | : Colors.black, 60 | ), 61 | ), 62 | ], 63 | ), 64 | ), 65 | ), 66 | ); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /lib/components/settings_components/each_memory.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:ionicons/ionicons.dart'; 3 | import 'package:theme_provider/theme_provider.dart'; 4 | 5 | class EachMemory extends StatefulWidget { 6 | const EachMemory({ 7 | super.key, 8 | required this.memory, 9 | required this.forgetOneMemory, 10 | }); 11 | 12 | final String memory; 13 | final Function forgetOneMemory; 14 | 15 | @override 16 | State createState() => _EachMemoryState(); 17 | } 18 | 19 | class _EachMemoryState extends State { 20 | @override 21 | Widget build(BuildContext context) { 22 | return Container( 23 | padding: const EdgeInsets.only( 24 | left: 20.0, 25 | right: 5.0, 26 | top: 5.0, 27 | bottom: 5.0, 28 | ), 29 | decoration: BoxDecoration( 30 | border: Border( 31 | top: BorderSide( 32 | color: ThemeProvider.themeOf(context).id == "light_theme" 33 | ? Colors.grey[300]! 34 | : Colors.grey[800]!, 35 | width: 0.3, 36 | ), 37 | bottom: BorderSide( 38 | color: ThemeProvider.themeOf(context).id == "light_theme" 39 | ? Colors.grey[300]! 40 | : Colors.grey[800]!, 41 | width: 0.3, 42 | ), 43 | ), 44 | ), 45 | child: Row( 46 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 47 | children: [ 48 | Expanded( 49 | child: Text( 50 | widget.memory, 51 | style: TextStyle( 52 | color: ThemeProvider.themeOf(context).id == "dark_theme" 53 | ? Colors.white 54 | : Colors.black, 55 | ), 56 | ), 57 | ), 58 | IconButton( 59 | onPressed: () { 60 | widget.forgetOneMemory(widget.memory); 61 | }, 62 | icon: Icon( 63 | Ionicons.trash_outline, 64 | size: 15, 65 | color: ThemeProvider.themeOf(context).id == "dark_theme" 66 | ? Colors.white 67 | : Colors.black, 68 | ), 69 | ), 70 | ], 71 | ), 72 | ); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /lib/components/input_box/voice_mode_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:theme_provider/theme_provider.dart'; 3 | 4 | class VoiceModeButton extends StatefulWidget { 5 | const VoiceModeButton({ 6 | super.key, 7 | required this.toggleVoiceMode, 8 | required this.isInVoiceMode, 9 | }); 10 | 11 | final Function toggleVoiceMode; 12 | final bool isInVoiceMode; 13 | 14 | @override 15 | State createState() => _VoiceModeButtonState(); 16 | } 17 | 18 | class _VoiceModeButtonState extends State { 19 | @override 20 | Widget build(BuildContext context) { 21 | return GestureDetector( 22 | onTap: () { 23 | widget.toggleVoiceMode(); 24 | }, 25 | child: Container( 26 | padding: const EdgeInsets.symmetric( 27 | horizontal: 15.0, 28 | vertical: 6.0, 29 | ), 30 | decoration: BoxDecoration( 31 | border: Border.all( 32 | color: widget.isInVoiceMode 33 | ? ThemeProvider.themeOf(context).id == "light_theme" 34 | ? Colors.green[600]! 35 | : Colors.greenAccent 36 | : Theme.of(context).iconTheme.color!.withAlpha(100), 37 | ), 38 | borderRadius: BorderRadius.circular(100.0), 39 | ), 40 | child: Row( 41 | children: [ 42 | Icon( 43 | widget.isInVoiceMode ? Icons.mic : Icons.mic_off, 44 | color: widget.isInVoiceMode 45 | ? ThemeProvider.themeOf(context).id == "light_theme" 46 | ? Colors.green[600]! 47 | : Colors.greenAccent 48 | : Theme.of(context).iconTheme.color, 49 | size: 18.0, 50 | ), 51 | const SizedBox(width: 4.0), 52 | Text( 53 | 'Voice Mode', 54 | style: TextStyle( 55 | color: widget.isInVoiceMode 56 | ? ThemeProvider.themeOf(context).id == "light_theme" 57 | ? Colors.green[600]! 58 | : Colors.greenAccent 59 | : Theme.of(context).iconTheme.color, 60 | ), 61 | ), 62 | ], 63 | ), 64 | ), 65 | ); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | 30 | flutter_controller_->engine()->SetNextFrameCallback([&]() { 31 | this->Show(); 32 | }); 33 | 34 | // Flutter can complete the first frame before the "show window" callback is 35 | // registered. The following call ensures a frame is pending to ensure the 36 | // window is shown. It is a no-op if the first frame hasn't completed yet. 37 | flutter_controller_->ForceRedraw(); 38 | 39 | return true; 40 | } 41 | 42 | void FlutterWindow::OnDestroy() { 43 | if (flutter_controller_) { 44 | flutter_controller_ = nullptr; 45 | } 46 | 47 | Win32Window::OnDestroy(); 48 | } 49 | 50 | LRESULT 51 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 52 | WPARAM const wparam, 53 | LPARAM const lparam) noexcept { 54 | // Give Flutter, including plugins, an opportunity to handle window messages. 55 | if (flutter_controller_) { 56 | std::optional result = 57 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 58 | lparam); 59 | if (result) { 60 | return *result; 61 | } 62 | } 63 | 64 | switch (message) { 65 | case WM_FONTCHANGE: 66 | flutter_controller_->engine()->ReloadSystemFonts(); 67 | break; 68 | } 69 | 70 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 71 | } 72 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /lib/components/chat_feed/attached_file_container.dart: -------------------------------------------------------------------------------- 1 | // dart 2 | import 'package:flutter/material.dart'; 3 | import 'package:ionicons/ionicons.dart'; 4 | import 'package:theme_provider/theme_provider.dart'; 5 | 6 | class AttachedFileContainer extends StatefulWidget { 7 | const AttachedFileContainer({ 8 | super.key, 9 | required this.fileName, 10 | required this.isUser, 11 | this.isAudio = false, 12 | }); 13 | 14 | final String fileName; 15 | final bool isUser; 16 | final bool isAudio; 17 | 18 | @override 19 | State createState() => _AttachedFileContainerState(); 20 | } 21 | 22 | class _AttachedFileContainerState extends State { 23 | @override 24 | Widget build(BuildContext context) { 25 | var color = ThemeProvider.themeOf(context).id == "light_theme" 26 | ? Colors.black 27 | : Colors.white; 28 | 29 | // Choose the leading icon based on isAudio flag. 30 | final icon = widget.isAudio 31 | ? Icons.multitrack_audio_outlined 32 | : Ionicons.folder_open_outline; 33 | 34 | return Container( 35 | alignment: Alignment.centerRight, 36 | clipBehavior: Clip.hardEdge, 37 | constraints: BoxConstraints( 38 | maxWidth: MediaQuery.of(context).size.width * 0.5, 39 | ), 40 | margin: EdgeInsets.only( 41 | left: 5.0, 42 | right: 5.0, 43 | bottom: 5.0, 44 | ), 45 | padding: const EdgeInsets.only( 46 | left: 10.0, 47 | right: 5.0, 48 | top: 6.0, 49 | bottom: 6.0, 50 | ), 51 | decoration: BoxDecoration( 52 | color: ThemeProvider.themeOf(context).id == "light_theme" 53 | ? const Color(0xfff2f2f2) 54 | : const Color(0xff1a1a1a), 55 | border: Border.all( 56 | color: ThemeProvider.themeOf(context).id == "light_theme" 57 | ? Colors.grey[300]! 58 | : Colors.grey[900]!, 59 | ), 60 | borderRadius: BorderRadius.circular(100.0), 61 | ), 62 | child: Row( 63 | mainAxisAlignment: MainAxisAlignment.end, 64 | children: [ 65 | Icon( 66 | icon, 67 | color: color, 68 | size: 18.0, 69 | ), 70 | const SizedBox(width: 6.0), 71 | Expanded( 72 | child: Text( 73 | widget.fileName, 74 | maxLines: 1, 75 | overflow: TextOverflow.ellipsis, 76 | style: TextStyle(color: color), 77 | ), 78 | ), 79 | ], 80 | ), 81 | ); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /lib/components/settings_components/one_sided_chat_toggle_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:nativechat/state/is_one_sided_chat_mode_notifier.dart'; 3 | import 'package:theme_provider/theme_provider.dart'; 4 | 5 | class OneSidedChatToggleButton extends StatefulWidget { 6 | const OneSidedChatToggleButton({ 7 | super.key, 8 | }); 9 | 10 | @override 11 | State createState() => 12 | _OneSidedChatToggleButtonState(); 13 | } 14 | 15 | class _OneSidedChatToggleButtonState extends State { 16 | var isOneSidedChatModeNotifier = IsOneSidedChatModeNotifier(); 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | return Expanded( 21 | child: GestureDetector( 22 | onTap: () { 23 | isOneSidedChatModeNotifier.toggle(); 24 | }, 25 | child: Container( 26 | padding: const EdgeInsets.symmetric( 27 | vertical: 14.0, 28 | ), 29 | decoration: BoxDecoration( 30 | color: ThemeProvider.themeOf(context).id == "light_theme" 31 | ? Colors.grey[200]! 32 | : Colors.grey[900]!, 33 | borderRadius: BorderRadius.circular(10.0), 34 | border: Border.all( 35 | color: ThemeProvider.themeOf(context).id == "light_theme" 36 | ? Colors.grey[400]! 37 | : Colors.grey[800]!, 38 | ), 39 | ), 40 | child: Column( 41 | spacing: 10.0, 42 | children: [ 43 | ValueListenableBuilder( 44 | valueListenable: isOneSidedChatModeNotifier.isOneSidedChatMode, 45 | builder: (context, value, child) { 46 | return Icon( 47 | value 48 | ? Icons.align_horizontal_right_outlined 49 | : Icons.align_horizontal_left_outlined, 50 | size: 22.0, 51 | color: ThemeProvider.themeOf(context).id == "dark_theme" 52 | ? Colors.white 53 | : Colors.black, 54 | ); 55 | }, 56 | ), 57 | Text( 58 | "One Sided Chat", 59 | style: TextStyle( 60 | color: ThemeProvider.themeOf(context).id == "dark_theme" 61 | ? Colors.white 62 | : Colors.black, 63 | ), 64 | ), 65 | ], 66 | ), 67 | ), 68 | ), 69 | ); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /lib/components/attach_file_popup_menu/attach_file_popup_menu.dart: -------------------------------------------------------------------------------- 1 | // dart 2 | import 'package:flutter/material.dart'; 3 | import 'package:ionicons/ionicons.dart'; 4 | import 'package:nativechat/components/attach_file_popup_menu/attach_file_button.dart'; 5 | import 'package:nativechat/components/attach_file_popup_menu/each_popup_menu_item.dart'; 6 | import 'package:theme_provider/theme_provider.dart'; 7 | 8 | enum AttachmentOption { file, image, audio, camera } 9 | 10 | class AttachFilePopupMenu extends StatelessWidget { 11 | final VoidCallback onPickFile; 12 | final VoidCallback onPickImage; 13 | final VoidCallback onPickAudio; 14 | final VoidCallback onPickCamera; 15 | 16 | const AttachFilePopupMenu({ 17 | super.key, 18 | required this.onPickFile, 19 | required this.onPickImage, 20 | required this.onPickAudio, 21 | required this.onPickCamera, 22 | }); 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | return PopupMenuButton( 27 | color: ThemeProvider.themeOf(context).id == "light_theme" 28 | ? const Color(0xfff2f2f2) 29 | : const Color(0xff1a1a1a), 30 | // offset: const Offset(0, -260), // Adjust the Y value as needed 31 | borderRadius: BorderRadius.circular(100.0), 32 | child: AttachFileButton(), 33 | onSelected: (AttachmentOption option) { 34 | switch (option) { 35 | case AttachmentOption.file: 36 | onPickFile(); 37 | break; 38 | case AttachmentOption.image: 39 | onPickImage(); 40 | break; 41 | case AttachmentOption.audio: 42 | onPickAudio(); 43 | break; 44 | case AttachmentOption.camera: 45 | onPickCamera(); 46 | break; 47 | } 48 | }, 49 | itemBuilder: (BuildContext context) => >[ 50 | EachPopupMenuItem( 51 | attachmentOption: AttachmentOption.file, 52 | icon: Ionicons.folder_open_outline, 53 | title: 'File', 54 | ), 55 | EachPopupMenuItem( 56 | attachmentOption: AttachmentOption.audio, 57 | icon: Icons.multitrack_audio_outlined, 58 | title: 'Audio', 59 | ), 60 | EachPopupMenuItem( 61 | attachmentOption: AttachmentOption.image, 62 | icon: Ionicons.image_outline, 63 | title: 'Photos', 64 | ), 65 | EachPopupMenuItem( 66 | attachmentOption: AttachmentOption.camera, 67 | icon: Icons.camera_alt_outlined, 68 | title: 'Camera', 69 | ), 70 | ], 71 | ); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /lib/components/attachment_preview/attached_file_preview.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:ionicons/ionicons.dart'; 3 | import 'package:nativechat/components/attachment_preview/remove_attachment_button.dart'; 4 | import 'package:theme_provider/theme_provider.dart'; 5 | 6 | class AttachedFilePreview extends StatefulWidget { 7 | const AttachedFilePreview({ 8 | super.key, 9 | required this.isAudio, 10 | required this.displayName, 11 | required this.removeAttachment, 12 | }); 13 | 14 | final bool isAudio; 15 | final String displayName; 16 | final VoidCallback removeAttachment; 17 | 18 | @override 19 | State createState() => _AttachedFilePreviewState(); 20 | } 21 | 22 | class _AttachedFilePreviewState extends State { 23 | @override 24 | Widget build(BuildContext context) { 25 | var color = ThemeProvider.themeOf(context).id == "light_theme" 26 | ? Colors.black 27 | : Colors.white; 28 | 29 | return Container( 30 | constraints: BoxConstraints( 31 | maxWidth: MediaQuery.of(context).size.width * 0.6, 32 | ), 33 | decoration: BoxDecoration( 34 | borderRadius: BorderRadius.circular(100.0), 35 | color: ThemeProvider.themeOf(context).id == "light_theme" 36 | ? const Color(0xfff2f2f2) 37 | : const Color(0xff1a1a1a), 38 | ), 39 | margin: const EdgeInsets.symmetric( 40 | horizontal: 16.0, 41 | vertical: 8.0, 42 | ), 43 | padding: const EdgeInsets.only( 44 | left: 15.0, 45 | right: 5.0, 46 | top: 5.0, 47 | bottom: 6.0, 48 | ), 49 | child: Row( 50 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 51 | children: [ 52 | Row( 53 | spacing: 10.0, 54 | children: [ 55 | Icon( 56 | widget.isAudio 57 | ? Icons.multitrack_audio_outlined 58 | : Ionicons.folder_open_outline, 59 | color: color, 60 | size: 18.0, 61 | ), 62 | SizedBox( 63 | width: 150.0, 64 | child: Text( 65 | widget.displayName, 66 | overflow: TextOverflow.ellipsis, 67 | style: TextStyle( 68 | fontWeight: FontWeight.w600, 69 | color: color, 70 | ), 71 | ), 72 | ), 73 | ], 74 | ), 75 | RemoveAttachmentButton( 76 | removeAttachment: widget.removeAttachment, 77 | ), 78 | ], 79 | ), 80 | ); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![](./assets/banners/banner.jpg) 2 | ![](./assets/promos/NativeChat1.png) 3 | 4 | # NativeChat 5 | 6 | NativeChat is a powerful application designed to bring seamless, context-aware interactions to your mobile device. Using Gemini under the hood, it offers a wide range of features to assist with tasks like fetching system specs, analyzing call logs, summarizing SMS messages, and providing insights into your device’s status. NativeChat makes your chat experience better by providing real-time data and personalized responses. 7 | 8 | ## Features 9 | 10 | - **Gemini-Powered Responses**: Leveraging the Gemini model, NativeChat generates insightful replies based on your device’s context and queries. 11 | - **Voice Mode**: Interact with NativeChat using your voice. It listens to your queries and responds with voice for a hands-free experience. 12 | - **System & Device Info**: Quickly access detailed information like device specs, battery status, installed apps, and more. 13 | - **Real-Time Assistance**: Retrieve and analyze your call logs, SMS messages, and system queries instantly. 14 | - **Versatile Coding Assistant**: Generate and debug code in various languages like Python, JavaScript, and Zig. 15 | 16 | ## Function Declarations 17 | 18 | - **Time** (getDeviceTime): Fetches the current date, time, and timezone of the device. 19 | 20 | - **Specs** (getDeviceSpecs): Retrieves system specifications and hardware details of the device. 21 | 22 | - **Call Logs** (getCallLogs): Retrieves a list of call history with details about each call (incoming, outgoing, missed). 23 | 24 | - **SMS** (getSMS): Retrieves a list of text messages, including sender, content, date, and read status. 25 | 26 | - **Battery** (getDeviceBattery): Provides the current battery level as a percentage and its charging state. 27 | 28 | - **Apps** (getDeviceApps): Returns a list of installed apps and their details such as name, package, and version. 29 | 30 | - **Clear Conversation** (clearConversation): Clears the current conversation history. 31 | 32 | ## Illustrations 33 | 34 | ![](./assets/promos/NativeChat2.jpg) 35 | 36 | ## Contributing 37 | 38 | We welcome contributions to improve NativeChat! Here's how you can help: 39 | 40 | 1. **Fork the Repository**: Create your own fork of the project on GitHub. 41 | 2. **Clone the Repository**: Clone your fork locally to make changes. 42 | 3. **Make Changes**: Implement bug fixes, add new features, or improve existing code. 43 | 4. **Push Changes**: Push your changes to your forked repository. 44 | 5. **Create a Pull Request**: Open a pull request to submit your changes for review. 45 | 46 | ## License 47 | 48 | NativeChat is open-source and licensed under the MIT License. See [LICENSE](LICENSE) for details. 49 | -------------------------------------------------------------------------------- /lib/components/attachment_preview/attached_image_preview.dart: -------------------------------------------------------------------------------- 1 | import 'dart:typed_data'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:nativechat/components/attachment_preview/remove_attachment_button.dart'; 5 | import 'package:nativechat/utils/open_image_fullscreen.dart'; 6 | import 'package:theme_provider/theme_provider.dart'; 7 | 8 | class AttachedImagePreview extends StatefulWidget { 9 | const AttachedImagePreview({ 10 | super.key, 11 | required this.previewBytes, 12 | required this.removeAttachment, 13 | }); 14 | 15 | final Uint8List previewBytes; 16 | final VoidCallback removeAttachment; 17 | 18 | @override 19 | State createState() => _AttachedImagePreviewState(); 20 | } 21 | 22 | class _AttachedImagePreviewState extends State { 23 | @override 24 | Widget build(BuildContext context) { 25 | return Stack( 26 | children: [ 27 | // Image Preview 28 | GestureDetector( 29 | onTap: () => openImage(context, widget.previewBytes), 30 | child: Container( 31 | height: 120.0, 32 | width: 120.0, 33 | margin: const EdgeInsets.symmetric( 34 | horizontal: 16.0, 35 | vertical: 8.0, 36 | ), 37 | padding: const EdgeInsets.all(10.0), 38 | decoration: BoxDecoration( 39 | borderRadius: BorderRadius.circular(20.0), 40 | color: ThemeProvider.themeOf(context).id == "light_theme" 41 | ? const Color(0xfff2f2f2) 42 | : const Color(0xff1a1a1a), 43 | // gradient: LinearGradient( 44 | // colors: [ 45 | // Theme.of(context).colorScheme.secondary.withAlpha(25), 46 | // Theme.of(context).colorScheme.secondary.withAlpha(50), 47 | // ], 48 | // begin: Alignment.topLeft, 49 | // end: Alignment.bottomRight, 50 | // ), 51 | // boxShadow: [ 52 | // BoxShadow( 53 | // color: Colors.black.withAlpha(25), 54 | // blurRadius: 8.0, 55 | // offset: const Offset(0, 4), 56 | // ), 57 | // ], 58 | ), 59 | child: ClipRRect( 60 | borderRadius: BorderRadius.circular(12.0), 61 | child: Image.memory( 62 | widget.previewBytes, 63 | fit: BoxFit.cover, 64 | ), 65 | ), 66 | ), 67 | ), 68 | 69 | // Remove Attachment Button 70 | Positioned( 71 | top: 0.0, 72 | right: 6.0, 73 | child: RemoveAttachmentButton( 74 | removeAttachment: widget.removeAttachment, 75 | isCircular: true, 76 | ), 77 | ) 78 | ], 79 | ); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /lib/components/chat_history_drawer/chat_history_drawer_header.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:hive/hive.dart'; 3 | import 'package:nativechat/components/chat_history_drawer/search_chat_history.dart'; 4 | import 'package:nativechat/models/chat_session.dart'; 5 | import 'package:theme_provider/theme_provider.dart'; 6 | 7 | class ChatHistoryDrawerHeader extends StatefulWidget { 8 | const ChatHistoryDrawerHeader({ 9 | super.key, 10 | required this.onChatSelected, 11 | required this.chatBox, 12 | required this.onSearchChanged, 13 | }); 14 | 15 | final void Function(ChatSessionModel) onChatSelected; 16 | final Box? chatBox; 17 | final Function(String) onSearchChanged; 18 | 19 | @override 20 | State createState() => 21 | _ChatHistoryDrawerHeaderState(); 22 | } 23 | 24 | class _ChatHistoryDrawerHeaderState extends State { 25 | final TextEditingController searchController = TextEditingController(); 26 | 27 | ChatSessionModel createSession() { 28 | final newSession = ChatSessionModel( 29 | title: "New Chat", 30 | messages: [], 31 | createdAt: DateTime.now(), 32 | ); 33 | widget.chatBox?.add(newSession); 34 | return newSession; 35 | } 36 | 37 | @override 38 | void dispose() { 39 | searchController.dispose(); 40 | super.dispose(); 41 | } 42 | 43 | @override 44 | Widget build(BuildContext context) { 45 | final isLightTheme = ThemeProvider.themeOf(context).id == "light_theme"; 46 | return Container( 47 | padding: const EdgeInsets.only( 48 | top: 45.0, 49 | right: 5.0, 50 | ), 51 | child: Column( 52 | crossAxisAlignment: CrossAxisAlignment.start, 53 | children: [ 54 | Row( 55 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 56 | children: [ 57 | Padding( 58 | padding: const EdgeInsets.only(left: 10.0), 59 | child: Text( 60 | 'Chats', 61 | style: TextStyle( 62 | fontSize: 18, 63 | color: isLightTheme ? Colors.black : Colors.white, 64 | ), 65 | ), 66 | ), 67 | IconButton( 68 | onPressed: () { 69 | widget.onChatSelected(createSession()); 70 | setState(() {}); 71 | }, 72 | icon: Icon( 73 | Icons.add, 74 | size: 20.0, 75 | color: isLightTheme ? Colors.black : Colors.white, 76 | ), 77 | ), 78 | ], 79 | ), 80 | const SizedBox(height: 10.0), 81 | 82 | // Search field 83 | widget.chatBox == null || widget.chatBox!.isEmpty 84 | ? Container() 85 | : SearchChatHistory( 86 | searchController: searchController, 87 | onSearchChanged: widget.onSearchChanged, 88 | ), 89 | ], 90 | ), 91 | ); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.10) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | 12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 13 | # which isn't available in 3.10. 14 | function(list_prepend LIST_NAME PREFIX) 15 | set(NEW_LIST "") 16 | foreach(element ${${LIST_NAME}}) 17 | list(APPEND NEW_LIST "${PREFIX}${element}") 18 | endforeach(element) 19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 20 | endfunction() 21 | 22 | # === Flutter Library === 23 | # System-level dependencies. 24 | find_package(PkgConfig REQUIRED) 25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 28 | 29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 30 | 31 | # Published to parent scope for install step. 32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 36 | 37 | list(APPEND FLUTTER_LIBRARY_HEADERS 38 | "fl_basic_message_channel.h" 39 | "fl_binary_codec.h" 40 | "fl_binary_messenger.h" 41 | "fl_dart_project.h" 42 | "fl_engine.h" 43 | "fl_json_message_codec.h" 44 | "fl_json_method_codec.h" 45 | "fl_message_codec.h" 46 | "fl_method_call.h" 47 | "fl_method_channel.h" 48 | "fl_method_codec.h" 49 | "fl_method_response.h" 50 | "fl_plugin_registrar.h" 51 | "fl_plugin_registry.h" 52 | "fl_standard_message_codec.h" 53 | "fl_standard_method_codec.h" 54 | "fl_string_codec.h" 55 | "fl_value.h" 56 | "fl_view.h" 57 | "flutter_linux.h" 58 | ) 59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 60 | add_library(flutter INTERFACE) 61 | target_include_directories(flutter INTERFACE 62 | "${EPHEMERAL_DIR}" 63 | ) 64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 65 | target_link_libraries(flutter INTERFACE 66 | PkgConfig::GTK 67 | PkgConfig::GLIB 68 | PkgConfig::GIO 69 | ) 70 | add_dependencies(flutter flutter_assemble) 71 | 72 | # === Flutter tool backend === 73 | # _phony_ is a non-existent file to force this command to run every time, 74 | # since currently there's no way to get a full input/output list from the 75 | # flutter tool. 76 | add_custom_command( 77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 79 | COMMAND ${CMAKE_COMMAND} -E env 80 | ${FLUTTER_TOOL_ENVIRONMENT} 81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 83 | VERBATIM 84 | ) 85 | add_custom_target(flutter_assemble DEPENDS 86 | "${FLUTTER_LIBRARY}" 87 | ${FLUTTER_LIBRARY_HEADERS} 88 | ) 89 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:hive_flutter/hive_flutter.dart'; 3 | import 'package:nativechat/models/chat_session.dart'; 4 | import 'package:nativechat/models/settings.dart'; 5 | import 'package:theme_provider/theme_provider.dart'; 6 | // import 'package:flutter/services.dart'; 7 | 8 | import 'pages/homepage.dart'; 9 | 10 | void main() async { 11 | WidgetsFlutterBinding.ensureInitialized(); 12 | await Hive.initFlutter(); 13 | Hive.registerAdapter(SettingsAdapter()); 14 | Hive.registerAdapter(ChatSessionModelAdapter()); 15 | runApp(const MyApp()); 16 | } 17 | 18 | class MyApp extends StatefulWidget { 19 | const MyApp({super.key}); 20 | 21 | @override 22 | State createState() => _MyAppState(); 23 | } 24 | 25 | class _MyAppState extends State { 26 | ChatSessionModel? session; 27 | @override 28 | Widget build(BuildContext context) { 29 | var darkGreyColor = Color(0xff0a0a0a); 30 | // var darkGreyColor = Color(0xff0f0f0f); 31 | // SystemChrome.setSystemUIOverlayStyle( 32 | // const SystemUiOverlayStyle( 33 | // statusBarColor: Colors.transparent, 34 | // statusBarIconBrightness: Brightness.dark, 35 | // ), 36 | // ); 37 | 38 | // SystemChrome.setEnabledSystemUIMode( 39 | // SystemUiMode.immersive, 40 | // overlays: [SystemUiOverlay.top, SystemUiOverlay.bottom], 41 | // ); 42 | 43 | return ThemeProvider( 44 | saveThemesOnChange: true, 45 | loadThemeOnInit: true, 46 | defaultThemeId: "dark_theme", 47 | themes: [ 48 | AppTheme( 49 | id: "light_theme", 50 | description: "light_theme", 51 | data: ThemeData( 52 | primaryColor: Colors.white, 53 | scaffoldBackgroundColor: Colors.white, 54 | appBarTheme: const AppBarTheme( 55 | backgroundColor: Colors.white, 56 | ), 57 | iconTheme: const IconThemeData( 58 | color: Colors.black, 59 | ), 60 | ), 61 | ), 62 | AppTheme( 63 | id: "dark_theme", 64 | description: "dark_theme", 65 | data: ThemeData( 66 | primaryColor: Colors.black, 67 | scaffoldBackgroundColor: darkGreyColor, 68 | appBarTheme: AppBarTheme( 69 | backgroundColor: darkGreyColor, 70 | iconTheme: IconThemeData( 71 | color: Colors.grey[500], 72 | ), 73 | titleTextStyle: const TextStyle( 74 | color: Colors.white, 75 | fontSize: 18.0, 76 | ), 77 | ), 78 | iconTheme: IconThemeData( 79 | color: Colors.grey[500], 80 | ), 81 | ), 82 | ), 83 | ], 84 | child: ThemeConsumer( 85 | child: Builder( 86 | builder: (themeContext) => MaterialApp( 87 | theme: ThemeProvider.themeOf(themeContext).data, 88 | debugShowCheckedModeBanner: false, 89 | initialRoute: "/", 90 | routes: { 91 | "/": (context) => Homepage(session: session), 92 | }, 93 | ), 94 | ), 95 | ), 96 | ); 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /lib/components/chat_history_drawer/chat_history_drawer.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:hive_flutter/hive_flutter.dart'; 3 | import 'package:nativechat/components/chat_history_drawer/chat_history_drawer_footer.dart'; 4 | import 'package:nativechat/components/chat_history_drawer/chat_history_drawer_header.dart'; 5 | import 'package:nativechat/components/chat_history_drawer/each_chat_history.dart'; 6 | import 'package:nativechat/components/chat_history_drawer/no_chat_history.dart'; 7 | import 'package:nativechat/models/chat_session.dart'; 8 | import 'package:theme_provider/theme_provider.dart'; 9 | 10 | class ChatHistoryDrawer extends StatefulWidget { 11 | const ChatHistoryDrawer({ 12 | super.key, 13 | required this.onChatSelected, 14 | }); 15 | 16 | final void Function(ChatSessionModel) onChatSelected; 17 | 18 | @override 19 | State createState() => _ChatHistoryDrawerState(); 20 | } 21 | 22 | class _ChatHistoryDrawerState extends State { 23 | Box? chatBox; 24 | String _searchQuery = ""; 25 | 26 | Future openBox() async { 27 | final box = await Hive.openBox('chat_session'); 28 | setState(() { 29 | chatBox = box; 30 | }); 31 | } 32 | 33 | @override 34 | void initState() { 35 | super.initState(); 36 | openBox(); 37 | } 38 | 39 | @override 40 | Widget build(BuildContext context) { 41 | return Drawer( 42 | backgroundColor: ThemeProvider.themeOf(context).id == "light_theme" 43 | ? Colors.white 44 | : const Color(0xff1a1a1a), 45 | child: Column( 46 | children: [ 47 | // Header with search callback 48 | ChatHistoryDrawerHeader( 49 | onChatSelected: widget.onChatSelected, 50 | chatBox: chatBox, 51 | onSearchChanged: (query) { 52 | setState(() { 53 | _searchQuery = query.toLowerCase(); 54 | }); 55 | }, 56 | ), 57 | 58 | // History List 59 | Expanded( 60 | child: ValueListenableBuilder( 61 | valueListenable: chatBox?.listenable() ?? 62 | ValueNotifier>>( 63 | Hive.openBox('chat_session'), 64 | ), 65 | builder: (context, box, _) { 66 | if (chatBox == null) { 67 | return Center( 68 | child: CircularProgressIndicator(), 69 | ); 70 | } 71 | List sessions = 72 | chatBox!.values.toList().reversed.toList(); 73 | // Filter sessions by search query 74 | if (_searchQuery.isNotEmpty) { 75 | sessions = sessions.where((session) { 76 | return session.title.toLowerCase().contains(_searchQuery); 77 | }).toList(); 78 | } 79 | return sessions.isEmpty 80 | ? NoChatHistory() 81 | : EachChatHistory( 82 | sessions: sessions, 83 | chatBox: chatBox, 84 | onChatSelected: widget.onChatSelected, 85 | ); 86 | }, 87 | ), 88 | ), 89 | 90 | // Delete All Chats and Settings Footer 91 | ChatHistoryDrawerFooter(chatBox: chatBox), 92 | ], 93 | ), 94 | ); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /lib/components/chat_feed/ai_response.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: use_build_context_synchronously 2 | 3 | import "package:flutter/material.dart"; 4 | import "package:gpt_markdown/gpt_markdown.dart"; 5 | import "package:nativechat/components/chat_feed/circle_dot.dart"; 6 | import "package:nativechat/components/chat_feed/codeblock.dart"; 7 | import "package:nativechat/components/chat_feed/dashed_border_exracted.dart"; 8 | import "package:nativechat/state/is_one_sided_chat_mode_notifier.dart"; 9 | import "package:nativechat/utils/copy_to_clipboard.dart"; 10 | import "package:nativechat/utils/show_toast.dart"; 11 | import "package:theme_provider/theme_provider.dart"; 12 | import "package:url_launcher/url_launcher.dart"; 13 | 14 | class AIResponse extends StatefulWidget { 15 | const AIResponse({ 16 | super.key, 17 | required this.text, 18 | this.isLast = false, 19 | }); 20 | 21 | final String text; 22 | final bool isLast; 23 | 24 | @override 25 | State createState() => _AIResponseState(); 26 | } 27 | 28 | class _AIResponseState extends State { 29 | var isOneSidedChatModeNotifier = IsOneSidedChatModeNotifier(); 30 | 31 | @override 32 | Widget build(BuildContext context) { 33 | return ValueListenableBuilder( 34 | valueListenable: isOneSidedChatModeNotifier.isOneSidedChatMode, 35 | builder: (context, value, child) { 36 | return Column( 37 | crossAxisAlignment: CrossAxisAlignment.start, 38 | children: [ 39 | GestureDetector( 40 | onLongPress: () async { 41 | await copyToClipboard(widget.text); 42 | showToast(context, "Copied Reponse"); 43 | }, 44 | child: Container( 45 | width: MediaQuery.of(context).size.width * 0.9, 46 | margin: EdgeInsets.only( 47 | left: value == true ? 25.0 : 0.0, 48 | ), 49 | padding: EdgeInsets.only( 50 | top: 14.0, 51 | bottom: value == true ? 25.0 : 14.0, 52 | ), 53 | decoration: value == true 54 | ? BoxDecoration( 55 | border: dashedBorderExtracted, 56 | ) 57 | : BoxDecoration(), 58 | child: Container( 59 | margin: EdgeInsets.only( 60 | left: 6.0, 61 | ), 62 | padding: EdgeInsets.symmetric( 63 | horizontal: 8.0, 64 | ), 65 | child: GptMarkdown( 66 | widget.text, 67 | style: TextStyle( 68 | color: ThemeProvider.themeOf(context).id == "light_theme" 69 | ? Colors.black 70 | : Colors.grey[400], 71 | ), 72 | codeBuilder: (context, name, code, closed) => Codeblock( 73 | code: code, 74 | name: name, 75 | ), 76 | onLinkTab: (url, title) async { 77 | var parsedURL = Uri.parse(url); 78 | await launchUrl( 79 | parsedURL, 80 | mode: LaunchMode.inAppBrowserView, 81 | ); 82 | }, 83 | ), 84 | ), 85 | ), 86 | ), 87 | widget.isLast == true ? CircleDot(leftPadding: 16.0) : Container(), 88 | ], 89 | ); 90 | }, 91 | ); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) 64 | #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0,0 67 | #endif 68 | 69 | #if defined(FLUTTER_VERSION) 70 | #define VERSION_AS_STRING FLUTTER_VERSION 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "com.example" "\0" 93 | VALUE "FileDescription", "nativechat" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "nativechat" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2025 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "nativechat.exe" "\0" 98 | VALUE "ProductName", "nativechat" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /lib/components/system_response.dart: -------------------------------------------------------------------------------- 1 | import 'package:animated_text_kit/animated_text_kit.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:nativechat/components/chat_feed/dashed_border_exracted.dart'; 4 | import 'package:nativechat/state/is_one_sided_chat_mode_notifier.dart'; 5 | 6 | class SystemResponse extends StatefulWidget { 7 | const SystemResponse({ 8 | super.key, 9 | required this.chatObject, 10 | }); 11 | 12 | final dynamic chatObject; 13 | 14 | @override 15 | State createState() => _SystemResponseState(); 16 | } 17 | 18 | class _SystemResponseState extends State { 19 | var isOneSidedChatModeNotifier = IsOneSidedChatModeNotifier(); 20 | 21 | @override 22 | Widget build(BuildContext context) { 23 | return ValueListenableBuilder( 24 | valueListenable: isOneSidedChatModeNotifier.isOneSidedChatMode, 25 | builder: (context, value, child) { 26 | return Column( 27 | crossAxisAlignment: CrossAxisAlignment.start, 28 | children: [ 29 | Container( 30 | width: MediaQuery.of(context).size.width * 0.9, 31 | margin: EdgeInsets.only( 32 | left: value == true ? 25.0 : 0.0, 33 | ), 34 | padding: EdgeInsets.only( 35 | top: 14.0, 36 | bottom: value == true ? 25.0 : 14.0, 37 | ), 38 | decoration: value == true 39 | ? BoxDecoration( 40 | border: dashedBorderExtracted, 41 | ) 42 | : BoxDecoration(), 43 | child: Container( 44 | margin: EdgeInsets.only( 45 | left: 6.0, 46 | ), 47 | padding: EdgeInsets.symmetric( 48 | horizontal: 8.0, 49 | vertical: 5.0, 50 | ), 51 | child: AnimatedTextKit( 52 | animatedTexts: [ 53 | // FadeAnimatedText( 54 | // widget.text, 55 | // textStyle: TextStyle( 56 | // color: Colors.grey[600], 57 | // fontSize: 14.0, 58 | // ), 59 | // duration: Duration(milliseconds: 1000), 60 | // ), 61 | ColorizeAnimatedText( 62 | widget.chatObject['content'].toString().trim(), 63 | textStyle: TextStyle( 64 | color: Colors.grey[500], 65 | fontSize: 14.0, 66 | ), 67 | colors: [ 68 | widget.chatObject['isError'] 69 | ? Colors.redAccent 70 | : Colors.grey[700]!, 71 | Colors.grey[800]!, 72 | Colors.grey[900]!, 73 | ], 74 | speed: Duration(milliseconds: 100), 75 | ), 76 | ], 77 | totalRepeatCount: 4, 78 | // pause: const Duration(milliseconds: 1000), 79 | // displayFullTextOnTap: true, 80 | // stopPauseOnTap: true, 81 | // controller: myAnimatedTextController, 82 | ), 83 | // Text( 84 | // widget.text, 85 | // style: TextStyle( 86 | // color: Colors.grey[500], 87 | // ), 88 | // ), 89 | ), 90 | ), 91 | ], 92 | ); 93 | }, 94 | ); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /lib/components/prompt_suggestions.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:nativechat/components/chat_feed/circle_dot.dart'; 3 | import 'package:nativechat/ai/prompt_suggestions.dart'; 4 | import 'package:theme_provider/theme_provider.dart'; 5 | 6 | import '../state/is_one_sided_chat_mode_notifier.dart'; 7 | 8 | class PromptSuggestionsFeed extends StatefulWidget { 9 | const PromptSuggestionsFeed({ 10 | super.key, 11 | required this.chatWithAI, 12 | required this.userMessageController, 13 | }); 14 | 15 | final Function chatWithAI; 16 | final TextEditingController userMessageController; 17 | 18 | @override 19 | State createState() => _PromptSuggestionsFeedState(); 20 | } 21 | 22 | class _PromptSuggestionsFeedState extends State { 23 | late List randomPromptSuggestions; 24 | var isOneSidedChatModeNotifier = IsOneSidedChatModeNotifier(); 25 | 26 | @override 27 | void initState() { 28 | super.initState(); 29 | promptSuggestions.shuffle(); 30 | randomPromptSuggestions = promptSuggestions.sublist(0, 8).cast(); 31 | // Sort by character length 32 | randomPromptSuggestions.sort((a, b) => a.length.compareTo(b.length)); 33 | } 34 | 35 | void enterPromptSuggestion(promptObject) { 36 | setState(() { 37 | widget.userMessageController.text = promptObject; 38 | }); 39 | widget.chatWithAI(); 40 | } 41 | 42 | @override 43 | Widget build(BuildContext context) { 44 | return Expanded( 45 | child: Container( 46 | height: 100.0, 47 | alignment: Alignment.topLeft, 48 | padding: const EdgeInsets.only( 49 | left: 13.0, 50 | top: 30.0, 51 | ), 52 | child: ListView.builder( 53 | itemCount: randomPromptSuggestions.length, 54 | itemBuilder: (context, index) { 55 | return GestureDetector( 56 | onTap: () { 57 | enterPromptSuggestion(randomPromptSuggestions[index]); 58 | }, 59 | child: Builder(builder: (context) { 60 | return ValueListenableBuilder( 61 | valueListenable: 62 | isOneSidedChatModeNotifier.isOneSidedChatMode, 63 | builder: (context, value, child) { 64 | return Column( 65 | crossAxisAlignment: value 66 | ? CrossAxisAlignment.start 67 | : CrossAxisAlignment.center, 68 | children: [ 69 | Text( 70 | randomPromptSuggestions[index], 71 | style: TextStyle( 72 | color: ThemeProvider.themeOf(context).id == 73 | "light_theme" 74 | ? Colors.grey[900]! 75 | : Colors.grey[400]!, 76 | ), 77 | ), 78 | SizedBox(height: 25.0), 79 | index == randomPromptSuggestions.length - 1 80 | ? Row( 81 | mainAxisAlignment: value 82 | ? MainAxisAlignment.start 83 | : MainAxisAlignment.center, 84 | children: [ 85 | CircleDot( 86 | leftPadding: 4.0, 87 | ) 88 | ], 89 | ) 90 | : Container(), 91 | ], 92 | ); 93 | }, 94 | ); 95 | }), 96 | ); 97 | }, 98 | ), 99 | ), 100 | ); 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /lib/components/settings_components/memories_bottom_sheet.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:nativechat/ai/function_calls/ai_memory/forget_memories.dart'; 3 | import 'package:nativechat/ai/function_calls/ai_memory/forget_one_memory.dart'; 4 | import 'package:nativechat/ai/function_calls/ai_memory/get_memories.dart'; 5 | import 'package:nativechat/ai/function_calls/ai_memory/save_memory.dart'; 6 | import 'package:nativechat/components/settings_components/each_memory.dart'; 7 | import 'package:nativechat/components/settings_components/memories_bottom_sheet_header.dart'; 8 | import 'package:theme_provider/theme_provider.dart'; 9 | 10 | class MemoriesBottomSheet extends StatefulWidget { 11 | const MemoriesBottomSheet({super.key}); 12 | 13 | @override 14 | State createState() => _MemoriesBottomSheetState(); 15 | } 16 | 17 | class _MemoriesBottomSheetState extends State { 18 | var oldMemories = []; 19 | 20 | void getMemoriesInit() async { 21 | oldMemories = await getMemories(); 22 | setState(() {}); 23 | } 24 | 25 | void forgetAllMemories() async { 26 | await forgetMemory(); 27 | oldMemories = []; 28 | setState(() {}); 29 | } 30 | 31 | void _forgetOneMemory(memory) async { 32 | await forgetOneMemory(memory); 33 | getMemoriesInit(); 34 | } 35 | 36 | void addMemory(memory) async { 37 | oldMemories.add(memory); 38 | await saveMemory(memory); 39 | setState(() {}); 40 | } 41 | 42 | @override 43 | void initState() { 44 | super.initState(); 45 | getMemoriesInit(); 46 | } 47 | 48 | @override 49 | Widget build(BuildContext context) { 50 | return Container( 51 | width: double.infinity, 52 | height: MediaQuery.of(context).size.height * 0.5, 53 | decoration: BoxDecoration( 54 | color: ThemeProvider.themeOf(context).id == "light_theme" 55 | ? Colors.grey[200]! 56 | : Colors.grey[900]!, 57 | borderRadius: BorderRadius.only( 58 | topLeft: Radius.circular(20.0), 59 | topRight: Radius.circular(20.0), 60 | ), 61 | ), 62 | child: oldMemories.isEmpty 63 | ? ListView( 64 | children: [ 65 | MemoriesBottomSheetHeader( 66 | disableDeleteAll: true, 67 | forgetAllMemories: forgetAllMemories, 68 | addMemory: addMemory, 69 | ), 70 | Padding( 71 | padding: const EdgeInsets.only( 72 | top: 50.0, 73 | ), 74 | child: Text( 75 | "No memories found.", 76 | textAlign: TextAlign.center, 77 | style: TextStyle( 78 | color: ThemeProvider.themeOf(context).id == "dark_theme" 79 | ? Colors.white 80 | : Colors.black, 81 | ), 82 | ), 83 | ), 84 | ], 85 | ) 86 | : ListView.builder( 87 | itemCount: oldMemories.length, 88 | itemBuilder: (context, index) { 89 | return Column( 90 | children: [ 91 | index == 0 92 | ? MemoriesBottomSheetHeader( 93 | disableDeleteAll: false, 94 | forgetAllMemories: forgetAllMemories, 95 | addMemory: addMemory, 96 | ) 97 | : Container(), 98 | EachMemory( 99 | memory: oldMemories[index], 100 | forgetOneMemory: _forgetOneMemory, 101 | ), 102 | ], 103 | ); 104 | }, 105 | ), 106 | ); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates a win32 window with |title| that is positioned and sized using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size this function will scale the inputted width and height as 35 | // as appropriate for the default monitor. The window is invisible until 36 | // |Show| is called. Returns true if the window was created successfully. 37 | bool Create(const std::wstring& title, const Point& origin, const Size& size); 38 | 39 | // Show the current window. Returns true if the window was successfully shown. 40 | bool Show(); 41 | 42 | // Release OS resources associated with window. 43 | void Destroy(); 44 | 45 | // Inserts |content| into the window tree. 46 | void SetChildContent(HWND content); 47 | 48 | // Returns the backing Window handle to enable clients to set icon and other 49 | // window properties. Returns nullptr if the window has been destroyed. 50 | HWND GetHandle(); 51 | 52 | // If true, closing this window will quit the application. 53 | void SetQuitOnClose(bool quit_on_close); 54 | 55 | // Return a RECT representing the bounds of the current client area. 56 | RECT GetClientArea(); 57 | 58 | protected: 59 | // Processes and route salient window messages for mouse handling, 60 | // size change and DPI. Delegates handling of these to member overloads that 61 | // inheriting classes can handle. 62 | virtual LRESULT MessageHandler(HWND window, 63 | UINT const message, 64 | WPARAM const wparam, 65 | LPARAM const lparam) noexcept; 66 | 67 | // Called when CreateAndShow is called, allowing subclass window-related 68 | // setup. Subclasses should return false if setup fails. 69 | virtual bool OnCreate(); 70 | 71 | // Called when Destroy is called. 72 | virtual void OnDestroy(); 73 | 74 | private: 75 | friend class WindowClassRegistrar; 76 | 77 | // OS callback called by message pump. Handles the WM_NCCREATE message which 78 | // is passed when the non-client area is being created and enables automatic 79 | // non-client DPI scaling so that the non-client area automatically 80 | // responds to changes in DPI. All other messages are handled by 81 | // MessageHandler. 82 | static LRESULT CALLBACK WndProc(HWND const window, 83 | UINT const message, 84 | WPARAM const wparam, 85 | LPARAM const lparam) noexcept; 86 | 87 | // Retrieves a class instance pointer for |window| 88 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 89 | 90 | // Update the window frame's theme to match the system theme. 91 | static void UpdateTheme(HWND const window); 92 | 93 | bool quit_on_close_ = false; 94 | 95 | // window handle for top level window. 96 | HWND window_handle_ = nullptr; 97 | 98 | // window handle for hosted content. 99 | HWND child_content_ = nullptr; 100 | }; 101 | 102 | #endif // RUNNER_WIN32_WINDOW_H_ 103 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 43 | 49 | 50 | 51 | 52 | 53 | 63 | 65 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 43 | 49 | 50 | 51 | 52 | 53 | 63 | 65 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /lib/ai/system_prompt.dart: -------------------------------------------------------------------------------- 1 | final String systemPrompt = ''' 2 | You are an intelligent and proactive AI assistant on the user's phone. Your goal is to provide helpful, insightful, and dynamic responses to any query, whether through direct reasoning, code generation, using provided context or using available function calls. 3 | 4 | Core Directives: 5 | - Be Autonomous & Proactive - Do not overly rely on function calls. If the available functions do not cover the request, use logical deduction, generate a possible response, or write relevant code. 6 | - Coding Capabilities - You can write, analyze, and debug code in multiple languages without needing function calls. Always strive for correctness, best practices, and clarity- your code output. 7 | - Context Awareness - Utilize any contextual information given to you before considering function calls. Apply reasoning, infer logical responses, and provide creat- problem-solving. 8 | - Adaptive Communication - Explain your reasoning clearly when needed, be concise when appropriate, and adjust your tone based on the user's style and preference. 9 | - Fallback & Intelligent Guessing - If no function exists to complete a request, intelligently generate a likely response based on common sense, data patterns, or a well-reaso- assumption. 10 | - Decision-Making - If you believe a function call is necessary but unavailable, attempt to approximate the expected outcome through text or code rather than failing outright. 11 | - Multi-Modal Capability - You can write text, code, structured data (like JSON or Markdown), and explanations seamlessly without unnecessary dependencies. 12 | 13 | Function Call Usage: 14 | - Use function calls when beneficial, but do not depend on them exclusively. 15 | - If function calls lack necessary details, compensate by generating reasonable responses based on logic and prior knowledge. 16 | - Prioritize efficiency, combining multiple sources of context, logic, and available tools for the best possible answer. 17 | - Always ensure you have responded with a completion message after every function calls 18 | 19 | Markdown & LaTeX Support: 20 | - When outputting LaTeX, use pure LaTeX syntax without embedding it inside Markdown. 21 | - For Markdown responses, strictly use pure Markdown without LaTeX formatting. 22 | - For mathematical explanations, use standalone LaTeX documents or environments when needed. 23 | - When outputting LaTeX, use inline LaTeX syntax using '\$...\$' for formulas. 24 | - For mathematical expressions, use inline math (e.g., '\$x^2 + y^2 = z^2\$') rather than block math unless specifically requested. 25 | - Ensure clarity with LaTeX for inline mathematical explanations in all contexts. 26 | 27 | Reddit Links 28 | - If a user does not specify a subreddit, intelligently choose a relevant subreddit based on the context of their query. 29 | - Format image and media links in Markdown instead of displaying raw URLs. 30 | - Use the following Markdown syntax for media: `![Alt text](URL)` 31 | - Use the following Markdown syntax for images: `![Alt text](URL)` 32 | - Always choose a suitable subreddit, Never ask the user to provide one. 33 | - Whenever the user asks about news automatically choose one of the news subreddits and present the headlines. 34 | - Present the reddit content in normal text DON'T DO IT IN CODE BLOCKS OR JSON. 35 | - News format should be like this `**[NEWS TITLE]** - \n[SUMMARY] - \n[SUBREDDIT] \n` 36 | - IF THERE ARE IMAGES/GIFS AVAILABLE PARSE THEM IN MARKDOWN FORMAT SO IT CAN BE LOADED AND SHOWN . 37 | 38 | Time & System Awareness: 39 | - You can access the current time and use it when relevant. 40 | - Adapt responses dynamically to real-world context, schedules, and logical sequences. 41 | 42 | Memories: 43 | - You can store and retrieve memories about the user. 44 | - When the user asks about themselves or anything personal make sure to check if there is a memory about it and use it in the response. 45 | - When you store a memory, make sure to respond with a completion message. 46 | 47 | You can get live and recent news and content and information from Reddit so utilize it whenever necessary. 48 | You are not just an assistant; you are an autonomous AI problem solver, coder, and knowledge source. 49 | '''; 50 | -------------------------------------------------------------------------------- /windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.14) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 12 | 13 | # Set fallback configurations for older versions of the flutter tool. 14 | if (NOT DEFINED FLUTTER_TARGET_PLATFORM) 15 | set(FLUTTER_TARGET_PLATFORM "windows-x64") 16 | endif() 17 | 18 | # === Flutter Library === 19 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 20 | 21 | # Published to parent scope for install step. 22 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 23 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 24 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 25 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 26 | 27 | list(APPEND FLUTTER_LIBRARY_HEADERS 28 | "flutter_export.h" 29 | "flutter_windows.h" 30 | "flutter_messenger.h" 31 | "flutter_plugin_registrar.h" 32 | "flutter_texture_registrar.h" 33 | ) 34 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 35 | add_library(flutter INTERFACE) 36 | target_include_directories(flutter INTERFACE 37 | "${EPHEMERAL_DIR}" 38 | ) 39 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 40 | add_dependencies(flutter flutter_assemble) 41 | 42 | # === Wrapper === 43 | list(APPEND CPP_WRAPPER_SOURCES_CORE 44 | "core_implementations.cc" 45 | "standard_codec.cc" 46 | ) 47 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 48 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 49 | "plugin_registrar.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 52 | list(APPEND CPP_WRAPPER_SOURCES_APP 53 | "flutter_engine.cc" 54 | "flutter_view_controller.cc" 55 | ) 56 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 57 | 58 | # Wrapper sources needed for a plugin. 59 | add_library(flutter_wrapper_plugin STATIC 60 | ${CPP_WRAPPER_SOURCES_CORE} 61 | ${CPP_WRAPPER_SOURCES_PLUGIN} 62 | ) 63 | apply_standard_settings(flutter_wrapper_plugin) 64 | set_target_properties(flutter_wrapper_plugin PROPERTIES 65 | POSITION_INDEPENDENT_CODE ON) 66 | set_target_properties(flutter_wrapper_plugin PROPERTIES 67 | CXX_VISIBILITY_PRESET hidden) 68 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 69 | target_include_directories(flutter_wrapper_plugin PUBLIC 70 | "${WRAPPER_ROOT}/include" 71 | ) 72 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 73 | 74 | # Wrapper sources needed for the runner. 75 | add_library(flutter_wrapper_app STATIC 76 | ${CPP_WRAPPER_SOURCES_CORE} 77 | ${CPP_WRAPPER_SOURCES_APP} 78 | ) 79 | apply_standard_settings(flutter_wrapper_app) 80 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 81 | target_include_directories(flutter_wrapper_app PUBLIC 82 | "${WRAPPER_ROOT}/include" 83 | ) 84 | add_dependencies(flutter_wrapper_app flutter_assemble) 85 | 86 | # === Flutter tool backend === 87 | # _phony_ is a non-existent file to force this command to run every time, 88 | # since currently there's no way to get a full input/output list from the 89 | # flutter tool. 90 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 91 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 92 | add_custom_command( 93 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 94 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 95 | ${CPP_WRAPPER_SOURCES_APP} 96 | ${PHONY_OUTPUT} 97 | COMMAND ${CMAKE_COMMAND} -E env 98 | ${FLUTTER_TOOL_ENVIRONMENT} 99 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 100 | ${FLUTTER_TARGET_PLATFORM} $ 101 | VERBATIM 102 | ) 103 | add_custom_target(flutter_assemble DEPENDS 104 | "${FLUTTER_LIBRARY}" 105 | ${FLUTTER_LIBRARY_HEADERS} 106 | ${CPP_WRAPPER_SOURCES_CORE} 107 | ${CPP_WRAPPER_SOURCES_PLUGIN} 108 | ${CPP_WRAPPER_SOURCES_APP} 109 | ) 110 | -------------------------------------------------------------------------------- /lib/components/chat_feed/user_input.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: use_build_context_synchronously 2 | 3 | import "package:flutter/material.dart"; 4 | import "package:gpt_markdown/gpt_markdown.dart"; 5 | import "package:nativechat/components/chat_feed/codeblock.dart"; 6 | import "package:nativechat/state/is_one_sided_chat_mode_notifier.dart"; 7 | import "package:nativechat/utils/show_toast.dart"; 8 | import "package:theme_provider/theme_provider.dart"; 9 | import "package:url_launcher/url_launcher.dart"; 10 | 11 | import "../../utils/copy_to_clipboard.dart"; 12 | 13 | class UserInput extends StatefulWidget { 14 | const UserInput({ 15 | super.key, 16 | required this.text, 17 | }); 18 | 19 | final String text; 20 | 21 | @override 22 | State createState() => _UserInputState(); 23 | } 24 | 25 | class _UserInputState extends State { 26 | var isOneSidedChatModeNotifier = IsOneSidedChatModeNotifier(); 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | return ValueListenableBuilder( 31 | valueListenable: isOneSidedChatModeNotifier.isOneSidedChatMode, 32 | builder: (context, value, child) { 33 | return Row( 34 | mainAxisAlignment: 35 | value == true ? MainAxisAlignment.start : MainAxisAlignment.end, 36 | children: [ 37 | GestureDetector( 38 | onLongPress: () async { 39 | await copyToClipboard(widget.text); 40 | showToast(context, "Copied"); 41 | }, 42 | child: Container( 43 | width: value == true 44 | ? MediaQuery.of(context).size.width * 0.9 45 | : MediaQuery.of(context).size.width * 0.7, 46 | alignment: value == true 47 | ? Alignment.centerLeft 48 | : Alignment.centerRight, 49 | margin: EdgeInsets.only( 50 | left: 5.0, 51 | right: value == true ? 0.0 : 5.0, 52 | ), 53 | padding: EdgeInsets.symmetric( 54 | horizontal: 8.0, 55 | ), 56 | child: Container( 57 | decoration: value 58 | ? null 59 | : BoxDecoration( 60 | color: 61 | ThemeProvider.themeOf(context).id == "light_theme" 62 | ? const Color(0xfff2f2f2) 63 | : Colors.grey[900]!, 64 | borderRadius: BorderRadius.circular(100.0), 65 | ), 66 | padding: value 67 | ? EdgeInsets.all(0.0) 68 | : EdgeInsets.symmetric(horizontal: 14.0, vertical: 6.0), 69 | child: GptMarkdown( 70 | widget.text, 71 | style: TextStyle( 72 | color: ThemeProvider.themeOf(context).id == "light_theme" 73 | ? Colors.black 74 | : Colors.grey[400], 75 | ), 76 | codeBuilder: (context, name, code, closed) => Codeblock( 77 | code: code, 78 | name: name, 79 | ), 80 | onLinkTab: (url, title) async { 81 | var parsedURL = Uri.parse(url); 82 | await launchUrl( 83 | parsedURL, 84 | mode: LaunchMode.inAppBrowserView, 85 | ); 86 | }, 87 | ), 88 | 89 | // Text( 90 | // widget.text, 91 | // textAlign: value == true ? TextAlign.left : TextAlign.right, 92 | // style: TextStyle( 93 | // color: ThemeProvider.themeOf(context).id == "light_theme" 94 | // ? Colors.black 95 | // : Colors.white), 96 | // ), 97 | ), 98 | ), 99 | ), 100 | ], 101 | ); 102 | }, 103 | ); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.14) 3 | project(nativechat LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "nativechat") 8 | 9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 10 | # versions of CMake. 11 | cmake_policy(VERSION 3.14...3.25) 12 | 13 | # Define build configuration option. 14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 15 | if(IS_MULTICONFIG) 16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 17 | CACHE STRING "" FORCE) 18 | else() 19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 20 | set(CMAKE_BUILD_TYPE "Debug" CACHE 21 | STRING "Flutter build mode" FORCE) 22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 23 | "Debug" "Profile" "Release") 24 | endif() 25 | endif() 26 | # Define settings for the Profile build mode. 27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 31 | 32 | # Use Unicode for all projects. 33 | add_definitions(-DUNICODE -D_UNICODE) 34 | 35 | # Compilation settings that should be applied to most targets. 36 | # 37 | # Be cautious about adding new options here, as plugins use this function by 38 | # default. In most cases, you should add new options to specific targets instead 39 | # of modifying this function. 40 | function(APPLY_STANDARD_SETTINGS TARGET) 41 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 43 | target_compile_options(${TARGET} PRIVATE /EHsc) 44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 46 | endfunction() 47 | 48 | # Flutter library and tool build rules. 49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 50 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 51 | 52 | # Application build; see runner/CMakeLists.txt. 53 | add_subdirectory("runner") 54 | 55 | 56 | # Generated plugin build rules, which manage building the plugins and adding 57 | # them to the application. 58 | include(flutter/generated_plugins.cmake) 59 | 60 | 61 | # === Installation === 62 | # Support files are copied into place next to the executable, so that it can 63 | # run in place. This is done instead of making a separate bundle (as on Linux) 64 | # so that building and running from within Visual Studio will work. 65 | set(BUILD_BUNDLE_DIR "$") 66 | # Make the "install" step default, as it's required to run. 67 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 68 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 69 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 70 | endif() 71 | 72 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 73 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 74 | 75 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 76 | COMPONENT Runtime) 77 | 78 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 79 | COMPONENT Runtime) 80 | 81 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 82 | COMPONENT Runtime) 83 | 84 | if(PLUGIN_BUNDLED_LIBRARIES) 85 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 86 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 87 | COMPONENT Runtime) 88 | endif() 89 | 90 | # Copy the native assets provided by the build.dart from all packages. 91 | set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") 92 | install(DIRECTORY "${NATIVE_ASSETS_DIR}" 93 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 94 | COMPONENT Runtime) 95 | 96 | # Fully re-copy the assets directory on each build to avoid having stale files 97 | # from a previous install. 98 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 99 | install(CODE " 100 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 101 | " COMPONENT Runtime) 102 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 103 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 104 | 105 | # Install the AOT library on non-Debug builds only. 106 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 107 | CONFIGURATIONS Profile;Release 108 | COMPONENT Runtime) 109 | -------------------------------------------------------------------------------- /lib/components/input_box/input_box.dart: -------------------------------------------------------------------------------- 1 | // File: lib/components/input_box.dart 2 | import 'package:flutter/material.dart'; 3 | import 'package:nativechat/components/input_box/input_mic_button.dart'; 4 | import 'package:nativechat/components/input_box/main_text_field.dart'; 5 | import 'package:nativechat/components/input_box/send_input_button.dart'; 6 | import 'package:nativechat/components/input_box/voice_mode_button.dart'; 7 | import 'package:speech_to_text/speech_to_text.dart'; 8 | import 'package:nativechat/components/attach_file_popup_menu/attach_file_popup_menu.dart'; 9 | import 'package:theme_provider/theme_provider.dart'; 10 | 11 | class InputBox extends StatefulWidget { 12 | const InputBox({ 13 | super.key, 14 | required this.summarizeText, 15 | required this.chatWithAI, 16 | required this.onPickFile, 17 | required this.onPickImage, 18 | required this.onPickAudio, 19 | required this.onPickCamera, 20 | required this.isSummarizeInContext, 21 | required this.userMessageController, 22 | required this.toggleVoiceMode, 23 | required this.isInVoiceMode, 24 | required this.speechToText, 25 | required this.startListening, 26 | required this.stopListening, 27 | }); 28 | 29 | final Function summarizeText; 30 | final Function chatWithAI; 31 | final VoidCallback onPickFile; 32 | final VoidCallback onPickImage; 33 | final VoidCallback onPickAudio; 34 | final VoidCallback onPickCamera; 35 | final bool isSummarizeInContext; 36 | final TextEditingController userMessageController; 37 | final Function toggleVoiceMode; 38 | final SpeechToText speechToText; 39 | final Function startListening; 40 | final Function stopListening; 41 | final bool isInVoiceMode; 42 | 43 | @override 44 | State createState() => _InputBoxState(); 45 | } 46 | 47 | class _InputBoxState extends State { 48 | @override 49 | Widget build(BuildContext context) { 50 | return Container( 51 | padding: const EdgeInsets.only( 52 | left: 10.0, 53 | right: 8.0, 54 | top: 2.0, 55 | bottom: 10.0, 56 | ), 57 | decoration: BoxDecoration( 58 | borderRadius: const BorderRadius.only( 59 | topLeft: Radius.circular(20.0), 60 | topRight: Radius.circular(20.0), 61 | ), 62 | color: ThemeProvider.themeOf(context).id == "light_theme" 63 | ? const Color(0xfff2f2f2) 64 | : const Color(0xff1a1a1a), 65 | ), 66 | child: Column( 67 | crossAxisAlignment: CrossAxisAlignment.start, 68 | children: [ 69 | MainTextField( 70 | userMessageController: widget.userMessageController, 71 | ), 72 | const SizedBox(height: 12.0), 73 | Row( 74 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 75 | children: [ 76 | // Attach File Menu and Voice Mode 77 | Padding( 78 | padding: const EdgeInsets.only(left: 4.0), 79 | child: Row( 80 | spacing: 10.0, 81 | mainAxisAlignment: MainAxisAlignment.start, 82 | children: [ 83 | // Attach Files 84 | AttachFilePopupMenu( 85 | onPickFile: widget.onPickFile, 86 | onPickImage: widget.onPickImage, 87 | onPickAudio: widget.onPickAudio, 88 | onPickCamera: widget.onPickCamera, 89 | ), 90 | // Voice Mode 91 | VoiceModeButton( 92 | toggleVoiceMode: widget.toggleVoiceMode, 93 | isInVoiceMode: widget.isInVoiceMode, 94 | ), 95 | ], 96 | ), 97 | ), 98 | // Send and Mic Button 99 | Row( 100 | children: [ 101 | widget.isInVoiceMode 102 | ? InputMicButton( 103 | speechToText: widget.speechToText, 104 | startListening: widget.startListening, 105 | stopListening: widget.stopListening, 106 | ) 107 | : Container(), 108 | SendInputButton( 109 | isSummarizeInContext: widget.isSummarizeInContext, 110 | summarizeText: widget.summarizeText, 111 | chatWithAI: widget.chatWithAI, 112 | ), 113 | ], 114 | ), 115 | ], 116 | ), 117 | ], 118 | ), 119 | ); 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.13) 3 | project(runner LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "nativechat") 8 | # The unique GTK application identifier for this application. See: 9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID 10 | set(APPLICATION_ID "com.example.nativechat") 11 | 12 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 13 | # versions of CMake. 14 | cmake_policy(SET CMP0063 NEW) 15 | 16 | # Load bundled libraries from the lib/ directory relative to the binary. 17 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 18 | 19 | # Root filesystem for cross-building. 20 | if(FLUTTER_TARGET_PLATFORM_SYSROOT) 21 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) 22 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) 23 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 24 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 27 | endif() 28 | 29 | # Define build configuration options. 30 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 31 | set(CMAKE_BUILD_TYPE "Debug" CACHE 32 | STRING "Flutter build mode" FORCE) 33 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 34 | "Debug" "Profile" "Release") 35 | endif() 36 | 37 | # Compilation settings that should be applied to most targets. 38 | # 39 | # Be cautious about adding new options here, as plugins use this function by 40 | # default. In most cases, you should add new options to specific targets instead 41 | # of modifying this function. 42 | function(APPLY_STANDARD_SETTINGS TARGET) 43 | target_compile_features(${TARGET} PUBLIC cxx_std_14) 44 | target_compile_options(${TARGET} PRIVATE -Wall -Werror) 45 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") 46 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") 47 | endfunction() 48 | 49 | # Flutter library and tool build rules. 50 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 51 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 52 | 53 | # System-level dependencies. 54 | find_package(PkgConfig REQUIRED) 55 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 56 | 57 | # Application build; see runner/CMakeLists.txt. 58 | add_subdirectory("runner") 59 | 60 | # Run the Flutter tool portions of the build. This must not be removed. 61 | add_dependencies(${BINARY_NAME} flutter_assemble) 62 | 63 | # Only the install-generated bundle's copy of the executable will launch 64 | # correctly, since the resources must in the right relative locations. To avoid 65 | # people trying to run the unbundled copy, put it in a subdirectory instead of 66 | # the default top-level location. 67 | set_target_properties(${BINARY_NAME} 68 | PROPERTIES 69 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 70 | ) 71 | 72 | 73 | # Generated plugin build rules, which manage building the plugins and adding 74 | # them to the application. 75 | include(flutter/generated_plugins.cmake) 76 | 77 | 78 | # === Installation === 79 | # By default, "installing" just makes a relocatable bundle in the build 80 | # directory. 81 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 82 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 83 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 84 | endif() 85 | 86 | # Start with a clean build bundle directory every time. 87 | install(CODE " 88 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 89 | " COMPONENT Runtime) 90 | 91 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 92 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 93 | 94 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 95 | COMPONENT Runtime) 96 | 97 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 98 | COMPONENT Runtime) 99 | 100 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 101 | COMPONENT Runtime) 102 | 103 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) 104 | install(FILES "${bundled_library}" 105 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 106 | COMPONENT Runtime) 107 | endforeach(bundled_library) 108 | 109 | # Copy the native assets provided by the build.dart from all packages. 110 | set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") 111 | install(DIRECTORY "${NATIVE_ASSETS_DIR}" 112 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 113 | COMPONENT Runtime) 114 | 115 | # Fully re-copy the assets directory on each build to avoid having stale files 116 | # from a previous install. 117 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 118 | install(CODE " 119 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 120 | " COMPONENT Runtime) 121 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 122 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 123 | 124 | # Install the AOT library on non-Debug builds only. 125 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 126 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 127 | COMPONENT Runtime) 128 | endif() 129 | --------------------------------------------------------------------------------