├── .vim └── coc-settings.json ├── linux ├── .gitignore ├── main.cc ├── flutter │ ├── generated_plugin_registrant.h │ ├── generated_plugin_registrant.cc │ ├── generated_plugins.cmake │ └── CMakeLists.txt ├── my_application.h ├── my_application.cc └── CMakeLists.txt ├── .env.example ├── ios ├── 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-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.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 ├── Flutter │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── AppFrameworkInfo.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 ├── .gitignore └── Podfile ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── manifest.json └── index.html ├── android ├── gradle.properties ├── app │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── drawable │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── drawable-v21 │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── values │ │ │ │ │ └── styles.xml │ │ │ │ └── values-night │ │ │ │ │ └── styles.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── potato │ │ │ │ │ └── MainActivity.kt │ │ │ └── AndroidManifest.xml │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ └── profile │ │ │ └── AndroidManifest.xml │ └── build.gradle ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── .gitignore ├── settings.gradle └── build.gradle ├── lib ├── src │ ├── models │ │ ├── index.dart │ │ ├── notes │ │ │ ├── index.dart │ │ │ ├── note.dart │ │ │ ├── index.g.dart │ │ │ └── index.freezed.dart │ │ ├── auth │ │ │ ├── index.dart │ │ │ ├── user_profile.dart │ │ │ ├── index.g.dart │ │ │ └── index.freezed.dart │ │ └── clipboard │ │ │ ├── index.dart │ │ │ ├── p_clipboard.dart │ │ │ ├── index.g.dart │ │ │ └── index.freezed.dart │ ├── utils │ │ └── supabase.dart │ ├── layouts │ │ └── auth_layout.dart │ ├── init │ │ ├── locator.dart │ │ └── init.dart │ ├── stores │ │ ├── app_store.dart │ │ ├── clipboard_store.dart │ │ ├── app_store.g.dart │ │ ├── notes_store.dart │ │ ├── clipboard_store.g.dart │ │ ├── auth_store.dart │ │ ├── notes_store.g.dart │ │ └── auth_store.g.dart │ ├── data │ │ ├── auth_api.dart │ │ └── notes_api.dart │ ├── app │ │ ├── router.dart │ │ └── router.gr.dart │ └── screens │ │ ├── dashboard │ │ ├── notes │ │ │ ├── note_detail_page.dart │ │ │ └── dashboard_notes.dart │ │ ├── clipboard │ │ │ └── clipboard_list.dart │ │ ├── new_note_screen.dart │ │ └── dashboard.dart │ │ ├── auth │ │ ├── login.dart │ │ ├── sign_up.dart │ │ └── create_profile.dart │ │ └── home.dart └── main.dart ├── macos ├── Runner │ ├── Configs │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ ├── Warnings.xcconfig │ │ └── AppInfo.xcconfig │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_64.png │ │ │ ├── app_icon_1024.png │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_512.png │ │ │ └── Contents.json │ ├── Release.entitlements │ ├── MainFlutterWindow.swift │ ├── DebugProfile.entitlements │ ├── AppDelegate.swift │ ├── Info.plist │ └── StatusBarController.swift ├── .gitignore ├── Flutter │ ├── Flutter-Debug.xcconfig │ ├── Flutter-Release.xcconfig │ └── GeneratedPluginRegistrant.swift ├── Runner.xcworkspace │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── contents.xcworkspacedata ├── Runner.xcodeproj │ ├── project.xcworkspace │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Podfile └── Podfile.lock ├── windows ├── runner │ ├── resources │ │ └── app_icon.ico │ ├── resource.h │ ├── utils.h │ ├── runner.exe.manifest │ ├── flutter_window.h │ ├── main.cpp │ ├── CMakeLists.txt │ ├── utils.cpp │ ├── flutter_window.cpp │ ├── Runner.rc │ ├── win32_window.h │ └── win32_window.cpp ├── .gitignore ├── flutter │ ├── generated_plugin_registrant.h │ ├── generated_plugin_registrant.cc │ ├── generated_plugins.cmake │ └── CMakeLists.txt └── CMakeLists.txt ├── analysis_options.yaml ├── .gitignore ├── pubspec.yaml ├── LICENSE ├── test └── widget_test.dart ├── README.md └── .metadata /.vim/coc-settings.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | SUPABASE_ANON_KEY="" 2 | SUPABASE_URL="" -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rohithgilla12/potato/HEAD/web/favicon.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rohithgilla12/potato/HEAD/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rohithgilla12/potato/HEAD/web/icons/Icon-512.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rohithgilla12/potato/HEAD/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rohithgilla12/potato/HEAD/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /lib/src/models/index.dart: -------------------------------------------------------------------------------- 1 | export 'auth/index.dart'; 2 | export 'clipboard/index.dart'; 3 | export 'notes/index.dart'; 4 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /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/Rohithgilla12/potato/HEAD/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rohithgilla12/potato/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/Rohithgilla12/potato/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rohithgilla12/potato/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rohithgilla12/potato/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/Rohithgilla12/potato/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | linter: 4 | rules: 5 | 6 | analyzer: 7 | errors: 8 | invalid_annotation_target: ignore 9 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rohithgilla12/potato/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rohithgilla12/potato/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rohithgilla12/potato/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rohithgilla12/potato/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rohithgilla12/potato/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rohithgilla12/potato/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rohithgilla12/potato/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/Rohithgilla12/potato/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rohithgilla12/potato/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rohithgilla12/potato/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rohithgilla12/potato/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/Rohithgilla12/potato/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/Rohithgilla12/potato/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/Rohithgilla12/potato/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/Rohithgilla12/potato/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/Rohithgilla12/potato/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/Rohithgilla12/potato/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/Rohithgilla12/potato/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/Rohithgilla12/potato/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rohithgilla12/potato/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/Rohithgilla12/potato/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rohithgilla12/potato/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/Rohithgilla12/potato/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rohithgilla12/potato/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/Rohithgilla12/potato/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/potato/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package io.potato.app 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /lib/src/models/notes/index.dart: -------------------------------------------------------------------------------- 1 | library notes_models; 2 | 3 | import 'package:freezed_annotation/freezed_annotation.dart'; 4 | 5 | part 'index.freezed.dart'; 6 | part 'index.g.dart'; 7 | part 'note.dart'; 8 | -------------------------------------------------------------------------------- /lib/src/models/auth/index.dart: -------------------------------------------------------------------------------- 1 | library auth_models; 2 | 3 | import 'package:freezed_annotation/freezed_annotation.dart'; 4 | 5 | part 'index.freezed.dart'; 6 | part 'index.g.dart'; 7 | part 'user_profile.dart'; 8 | -------------------------------------------------------------------------------- /lib/src/utils/supabase.dart: -------------------------------------------------------------------------------- 1 | import 'package:supabase_flutter/supabase_flutter.dart'; 2 | 3 | final supabase = Supabase.instance.client; 4 | // final auth = SupabaseAuth.instance; 5 | final auth = supabase.auth; 6 | -------------------------------------------------------------------------------- /linux/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 | -------------------------------------------------------------------------------- /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/src/models/clipboard/index.dart: -------------------------------------------------------------------------------- 1 | library clipboard_models; 2 | 3 | import 'package:freezed_annotation/freezed_annotation.dart'; 4 | 5 | part 'index.freezed.dart'; 6 | part 'index.g.dart'; 7 | part 'p_clipboard.dart'; 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-7.4-all.zip 6 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /lib/src/models/auth/user_profile.dart: -------------------------------------------------------------------------------- 1 | part of auth_models; 2 | 3 | @freezed 4 | class UserProfile with _$UserProfile { 5 | const factory UserProfile({ 6 | required String id, 7 | required String email, 8 | String? name, 9 | }) = _UserProfile; 10 | 11 | factory UserProfile.fromJson(Map json) => _$UserProfileFromJson(json); 12 | } 13 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/src/models/clipboard/p_clipboard.dart: -------------------------------------------------------------------------------- 1 | part of clipboard_models; 2 | 3 | @freezed 4 | class PClipboard with _$PClipboard { 5 | const factory PClipboard({ 6 | required String id, 7 | required String text, 8 | @Default('text/plain') String mimeType, 9 | }) = _PClipboard; 10 | 11 | factory PClipboard.fromJson(Map json) => _$PClipboardFromJson(json); 12 | } 13 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.network.server 8 | 9 | com.apple.security.network.client 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /lib/src/models/notes/note.dart: -------------------------------------------------------------------------------- 1 | part of notes_models; 2 | 3 | @freezed 4 | class Note with _$Note { 5 | const factory Note({ 6 | required String id, 7 | required String? fid, 8 | required String uid, 9 | required String? title, 10 | required String? description, 11 | @JsonKey(name: 'created_at') required DateTime createdAt, 12 | }) = _Note; 13 | 14 | factory Note.fromJson(Map json) => _$NoteFromJson(json); 15 | } 16 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 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 | -------------------------------------------------------------------------------- /linux/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 | -------------------------------------------------------------------------------- /macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 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 | -------------------------------------------------------------------------------- /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 | com.apple.security.network.client 12 | 13 | 14 | -------------------------------------------------------------------------------- /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/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /lib/src/layouts/auth_layout.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class AuthLayout extends StatelessWidget { 4 | const AuthLayout({super.key, required this.child}); 5 | 6 | final Widget child; 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return Scaffold( 11 | appBar: AppBar( 12 | title: const Text('Potato'), 13 | ), 14 | body: Padding( 15 | padding: const EdgeInsets.all(16.0), 16 | child: child, 17 | ), 18 | ); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:potato/src/app/router.gr.dart'; 3 | import 'package:potato/src/init/init.dart'; 4 | 5 | void main() async { 6 | await init(); 7 | runApp(const MyApp()); 8 | } 9 | 10 | final AppRouter appRouter = AppRouter(); 11 | 12 | class MyApp extends StatelessWidget { 13 | const MyApp({super.key}); 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return MaterialApp.router( 18 | title: 'Potato', 19 | routerDelegate: appRouter.delegate(), 20 | routeInformationParser: appRouter.defaultRouteParser(), 21 | theme: ThemeData.dark(), 22 | ); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /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 = potato 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = io.potato.app 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2022 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /lib/src/init/locator.dart: -------------------------------------------------------------------------------- 1 | import 'package:get_it/get_it.dart'; 2 | import 'package:potato/src/stores/app_store.dart'; 3 | import 'package:potato/src/stores/auth_store.dart'; 4 | import 'package:potato/src/stores/clipboard_store.dart'; 5 | import 'package:potato/src/stores/notes_store.dart'; 6 | 7 | GetIt locator = GetIt.instance; 8 | 9 | void setupLocator() { 10 | // Don't think we need ro register it, since we access from `AppStore` 11 | locator.registerLazySingleton(() => AuthStore()); 12 | locator.registerLazySingleton(() => AppStore()); 13 | locator.registerLazySingleton(() => NotesStore()); 14 | locator.registerLazySingleton(() => ClipboardStore()); 15 | } 16 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.6.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.1.2' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /lib/src/stores/app_store.dart: -------------------------------------------------------------------------------- 1 | import 'package:mobx/mobx.dart'; 2 | import 'package:potato/src/init/locator.dart'; 3 | import 'package:potato/src/stores/auth_store.dart'; 4 | import 'package:potato/src/stores/clipboard_store.dart'; 5 | import 'package:potato/src/stores/notes_store.dart'; 6 | 7 | part 'app_store.g.dart'; 8 | 9 | class AppStore = _AppStore with _$AppStore; 10 | 11 | abstract class _AppStore with Store { 12 | // final AuthStore auth = AuthStore(); 13 | final AuthStore auth = locator(); 14 | final NotesStore notes = locator(); 15 | final ClipboardStore clipboard = locator(); 16 | 17 | @observable 18 | bool isLoading = false; 19 | 20 | @observable 21 | int tabIndex = 0; 22 | } 23 | -------------------------------------------------------------------------------- /macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import app_links_macos 9 | import flutter_secure_storage_macos 10 | import path_provider_macos 11 | import url_launcher_macos 12 | 13 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 14 | AppLinksMacosPlugin.register(with: registry.registrar(forPlugin: "AppLinksMacosPlugin")) 15 | FlutterSecureStorageMacosPlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStorageMacosPlugin")) 16 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) 17 | UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) 18 | } 19 | -------------------------------------------------------------------------------- /lib/src/models/auth/index.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of auth_models; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | _$_UserProfile _$$_UserProfileFromJson(Map json) => 10 | _$_UserProfile( 11 | id: json['id'] as String, 12 | email: json['email'] as String, 13 | name: json['name'] as String?, 14 | ); 15 | 16 | Map _$$_UserProfileToJson(_$_UserProfile instance) => 17 | { 18 | 'id': instance.id, 19 | 'email': instance.email, 20 | 'name': instance.name, 21 | }; 22 | -------------------------------------------------------------------------------- /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/src/models/clipboard/index.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of clipboard_models; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | _$_PClipboard _$$_PClipboardFromJson(Map json) => 10 | _$_PClipboard( 11 | id: json['id'] as String, 12 | text: json['text'] as String, 13 | mimeType: json['mimeType'] as String? ?? 'text/plain', 14 | ); 15 | 16 | Map _$$_PClipboardToJson(_$_PClipboard instance) => 17 | { 18 | 'id': instance.id, 19 | 'text': instance.text, 20 | 'mimeType': instance.mimeType, 21 | }; 22 | -------------------------------------------------------------------------------- /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 | 13 | void RegisterPlugins(flutter::PluginRegistry* registry) { 14 | AppLinksWindowsPluginRegisterWithRegistrar( 15 | registry->GetRegistrarForPlugin("AppLinksWindowsPlugin")); 16 | FlutterSecureStorageWindowsPluginRegisterWithRegistrar( 17 | registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin")); 18 | UrlLauncherWindowsRegisterWithRegistrar( 19 | registry->GetRegistrarForPlugin("UrlLauncherWindows")); 20 | } 21 | -------------------------------------------------------------------------------- /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 | 12 | void fl_register_plugins(FlPluginRegistry* registry) { 13 | g_autoptr(FlPluginRegistrar) flutter_secure_storage_linux_registrar = 14 | fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterSecureStorageLinuxPlugin"); 15 | flutter_secure_storage_linux_plugin_register_with_registrar(flutter_secure_storage_linux_registrar); 16 | g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = 17 | fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); 18 | url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); 19 | } 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Symbolication related 36 | app.*.symbols 37 | 38 | # Obfuscation related 39 | app.*.map.json 40 | 41 | # Android Studio will place build artifacts here 42 | /android/app/debug 43 | /android/app/profile 44 | /android/app/release 45 | 46 | .env -------------------------------------------------------------------------------- /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 | 11.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | flutter_secure_storage_linux 7 | url_launcher_linux 8 | ) 9 | 10 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 11 | ) 12 | 13 | set(PLUGIN_BUNDLED_LIBRARIES) 14 | 15 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 16 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 17 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 20 | endforeach(plugin) 21 | 22 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 23 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 24 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 25 | endforeach(ffi_plugin) 26 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | app_links_windows 7 | flutter_secure_storage_windows 8 | url_launcher_windows 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}/windows 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}/windows plugins/${ffi_plugin}) 25 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 26 | endforeach(ffi_plugin) 27 | -------------------------------------------------------------------------------- /windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /lib/src/models/notes/index.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of notes_models; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | _$_Note _$$_NoteFromJson(Map json) => _$_Note( 10 | id: json['id'] as String, 11 | fid: json['fid'] as String?, 12 | uid: json['uid'] as String, 13 | title: json['title'] as String?, 14 | description: json['description'] as String?, 15 | createdAt: DateTime.parse(json['created_at'] as String), 16 | ); 17 | 18 | Map _$$_NoteToJson(_$_Note instance) => { 19 | 'id': instance.id, 20 | 'fid': instance.fid, 21 | 'uid': instance.uid, 22 | 'title': instance.title, 23 | 'description': instance.description, 24 | 'created_at': instance.createdAt.toIso8601String(), 25 | }; 26 | -------------------------------------------------------------------------------- /lib/src/data/auth_api.dart: -------------------------------------------------------------------------------- 1 | import 'package:crispin/crispin.dart'; 2 | import 'package:potato/src/models/auth/index.dart'; 3 | import 'package:potato/src/utils/supabase.dart'; 4 | 5 | class AuthApi { 6 | Future getUser(String uid) async { 7 | try { 8 | final response = await supabase // 9 | .from('user_profiles') 10 | .select() 11 | .eq('id', uid); 12 | 13 | Crispin().info(response.toString()); 14 | return UserProfile.fromJson(response.first); 15 | } catch (e) { 16 | Crispin().error(e.toString()); 17 | throw Exception(e); 18 | } 19 | } 20 | 21 | Future createProfile(UserProfile userProfile) async { 22 | try { 23 | final response = await supabase // 24 | .from('user_profiles') 25 | .insert(userProfile.toJson()); 26 | 27 | Crispin().info(response.toString()); 28 | } catch (e) { 29 | Crispin().error(e.toString(), error: e); 30 | throw Exception(e); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: potato 2 | description: A new Flutter project. 3 | 4 | publish_to: "none" 5 | 6 | version: 1.0.0+1 7 | 8 | environment: 9 | sdk: ">=2.18.0-271.4.beta <3.0.0" 10 | 11 | dependencies: 12 | flutter: 13 | sdk: flutter 14 | supabase_flutter: ^1.0.0-dev.4 15 | 16 | cupertino_icons: ^1.0.2 17 | flutter_dotenv: ^5.0.2 18 | auto_route: ^4.2.1 19 | get_it: ^7.2.0 20 | mobx: ^2.0.7+5 21 | flutter_mobx: ^2.0.6+1 22 | crispin: ^1.1.0 23 | logger_crispin_transport: ^1.1.0 24 | freezed_annotation: ^2.1.0 25 | json_annotation: ^4.6.0 26 | flutter_remix: ^0.0.3 27 | flutter_markdown: ^0.6.10+3 28 | uuid: ^3.0.6 29 | flutter_secure_storage: ^6.0.0 30 | 31 | dev_dependencies: 32 | flutter_test: 33 | sdk: flutter 34 | 35 | flutter_lints: ^2.0.0 36 | auto_route_generator: ^4.2.1 37 | build_runner: ^2.2.0 38 | mobx_codegen: ^2.0.7 39 | freezed: ^2.1.0+1 40 | json_serializable: ^6.3.1 41 | 42 | flutter: 43 | uses-material-design: true 44 | 45 | assets: 46 | - .env 47 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "potato", 3 | "short_name": "potato", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 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 | } 36 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Rohith Gilla 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 | -------------------------------------------------------------------------------- /macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | var statusBar: StatusBarController? 7 | var popover = NSPopover.init() 8 | override init() { 9 | // Todo: Remove after dev 10 | // popover.behavior = NSPopover.Behavior.transient //to make the popover hide when the user clicks outside of it 11 | } 12 | 13 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 14 | return false 15 | } 16 | 17 | override func applicationDidFinishLaunching(_ aNotification: Notification) { 18 | let controller: FlutterViewController = 19 | mainFlutterWindow?.contentViewController as! FlutterViewController 20 | popover.contentSize = NSSize(width: 480, height: 640) //change this to your desired size 21 | popover.contentViewController = controller //set the content view controller for the popover to flutter view controller 22 | statusBar = StatusBarController.init(popover) 23 | mainFlutterWindow.close() //close the default flutter window 24 | super.applicationDidFinishLaunching(aNotification) 25 | } 26 | } -------------------------------------------------------------------------------- /lib/src/app/router.dart: -------------------------------------------------------------------------------- 1 | import 'package:auto_route/auto_route.dart'; 2 | import 'package:potato/src/screens/auth/login.dart'; 3 | import 'package:potato/src/screens/auth/sign_up.dart'; 4 | import 'package:potato/src/screens/dashboard/dashboard.dart'; 5 | import 'package:potato/src/screens/dashboard/new_note_screen.dart'; 6 | import 'package:potato/src/screens/dashboard/notes/note_detail_page.dart'; 7 | import 'package:potato/src/screens/home.dart'; 8 | 9 | @MaterialAutoRouter( 10 | replaceInRouteName: 'Page,Route', 11 | routes: [ 12 | AutoRoute( 13 | path: '/', 14 | page: HomePage, 15 | initial: true, 16 | ), 17 | AutoRoute( 18 | path: '/login', 19 | page: LoginPage, 20 | ), 21 | AutoRoute( 22 | path: '/sign-up', 23 | page: SignUpPage, 24 | ), 25 | // Todo add auth guards later :p 26 | AutoRoute( 27 | path: '/dashboard', 28 | page: DashboardPage, 29 | ), 30 | AutoRoute( 31 | path: '/new-note', 32 | page: NewNotePage, 33 | ), 34 | AutoRoute( 35 | path: '/note-detail/:id', 36 | page: NoteDetailPage, 37 | ), 38 | ], 39 | ) 40 | class $AppRouter {} 41 | -------------------------------------------------------------------------------- /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:potato/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 | -------------------------------------------------------------------------------- /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.CreateAndShow(L"potato", 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Potato 2 | A productivity manager application, designed to sync across your devices, it currently supports macOS! 3 | 4 | ## Demo 5 | https://user-images.githubusercontent.com/19389850/185851371-1a52c232-bd88-4e92-85fb-c48a3b3cf516.mp4 6 | 7 | ## Tools used 8 | - Flutter 9 | - Supabase 10 | - Remix Icons 11 | 12 | P.S: This uses the `dev` version of the `supabase_flutter` pacakge. 13 | 14 | 15 | ![Wohoo](https://c.tenor.com/cxhXkLhVpHEAAAAC/punch-it-kevin.gif) 16 | ## Description 17 | ### Authentication 18 | - Uses supabase magic link to login 19 | 20 | The current application dashboard mainly consists of two views 21 | - Notes 22 | - Clipboard 23 | 24 | ### Notes 25 | ![Notes](https://i.imgur.com/qGowthZ.png) 26 | - Add a note in markdown format. 27 | 28 | View notes nice and clean 29 | ![Notes detail](https://i.imgur.com/miVIV5l.png) 30 | 31 | ### Clipboard 32 | ![Clipboard](https://i.imgur.com/2Oexecp.png) 33 | - Syncs system clipboard with the application. 34 | - Syncs system clipboard to supabase. 35 | 36 | ## Current improvement areas 37 | - Make UI look neat 38 | - Add the ability to edit/delete notes 39 | - More abilities for users to sign in 40 | - Better icons 41 | - Add the potato logo! 42 | 43 | ## Future ideas 44 | - Make it compatible with Linux and windows. 45 | - Create a mobile application for the same, allowing to sync across devices. 46 | - Public API for users to play with it. 47 | - A marketplace to add "micro applications" to the application. 48 | -------------------------------------------------------------------------------- /macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.11' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | end 35 | 36 | post_install do |installer| 37 | installer.pods_project.targets.each do |target| 38 | flutter_additional_macos_build_settings(target) 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /lib/src/stores/clipboard_store.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/services.dart'; 4 | import 'package:mobx/mobx.dart'; 5 | import 'package:potato/src/models/clipboard/index.dart'; 6 | import 'package:uuid/uuid.dart'; 7 | 8 | part 'clipboard_store.g.dart'; 9 | 10 | class ClipboardStore = ClipboardStoreBase with _$ClipboardStore; 11 | 12 | abstract class ClipboardStoreBase with Store { 13 | final uuid = const Uuid(); 14 | 15 | @observable 16 | List clipboard = []; 17 | 18 | @action 19 | Future getClipboard() async { 20 | final ClipboardData? clipboardData = await Clipboard.getData(Clipboard.kTextPlain); 21 | if (clipboardData != null) { 22 | if (clipboardData.text != null) { 23 | //create clipboard object 24 | final PClipboard clipboardObject = PClipboard( 25 | id: uuid.v4(), 26 | text: clipboardData.text!, 27 | ); 28 | 29 | // Need to check recent value and if it is the same as the current value, then don't add it to the list 30 | if (clipboard.isNotEmpty && clipboard.last.text == clipboardObject.text) { 31 | return; 32 | } 33 | // Ah very weird but doing this would reload :( 34 | clipboard = [...clipboard, clipboardObject]; 35 | } 36 | } 37 | } 38 | 39 | @action 40 | Future listenToClipboard() async { 41 | Timer.periodic(const Duration(seconds: 2), (timer) async { 42 | await getClipboard(); 43 | }); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '11.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /lib/src/data/notes_api.dart: -------------------------------------------------------------------------------- 1 | import 'package:crispin/crispin.dart'; 2 | import 'package:potato/src/models/notes/index.dart'; 3 | import 'package:potato/src/utils/supabase.dart'; 4 | 5 | class NotesApi { 6 | static const String tableName = 'user_notes'; 7 | 8 | Future createNote({ 9 | String? title, 10 | String? description, 11 | }) async { 12 | try { 13 | final response = await supabase.from(tableName).insert({ 14 | 'title': title, 15 | 'description': description, 16 | }); 17 | Crispin().info('createNote response: $response'); 18 | } catch (e) { 19 | Crispin().error(e.toString(), error: e); 20 | throw Exception(e); 21 | } 22 | } 23 | 24 | Future> getUserNotes(String uid) async { 25 | try { 26 | Crispin().info('getUserNotes uid: $uid'); 27 | final response = await supabase.from(tableName).select().eq('uid', uid); 28 | Crispin().info('getUserNotes response: $response'); 29 | final List notes = []; 30 | response.forEach((note) { 31 | final Note noteSerialise = Note.fromJson(note); 32 | notes.add(noteSerialise); 33 | }); 34 | return notes; 35 | } catch (e) { 36 | Crispin().error(e.toString(), error: e); 37 | throw Exception(e); 38 | } 39 | } 40 | 41 | Future deleteNote(String noteId) async { 42 | try { 43 | await supabase.from(tableName).delete().eq('id', noteId); 44 | } catch (e) { 45 | throw Exception(e); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/src/stores/app_store.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'app_store.dart'; 4 | 5 | // ************************************************************************** 6 | // StoreGenerator 7 | // ************************************************************************** 8 | 9 | // ignore_for_file: non_constant_identifier_names, unnecessary_brace_in_string_interps, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, no_leading_underscores_for_local_identifiers 10 | 11 | mixin _$AppStore on _AppStore, Store { 12 | late final _$isLoadingAtom = 13 | Atom(name: '_AppStore.isLoading', context: context); 14 | 15 | @override 16 | bool get isLoading { 17 | _$isLoadingAtom.reportRead(); 18 | return super.isLoading; 19 | } 20 | 21 | @override 22 | set isLoading(bool value) { 23 | _$isLoadingAtom.reportWrite(value, super.isLoading, () { 24 | super.isLoading = value; 25 | }); 26 | } 27 | 28 | late final _$tabIndexAtom = 29 | Atom(name: '_AppStore.tabIndex', context: context); 30 | 31 | @override 32 | int get tabIndex { 33 | _$tabIndexAtom.reportRead(); 34 | return super.tabIndex; 35 | } 36 | 37 | @override 38 | set tabIndex(int value) { 39 | _$tabIndexAtom.reportWrite(value, super.tabIndex, () { 40 | super.tabIndex = value; 41 | }); 42 | } 43 | 44 | @override 45 | String toString() { 46 | return ''' 47 | isLoading: ${isLoading}, 48 | tabIndex: ${tabIndex} 49 | '''; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /lib/src/screens/dashboard/notes/note_detail_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:auto_route/auto_route.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_markdown/flutter_markdown.dart'; 4 | import 'package:markdown/markdown.dart' as md; 5 | import 'package:potato/src/init/locator.dart'; 6 | import 'package:potato/src/models/index.dart'; 7 | import 'package:potato/src/stores/app_store.dart'; 8 | 9 | class NoteDetailPage extends StatelessWidget { 10 | const NoteDetailPage({ 11 | super.key, 12 | @PathParam('id') required this.id, 13 | }); 14 | 15 | final String id; 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | final AppStore appStore = locator(); 20 | 21 | final Note note = appStore.notes.userNotes.firstWhere( 22 | (note) => note.id == id, 23 | ); 24 | return Scaffold( 25 | appBar: AppBar( 26 | title: Text(note.title ?? 'Note Detail'), 27 | ), 28 | body: SingleChildScrollView( 29 | child: Container( 30 | padding: const EdgeInsets.all(16.0), 31 | height: MediaQuery.of(context).size.height, 32 | child: Markdown( 33 | data: note.description ?? 'No Description', 34 | extensionSet: md.ExtensionSet( 35 | md.ExtensionSet.gitHubFlavored.blockSyntaxes, 36 | [ 37 | md.EmojiSyntax(), 38 | ...md.ExtensionSet.gitHubFlavored.inlineSyntaxes, 39 | ], 40 | ), 41 | ), 42 | ), 43 | ), 44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /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 | LSUIElement 32 | 33 | CFBundleURLTypes 34 | 35 | 36 | CFBundleURLName 37 | 38 | CFBundleURLSchemes 39 | 40 | potato 41 | io.potato.app 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /macos/Runner/StatusBarController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // StatusBarController.swift 3 | // 4 | // 5 | // Created by Rohith Gilla on 16/08/22. 6 | // 7 | 8 | import AppKit 9 | 10 | class StatusBarController { 11 | private var statusBar: NSStatusBar 12 | private var statusItem: NSStatusItem 13 | private var popover: NSPopover 14 | 15 | init(_ popover: NSPopover) { 16 | self.popover = popover 17 | statusBar = NSStatusBar.init() 18 | statusItem = statusBar.statusItem(withLength: 28.0) 19 | 20 | if let statusBarButton = statusItem.button { 21 | statusBarButton.image = #imageLiteral(resourceName: "AppIcon") //change this to your desired image 22 | statusBarButton.image?.size = NSSize(width: 18.0, height: 18.0) 23 | statusBarButton.image?.isTemplate = true 24 | statusBarButton.action = #selector(togglePopover(sender:)) 25 | statusBarButton.target = self 26 | } 27 | } 28 | 29 | @objc func togglePopover(sender: AnyObject) { 30 | if(popover.isShown) { 31 | hidePopover(sender) 32 | } 33 | else { 34 | showPopover(sender) 35 | } 36 | } 37 | 38 | func showPopover(_ sender: AnyObject) { 39 | if let statusBarButton = statusItem.button { 40 | popover.show(relativeTo: statusBarButton.bounds, of: statusBarButton, preferredEdge: NSRectEdge.maxY) 41 | } 42 | } 43 | 44 | func hidePopover(_ sender: AnyObject) { 45 | popover.performClose(sender) 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /lib/src/screens/auth/login.dart: -------------------------------------------------------------------------------- 1 | import 'package:auto_route/auto_route.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:potato/src/init/locator.dart'; 4 | import 'package:potato/src/layouts/auth_layout.dart'; 5 | import 'package:potato/src/stores/app_store.dart'; 6 | 7 | class LoginPage extends StatefulWidget { 8 | const LoginPage({super.key}); 9 | 10 | @override 11 | State createState() => _LoginPageState(); 12 | } 13 | 14 | class _LoginPageState extends State { 15 | final TextEditingController _emailController = TextEditingController(); 16 | 17 | final AppStore appStore = locator(); 18 | 19 | @override 20 | Widget build(BuildContext context) { 21 | return AuthLayout( 22 | child: Form( 23 | child: Column( 24 | children: [ 25 | TextFormField( 26 | controller: _emailController, 27 | decoration: const InputDecoration( 28 | labelText: 'Email', 29 | ), 30 | ), 31 | ElevatedButton( 32 | child: const Text('Send magic link'), 33 | onPressed: () async { 34 | await appStore.auth.loginWithMagicLink(_emailController.text); 35 | if (mounted) { 36 | ScaffoldMessenger.of(context).showSnackBar(const SnackBar( 37 | content: Text('Magic link sent'), 38 | )); 39 | } 40 | context.router.navigateBack(); 41 | }, 42 | ), 43 | ], 44 | ), 45 | ), 46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /macos/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - app_links_macos (1.0.0): 3 | - FlutterMacOS 4 | - flutter_secure_storage_macos (3.3.1): 5 | - FlutterMacOS 6 | - FlutterMacOS (1.0.0) 7 | - path_provider_macos (0.0.1): 8 | - FlutterMacOS 9 | - url_launcher_macos (0.0.1): 10 | - FlutterMacOS 11 | 12 | DEPENDENCIES: 13 | - app_links_macos (from `Flutter/ephemeral/.symlinks/plugins/app_links_macos/macos`) 14 | - flutter_secure_storage_macos (from `Flutter/ephemeral/.symlinks/plugins/flutter_secure_storage_macos/macos`) 15 | - FlutterMacOS (from `Flutter/ephemeral`) 16 | - path_provider_macos (from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`) 17 | - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) 18 | 19 | EXTERNAL SOURCES: 20 | app_links_macos: 21 | :path: Flutter/ephemeral/.symlinks/plugins/app_links_macos/macos 22 | flutter_secure_storage_macos: 23 | :path: Flutter/ephemeral/.symlinks/plugins/flutter_secure_storage_macos/macos 24 | FlutterMacOS: 25 | :path: Flutter/ephemeral 26 | path_provider_macos: 27 | :path: Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos 28 | url_launcher_macos: 29 | :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos 30 | 31 | SPEC CHECKSUMS: 32 | app_links_macos: 15e554f46b367713cb8d1db37cee3d1701d22a27 33 | flutter_secure_storage_macos: 6ceee8fbc7f484553ad17f79361b556259df89aa 34 | FlutterMacOS: ae6af50a8ea7d6103d888583d46bd8328a7e9811 35 | path_provider_macos: 3c0c3b4b0d4a76d2bf989a913c2de869c5641a19 36 | url_launcher_macos: 597e05b8e514239626bcf4a850fcf9ef5c856ec3 37 | 38 | PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c 39 | 40 | COCOAPODS: 1.11.3 41 | -------------------------------------------------------------------------------- /lib/src/stores/notes_store.dart: -------------------------------------------------------------------------------- 1 | import 'package:mobx/mobx.dart'; 2 | import 'package:potato/src/data/notes_api.dart'; 3 | import 'package:potato/src/init/locator.dart'; 4 | import 'package:potato/src/models/notes/index.dart'; 5 | import 'package:potato/src/stores/auth_store.dart'; 6 | 7 | part 'notes_store.g.dart'; 8 | 9 | class NotesStore = NotesStoreBase with _$NotesStore; 10 | 11 | abstract class NotesStoreBase with Store { 12 | final AuthStore authStore = locator(); 13 | final NotesApi notesApi = NotesApi(); 14 | 15 | @observable 16 | List userNotes = []; 17 | 18 | @observable 19 | String? title; 20 | 21 | @observable 22 | String? description; 23 | 24 | @observable 25 | ObservableFuture> userNotesFuture = ObservableFuture.value([]); 26 | 27 | @action 28 | Future getUserNotes() async { 29 | try { 30 | final Future> notesFuture = notesApi.getUserNotes(authStore.uid!); 31 | userNotesFuture = ObservableFuture(notesFuture); 32 | userNotes = await notesFuture; 33 | } catch (e) { 34 | throw Exception(e); 35 | } 36 | } 37 | 38 | @action 39 | Future createNote() async { 40 | try { 41 | await notesApi.createNote( 42 | title: title, 43 | description: description, 44 | ); 45 | } catch (e) { 46 | throw Exception(e); 47 | } 48 | } 49 | 50 | @action 51 | Future deleteNote(String id) async { 52 | try { 53 | await notesApi.deleteNote(id); 54 | 55 | // Till we implement the realtime listening, refreshing the list is the easiest way to update the list 56 | await getUserNotes(); 57 | } catch (e) { 58 | throw Exception(e); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /lib/src/stores/clipboard_store.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'clipboard_store.dart'; 4 | 5 | // ************************************************************************** 6 | // StoreGenerator 7 | // ************************************************************************** 8 | 9 | // ignore_for_file: non_constant_identifier_names, unnecessary_brace_in_string_interps, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, no_leading_underscores_for_local_identifiers 10 | 11 | mixin _$ClipboardStore on ClipboardStoreBase, Store { 12 | late final _$clipboardAtom = 13 | Atom(name: 'ClipboardStoreBase.clipboard', context: context); 14 | 15 | @override 16 | List get clipboard { 17 | _$clipboardAtom.reportRead(); 18 | return super.clipboard; 19 | } 20 | 21 | @override 22 | set clipboard(List value) { 23 | _$clipboardAtom.reportWrite(value, super.clipboard, () { 24 | super.clipboard = value; 25 | }); 26 | } 27 | 28 | late final _$getClipboardAsyncAction = 29 | AsyncAction('ClipboardStoreBase.getClipboard', context: context); 30 | 31 | @override 32 | Future getClipboard() { 33 | return _$getClipboardAsyncAction.run(() => super.getClipboard()); 34 | } 35 | 36 | late final _$listenToClipboardAsyncAction = 37 | AsyncAction('ClipboardStoreBase.listenToClipboard', context: context); 38 | 39 | @override 40 | Future listenToClipboard() { 41 | return _$listenToClipboardAsyncAction.run(() => super.listenToClipboard()); 42 | } 43 | 44 | @override 45 | String toString() { 46 | return ''' 47 | clipboard: ${clipboard} 48 | '''; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /lib/src/screens/dashboard/clipboard/clipboard_list.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/services.dart'; 3 | import 'package:flutter_mobx/flutter_mobx.dart'; 4 | import 'package:flutter_remix/flutter_remix.dart'; 5 | import 'package:potato/src/init/locator.dart'; 6 | import 'package:potato/src/models/index.dart'; 7 | import 'package:potato/src/stores/clipboard_store.dart'; 8 | 9 | class ClipboardListPage extends StatelessWidget { 10 | const ClipboardListPage({super.key}); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | final ClipboardStore clipboardStore = locator(); 15 | 16 | return Scaffold( 17 | body: Container( 18 | padding: const EdgeInsets.all(16.0), 19 | height: MediaQuery.of(context).size.height, 20 | child: Observer( 21 | builder: (_) { 22 | return ListView.separated( 23 | reverse: true, 24 | itemBuilder: (context, int index) { 25 | final PClipboard clipboard = clipboardStore.clipboard[index]; 26 | return ListTile( 27 | title: Text( 28 | clipboard.text, 29 | ), 30 | trailing: IconButton( 31 | onPressed: () async { 32 | Clipboard.setData(ClipboardData(text: clipboard.text)); 33 | }, 34 | icon: const Icon( 35 | FlutterRemix.file_copy_2_line, 36 | ), 37 | ), 38 | ); 39 | }, 40 | separatorBuilder: ((context, index) => const Divider()), 41 | itemCount: clipboardStore.clipboard.length, 42 | ); 43 | }, 44 | ), 45 | ), 46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /.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. 5 | 6 | version: 7 | revision: 8c1149878bbb8f062aecfab4d825e5b87bdb4487 8 | channel: beta 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: 8c1149878bbb8f062aecfab4d825e5b87bdb4487 17 | base_revision: 8c1149878bbb8f062aecfab4d825e5b87bdb4487 18 | - platform: android 19 | create_revision: 8c1149878bbb8f062aecfab4d825e5b87bdb4487 20 | base_revision: 8c1149878bbb8f062aecfab4d825e5b87bdb4487 21 | - platform: ios 22 | create_revision: 8c1149878bbb8f062aecfab4d825e5b87bdb4487 23 | base_revision: 8c1149878bbb8f062aecfab4d825e5b87bdb4487 24 | - platform: linux 25 | create_revision: 8c1149878bbb8f062aecfab4d825e5b87bdb4487 26 | base_revision: 8c1149878bbb8f062aecfab4d825e5b87bdb4487 27 | - platform: macos 28 | create_revision: 8c1149878bbb8f062aecfab4d825e5b87bdb4487 29 | base_revision: 8c1149878bbb8f062aecfab4d825e5b87bdb4487 30 | - platform: web 31 | create_revision: 8c1149878bbb8f062aecfab4d825e5b87bdb4487 32 | base_revision: 8c1149878bbb8f062aecfab4d825e5b87bdb4487 33 | - platform: windows 34 | create_revision: 8c1149878bbb8f062aecfab4d825e5b87bdb4487 35 | base_revision: 8c1149878bbb8f062aecfab4d825e5b87bdb4487 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 | -------------------------------------------------------------------------------- /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_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 37 | 38 | # Run the Flutter tool portions of the build. This must not be removed. 39 | add_dependencies(${BINARY_NAME} flutter_assemble) 40 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Potato 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | potato 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 | UIViewControllerBasedStatusBarAppearance 45 | 46 | CADisableMinimumFrameDurationOnPhone 47 | 48 | UIApplicationSupportsIndirectInputEvents 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /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 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | std::string utf8_string; 52 | if (target_length == 0 || target_length > utf8_string.max_size()) { 53 | return utf8_string; 54 | } 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /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 | return true; 30 | } 31 | 32 | void FlutterWindow::OnDestroy() { 33 | if (flutter_controller_) { 34 | flutter_controller_ = nullptr; 35 | } 36 | 37 | Win32Window::OnDestroy(); 38 | } 39 | 40 | LRESULT 41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 42 | WPARAM const wparam, 43 | LPARAM const lparam) noexcept { 44 | // Give Flutter, including plugins, an opportunity to handle window messages. 45 | if (flutter_controller_) { 46 | std::optional result = 47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 48 | lparam); 49 | if (result) { 50 | return *result; 51 | } 52 | } 53 | 54 | switch (message) { 55 | case WM_FONTCHANGE: 56 | flutter_controller_->engine()->ReloadSystemFonts(); 57 | break; 58 | } 59 | 60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 61 | } 62 | -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | potato 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /lib/src/screens/dashboard/new_note_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:auto_route/auto_route.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:potato/src/init/locator.dart'; 4 | import 'package:potato/src/stores/app_store.dart'; 5 | 6 | class NewNotePage extends StatefulWidget { 7 | const NewNotePage({Key? key}) : super(key: key); 8 | 9 | @override 10 | State createState() => _NewNotePageState(); 11 | } 12 | 13 | class _NewNotePageState extends State { 14 | final AppStore appStore = locator(); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return Scaffold( 19 | appBar: AppBar( 20 | title: const Text('Add your note'), 21 | ), 22 | floatingActionButton: FloatingActionButton( 23 | child: const Icon(Icons.save), 24 | onPressed: () async { 25 | // TODO: Add clean up and pop back after save! 26 | // TODO: Add loaders 27 | await appStore.notes.createNote(); 28 | if (mounted) { 29 | ScaffoldMessenger.of(context).showSnackBar( 30 | const SnackBar( 31 | content: Text('Note saved!'), 32 | ), 33 | ); 34 | } 35 | appStore.notes.getUserNotes(); 36 | context.router.navigateBack(); 37 | }, 38 | ), 39 | body: Container( 40 | padding: const EdgeInsets.all(16.0), 41 | child: Column( 42 | children: [ 43 | TextField( 44 | decoration: const InputDecoration( 45 | labelText: 'Title', 46 | ), 47 | onChanged: (String value) { 48 | appStore.notes.title = value; 49 | }, 50 | ), 51 | TextField( 52 | decoration: const InputDecoration( 53 | labelText: 'Description', 54 | ), 55 | maxLines: 18, 56 | onChanged: (String value) { 57 | appStore.notes.description = value; 58 | }, 59 | ), 60 | ], 61 | ), 62 | ), 63 | ); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /lib/src/screens/auth/sign_up.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:potato/src/init/locator.dart'; 3 | import 'package:potato/src/layouts/auth_layout.dart'; 4 | import 'package:potato/src/stores/app_store.dart'; 5 | 6 | class SignUpPage extends StatefulWidget { 7 | const SignUpPage({super.key}); 8 | 9 | @override 10 | State createState() => _SignUpPageState(); 11 | } 12 | 13 | class _SignUpPageState extends State { 14 | final GlobalKey _formKey = GlobalKey(); 15 | 16 | final TextEditingController _emailController = TextEditingController(); 17 | final TextEditingController _passwordController = TextEditingController(); 18 | final TextEditingController _confirmPasswordController = TextEditingController(); 19 | 20 | final AppStore appStore = locator(); 21 | 22 | @override 23 | Widget build(BuildContext context) { 24 | return AuthLayout( 25 | child: Form( 26 | key: _formKey, 27 | child: Column( 28 | children: [ 29 | TextFormField( 30 | controller: _emailController, 31 | decoration: const InputDecoration( 32 | labelText: 'Email', 33 | ), 34 | ), 35 | TextFormField( 36 | controller: _passwordController, 37 | decoration: const InputDecoration( 38 | labelText: 'Password', 39 | ), 40 | ), 41 | TextFormField( 42 | controller: _confirmPasswordController, 43 | decoration: const InputDecoration( 44 | labelText: 'Confirm Password', 45 | ), 46 | ), 47 | ElevatedButton( 48 | child: const Text('Sign Up'), 49 | onPressed: () async { 50 | if (_formKey.currentState!.validate()) { 51 | await appStore.auth.signUp( 52 | _emailController.text, 53 | _passwordController.text, 54 | ); 55 | } 56 | }, 57 | ), 58 | ], 59 | ), 60 | ), 61 | ); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /lib/src/screens/dashboard/dashboard.dart: -------------------------------------------------------------------------------- 1 | import 'package:auto_route/auto_route.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_mobx/flutter_mobx.dart'; 4 | import 'package:flutter_remix/flutter_remix.dart'; 5 | import 'package:potato/src/app/router.gr.dart'; 6 | import 'package:potato/src/init/locator.dart'; 7 | import 'package:potato/src/screens/dashboard/clipboard/clipboard_list.dart'; 8 | import 'package:potato/src/screens/dashboard/notes/dashboard_notes.dart'; 9 | import 'package:potato/src/stores/app_store.dart'; 10 | 11 | class DashboardPage extends StatefulWidget { 12 | const DashboardPage({super.key}); 13 | 14 | @override 15 | State createState() => _DashboardPageState(); 16 | } 17 | 18 | class _DashboardPageState extends State { 19 | final AppStore appStore = locator(); 20 | 21 | @override 22 | initState() { 23 | super.initState(); 24 | appStore.notes.getUserNotes(); 25 | Future.delayed(const Duration(seconds: 1), () async { 26 | await appStore.clipboard.listenToClipboard(); 27 | }); 28 | } 29 | 30 | @override 31 | Widget build(BuildContext context) { 32 | return Observer(builder: (context) { 33 | return Scaffold( 34 | floatingActionButton: appStore.tabIndex == 0 35 | ? FloatingActionButton( 36 | child: const Icon(Icons.add), 37 | onPressed: () async { 38 | context.router.push(const NewNoteRoute()); 39 | }, 40 | ) 41 | : null, 42 | bottomNavigationBar: BottomNavigationBar( 43 | currentIndex: appStore.tabIndex, 44 | onTap: (int index) { 45 | appStore.tabIndex = index; 46 | }, 47 | items: const [ 48 | BottomNavigationBarItem( 49 | icon: Icon(FlutterRemix.booklet_line), 50 | label: 'Notes', 51 | ), 52 | BottomNavigationBarItem( 53 | icon: Icon(FlutterRemix.clipboard_line), 54 | label: 'Clipboard', 55 | ), 56 | ], 57 | ), 58 | body: [ 59 | const DashboardNotes(), 60 | const ClipboardListPage(), 61 | ][appStore.tabIndex], 62 | ); 63 | }); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /lib/src/screens/auth/create_profile.dart: -------------------------------------------------------------------------------- 1 | import 'package:auto_route/auto_route.dart'; 2 | import 'package:crispin/crispin.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_mobx/flutter_mobx.dart'; 5 | import 'package:potato/src/app/router.gr.dart'; 6 | import 'package:potato/src/init/locator.dart'; 7 | import 'package:potato/src/stores/app_store.dart'; 8 | 9 | class CreateProfile extends StatefulWidget { 10 | const CreateProfile({super.key}); 11 | 12 | @override 13 | State createState() => _CreateProfileState(); 14 | } 15 | 16 | class _CreateProfileState extends State { 17 | final AppStore appStore = locator(); 18 | 19 | bool isLoading = false; 20 | 21 | @override 22 | Widget build(BuildContext context) { 23 | return Column( 24 | children: [ 25 | Text( 26 | 'Complete your profile', 27 | style: Theme.of(context).textTheme.titleLarge, 28 | ), 29 | TextField( 30 | decoration: const InputDecoration( 31 | labelText: 'Name', 32 | ), 33 | onChanged: (value) => appStore.auth.name = value, 34 | ), 35 | const SizedBox(height: 16.0), 36 | Observer( 37 | builder: (_) { 38 | if (isLoading) { 39 | return const Center( 40 | child: CircularProgressIndicator(), 41 | ); 42 | } 43 | return ElevatedButton( 44 | onPressed: () async { 45 | if (appStore.auth.name != null) { 46 | setState(() => isLoading = true); 47 | try { 48 | await appStore.auth.createInitialProfile(); 49 | context.router.push(const DashboardRoute()); 50 | } catch (e, st) { 51 | setState(() { 52 | isLoading = false; 53 | }); 54 | Crispin().error( 55 | e.toString(), 56 | error: e, 57 | stackTrace: st, 58 | ); 59 | } 60 | } 61 | }, 62 | child: const Text('Create Profile'), 63 | ); 64 | }, 65 | ), 66 | ], 67 | ); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /lib/src/screens/dashboard/notes/dashboard_notes.dart: -------------------------------------------------------------------------------- 1 | import 'package:auto_route/auto_route.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_mobx/flutter_mobx.dart'; 4 | import 'package:potato/src/app/router.gr.dart'; 5 | import 'package:potato/src/init/locator.dart'; 6 | import 'package:potato/src/stores/app_store.dart'; 7 | 8 | class DashboardNotes extends StatelessWidget { 9 | const DashboardNotes({super.key}); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | final AppStore appStore = locator(); 14 | 15 | return Container( 16 | padding: const EdgeInsets.all(16.0), 17 | child: Observer( 18 | builder: (context) { 19 | return ListView.separated( 20 | separatorBuilder: (context, index) => const Divider(), 21 | itemCount: appStore.notes.userNotes.length, 22 | reverse: true, 23 | itemBuilder: (context, index) { 24 | final note = appStore.notes.userNotes[index]; 25 | return ListTile( 26 | title: Text(note.title ?? 'No Title'), 27 | subtitle: Text( 28 | note.description ?? 'No Description', 29 | maxLines: 3, 30 | ), 31 | onTap: () { 32 | context.router.push(NoteDetailRoute(id: note.id)); 33 | }, 34 | trailing: SizedBox( 35 | width: 80.0, 36 | child: Row( 37 | children: [ 38 | IconButton( 39 | icon: const Icon(Icons.edit), 40 | onPressed: () { 41 | ScaffoldMessenger.of(context).showSnackBar( 42 | const SnackBar( 43 | content: Text('TODO: Implement edit note'), 44 | ), 45 | ); 46 | }, 47 | ), 48 | IconButton( 49 | icon: const Icon(Icons.delete), 50 | onPressed: () async { 51 | await appStore.notes.deleteNote(note.id); 52 | }, 53 | ), 54 | ], 55 | ), 56 | ), 57 | ); 58 | }, 59 | ); 60 | }, 61 | ), 62 | ); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion flutter.compileSdkVersion 30 | ndkVersion flutter.ndkVersion 31 | 32 | compileOptions { 33 | sourceCompatibility JavaVersion.VERSION_1_8 34 | targetCompatibility JavaVersion.VERSION_1_8 35 | } 36 | 37 | kotlinOptions { 38 | jvmTarget = '1.8' 39 | } 40 | 41 | sourceSets { 42 | main.java.srcDirs += 'src/main/kotlin' 43 | } 44 | 45 | defaultConfig { 46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 47 | applicationId "io.potato.app" 48 | // You can update the following values to match your application needs. 49 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. 50 | minSdkVersion flutter.minSdkVersion 51 | targetSdkVersion flutter.targetSdkVersion 52 | versionCode flutterVersionCode.toInteger() 53 | versionName flutterVersionName 54 | } 55 | 56 | buildTypes { 57 | release { 58 | // TODO: Add your own signing config for the release build. 59 | // Signing with the debug keys for now, so `flutter run --release` works. 60 | signingConfig signingConfigs.debug 61 | } 62 | } 63 | } 64 | 65 | flutter { 66 | source '../..' 67 | } 68 | 69 | dependencies { 70 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 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/src/init/init.dart: -------------------------------------------------------------------------------- 1 | import 'package:crispin/crispin.dart'; 2 | import 'package:flutter/foundation.dart'; 3 | import 'package:flutter_dotenv/flutter_dotenv.dart'; 4 | import 'package:flutter_secure_storage/flutter_secure_storage.dart'; 5 | import 'package:logger_crispin_transport/logger_crispin_transport.dart'; 6 | import 'package:potato/src/init/locator.dart'; 7 | import 'package:potato/src/stores/app_store.dart'; 8 | import 'package:potato/src/utils/supabase.dart'; 9 | import 'package:supabase_flutter/supabase_flutter.dart'; 10 | 11 | // user flutter_secure_storage to persist user session 12 | class SecureLocalStorage extends LocalStorage { 13 | SecureLocalStorage() 14 | : super( 15 | initialize: () async {}, 16 | hasAccessToken: () { 17 | const storage = FlutterSecureStorage(); 18 | return storage.containsKey(key: supabasePersistSessionKey); 19 | }, 20 | accessToken: () { 21 | const storage = FlutterSecureStorage(); 22 | return storage.read(key: supabasePersistSessionKey); 23 | }, 24 | removePersistedSession: () { 25 | const storage = FlutterSecureStorage(); 26 | return storage.delete(key: supabasePersistSessionKey); 27 | }, 28 | persistSession: (String value) { 29 | const storage = FlutterSecureStorage(); 30 | return storage.write(key: supabasePersistSessionKey, value: value); 31 | }, 32 | ); 33 | } 34 | 35 | Future init() async { 36 | await dotenv.load(); 37 | 38 | final String? supbaseUrl = dotenv.maybeGet('SUPABASE_URL'); 39 | final String? supabaseAnonKey = dotenv.maybeGet('SUPABASE_ANON_KEY'); 40 | 41 | if (supbaseUrl == null || supabaseAnonKey == null) { 42 | throw Exception('Missing SUPBASE_URL or SUPBASE_ANON_KEY'); 43 | } 44 | 45 | await Supabase.initialize( 46 | url: supbaseUrl, 47 | anonKey: supabaseAnonKey, 48 | debug: kDebugMode, 49 | authCallbackUrlHostname: 'login-callback', 50 | localStorage: SecureLocalStorage(), 51 | ); 52 | 53 | setupLocator(); 54 | 55 | final AppStore appStore = locator(); 56 | 57 | // Setup loggers 58 | Crispin().addTransport(LoggerCrispinTransport( 59 | LoggerCrispinTransportOptions( 60 | level: 'info', 61 | ), 62 | )); 63 | 64 | appStore.auth.listenToAuth(); 65 | 66 | // Hacky way to do for now. 67 | appStore.auth.uid = auth.currentSession?.user?.id; 68 | if (appStore.auth.uid != null) { 69 | await appStore.auth.getUser(appStore.auth.uid!); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /lib/src/stores/auth_store.dart: -------------------------------------------------------------------------------- 1 | import 'package:crispin/crispin.dart'; 2 | import 'package:mobx/mobx.dart'; 3 | import 'package:potato/src/data/auth_api.dart'; 4 | import 'package:potato/src/models/auth/index.dart'; 5 | import 'package:potato/src/utils/supabase.dart'; 6 | import 'package:supabase_flutter/supabase_flutter.dart'; 7 | 8 | part 'auth_store.g.dart'; 9 | 10 | class AuthStore = AuthStoreBase with _$AuthStore; 11 | 12 | abstract class AuthStoreBase with Store { 13 | GotrueSubscription? authSubscription; 14 | 15 | @observable 16 | String? uid; 17 | 18 | @observable 19 | UserProfile? userProfile; 20 | 21 | @observable 22 | String? name; 23 | 24 | @observable 25 | ObservableFuture? userProfileFuture; 26 | 27 | final AuthApi authApi = AuthApi(); 28 | 29 | @action 30 | void listenToAuth() { 31 | authSubscription = auth.onAuthStateChange((AuthChangeEvent event, Session? session) { 32 | if (session?.user?.id != null) { 33 | getUser(session!.user!.id); 34 | } 35 | Crispin().info('Updaing current user in listen to ${auth.currentUser?.id ?? 'No current user'}'); 36 | Crispin().info(event.toString()); 37 | Crispin().info(auth.currentSession?.user?.id ?? 'No session'); 38 | Crispin().info(auth.currentUser?.id ?? 'No current user'); 39 | }); 40 | SupabaseAuth.instance.onAuthChange.listen((AuthChangeEvent event) { 41 | Crispin().info(event.toString()); 42 | Crispin().info('Updaing current user in listen to ${auth.currentUser?.id ?? 'No current user'}'); 43 | uid = auth.currentUser?.id; 44 | if (uid != null) { 45 | getUser(uid!); 46 | } 47 | Crispin().info(auth.currentSession?.user?.id ?? 'No session'); 48 | Crispin().info(auth.currentUser?.id ?? 'No current user'); 49 | }); 50 | } 51 | 52 | @action 53 | Future signUp(String email, String password) async { 54 | await auth.signUp(email, password); 55 | } 56 | 57 | @action 58 | Future loginWithMagicLink(String email) async { 59 | await auth.signIn( 60 | email: email, 61 | options: const AuthOptions( 62 | redirectTo: 'potato://login-callback', 63 | ), 64 | ); 65 | } 66 | 67 | @action 68 | Future getUser(String uid) async { 69 | final Future userProfFuture = authApi.getUser(uid); 70 | userProfileFuture = ObservableFuture(userProfFuture); 71 | userProfile = await userProfileFuture; 72 | //await authApi.getUser(uid); 73 | } 74 | 75 | @action 76 | Future createInitialProfile() async { 77 | userProfile = UserProfile( 78 | name: name, 79 | email: auth.currentSession!.user!.email!, 80 | id: uid!, 81 | ); 82 | await authApi.createProfile(userProfile!); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /lib/src/screens/home.dart: -------------------------------------------------------------------------------- 1 | import 'package:auto_route/auto_route.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_mobx/flutter_mobx.dart'; 4 | import 'package:potato/src/app/router.gr.dart'; 5 | import 'package:potato/src/init/locator.dart'; 6 | import 'package:potato/src/screens/auth/create_profile.dart'; 7 | import 'package:potato/src/stores/app_store.dart'; 8 | 9 | class HomePage extends StatefulWidget { 10 | const HomePage({super.key}); 11 | 12 | @override 13 | State createState() => _HomePageState(); 14 | } 15 | 16 | class _HomePageState extends State { 17 | final AppStore appStore = locator(); 18 | 19 | @override 20 | initState() { 21 | super.initState(); 22 | 23 | if (appStore.auth.userProfile != null) { 24 | context.router.push(const DashboardRoute()); 25 | } 26 | } 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | return Scaffold( 31 | appBar: AppBar( 32 | title: const Text('Home'), 33 | ), 34 | floatingActionButton: FloatingActionButton( 35 | child: const Icon(Icons.add), 36 | onPressed: () async { 37 | await appStore.auth.getUser(appStore.auth.uid!); 38 | }, 39 | ), 40 | body: Padding( 41 | padding: const EdgeInsets.all(16.0), 42 | child: Observer( 43 | builder: (_) { 44 | if (appStore.auth.uid == null) { 45 | return Column( 46 | children: [ 47 | const Center( 48 | child: Text( 49 | 'If you are redirected from login page, please click on the email link to complete the sign up process.'), 50 | ), 51 | ElevatedButton( 52 | onPressed: () { 53 | context.router.push(const LoginRoute()); 54 | }, 55 | child: const Text('Login'), 56 | ), 57 | ], 58 | ); 59 | } else if (appStore.auth.uid != null // 60 | && 61 | appStore.auth.userProfile == null) { 62 | return const CreateProfile(); 63 | } else { 64 | // Temp 65 | WidgetsBinding.instance.addPostFrameCallback((_) { 66 | // Maynot be the best for now, lets' listen to the store and push later 67 | context.router.replaceAll([const DashboardRoute()]); 68 | }); 69 | return const Text('Loading;'); 70 | } 71 | 72 | // return const Center( 73 | //child: Text('Redirect me / Add a button to take me somewhere else'), 74 | //); 75 | }, 76 | ), 77 | ), 78 | ); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /lib/src/stores/notes_store.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'notes_store.dart'; 4 | 5 | // ************************************************************************** 6 | // StoreGenerator 7 | // ************************************************************************** 8 | 9 | // ignore_for_file: non_constant_identifier_names, unnecessary_brace_in_string_interps, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, no_leading_underscores_for_local_identifiers 10 | 11 | mixin _$NotesStore on NotesStoreBase, Store { 12 | late final _$userNotesAtom = 13 | Atom(name: 'NotesStoreBase.userNotes', context: context); 14 | 15 | @override 16 | List get userNotes { 17 | _$userNotesAtom.reportRead(); 18 | return super.userNotes; 19 | } 20 | 21 | @override 22 | set userNotes(List value) { 23 | _$userNotesAtom.reportWrite(value, super.userNotes, () { 24 | super.userNotes = value; 25 | }); 26 | } 27 | 28 | late final _$titleAtom = Atom(name: 'NotesStoreBase.title', context: context); 29 | 30 | @override 31 | String? get title { 32 | _$titleAtom.reportRead(); 33 | return super.title; 34 | } 35 | 36 | @override 37 | set title(String? value) { 38 | _$titleAtom.reportWrite(value, super.title, () { 39 | super.title = value; 40 | }); 41 | } 42 | 43 | late final _$descriptionAtom = 44 | Atom(name: 'NotesStoreBase.description', context: context); 45 | 46 | @override 47 | String? get description { 48 | _$descriptionAtom.reportRead(); 49 | return super.description; 50 | } 51 | 52 | @override 53 | set description(String? value) { 54 | _$descriptionAtom.reportWrite(value, super.description, () { 55 | super.description = value; 56 | }); 57 | } 58 | 59 | late final _$userNotesFutureAtom = 60 | Atom(name: 'NotesStoreBase.userNotesFuture', context: context); 61 | 62 | @override 63 | ObservableFuture> get userNotesFuture { 64 | _$userNotesFutureAtom.reportRead(); 65 | return super.userNotesFuture; 66 | } 67 | 68 | @override 69 | set userNotesFuture(ObservableFuture> value) { 70 | _$userNotesFutureAtom.reportWrite(value, super.userNotesFuture, () { 71 | super.userNotesFuture = value; 72 | }); 73 | } 74 | 75 | late final _$getUserNotesAsyncAction = 76 | AsyncAction('NotesStoreBase.getUserNotes', context: context); 77 | 78 | @override 79 | Future getUserNotes() { 80 | return _$getUserNotesAsyncAction.run(() => super.getUserNotes()); 81 | } 82 | 83 | late final _$createNoteAsyncAction = 84 | AsyncAction('NotesStoreBase.createNote', context: context); 85 | 86 | @override 87 | Future createNote() { 88 | return _$createNoteAsyncAction.run(() => super.createNote()); 89 | } 90 | 91 | late final _$deleteNoteAsyncAction = 92 | AsyncAction('NotesStoreBase.deleteNote', context: context); 93 | 94 | @override 95 | Future deleteNote(String id) { 96 | return _$deleteNoteAsyncAction.run(() => super.deleteNote(id)); 97 | } 98 | 99 | @override 100 | String toString() { 101 | return ''' 102 | userNotes: ${userNotes}, 103 | title: ${title}, 104 | description: ${description}, 105 | userNotesFuture: ${userNotesFuture} 106 | '''; 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /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", "potato" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "potato" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2022 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "potato.exe" "\0" 98 | VALUE "ProductName", "potato" "\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 | -------------------------------------------------------------------------------- /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 and shows a win32 window with |title| and position and size 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 to will treat the width height passed in to this function 35 | // as logical pixels and scale to appropriate for the default monitor. Returns 36 | // true if the window was created successfully. 37 | bool CreateAndShow(const std::wstring& title, 38 | const Point& origin, 39 | const Size& size); 40 | 41 | // Release OS resources associated with window. 42 | void Destroy(); 43 | 44 | // Inserts |content| into the window tree. 45 | void SetChildContent(HWND content); 46 | 47 | // Returns the backing Window handle to enable clients to set icon and other 48 | // window properties. Returns nullptr if the window has been destroyed. 49 | HWND GetHandle(); 50 | 51 | // If true, closing this window will quit the application. 52 | void SetQuitOnClose(bool quit_on_close); 53 | 54 | // Return a RECT representing the bounds of the current client area. 55 | RECT GetClientArea(); 56 | 57 | protected: 58 | // Processes and route salient window messages for mouse handling, 59 | // size change and DPI. Delegates handling of these to member overloads that 60 | // inheriting classes can handle. 61 | virtual LRESULT MessageHandler(HWND window, 62 | UINT const message, 63 | WPARAM const wparam, 64 | LPARAM const lparam) noexcept; 65 | 66 | // Called when CreateAndShow is called, allowing subclass window-related 67 | // setup. Subclasses should return false if setup fails. 68 | virtual bool OnCreate(); 69 | 70 | // Called when Destroy is called. 71 | virtual void OnDestroy(); 72 | 73 | private: 74 | friend class WindowClassRegistrar; 75 | 76 | // OS callback called by message pump. Handles the WM_NCCREATE message which 77 | // is passed when the non-client area is being created and enables automatic 78 | // non-client DPI scaling so that the non-client area automatically 79 | // responsponds to changes in DPI. All other messages are handled by 80 | // MessageHandler. 81 | static LRESULT CALLBACK WndProc(HWND const window, 82 | UINT const message, 83 | WPARAM const wparam, 84 | LPARAM const lparam) noexcept; 85 | 86 | // Retrieves a class instance pointer for |window| 87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 88 | 89 | bool quit_on_close_ = false; 90 | 91 | // window handle for top level window. 92 | HWND window_handle_ = nullptr; 93 | 94 | // window handle for hosted content. 95 | HWND child_content_ = nullptr; 96 | }; 97 | 98 | #endif // RUNNER_WIN32_WINDOW_H_ 99 | -------------------------------------------------------------------------------- /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 | # === Flutter Library === 14 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 15 | 16 | # Published to parent scope for install step. 17 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 18 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 19 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 20 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 21 | 22 | list(APPEND FLUTTER_LIBRARY_HEADERS 23 | "flutter_export.h" 24 | "flutter_windows.h" 25 | "flutter_messenger.h" 26 | "flutter_plugin_registrar.h" 27 | "flutter_texture_registrar.h" 28 | ) 29 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 30 | add_library(flutter INTERFACE) 31 | target_include_directories(flutter INTERFACE 32 | "${EPHEMERAL_DIR}" 33 | ) 34 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 35 | add_dependencies(flutter flutter_assemble) 36 | 37 | # === Wrapper === 38 | list(APPEND CPP_WRAPPER_SOURCES_CORE 39 | "core_implementations.cc" 40 | "standard_codec.cc" 41 | ) 42 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 43 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 44 | "plugin_registrar.cc" 45 | ) 46 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 47 | list(APPEND CPP_WRAPPER_SOURCES_APP 48 | "flutter_engine.cc" 49 | "flutter_view_controller.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 52 | 53 | # Wrapper sources needed for a plugin. 54 | add_library(flutter_wrapper_plugin STATIC 55 | ${CPP_WRAPPER_SOURCES_CORE} 56 | ${CPP_WRAPPER_SOURCES_PLUGIN} 57 | ) 58 | apply_standard_settings(flutter_wrapper_plugin) 59 | set_target_properties(flutter_wrapper_plugin PROPERTIES 60 | POSITION_INDEPENDENT_CODE ON) 61 | set_target_properties(flutter_wrapper_plugin PROPERTIES 62 | CXX_VISIBILITY_PRESET hidden) 63 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 64 | target_include_directories(flutter_wrapper_plugin PUBLIC 65 | "${WRAPPER_ROOT}/include" 66 | ) 67 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 68 | 69 | # Wrapper sources needed for the runner. 70 | add_library(flutter_wrapper_app STATIC 71 | ${CPP_WRAPPER_SOURCES_CORE} 72 | ${CPP_WRAPPER_SOURCES_APP} 73 | ) 74 | apply_standard_settings(flutter_wrapper_app) 75 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 76 | target_include_directories(flutter_wrapper_app PUBLIC 77 | "${WRAPPER_ROOT}/include" 78 | ) 79 | add_dependencies(flutter_wrapper_app flutter_assemble) 80 | 81 | # === Flutter tool backend === 82 | # _phony_ is a non-existent file to force this command to run every time, 83 | # since currently there's no way to get a full input/output list from the 84 | # flutter tool. 85 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 86 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 87 | add_custom_command( 88 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 89 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 90 | ${CPP_WRAPPER_SOURCES_APP} 91 | ${PHONY_OUTPUT} 92 | COMMAND ${CMAKE_COMMAND} -E env 93 | ${FLUTTER_TOOL_ENVIRONMENT} 94 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 95 | windows-x64 $ 96 | VERBATIM 97 | ) 98 | add_custom_target(flutter_assemble DEPENDS 99 | "${FLUTTER_LIBRARY}" 100 | ${FLUTTER_LIBRARY_HEADERS} 101 | ${CPP_WRAPPER_SOURCES_CORE} 102 | ${CPP_WRAPPER_SOURCES_PLUGIN} 103 | ${CPP_WRAPPER_SOURCES_APP} 104 | ) 105 | -------------------------------------------------------------------------------- /linux/my_application.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | #include 4 | #ifdef GDK_WINDOWING_X11 5 | #include 6 | #endif 7 | 8 | #include "flutter/generated_plugin_registrant.h" 9 | 10 | struct _MyApplication { 11 | GtkApplication parent_instance; 12 | char** dart_entrypoint_arguments; 13 | }; 14 | 15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) 16 | 17 | // Implements GApplication::activate. 18 | static void my_application_activate(GApplication* application) { 19 | MyApplication* self = MY_APPLICATION(application); 20 | GtkWindow* window = 21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); 22 | 23 | // Use a header bar when running in GNOME as this is the common style used 24 | // by applications and is the setup most users will be using (e.g. Ubuntu 25 | // desktop). 26 | // If running on X and not using GNOME then just use a traditional title bar 27 | // in case the window manager does more exotic layout, e.g. tiling. 28 | // If running on Wayland assume the header bar will work (may need changing 29 | // if future cases occur). 30 | gboolean use_header_bar = TRUE; 31 | #ifdef GDK_WINDOWING_X11 32 | GdkScreen* screen = gtk_window_get_screen(window); 33 | if (GDK_IS_X11_SCREEN(screen)) { 34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); 35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) { 36 | use_header_bar = FALSE; 37 | } 38 | } 39 | #endif 40 | if (use_header_bar) { 41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); 42 | gtk_widget_show(GTK_WIDGET(header_bar)); 43 | gtk_header_bar_set_title(header_bar, "potato"); 44 | gtk_header_bar_set_show_close_button(header_bar, TRUE); 45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); 46 | } else { 47 | gtk_window_set_title(window, "potato"); 48 | } 49 | 50 | gtk_window_set_default_size(window, 1280, 720); 51 | gtk_widget_show(GTK_WIDGET(window)); 52 | 53 | g_autoptr(FlDartProject) project = fl_dart_project_new(); 54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); 55 | 56 | FlView* view = fl_view_new(project); 57 | gtk_widget_show(GTK_WIDGET(view)); 58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); 59 | 60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view)); 61 | 62 | gtk_widget_grab_focus(GTK_WIDGET(view)); 63 | } 64 | 65 | // Implements GApplication::local_command_line. 66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { 67 | MyApplication* self = MY_APPLICATION(application); 68 | // Strip out the first argument as it is the binary name. 69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); 70 | 71 | g_autoptr(GError) error = nullptr; 72 | if (!g_application_register(application, nullptr, &error)) { 73 | g_warning("Failed to register: %s", error->message); 74 | *exit_status = 1; 75 | return TRUE; 76 | } 77 | 78 | g_application_activate(application); 79 | *exit_status = 0; 80 | 81 | return TRUE; 82 | } 83 | 84 | // Implements GObject::dispose. 85 | static void my_application_dispose(GObject* object) { 86 | MyApplication* self = MY_APPLICATION(object); 87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 89 | } 90 | 91 | static void my_application_class_init(MyApplicationClass* klass) { 92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 95 | } 96 | 97 | static void my_application_init(MyApplication* self) {} 98 | 99 | MyApplication* my_application_new() { 100 | return MY_APPLICATION(g_object_new(my_application_get_type(), 101 | "application-id", APPLICATION_ID, 102 | "flags", G_APPLICATION_NON_UNIQUE, 103 | nullptr)); 104 | } 105 | -------------------------------------------------------------------------------- /lib/src/stores/auth_store.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'auth_store.dart'; 4 | 5 | // ************************************************************************** 6 | // StoreGenerator 7 | // ************************************************************************** 8 | 9 | // ignore_for_file: non_constant_identifier_names, unnecessary_brace_in_string_interps, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic, no_leading_underscores_for_local_identifiers 10 | 11 | mixin _$AuthStore on AuthStoreBase, Store { 12 | late final _$uidAtom = Atom(name: 'AuthStoreBase.uid', context: context); 13 | 14 | @override 15 | String? get uid { 16 | _$uidAtom.reportRead(); 17 | return super.uid; 18 | } 19 | 20 | @override 21 | set uid(String? value) { 22 | _$uidAtom.reportWrite(value, super.uid, () { 23 | super.uid = value; 24 | }); 25 | } 26 | 27 | late final _$userProfileAtom = 28 | Atom(name: 'AuthStoreBase.userProfile', context: context); 29 | 30 | @override 31 | UserProfile? get userProfile { 32 | _$userProfileAtom.reportRead(); 33 | return super.userProfile; 34 | } 35 | 36 | @override 37 | set userProfile(UserProfile? value) { 38 | _$userProfileAtom.reportWrite(value, super.userProfile, () { 39 | super.userProfile = value; 40 | }); 41 | } 42 | 43 | late final _$nameAtom = Atom(name: 'AuthStoreBase.name', context: context); 44 | 45 | @override 46 | String? get name { 47 | _$nameAtom.reportRead(); 48 | return super.name; 49 | } 50 | 51 | @override 52 | set name(String? value) { 53 | _$nameAtom.reportWrite(value, super.name, () { 54 | super.name = value; 55 | }); 56 | } 57 | 58 | late final _$userProfileFutureAtom = 59 | Atom(name: 'AuthStoreBase.userProfileFuture', context: context); 60 | 61 | @override 62 | ObservableFuture? get userProfileFuture { 63 | _$userProfileFutureAtom.reportRead(); 64 | return super.userProfileFuture; 65 | } 66 | 67 | @override 68 | set userProfileFuture(ObservableFuture? value) { 69 | _$userProfileFutureAtom.reportWrite(value, super.userProfileFuture, () { 70 | super.userProfileFuture = value; 71 | }); 72 | } 73 | 74 | late final _$signUpAsyncAction = 75 | AsyncAction('AuthStoreBase.signUp', context: context); 76 | 77 | @override 78 | Future signUp(String email, String password) { 79 | return _$signUpAsyncAction.run(() => super.signUp(email, password)); 80 | } 81 | 82 | late final _$loginWithMagicLinkAsyncAction = 83 | AsyncAction('AuthStoreBase.loginWithMagicLink', context: context); 84 | 85 | @override 86 | Future loginWithMagicLink(String email) { 87 | return _$loginWithMagicLinkAsyncAction 88 | .run(() => super.loginWithMagicLink(email)); 89 | } 90 | 91 | late final _$getUserAsyncAction = 92 | AsyncAction('AuthStoreBase.getUser', context: context); 93 | 94 | @override 95 | Future getUser(String uid) { 96 | return _$getUserAsyncAction.run(() => super.getUser(uid)); 97 | } 98 | 99 | late final _$createInitialProfileAsyncAction = 100 | AsyncAction('AuthStoreBase.createInitialProfile', context: context); 101 | 102 | @override 103 | Future createInitialProfile() { 104 | return _$createInitialProfileAsyncAction 105 | .run(() => super.createInitialProfile()); 106 | } 107 | 108 | late final _$AuthStoreBaseActionController = 109 | ActionController(name: 'AuthStoreBase', context: context); 110 | 111 | @override 112 | void listenToAuth() { 113 | final _$actionInfo = _$AuthStoreBaseActionController.startAction( 114 | name: 'AuthStoreBase.listenToAuth'); 115 | try { 116 | return super.listenToAuth(); 117 | } finally { 118 | _$AuthStoreBaseActionController.endAction(_$actionInfo); 119 | } 120 | } 121 | 122 | @override 123 | String toString() { 124 | return ''' 125 | uid: ${uid}, 126 | userProfile: ${userProfile}, 127 | name: ${name}, 128 | userProfileFuture: ${userProfileFuture} 129 | '''; 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.14) 3 | project(potato 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 "potato") 8 | 9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 10 | # versions of CMake. 11 | cmake_policy(SET CMP0063 NEW) 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 | # Generated plugin build rules, which manage building the plugins and adding 56 | # them to the application. 57 | include(flutter/generated_plugins.cmake) 58 | 59 | 60 | # === Installation === 61 | # Support files are copied into place next to the executable, so that it can 62 | # run in place. This is done instead of making a separate bundle (as on Linux) 63 | # so that building and running from within Visual Studio will work. 64 | set(BUILD_BUNDLE_DIR "$") 65 | # Make the "install" step default, as it's required to run. 66 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 67 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 68 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 69 | endif() 70 | 71 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 72 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 73 | 74 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 75 | COMPONENT Runtime) 76 | 77 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 78 | COMPONENT Runtime) 79 | 80 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 81 | COMPONENT Runtime) 82 | 83 | if(PLUGIN_BUNDLED_LIBRARIES) 84 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 85 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 86 | COMPONENT Runtime) 87 | endif() 88 | 89 | # Fully re-copy the assets directory on each build to avoid having stale files 90 | # from a previous install. 91 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 92 | install(CODE " 93 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 94 | " COMPONENT Runtime) 95 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 96 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 97 | 98 | # Install the AOT library on non-Debug builds only. 99 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 100 | CONFIGURATIONS Profile;Release 101 | COMPONENT Runtime) 102 | -------------------------------------------------------------------------------- /lib/src/app/router.gr.dart: -------------------------------------------------------------------------------- 1 | // ************************************************************************** 2 | // AutoRouteGenerator 3 | // ************************************************************************** 4 | 5 | // GENERATED CODE - DO NOT MODIFY BY HAND 6 | 7 | // ************************************************************************** 8 | // AutoRouteGenerator 9 | // ************************************************************************** 10 | // 11 | // ignore_for_file: type=lint 12 | 13 | // ignore_for_file: no_leading_underscores_for_library_prefixes 14 | import 'package:auto_route/auto_route.dart' as _i7; 15 | import 'package:flutter/material.dart' as _i8; 16 | 17 | import '../screens/auth/login.dart' as _i2; 18 | import '../screens/auth/sign_up.dart' as _i3; 19 | import '../screens/dashboard/dashboard.dart' as _i4; 20 | import '../screens/dashboard/new_note_screen.dart' as _i5; 21 | import '../screens/dashboard/notes/note_detail_page.dart' as _i6; 22 | import '../screens/home.dart' as _i1; 23 | 24 | class AppRouter extends _i7.RootStackRouter { 25 | AppRouter([_i8.GlobalKey<_i8.NavigatorState>? navigatorKey]) 26 | : super(navigatorKey); 27 | 28 | @override 29 | final Map pagesMap = { 30 | HomeRoute.name: (routeData) { 31 | return _i7.MaterialPageX( 32 | routeData: routeData, child: const _i1.HomePage()); 33 | }, 34 | LoginRoute.name: (routeData) { 35 | return _i7.MaterialPageX( 36 | routeData: routeData, child: const _i2.LoginPage()); 37 | }, 38 | SignUpRoute.name: (routeData) { 39 | return _i7.MaterialPageX( 40 | routeData: routeData, child: const _i3.SignUpPage()); 41 | }, 42 | DashboardRoute.name: (routeData) { 43 | return _i7.MaterialPageX( 44 | routeData: routeData, child: const _i4.DashboardPage()); 45 | }, 46 | NewNoteRoute.name: (routeData) { 47 | return _i7.MaterialPageX( 48 | routeData: routeData, child: const _i5.NewNotePage()); 49 | }, 50 | NoteDetailRoute.name: (routeData) { 51 | final pathParams = routeData.inheritedPathParams; 52 | final args = routeData.argsAs( 53 | orElse: () => NoteDetailRouteArgs(id: pathParams.getString('id'))); 54 | return _i7.MaterialPageX( 55 | routeData: routeData, 56 | child: _i6.NoteDetailPage(key: args.key, id: args.id)); 57 | } 58 | }; 59 | 60 | @override 61 | List<_i7.RouteConfig> get routes => [ 62 | _i7.RouteConfig(HomeRoute.name, path: '/'), 63 | _i7.RouteConfig(LoginRoute.name, path: '/login'), 64 | _i7.RouteConfig(SignUpRoute.name, path: '/sign-up'), 65 | _i7.RouteConfig(DashboardRoute.name, path: '/dashboard'), 66 | _i7.RouteConfig(NewNoteRoute.name, path: '/new-note'), 67 | _i7.RouteConfig(NoteDetailRoute.name, path: '/note-detail/:id') 68 | ]; 69 | } 70 | 71 | /// generated route for 72 | /// [_i1.HomePage] 73 | class HomeRoute extends _i7.PageRouteInfo { 74 | const HomeRoute() : super(HomeRoute.name, path: '/'); 75 | 76 | static const String name = 'HomeRoute'; 77 | } 78 | 79 | /// generated route for 80 | /// [_i2.LoginPage] 81 | class LoginRoute extends _i7.PageRouteInfo { 82 | const LoginRoute() : super(LoginRoute.name, path: '/login'); 83 | 84 | static const String name = 'LoginRoute'; 85 | } 86 | 87 | /// generated route for 88 | /// [_i3.SignUpPage] 89 | class SignUpRoute extends _i7.PageRouteInfo { 90 | const SignUpRoute() : super(SignUpRoute.name, path: '/sign-up'); 91 | 92 | static const String name = 'SignUpRoute'; 93 | } 94 | 95 | /// generated route for 96 | /// [_i4.DashboardPage] 97 | class DashboardRoute extends _i7.PageRouteInfo { 98 | const DashboardRoute() : super(DashboardRoute.name, path: '/dashboard'); 99 | 100 | static const String name = 'DashboardRoute'; 101 | } 102 | 103 | /// generated route for 104 | /// [_i5.NewNotePage] 105 | class NewNoteRoute extends _i7.PageRouteInfo { 106 | const NewNoteRoute() : super(NewNoteRoute.name, path: '/new-note'); 107 | 108 | static const String name = 'NewNoteRoute'; 109 | } 110 | 111 | /// generated route for 112 | /// [_i6.NoteDetailPage] 113 | class NoteDetailRoute extends _i7.PageRouteInfo { 114 | NoteDetailRoute({_i8.Key? key, required String id}) 115 | : super(NoteDetailRoute.name, 116 | path: '/note-detail/:id', 117 | args: NoteDetailRouteArgs(key: key, id: id), 118 | rawPathParams: {'id': id}); 119 | 120 | static const String name = 'NoteDetailRoute'; 121 | } 122 | 123 | class NoteDetailRouteArgs { 124 | const NoteDetailRouteArgs({this.key, required this.id}); 125 | 126 | final _i8.Key? key; 127 | 128 | final String id; 129 | 130 | @override 131 | String toString() { 132 | return 'NoteDetailRouteArgs{key: $key, id: $id}'; 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.10) 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 "potato") 8 | # The unique GTK application identifier for this application. See: 9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID 10 | set(APPLICATION_ID "io.potato.app") 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 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 58 | 59 | # Define the application target. To change its name, change BINARY_NAME above, 60 | # not the value here, or `flutter run` will no longer work. 61 | # 62 | # Any new source files that you add to the application should be added here. 63 | add_executable(${BINARY_NAME} 64 | "main.cc" 65 | "my_application.cc" 66 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 67 | ) 68 | 69 | # Apply the standard set of build settings. This can be removed for applications 70 | # that need different build settings. 71 | apply_standard_settings(${BINARY_NAME}) 72 | 73 | # Add dependency libraries. Add any application-specific dependencies here. 74 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 75 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 76 | 77 | # Run the Flutter tool portions of the build. This must not be removed. 78 | add_dependencies(${BINARY_NAME} flutter_assemble) 79 | 80 | # Only the install-generated bundle's copy of the executable will launch 81 | # correctly, since the resources must in the right relative locations. To avoid 82 | # people trying to run the unbundled copy, put it in a subdirectory instead of 83 | # the default top-level location. 84 | set_target_properties(${BINARY_NAME} 85 | PROPERTIES 86 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 87 | ) 88 | 89 | # Generated plugin build rules, which manage building the plugins and adding 90 | # them to the application. 91 | include(flutter/generated_plugins.cmake) 92 | 93 | 94 | # === Installation === 95 | # By default, "installing" just makes a relocatable bundle in the build 96 | # directory. 97 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 98 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 99 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 100 | endif() 101 | 102 | # Start with a clean build bundle directory every time. 103 | install(CODE " 104 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 105 | " COMPONENT Runtime) 106 | 107 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 108 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 109 | 110 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 111 | COMPONENT Runtime) 112 | 113 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 114 | COMPONENT Runtime) 115 | 116 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 117 | COMPONENT Runtime) 118 | 119 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) 120 | install(FILES "${bundled_library}" 121 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 122 | COMPONENT Runtime) 123 | endforeach(bundled_library) 124 | 125 | # Fully re-copy the assets directory on each build to avoid having stale files 126 | # from a previous install. 127 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 128 | install(CODE " 129 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 130 | " COMPONENT Runtime) 131 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 132 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 133 | 134 | # Install the AOT library on non-Debug builds only. 135 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 136 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 137 | COMPONENT Runtime) 138 | endif() 139 | -------------------------------------------------------------------------------- /lib/src/models/auth/index.freezed.dart: -------------------------------------------------------------------------------- 1 | // coverage:ignore-file 2 | // GENERATED CODE - DO NOT MODIFY BY HAND 3 | // ignore_for_file: type=lint 4 | // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target 5 | 6 | part of auth_models; 7 | 8 | // ************************************************************************** 9 | // FreezedGenerator 10 | // ************************************************************************** 11 | 12 | T _$identity(T value) => value; 13 | 14 | final _privateConstructorUsedError = UnsupportedError( 15 | 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); 16 | 17 | UserProfile _$UserProfileFromJson(Map json) { 18 | return _UserProfile.fromJson(json); 19 | } 20 | 21 | /// @nodoc 22 | mixin _$UserProfile { 23 | String get id => throw _privateConstructorUsedError; 24 | String get email => throw _privateConstructorUsedError; 25 | String? get name => throw _privateConstructorUsedError; 26 | 27 | Map toJson() => throw _privateConstructorUsedError; 28 | @JsonKey(ignore: true) 29 | $UserProfileCopyWith get copyWith => 30 | throw _privateConstructorUsedError; 31 | } 32 | 33 | /// @nodoc 34 | abstract class $UserProfileCopyWith<$Res> { 35 | factory $UserProfileCopyWith( 36 | UserProfile value, $Res Function(UserProfile) then) = 37 | _$UserProfileCopyWithImpl<$Res>; 38 | $Res call({String id, String email, String? name}); 39 | } 40 | 41 | /// @nodoc 42 | class _$UserProfileCopyWithImpl<$Res> implements $UserProfileCopyWith<$Res> { 43 | _$UserProfileCopyWithImpl(this._value, this._then); 44 | 45 | final UserProfile _value; 46 | // ignore: unused_field 47 | final $Res Function(UserProfile) _then; 48 | 49 | @override 50 | $Res call({ 51 | Object? id = freezed, 52 | Object? email = freezed, 53 | Object? name = freezed, 54 | }) { 55 | return _then(_value.copyWith( 56 | id: id == freezed 57 | ? _value.id 58 | : id // ignore: cast_nullable_to_non_nullable 59 | as String, 60 | email: email == freezed 61 | ? _value.email 62 | : email // ignore: cast_nullable_to_non_nullable 63 | as String, 64 | name: name == freezed 65 | ? _value.name 66 | : name // ignore: cast_nullable_to_non_nullable 67 | as String?, 68 | )); 69 | } 70 | } 71 | 72 | /// @nodoc 73 | abstract class _$$_UserProfileCopyWith<$Res> 74 | implements $UserProfileCopyWith<$Res> { 75 | factory _$$_UserProfileCopyWith( 76 | _$_UserProfile value, $Res Function(_$_UserProfile) then) = 77 | __$$_UserProfileCopyWithImpl<$Res>; 78 | @override 79 | $Res call({String id, String email, String? name}); 80 | } 81 | 82 | /// @nodoc 83 | class __$$_UserProfileCopyWithImpl<$Res> extends _$UserProfileCopyWithImpl<$Res> 84 | implements _$$_UserProfileCopyWith<$Res> { 85 | __$$_UserProfileCopyWithImpl( 86 | _$_UserProfile _value, $Res Function(_$_UserProfile) _then) 87 | : super(_value, (v) => _then(v as _$_UserProfile)); 88 | 89 | @override 90 | _$_UserProfile get _value => super._value as _$_UserProfile; 91 | 92 | @override 93 | $Res call({ 94 | Object? id = freezed, 95 | Object? email = freezed, 96 | Object? name = freezed, 97 | }) { 98 | return _then(_$_UserProfile( 99 | id: id == freezed 100 | ? _value.id 101 | : id // ignore: cast_nullable_to_non_nullable 102 | as String, 103 | email: email == freezed 104 | ? _value.email 105 | : email // ignore: cast_nullable_to_non_nullable 106 | as String, 107 | name: name == freezed 108 | ? _value.name 109 | : name // ignore: cast_nullable_to_non_nullable 110 | as String?, 111 | )); 112 | } 113 | } 114 | 115 | /// @nodoc 116 | @JsonSerializable() 117 | class _$_UserProfile implements _UserProfile { 118 | const _$_UserProfile({required this.id, required this.email, this.name}); 119 | 120 | factory _$_UserProfile.fromJson(Map json) => 121 | _$$_UserProfileFromJson(json); 122 | 123 | @override 124 | final String id; 125 | @override 126 | final String email; 127 | @override 128 | final String? name; 129 | 130 | @override 131 | String toString() { 132 | return 'UserProfile(id: $id, email: $email, name: $name)'; 133 | } 134 | 135 | @override 136 | bool operator ==(dynamic other) { 137 | return identical(this, other) || 138 | (other.runtimeType == runtimeType && 139 | other is _$_UserProfile && 140 | const DeepCollectionEquality().equals(other.id, id) && 141 | const DeepCollectionEquality().equals(other.email, email) && 142 | const DeepCollectionEquality().equals(other.name, name)); 143 | } 144 | 145 | @JsonKey(ignore: true) 146 | @override 147 | int get hashCode => Object.hash( 148 | runtimeType, 149 | const DeepCollectionEquality().hash(id), 150 | const DeepCollectionEquality().hash(email), 151 | const DeepCollectionEquality().hash(name)); 152 | 153 | @JsonKey(ignore: true) 154 | @override 155 | _$$_UserProfileCopyWith<_$_UserProfile> get copyWith => 156 | __$$_UserProfileCopyWithImpl<_$_UserProfile>(this, _$identity); 157 | 158 | @override 159 | Map toJson() { 160 | return _$$_UserProfileToJson( 161 | this, 162 | ); 163 | } 164 | } 165 | 166 | abstract class _UserProfile implements UserProfile { 167 | const factory _UserProfile( 168 | {required final String id, 169 | required final String email, 170 | final String? name}) = _$_UserProfile; 171 | 172 | factory _UserProfile.fromJson(Map json) = 173 | _$_UserProfile.fromJson; 174 | 175 | @override 176 | String get id; 177 | @override 178 | String get email; 179 | @override 180 | String? get name; 181 | @override 182 | @JsonKey(ignore: true) 183 | _$$_UserProfileCopyWith<_$_UserProfile> get copyWith => 184 | throw _privateConstructorUsedError; 185 | } 186 | -------------------------------------------------------------------------------- /lib/src/models/clipboard/index.freezed.dart: -------------------------------------------------------------------------------- 1 | // coverage:ignore-file 2 | // GENERATED CODE - DO NOT MODIFY BY HAND 3 | // ignore_for_file: type=lint 4 | // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target 5 | 6 | part of clipboard_models; 7 | 8 | // ************************************************************************** 9 | // FreezedGenerator 10 | // ************************************************************************** 11 | 12 | T _$identity(T value) => value; 13 | 14 | final _privateConstructorUsedError = UnsupportedError( 15 | 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); 16 | 17 | PClipboard _$PClipboardFromJson(Map json) { 18 | return _PClipboard.fromJson(json); 19 | } 20 | 21 | /// @nodoc 22 | mixin _$PClipboard { 23 | String get id => throw _privateConstructorUsedError; 24 | String get text => throw _privateConstructorUsedError; 25 | String get mimeType => throw _privateConstructorUsedError; 26 | 27 | Map toJson() => throw _privateConstructorUsedError; 28 | @JsonKey(ignore: true) 29 | $PClipboardCopyWith get copyWith => 30 | throw _privateConstructorUsedError; 31 | } 32 | 33 | /// @nodoc 34 | abstract class $PClipboardCopyWith<$Res> { 35 | factory $PClipboardCopyWith( 36 | PClipboard value, $Res Function(PClipboard) then) = 37 | _$PClipboardCopyWithImpl<$Res>; 38 | $Res call({String id, String text, String mimeType}); 39 | } 40 | 41 | /// @nodoc 42 | class _$PClipboardCopyWithImpl<$Res> implements $PClipboardCopyWith<$Res> { 43 | _$PClipboardCopyWithImpl(this._value, this._then); 44 | 45 | final PClipboard _value; 46 | // ignore: unused_field 47 | final $Res Function(PClipboard) _then; 48 | 49 | @override 50 | $Res call({ 51 | Object? id = freezed, 52 | Object? text = freezed, 53 | Object? mimeType = freezed, 54 | }) { 55 | return _then(_value.copyWith( 56 | id: id == freezed 57 | ? _value.id 58 | : id // ignore: cast_nullable_to_non_nullable 59 | as String, 60 | text: text == freezed 61 | ? _value.text 62 | : text // ignore: cast_nullable_to_non_nullable 63 | as String, 64 | mimeType: mimeType == freezed 65 | ? _value.mimeType 66 | : mimeType // ignore: cast_nullable_to_non_nullable 67 | as String, 68 | )); 69 | } 70 | } 71 | 72 | /// @nodoc 73 | abstract class _$$_PClipboardCopyWith<$Res> 74 | implements $PClipboardCopyWith<$Res> { 75 | factory _$$_PClipboardCopyWith( 76 | _$_PClipboard value, $Res Function(_$_PClipboard) then) = 77 | __$$_PClipboardCopyWithImpl<$Res>; 78 | @override 79 | $Res call({String id, String text, String mimeType}); 80 | } 81 | 82 | /// @nodoc 83 | class __$$_PClipboardCopyWithImpl<$Res> extends _$PClipboardCopyWithImpl<$Res> 84 | implements _$$_PClipboardCopyWith<$Res> { 85 | __$$_PClipboardCopyWithImpl( 86 | _$_PClipboard _value, $Res Function(_$_PClipboard) _then) 87 | : super(_value, (v) => _then(v as _$_PClipboard)); 88 | 89 | @override 90 | _$_PClipboard get _value => super._value as _$_PClipboard; 91 | 92 | @override 93 | $Res call({ 94 | Object? id = freezed, 95 | Object? text = freezed, 96 | Object? mimeType = freezed, 97 | }) { 98 | return _then(_$_PClipboard( 99 | id: id == freezed 100 | ? _value.id 101 | : id // ignore: cast_nullable_to_non_nullable 102 | as String, 103 | text: text == freezed 104 | ? _value.text 105 | : text // ignore: cast_nullable_to_non_nullable 106 | as String, 107 | mimeType: mimeType == freezed 108 | ? _value.mimeType 109 | : mimeType // ignore: cast_nullable_to_non_nullable 110 | as String, 111 | )); 112 | } 113 | } 114 | 115 | /// @nodoc 116 | @JsonSerializable() 117 | class _$_PClipboard implements _PClipboard { 118 | const _$_PClipboard( 119 | {required this.id, required this.text, this.mimeType = 'text/plain'}); 120 | 121 | factory _$_PClipboard.fromJson(Map json) => 122 | _$$_PClipboardFromJson(json); 123 | 124 | @override 125 | final String id; 126 | @override 127 | final String text; 128 | @override 129 | @JsonKey() 130 | final String mimeType; 131 | 132 | @override 133 | String toString() { 134 | return 'PClipboard(id: $id, text: $text, mimeType: $mimeType)'; 135 | } 136 | 137 | @override 138 | bool operator ==(dynamic other) { 139 | return identical(this, other) || 140 | (other.runtimeType == runtimeType && 141 | other is _$_PClipboard && 142 | const DeepCollectionEquality().equals(other.id, id) && 143 | const DeepCollectionEquality().equals(other.text, text) && 144 | const DeepCollectionEquality().equals(other.mimeType, mimeType)); 145 | } 146 | 147 | @JsonKey(ignore: true) 148 | @override 149 | int get hashCode => Object.hash( 150 | runtimeType, 151 | const DeepCollectionEquality().hash(id), 152 | const DeepCollectionEquality().hash(text), 153 | const DeepCollectionEquality().hash(mimeType)); 154 | 155 | @JsonKey(ignore: true) 156 | @override 157 | _$$_PClipboardCopyWith<_$_PClipboard> get copyWith => 158 | __$$_PClipboardCopyWithImpl<_$_PClipboard>(this, _$identity); 159 | 160 | @override 161 | Map toJson() { 162 | return _$$_PClipboardToJson( 163 | this, 164 | ); 165 | } 166 | } 167 | 168 | abstract class _PClipboard implements PClipboard { 169 | const factory _PClipboard( 170 | {required final String id, 171 | required final String text, 172 | final String mimeType}) = _$_PClipboard; 173 | 174 | factory _PClipboard.fromJson(Map json) = 175 | _$_PClipboard.fromJson; 176 | 177 | @override 178 | String get id; 179 | @override 180 | String get text; 181 | @override 182 | String get mimeType; 183 | @override 184 | @JsonKey(ignore: true) 185 | _$$_PClipboardCopyWith<_$_PClipboard> get copyWith => 186 | throw _privateConstructorUsedError; 187 | } 188 | -------------------------------------------------------------------------------- /windows/runner/win32_window.cpp: -------------------------------------------------------------------------------- 1 | #include "win32_window.h" 2 | 3 | #include 4 | 5 | #include "resource.h" 6 | 7 | namespace { 8 | 9 | constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; 10 | 11 | // The number of Win32Window objects that currently exist. 12 | static int g_active_window_count = 0; 13 | 14 | using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); 15 | 16 | // Scale helper to convert logical scaler values to physical using passed in 17 | // scale factor 18 | int Scale(int source, double scale_factor) { 19 | return static_cast(source * scale_factor); 20 | } 21 | 22 | // Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. 23 | // This API is only needed for PerMonitor V1 awareness mode. 24 | void EnableFullDpiSupportIfAvailable(HWND hwnd) { 25 | HMODULE user32_module = LoadLibraryA("User32.dll"); 26 | if (!user32_module) { 27 | return; 28 | } 29 | auto enable_non_client_dpi_scaling = 30 | reinterpret_cast( 31 | GetProcAddress(user32_module, "EnableNonClientDpiScaling")); 32 | if (enable_non_client_dpi_scaling != nullptr) { 33 | enable_non_client_dpi_scaling(hwnd); 34 | FreeLibrary(user32_module); 35 | } 36 | } 37 | 38 | } // namespace 39 | 40 | // Manages the Win32Window's window class registration. 41 | class WindowClassRegistrar { 42 | public: 43 | ~WindowClassRegistrar() = default; 44 | 45 | // Returns the singleton registar instance. 46 | static WindowClassRegistrar* GetInstance() { 47 | if (!instance_) { 48 | instance_ = new WindowClassRegistrar(); 49 | } 50 | return instance_; 51 | } 52 | 53 | // Returns the name of the window class, registering the class if it hasn't 54 | // previously been registered. 55 | const wchar_t* GetWindowClass(); 56 | 57 | // Unregisters the window class. Should only be called if there are no 58 | // instances of the window. 59 | void UnregisterWindowClass(); 60 | 61 | private: 62 | WindowClassRegistrar() = default; 63 | 64 | static WindowClassRegistrar* instance_; 65 | 66 | bool class_registered_ = false; 67 | }; 68 | 69 | WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; 70 | 71 | const wchar_t* WindowClassRegistrar::GetWindowClass() { 72 | if (!class_registered_) { 73 | WNDCLASS window_class{}; 74 | window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); 75 | window_class.lpszClassName = kWindowClassName; 76 | window_class.style = CS_HREDRAW | CS_VREDRAW; 77 | window_class.cbClsExtra = 0; 78 | window_class.cbWndExtra = 0; 79 | window_class.hInstance = GetModuleHandle(nullptr); 80 | window_class.hIcon = 81 | LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); 82 | window_class.hbrBackground = 0; 83 | window_class.lpszMenuName = nullptr; 84 | window_class.lpfnWndProc = Win32Window::WndProc; 85 | RegisterClass(&window_class); 86 | class_registered_ = true; 87 | } 88 | return kWindowClassName; 89 | } 90 | 91 | void WindowClassRegistrar::UnregisterWindowClass() { 92 | UnregisterClass(kWindowClassName, nullptr); 93 | class_registered_ = false; 94 | } 95 | 96 | Win32Window::Win32Window() { 97 | ++g_active_window_count; 98 | } 99 | 100 | Win32Window::~Win32Window() { 101 | --g_active_window_count; 102 | Destroy(); 103 | } 104 | 105 | bool Win32Window::CreateAndShow(const std::wstring& title, 106 | const Point& origin, 107 | const Size& size) { 108 | Destroy(); 109 | 110 | const wchar_t* window_class = 111 | WindowClassRegistrar::GetInstance()->GetWindowClass(); 112 | 113 | const POINT target_point = {static_cast(origin.x), 114 | static_cast(origin.y)}; 115 | HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); 116 | UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); 117 | double scale_factor = dpi / 96.0; 118 | 119 | HWND window = CreateWindow( 120 | window_class, title.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE, 121 | Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), 122 | Scale(size.width, scale_factor), Scale(size.height, scale_factor), 123 | nullptr, nullptr, GetModuleHandle(nullptr), this); 124 | 125 | if (!window) { 126 | return false; 127 | } 128 | 129 | return OnCreate(); 130 | } 131 | 132 | // static 133 | LRESULT CALLBACK Win32Window::WndProc(HWND const window, 134 | UINT const message, 135 | WPARAM const wparam, 136 | LPARAM const lparam) noexcept { 137 | if (message == WM_NCCREATE) { 138 | auto window_struct = reinterpret_cast(lparam); 139 | SetWindowLongPtr(window, GWLP_USERDATA, 140 | reinterpret_cast(window_struct->lpCreateParams)); 141 | 142 | auto that = static_cast(window_struct->lpCreateParams); 143 | EnableFullDpiSupportIfAvailable(window); 144 | that->window_handle_ = window; 145 | } else if (Win32Window* that = GetThisFromHandle(window)) { 146 | return that->MessageHandler(window, message, wparam, lparam); 147 | } 148 | 149 | return DefWindowProc(window, message, wparam, lparam); 150 | } 151 | 152 | LRESULT 153 | Win32Window::MessageHandler(HWND hwnd, 154 | UINT const message, 155 | WPARAM const wparam, 156 | LPARAM const lparam) noexcept { 157 | switch (message) { 158 | case WM_DESTROY: 159 | window_handle_ = nullptr; 160 | Destroy(); 161 | if (quit_on_close_) { 162 | PostQuitMessage(0); 163 | } 164 | return 0; 165 | 166 | case WM_DPICHANGED: { 167 | auto newRectSize = reinterpret_cast(lparam); 168 | LONG newWidth = newRectSize->right - newRectSize->left; 169 | LONG newHeight = newRectSize->bottom - newRectSize->top; 170 | 171 | SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, 172 | newHeight, SWP_NOZORDER | SWP_NOACTIVATE); 173 | 174 | return 0; 175 | } 176 | case WM_SIZE: { 177 | RECT rect = GetClientArea(); 178 | if (child_content_ != nullptr) { 179 | // Size and position the child window. 180 | MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, 181 | rect.bottom - rect.top, TRUE); 182 | } 183 | return 0; 184 | } 185 | 186 | case WM_ACTIVATE: 187 | if (child_content_ != nullptr) { 188 | SetFocus(child_content_); 189 | } 190 | return 0; 191 | } 192 | 193 | return DefWindowProc(window_handle_, message, wparam, lparam); 194 | } 195 | 196 | void Win32Window::Destroy() { 197 | OnDestroy(); 198 | 199 | if (window_handle_) { 200 | DestroyWindow(window_handle_); 201 | window_handle_ = nullptr; 202 | } 203 | if (g_active_window_count == 0) { 204 | WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); 205 | } 206 | } 207 | 208 | Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { 209 | return reinterpret_cast( 210 | GetWindowLongPtr(window, GWLP_USERDATA)); 211 | } 212 | 213 | void Win32Window::SetChildContent(HWND content) { 214 | child_content_ = content; 215 | SetParent(content, window_handle_); 216 | RECT frame = GetClientArea(); 217 | 218 | MoveWindow(content, frame.left, frame.top, frame.right - frame.left, 219 | frame.bottom - frame.top, true); 220 | 221 | SetFocus(child_content_); 222 | } 223 | 224 | RECT Win32Window::GetClientArea() { 225 | RECT frame; 226 | GetClientRect(window_handle_, &frame); 227 | return frame; 228 | } 229 | 230 | HWND Win32Window::GetHandle() { 231 | return window_handle_; 232 | } 233 | 234 | void Win32Window::SetQuitOnClose(bool quit_on_close) { 235 | quit_on_close_ = quit_on_close; 236 | } 237 | 238 | bool Win32Window::OnCreate() { 239 | // No-op; provided for subclasses. 240 | return true; 241 | } 242 | 243 | void Win32Window::OnDestroy() { 244 | // No-op; provided for subclasses. 245 | } 246 | -------------------------------------------------------------------------------- /lib/src/models/notes/index.freezed.dart: -------------------------------------------------------------------------------- 1 | // coverage:ignore-file 2 | // GENERATED CODE - DO NOT MODIFY BY HAND 3 | // ignore_for_file: type=lint 4 | // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target 5 | 6 | part of notes_models; 7 | 8 | // ************************************************************************** 9 | // FreezedGenerator 10 | // ************************************************************************** 11 | 12 | T _$identity(T value) => value; 13 | 14 | final _privateConstructorUsedError = UnsupportedError( 15 | 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods'); 16 | 17 | Note _$NoteFromJson(Map json) { 18 | return _Note.fromJson(json); 19 | } 20 | 21 | /// @nodoc 22 | mixin _$Note { 23 | String get id => throw _privateConstructorUsedError; 24 | String? get fid => throw _privateConstructorUsedError; 25 | String get uid => throw _privateConstructorUsedError; 26 | String? get title => throw _privateConstructorUsedError; 27 | String? get description => throw _privateConstructorUsedError; 28 | @JsonKey(name: 'created_at') 29 | DateTime get createdAt => throw _privateConstructorUsedError; 30 | 31 | Map toJson() => throw _privateConstructorUsedError; 32 | @JsonKey(ignore: true) 33 | $NoteCopyWith get copyWith => throw _privateConstructorUsedError; 34 | } 35 | 36 | /// @nodoc 37 | abstract class $NoteCopyWith<$Res> { 38 | factory $NoteCopyWith(Note value, $Res Function(Note) then) = 39 | _$NoteCopyWithImpl<$Res>; 40 | $Res call( 41 | {String id, 42 | String? fid, 43 | String uid, 44 | String? title, 45 | String? description, 46 | @JsonKey(name: 'created_at') DateTime createdAt}); 47 | } 48 | 49 | /// @nodoc 50 | class _$NoteCopyWithImpl<$Res> implements $NoteCopyWith<$Res> { 51 | _$NoteCopyWithImpl(this._value, this._then); 52 | 53 | final Note _value; 54 | // ignore: unused_field 55 | final $Res Function(Note) _then; 56 | 57 | @override 58 | $Res call({ 59 | Object? id = freezed, 60 | Object? fid = freezed, 61 | Object? uid = freezed, 62 | Object? title = freezed, 63 | Object? description = freezed, 64 | Object? createdAt = freezed, 65 | }) { 66 | return _then(_value.copyWith( 67 | id: id == freezed 68 | ? _value.id 69 | : id // ignore: cast_nullable_to_non_nullable 70 | as String, 71 | fid: fid == freezed 72 | ? _value.fid 73 | : fid // ignore: cast_nullable_to_non_nullable 74 | as String?, 75 | uid: uid == freezed 76 | ? _value.uid 77 | : uid // ignore: cast_nullable_to_non_nullable 78 | as String, 79 | title: title == freezed 80 | ? _value.title 81 | : title // ignore: cast_nullable_to_non_nullable 82 | as String?, 83 | description: description == freezed 84 | ? _value.description 85 | : description // ignore: cast_nullable_to_non_nullable 86 | as String?, 87 | createdAt: createdAt == freezed 88 | ? _value.createdAt 89 | : createdAt // ignore: cast_nullable_to_non_nullable 90 | as DateTime, 91 | )); 92 | } 93 | } 94 | 95 | /// @nodoc 96 | abstract class _$$_NoteCopyWith<$Res> implements $NoteCopyWith<$Res> { 97 | factory _$$_NoteCopyWith(_$_Note value, $Res Function(_$_Note) then) = 98 | __$$_NoteCopyWithImpl<$Res>; 99 | @override 100 | $Res call( 101 | {String id, 102 | String? fid, 103 | String uid, 104 | String? title, 105 | String? description, 106 | @JsonKey(name: 'created_at') DateTime createdAt}); 107 | } 108 | 109 | /// @nodoc 110 | class __$$_NoteCopyWithImpl<$Res> extends _$NoteCopyWithImpl<$Res> 111 | implements _$$_NoteCopyWith<$Res> { 112 | __$$_NoteCopyWithImpl(_$_Note _value, $Res Function(_$_Note) _then) 113 | : super(_value, (v) => _then(v as _$_Note)); 114 | 115 | @override 116 | _$_Note get _value => super._value as _$_Note; 117 | 118 | @override 119 | $Res call({ 120 | Object? id = freezed, 121 | Object? fid = freezed, 122 | Object? uid = freezed, 123 | Object? title = freezed, 124 | Object? description = freezed, 125 | Object? createdAt = freezed, 126 | }) { 127 | return _then(_$_Note( 128 | id: id == freezed 129 | ? _value.id 130 | : id // ignore: cast_nullable_to_non_nullable 131 | as String, 132 | fid: fid == freezed 133 | ? _value.fid 134 | : fid // ignore: cast_nullable_to_non_nullable 135 | as String?, 136 | uid: uid == freezed 137 | ? _value.uid 138 | : uid // ignore: cast_nullable_to_non_nullable 139 | as String, 140 | title: title == freezed 141 | ? _value.title 142 | : title // ignore: cast_nullable_to_non_nullable 143 | as String?, 144 | description: description == freezed 145 | ? _value.description 146 | : description // ignore: cast_nullable_to_non_nullable 147 | as String?, 148 | createdAt: createdAt == freezed 149 | ? _value.createdAt 150 | : createdAt // ignore: cast_nullable_to_non_nullable 151 | as DateTime, 152 | )); 153 | } 154 | } 155 | 156 | /// @nodoc 157 | @JsonSerializable() 158 | class _$_Note implements _Note { 159 | const _$_Note( 160 | {required this.id, 161 | required this.fid, 162 | required this.uid, 163 | required this.title, 164 | required this.description, 165 | @JsonKey(name: 'created_at') required this.createdAt}); 166 | 167 | factory _$_Note.fromJson(Map json) => _$$_NoteFromJson(json); 168 | 169 | @override 170 | final String id; 171 | @override 172 | final String? fid; 173 | @override 174 | final String uid; 175 | @override 176 | final String? title; 177 | @override 178 | final String? description; 179 | @override 180 | @JsonKey(name: 'created_at') 181 | final DateTime createdAt; 182 | 183 | @override 184 | String toString() { 185 | return 'Note(id: $id, fid: $fid, uid: $uid, title: $title, description: $description, createdAt: $createdAt)'; 186 | } 187 | 188 | @override 189 | bool operator ==(dynamic other) { 190 | return identical(this, other) || 191 | (other.runtimeType == runtimeType && 192 | other is _$_Note && 193 | const DeepCollectionEquality().equals(other.id, id) && 194 | const DeepCollectionEquality().equals(other.fid, fid) && 195 | const DeepCollectionEquality().equals(other.uid, uid) && 196 | const DeepCollectionEquality().equals(other.title, title) && 197 | const DeepCollectionEquality() 198 | .equals(other.description, description) && 199 | const DeepCollectionEquality().equals(other.createdAt, createdAt)); 200 | } 201 | 202 | @JsonKey(ignore: true) 203 | @override 204 | int get hashCode => Object.hash( 205 | runtimeType, 206 | const DeepCollectionEquality().hash(id), 207 | const DeepCollectionEquality().hash(fid), 208 | const DeepCollectionEquality().hash(uid), 209 | const DeepCollectionEquality().hash(title), 210 | const DeepCollectionEquality().hash(description), 211 | const DeepCollectionEquality().hash(createdAt)); 212 | 213 | @JsonKey(ignore: true) 214 | @override 215 | _$$_NoteCopyWith<_$_Note> get copyWith => 216 | __$$_NoteCopyWithImpl<_$_Note>(this, _$identity); 217 | 218 | @override 219 | Map toJson() { 220 | return _$$_NoteToJson( 221 | this, 222 | ); 223 | } 224 | } 225 | 226 | abstract class _Note implements Note { 227 | const factory _Note( 228 | {required final String id, 229 | required final String? fid, 230 | required final String uid, 231 | required final String? title, 232 | required final String? description, 233 | @JsonKey(name: 'created_at') required final DateTime createdAt}) = 234 | _$_Note; 235 | 236 | factory _Note.fromJson(Map json) = _$_Note.fromJson; 237 | 238 | @override 239 | String get id; 240 | @override 241 | String? get fid; 242 | @override 243 | String get uid; 244 | @override 245 | String? get title; 246 | @override 247 | String? get description; 248 | @override 249 | @JsonKey(name: 'created_at') 250 | DateTime get createdAt; 251 | @override 252 | @JsonKey(ignore: true) 253 | _$$_NoteCopyWith<_$_Note> get copyWith => throw _privateConstructorUsedError; 254 | } 255 | --------------------------------------------------------------------------------