├── linux ├── .gitignore ├── main.cc ├── flutter │ ├── generated_plugin_registrant.h │ ├── generated_plugin_registrant.cc │ ├── generated_plugins.cmake │ └── CMakeLists.txt ├── my_application.h └── my_application.cc ├── ios ├── Flutter │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── AppFrameworkInfo.plist ├── Runner │ ├── Runner-Bridging-Header.h │ ├── Assets.xcassets │ │ ├── LaunchImage.imageset │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ ├── README.md │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-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 ├── 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 ├── lib ├── core │ ├── core.dart │ ├── failure.dart │ ├── type_defs.dart │ ├── enums │ │ ├── post_type.dart │ │ └── notification_type_enum.dart │ ├── ustils.dart │ └── providers.dart ├── theme │ ├── theme.dart │ ├── apptheme.dart │ └── pallet.dart ├── common │ ├── common.dart │ ├── loading_page.dart │ ├── error_page.dart │ └── rounded_small_button.dart ├── constants │ ├── constants.dart │ ├── appwrite_dependency.dart │ ├── assets_constant.dart │ └── ui_constants.dart ├── features │ ├── user_profile │ │ ├── widgets │ │ │ └── follow_count.dart │ │ ├── views │ │ │ └── user_profile_view.dart │ │ └── controller │ │ │ └── user_profile_controller.dart │ ├── explore │ │ ├── controller │ │ │ └── explore_controller.dart │ │ ├── widgets │ │ │ └── search_tile.dart │ │ └── views │ │ │ └── explore_view.dart │ ├── post │ │ ├── widgets │ │ │ ├── post_icon_button.dart │ │ │ ├── hashtag_text.dart │ │ │ ├── carousel_image.dart │ │ │ └── post_list.dart │ │ └── views │ │ │ ├── hashtag_view.dart │ │ │ └── post_reply_view.dart │ ├── auth │ │ ├── widgets │ │ │ └── auth_field.dart │ │ ├── controller │ │ │ └── auth_controller.dart │ │ └── view │ │ │ ├── login_view.dart │ │ │ └── signup_view.dart │ ├── notifications │ │ ├── widgets │ │ │ └── notification_tile.dart │ │ ├── controller │ │ │ └── notification_controller.dart │ │ └── views │ │ │ └── notification_view.dart │ └── home │ │ ├── view │ │ └── home_view.dart │ │ └── widgets │ │ └── side_drawer.dart ├── api │ ├── storage_api.dart │ ├── notification_api.dart │ ├── auth_api.dart │ ├── post_api.dart │ └── user_api.dart ├── main.dart └── models │ ├── notification_model.dart │ ├── user_model.dart │ └── post_model.dart ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── manifest.json └── index.html ├── macos ├── Flutter │ ├── Flutter-Debug.xcconfig │ ├── Flutter-Release.xcconfig │ └── GeneratedPluginRegistrant.swift ├── Runner │ ├── Configs │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ ├── Warnings.xcconfig │ │ └── AppInfo.xcconfig │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_512.png │ │ │ ├── app_icon_64.png │ │ │ ├── app_icon_1024.png │ │ │ └── Contents.json │ ├── AppDelegate.swift │ ├── Release.entitlements │ ├── DebugProfile.entitlements │ ├── MainFlutterWindow.swift │ └── Info.plist ├── .gitignore ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── Runner.xcodeproj │ ├── project.xcworkspace │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ └── xcschemes │ └── Runner.xcscheme ├── 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 │ │ │ │ │ └── todoapp │ │ │ │ │ └── MainActivity.kt │ │ │ └── AndroidManifest.xml │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ └── profile │ │ │ └── AndroidManifest.xml │ └── build.gradle ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── .gitignore ├── settings.gradle └── build.gradle ├── 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 ├── .gitignore ├── flutter │ ├── generated_plugin_registrant.h │ ├── generated_plugin_registrant.cc │ ├── generated_plugins.cmake │ └── CMakeLists.txt └── CMakeLists.txt ├── assets └── svgs │ ├── upvote.svg │ ├── twitter.svg │ ├── views.svg │ ├── notif_filled.svg │ ├── home_filled.svg │ ├── comment.svg │ ├── notif_outlined.svg │ ├── search.svg │ ├── home_outlined.svg │ ├── gallery.svg │ ├── like_outlined.svg │ ├── todo-list-svgrepo-com.svg │ ├── verified.svg │ ├── gif.svg │ ├── Google-Logo.svg │ └── devtick.svg ├── .gitignore ├── LICENSE ├── test └── widget_test.dart ├── analysis_options.yaml ├── .metadata ├── README.md └── pubspec.yaml /linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /lib/core/core.dart: -------------------------------------------------------------------------------- 1 | export './failure.dart'; 2 | export './type_defs.dart'; 3 | -------------------------------------------------------------------------------- /lib/theme/theme.dart: -------------------------------------------------------------------------------- 1 | export './apptheme.dart'; 2 | export './pallet.dart'; 3 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ommgh/devtown/HEAD/web/favicon.png -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ommgh/devtown/HEAD/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ommgh/devtown/HEAD/web/icons/Icon-512.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ommgh/devtown/HEAD/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ommgh/devtown/HEAD/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ommgh/devtown/HEAD/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /lib/common/common.dart: -------------------------------------------------------------------------------- 1 | export './rounded_small_button.dart'; 2 | export './loading_page.dart'; 3 | export './error_page.dart'; 4 | -------------------------------------------------------------------------------- /macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /lib/constants/constants.dart: -------------------------------------------------------------------------------- 1 | export './appwrite_dependency.dart'; 2 | export './assets_constant.dart'; 3 | export './ui_constants.dart'; 4 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ommgh/devtown/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/ommgh/devtown/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/ommgh/devtown/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/ommgh/devtown/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/ommgh/devtown/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ommgh/devtown/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ommgh/devtown/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ommgh/devtown/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ommgh/devtown/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ommgh/devtown/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ommgh/devtown/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ommgh/devtown/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ommgh/devtown/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/ommgh/devtown/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/ommgh/devtown/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/ommgh/devtown/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/ommgh/devtown/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/ommgh/devtown/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/ommgh/devtown/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/ommgh/devtown/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/ommgh/devtown/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/ommgh/devtown/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/ommgh/devtown/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/ommgh/devtown/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/ommgh/devtown/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ommgh/devtown/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ommgh/devtown/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /lib/core/failure.dart: -------------------------------------------------------------------------------- 1 | class Failure { 2 | final String message; 3 | final StackTrace stackTrace; 4 | Failure( 5 | this.message, 6 | this.stackTrace, 7 | ); 8 | } 9 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ommgh/devtown/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ommgh/devtown/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/ommgh/devtown/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /lib/core/type_defs.dart: -------------------------------------------------------------------------------- 1 | import 'package:fpdart/fpdart.dart'; 2 | 3 | import 'failure.dart'; 4 | 5 | typedef FuturEither = Future>; 6 | typedef FuturEitherVoid = FuturEither; 7 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/todoapp/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.todoapp 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /assets/svgs/upvote.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /assets/svgs/twitter.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /assets/svgs/views.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /assets/svgs/notif_filled.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svgs/home_filled.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /lib/core/enums/post_type.dart: -------------------------------------------------------------------------------- 1 | enum PostType { 2 | text('text'), 3 | image('image'); 4 | 5 | final String type; 6 | const PostType(this.type); 7 | } 8 | 9 | extension ConvertPost on String { 10 | PostType toPostTypeEnum() { 11 | switch (this) { 12 | case 'text': 13 | return PostType.text; 14 | case 'image': 15 | return PostType.image; 16 | default: 17 | return PostType.text; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /assets/svgs/comment.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svgs/notif_outlined.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /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/theme/apptheme.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:todoapp/theme/pallet.dart'; 3 | 4 | class AppTheme { 5 | static ThemeData theme = ThemeData.dark().copyWith( 6 | scaffoldBackgroundColor: Pallete.backgroundColor, 7 | appBarTheme: const AppBarTheme( 8 | backgroundColor: Pallete.backgroundColor, 9 | elevation: 0, 10 | ), 11 | floatingActionButtonTheme: const FloatingActionButtonThemeData( 12 | backgroundColor: Pallete.greencolor, 13 | ), 14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /assets/svgs/search.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svgs/home_outlined.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/theme/pallet.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class Pallete { 4 | static const Color backgroundColor = Color.fromRGBO(0, 0, 0, 1); 5 | static const Color redcolor = Color.fromARGB(255, 255, 1, 1); 6 | static const Color searchBarColor = Color.fromRGBO(48, 76, 112, 1); 7 | static const Color greencolor = Color.fromARGB(255, 120, 191, 59); 8 | static const Color whiteColor = Colors.white; 9 | static const Color greyColor = Colors.grey; 10 | static const Color blueColor = Color.fromARGB(255, 60, 194, 48); 11 | } 12 | -------------------------------------------------------------------------------- /lib/common/loading_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class Loader extends StatelessWidget { 4 | const Loader({super.key}); 5 | 6 | @override 7 | Widget build(BuildContext context) { 8 | return const Center( 9 | child: CircularProgressIndicator(), 10 | ); 11 | } 12 | } 13 | 14 | class LoadingPage extends StatelessWidget { 15 | const LoadingPage({super.key}); 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | return const Scaffold( 20 | body: Loader(), 21 | ); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /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 | 12 | void RegisterPlugins(flutter::PluginRegistry* registry) { 13 | UrlLauncherWindowsRegisterWithRegistrar( 14 | registry->GetRegistrarForPlugin("UrlLauncherWindows")); 15 | WindowToFrontPluginRegisterWithRegistrar( 16 | registry->GetRegistrarForPlugin("WindowToFrontPlugin")); 17 | } 18 | -------------------------------------------------------------------------------- /lib/core/enums/notification_type_enum.dart: -------------------------------------------------------------------------------- 1 | enum NotificationType { 2 | like('like'), 3 | reply('reply'), 4 | follow('follow'), 5 | retweet('retweet'); 6 | 7 | final String type; 8 | const NotificationType(this.type); 9 | } 10 | 11 | extension ConvertTweet on String { 12 | NotificationType toNotificationTypeEnum() { 13 | switch (this) { 14 | case 'retweet': 15 | return NotificationType.retweet; 16 | case 'follow': 17 | return NotificationType.follow; 18 | case 'reply': 19 | return NotificationType.reply; 20 | default: 21 | return NotificationType.like; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /assets/svgs/gallery.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /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/constants/appwrite_dependency.dart: -------------------------------------------------------------------------------- 1 | class AppwriteContants { 2 | static const String databaseID = "647c6bc3d7f483aa9967"; 3 | static const String projectID = "647c697a8ea533486648"; 4 | static const String endPoint = "https://cloud.appwrite.io/v1"; 5 | static const String userCollection = "647dc52b02f4722ce02a"; 6 | static const String postCollection = "6480ba959d04f18a751b"; 7 | static const String notificationCollection = "648998302e7df03976bc"; 8 | static const String imagesBucket = "64815a2032f6420147bf"; 9 | static String imageurl(String imageId) => 10 | "$endPoint/storage/buckets/$imagesBucket/files/$imageId/view?project=$projectID&mode=admin"; 11 | } 12 | -------------------------------------------------------------------------------- /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 = todoapp 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.todoapp 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2023 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /lib/common/error_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class ErrorText extends StatelessWidget { 4 | final String error; 5 | const ErrorText({ 6 | super.key, 7 | required this.error, 8 | }); 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | return Center( 13 | child: Text(error), 14 | ); 15 | } 16 | } 17 | 18 | class ErrorPage extends StatelessWidget { 19 | final String error; 20 | const ErrorPage({ 21 | super.key, 22 | required this.error, 23 | }); 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return Scaffold( 28 | body: ErrorText(error: error), 29 | ); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /assets/svgs/like_outlined.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.8.20' 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 | tasks.register("clean", Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /assets/svgs/todo-list-svgrepo-com.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /assets/svgs/verified.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /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) url_launcher_linux_registrar = 14 | fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); 15 | url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); 16 | g_autoptr(FlPluginRegistrar) window_to_front_registrar = 17 | fl_plugin_registry_get_registrar_for_plugin(registry, "WindowToFrontPlugin"); 18 | window_to_front_plugin_register_with_registrar(window_to_front_registrar); 19 | } 20 | -------------------------------------------------------------------------------- /assets/svgs/gif.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.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 | .env 13 | 14 | # IntelliJ related 15 | *.iml 16 | *.ipr 17 | *.iws 18 | .idea/ 19 | 20 | # The .vscode folder contains launch configuration and tasks you configure in 21 | # VS Code which you may wish to be included in version control, so this line 22 | # is commented out by default. 23 | #.vscode/ 24 | 25 | # Flutter/Dart/Pub related 26 | **/doc/api/ 27 | **/ios/Flutter/.last_build_id 28 | .dart_tool/ 29 | .flutter-plugins 30 | .flutter-plugins-dependencies 31 | .packages 32 | .pub-cache/ 33 | .pub/ 34 | /build/ 35 | 36 | # Symbolication related 37 | app.*.symbols 38 | 39 | # Obfuscation related 40 | app.*.map.json 41 | 42 | # Android Studio will place build artifacts here 43 | /android/app/debug 44 | /android/app/profile 45 | /android/app/release 46 | -------------------------------------------------------------------------------- /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 | url_launcher_linux 7 | window_to_front 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 | url_launcher_windows 7 | window_to_front 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}/windows 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}/windows plugins/${ffi_plugin}) 24 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 25 | endforeach(ffi_plugin) 26 | -------------------------------------------------------------------------------- /lib/common/rounded_small_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class RoundedSmallButton extends StatelessWidget { 4 | final VoidCallback onTap; 5 | final String label; 6 | final Color backgroundColor; 7 | final Color textColor; 8 | const RoundedSmallButton({ 9 | super.key, 10 | required this.onTap, 11 | required this.label, 12 | required this.backgroundColor, 13 | required this.textColor, 14 | }); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return InkWell( 19 | onTap: onTap, 20 | child: Chip( 21 | label: Text( 22 | label, 23 | style: TextStyle( 24 | color: textColor, 25 | fontSize: 16, 26 | ), 27 | ), 28 | backgroundColor: backgroundColor, 29 | labelPadding: const EdgeInsets.symmetric( 30 | horizontal: 20, 31 | vertical: 5, 32 | ), 33 | ), 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /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/features/user_profile/widgets/follow_count.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:todoapp/theme/pallet.dart'; 3 | 4 | class FollowCount extends StatelessWidget { 5 | final int count; 6 | final String text; 7 | const FollowCount({ 8 | Key? key, 9 | required this.count, 10 | required this.text, 11 | }) : super(key: key); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | double fontSize = 18; 16 | 17 | return Row( 18 | children: [ 19 | Text( 20 | '$count', 21 | style: TextStyle( 22 | color: Pallete.whiteColor, 23 | fontSize: fontSize, 24 | fontWeight: FontWeight.bold, 25 | ), 26 | ), 27 | const SizedBox(width: 3), 28 | Text( 29 | text, 30 | style: TextStyle( 31 | color: Pallete.greyColor, 32 | fontSize: fontSize, 33 | ), 34 | ), 35 | ], 36 | ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/features/explore/controller/explore_controller.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 2 | import 'package:todoapp/api/user_api.dart'; 3 | import 'package:todoapp/models/user_model.dart'; 4 | 5 | final exploreControllerProvider = StateNotifierProvider((ref) { 6 | return ExploreController( 7 | userAPI: ref.watch(userAPIProvider), 8 | ); 9 | }); 10 | 11 | final searchUserProvider = FutureProvider.family((ref, String name) async { 12 | final exploreController = ref.watch(exploreControllerProvider.notifier); 13 | return exploreController.searchUser(name); 14 | }); 15 | 16 | class ExploreController extends StateNotifier { 17 | final UserAPI _userAPI; 18 | ExploreController({ 19 | required UserAPI userAPI, 20 | }) : _userAPI = userAPI, 21 | super(false); 22 | 23 | Future> searchUser(String name) async { 24 | final users = await _userAPI.searchUserByName(name); 25 | return users.map((e) => UserModel.fromMap(e.data)).toList(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /lib/core/ustils.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:image_picker/image_picker.dart'; 4 | 5 | void showSnackBar(BuildContext context, String content) { 6 | ScaffoldMessenger.of(context).showSnackBar( 7 | SnackBar( 8 | content: Text(content), 9 | ), 10 | ); 11 | } 12 | 13 | String getNameFromEmail(String email) { 14 | return email.split('0')[0]; 15 | } 16 | 17 | Future> pickImages() async { 18 | List images = []; 19 | final ImagePicker picker = ImagePicker(); 20 | final imageFiles = await picker.pickMultiImage(); 21 | if (imageFiles.isNotEmpty) { 22 | for (final image in imageFiles) { 23 | images.add(File(image.path)); 24 | } 25 | } 26 | return images; 27 | } 28 | 29 | Future pickImage() async { 30 | final ImagePicker picker = ImagePicker(); 31 | final imageFile = await picker.pickImage(source: ImageSource.gallery); 32 | if (imageFile != null) { 33 | return File(imageFile.path); 34 | } 35 | return null; 36 | } 37 | -------------------------------------------------------------------------------- /lib/core/providers.dart: -------------------------------------------------------------------------------- 1 | import 'package:appwrite/appwrite.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:todoapp/constants/constants.dart'; 4 | 5 | final appwriteClientProvider = Provider((ref) { 6 | Client client = Client(); 7 | return client 8 | .setEndpoint(AppwriteContants.endPoint) 9 | .setProject(AppwriteContants.projectID) 10 | .setSelfSigned(status: true); 11 | }); 12 | 13 | final appwriteAccountProvider = Provider((ref) { 14 | final client = ref.watch(appwriteClientProvider); 15 | return Account(client); 16 | }); 17 | 18 | final appwriteDatabaseProvider = Provider((ref) { 19 | final client = ref.watch(appwriteClientProvider); 20 | return Databases(client); 21 | }); 22 | 23 | final appwriteStorageProvider = Provider((ref) { 24 | final client = ref.watch(appwriteClientProvider); 25 | return Storage(client); 26 | }); 27 | 28 | final appwriteRealtimeProvider = Provider((ref) { 29 | final client = ref.watch(appwriteClientProvider); 30 | return Realtime(client); 31 | }); 32 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "todoapp", 3 | "short_name": "todoapp", 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 | -------------------------------------------------------------------------------- /lib/api/storage_api.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:appwrite/appwrite.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | import 'package:todoapp/constants/appwrite_dependency.dart'; 5 | import 'package:todoapp/core/providers.dart'; 6 | 7 | final storageAPIProvider = Provider((ref) { 8 | return StorageAPI( 9 | storage: ref.watch(appwriteStorageProvider), 10 | ); 11 | }); 12 | 13 | class StorageAPI { 14 | final Storage _storage; 15 | StorageAPI({required Storage storage}) : _storage = storage; 16 | 17 | Future> uploadImage(List files) async { 18 | List imageLinks = []; 19 | for (final file in files) { 20 | final uploadedImage = await _storage.createFile( 21 | bucketId: AppwriteContants.imagesBucket, 22 | fileId: ID.unique(), 23 | file: InputFile.fromPath( 24 | path: file.path, 25 | ), 26 | ); 27 | imageLinks.add( 28 | AppwriteContants.imageurl(uploadedImage.$id), 29 | ); 30 | } 31 | return imageLinks; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/constants/assets_constant.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | class AssetsConstants { 4 | static const String _svgPath = "assets/svgs"; 5 | static const String logo = "$_svgPath/devlogo.svg"; 6 | static const String googlelogo = "$_svgPath/Google-Logo.svg"; 7 | static const String homeOutlined = "$_svgPath/home_outlined.svg"; 8 | static const String homeFilled = "$_svgPath/home_filled.svg"; 9 | static const String search = "$_svgPath/search.svg"; 10 | static const String notificationfilled = "$_svgPath/notif_filled.svg"; 11 | static const String notificationoutlined = "$_svgPath/notif_outlined.svg"; 12 | static const String galery = "$_svgPath/gallery.svg"; 13 | static const String gif = "$_svgPath/gif.svg"; 14 | static const String viewicon = "$_svgPath/views.svg"; 15 | static const String commenticon = "$_svgPath/comment.svg"; 16 | static const String likeoutlinedicon = "$_svgPath/like_outlined.svg"; 17 | static const String verifiedbadge = "$_svgPath/verified.svg"; 18 | static const String upvoteicon = "$_svgPath/upvote.svg"; 19 | } 20 | -------------------------------------------------------------------------------- /lib/constants/ui_constants.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_svg/flutter_svg.dart'; 3 | import 'package:google_fonts/google_fonts.dart'; 4 | import 'package:todoapp/features/explore/views/explore_view.dart'; 5 | import 'package:todoapp/features/notifications/views/notification_view.dart'; 6 | import 'package:todoapp/constants/constants.dart'; 7 | import 'package:todoapp/features/post/widgets/post_list.dart'; 8 | import 'package:todoapp/theme/pallet.dart'; 9 | 10 | class UIConstants { 11 | static AppBar appBar() { 12 | return AppBar( 13 | title: Text( 14 | "Devtown.", 15 | style: GoogleFonts.leagueSpartan( 16 | textStyle: const TextStyle( 17 | color: Color.fromARGB(255, 42, 209, 33), 18 | fontWeight: FontWeight.bold, 19 | fontSize: 23, 20 | ), 21 | ), 22 | ), 23 | centerTitle: true, 24 | ); 25 | } 26 | 27 | static const List bottomTabBarPages = [ 28 | PostList(), 29 | ExploreView(), 30 | NotificationView(), 31 | ]; 32 | } 33 | -------------------------------------------------------------------------------- /lib/features/post/widgets/post_icon_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_svg/svg.dart'; 3 | import 'package:todoapp/theme/pallet.dart'; 4 | 5 | class PostIconButton extends StatelessWidget { 6 | final String pathName; 7 | final String text; 8 | final VoidCallback onTap; 9 | const PostIconButton({ 10 | Key? key, 11 | required this.pathName, 12 | required this.text, 13 | required this.onTap, 14 | }) : super(key: key); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return GestureDetector( 19 | onTap: onTap, 20 | child: Row( 21 | children: [ 22 | SvgPicture.asset( 23 | pathName, 24 | color: Pallete.greyColor, 25 | ), 26 | Container( 27 | margin: const EdgeInsets.all(6), 28 | child: Text( 29 | text, 30 | style: const TextStyle( 31 | fontSize: 16, 32 | ), 33 | ), 34 | ), 35 | ], 36 | ), 37 | ); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import device_info_plus 9 | import flutter_web_auth_2 10 | import package_info_plus 11 | import path_provider_foundation 12 | import shared_preferences_foundation 13 | import url_launcher_macos 14 | import window_to_front 15 | 16 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 17 | DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) 18 | FlutterWebAuth2Plugin.register(with: registry.registrar(forPlugin: "FlutterWebAuth2Plugin")) 19 | FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) 20 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) 21 | SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) 22 | UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) 23 | WindowToFrontPlugin.register(with: registry.registrar(forPlugin: "WindowToFrontPlugin")) 24 | } 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Om Mishra 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 | -------------------------------------------------------------------------------- /assets/svgs/Google-Logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /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:todoapp/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 | -------------------------------------------------------------------------------- /macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /lib/features/auth/widgets/auth_field.dart: -------------------------------------------------------------------------------- 1 | import "package:flutter/material.dart"; 2 | import 'package:todoapp/theme/pallet.dart'; 3 | 4 | class AuthField extends StatelessWidget { 5 | final TextEditingController controller; 6 | final String hintText; 7 | const AuthField({ 8 | super.key, 9 | required this.controller, 10 | required this.hintText, 11 | }); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return TextFormField( 16 | controller: controller, 17 | decoration: InputDecoration( 18 | focusedBorder: OutlineInputBorder( 19 | borderRadius: BorderRadius.circular(5), 20 | borderSide: const BorderSide( 21 | color: Pallete.greencolor, 22 | width: 3, 23 | ), 24 | ), 25 | enabledBorder: OutlineInputBorder( 26 | borderRadius: BorderRadius.circular(5), 27 | borderSide: const BorderSide( 28 | color: Pallete.greyColor, 29 | ), 30 | ), 31 | contentPadding: const EdgeInsets.all(22), 32 | hintText: hintText, 33 | hintStyle: const TextStyle( 34 | fontSize: 18, 35 | ), 36 | ), 37 | ); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:todoapp/features/auth/controller/auth_controller.dart'; 4 | import 'package:todoapp/features/auth/view/signup_view.dart'; 5 | import 'package:todoapp/features/home/view/home_view.dart'; 6 | import 'package:todoapp/common/common.dart'; 7 | import 'package:todoapp/common/loading_page.dart'; 8 | import 'package:todoapp/theme/theme.dart'; 9 | 10 | void main() { 11 | runApp(const ProviderScope(child: MyApp())); 12 | } 13 | 14 | class MyApp extends ConsumerWidget { 15 | const MyApp({super.key}); 16 | 17 | // This widget is the root of your application. 18 | @override 19 | Widget build(BuildContext context, WidgetRef ref) { 20 | return MaterialApp( 21 | title: 'Flutter Demo', 22 | theme: AppTheme.theme, 23 | home: ref.watch(currentUserAccountProvider).when( 24 | data: (user) { 25 | if (user != null) { 26 | return const HomeView(); 27 | } 28 | return const SignUpView(); 29 | }, 30 | error: (error, st) => ErrorPage( 31 | error: error.toString(), 32 | ), 33 | loading: () => const LoadingPage(), 34 | ), 35 | debugShowCheckedModeBanner: false); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /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"todoapp", 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 | -------------------------------------------------------------------------------- /lib/features/post/views/hashtag_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:todoapp/features/post/controllers/post_controller.dart'; 4 | import 'package:todoapp/common/common.dart'; 5 | import 'package:todoapp/features/post/widgets/post_card.dart'; 6 | 7 | class HashtagView extends ConsumerWidget { 8 | static route(String hashtag) => MaterialPageRoute( 9 | builder: (context) => HashtagView( 10 | hashtag: hashtag, 11 | ), 12 | ); 13 | final String hashtag; 14 | const HashtagView({ 15 | super.key, 16 | required this.hashtag, 17 | }); 18 | 19 | @override 20 | Widget build(BuildContext context, WidgetRef ref) { 21 | return Scaffold( 22 | appBar: AppBar( 23 | title: Text(hashtag), 24 | ), 25 | body: ref.watch(getPostsByHashtagProvider(hashtag)).when( 26 | data: (posts) { 27 | return ListView.builder( 28 | itemCount: posts.length, 29 | itemBuilder: (BuildContext context, int index) { 30 | final post = posts[index]; 31 | return PostCard(post: post); 32 | }, 33 | ); 34 | }, 35 | error: (error, stackTrace) => ErrorText( 36 | error: error.toString(), 37 | ), 38 | loading: () => const Loader(), 39 | ), 40 | ); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/features/explore/widgets/search_tile.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:todoapp/features/user_profile/views/user_profile_view.dart'; 3 | import 'package:todoapp/models/user_model.dart'; 4 | import 'package:todoapp/theme/pallet.dart'; 5 | 6 | class SearchTile extends StatelessWidget { 7 | final UserModel userModel; 8 | const SearchTile({ 9 | super.key, 10 | required this.userModel, 11 | }); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return ListTile( 16 | onTap: () { 17 | Navigator.push( 18 | context, 19 | UserProfileView.route(userModel), 20 | ); 21 | }, 22 | leading: CircleAvatar( 23 | backgroundImage: NetworkImage(userModel.profilePic), 24 | radius: 30, 25 | ), 26 | title: Text( 27 | userModel.name, 28 | style: const TextStyle( 29 | fontSize: 18, 30 | fontWeight: FontWeight.w600, 31 | ), 32 | ), 33 | subtitle: Column( 34 | crossAxisAlignment: CrossAxisAlignment.start, 35 | children: [ 36 | Text( 37 | '@${userModel.name}', 38 | style: const TextStyle( 39 | fontSize: 16, 40 | ), 41 | ), 42 | Text( 43 | userModel.bio, 44 | style: const TextStyle( 45 | color: Pallete.whiteColor, 46 | ), 47 | ), 48 | ], 49 | ), 50 | ); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /lib/features/notifications/widgets/notification_tile.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_svg/svg.dart'; 3 | import 'package:todoapp/constants/constants.dart'; 4 | import 'package:todoapp/core/enums/notification_type_enum.dart'; 5 | import 'package:todoapp/models/notification_model.dart' as model; 6 | import 'package:todoapp/theme/pallet.dart'; 7 | 8 | class NotificationTile extends StatelessWidget { 9 | final model.Notification notification; 10 | const NotificationTile({ 11 | super.key, 12 | required this.notification, 13 | }); 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return ListTile( 18 | leading: notification.notificationType == NotificationType.follow 19 | ? const Icon( 20 | Icons.person, 21 | color: Pallete.blueColor, 22 | ) 23 | : notification.notificationType == NotificationType.like 24 | ? SvgPicture.asset( 25 | AssetsConstants.likeoutlinedicon, 26 | color: Pallete.redcolor, 27 | height: 20, 28 | ) 29 | : notification.notificationType == NotificationType.retweet 30 | ? SvgPicture.asset( 31 | AssetsConstants.homeFilled, 32 | color: Pallete.whiteColor, 33 | height: 20, 34 | ) 35 | : null, 36 | title: Text(notification.text), 37 | ); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/features/user_profile/views/user_profile_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:todoapp/features/user_profile/controller/user_profile_controller.dart'; 4 | import 'package:todoapp/features/user_profile/widgets/user_profile.dart'; 5 | import 'package:todoapp/common/common.dart'; 6 | import 'package:todoapp/constants/appwrite_dependency.dart'; 7 | import 'package:todoapp/models/user_model.dart'; 8 | 9 | class UserProfileView extends ConsumerWidget { 10 | static route(UserModel userModel) => MaterialPageRoute( 11 | builder: (context) => UserProfileView( 12 | userModel: userModel, 13 | ), 14 | ); 15 | final UserModel userModel; 16 | const UserProfileView({ 17 | super.key, 18 | required this.userModel, 19 | }); 20 | 21 | @override 22 | Widget build(BuildContext context, WidgetRef ref) { 23 | UserModel copyOfUser = userModel; 24 | return Scaffold( 25 | body: ref.watch(getLatestUserProfileDataProvider).when( 26 | data: (data) { 27 | if (data.events.contains( 28 | 'databases.*.collections.${AppwriteContants.userCollection}.documents.${copyOfUser.uid}.update', 29 | )) { 30 | copyOfUser = UserModel.fromMap(data.payload); 31 | } 32 | return UserProfile(user: copyOfUser); 33 | }, 34 | error: (error, st) => ErrorText(error: error.toString()), 35 | loading: () { 36 | return UserProfile(user: copyOfUser); 37 | }, 38 | ), 39 | ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /assets/svgs/devtick.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /.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: 135454af32477f815a7525073027a3ff9eff1bfd 8 | channel: stable 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd 17 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd 18 | - platform: android 19 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd 20 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd 21 | - platform: ios 22 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd 23 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd 24 | - platform: linux 25 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd 26 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd 27 | - platform: macos 28 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd 29 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd 30 | - platform: web 31 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd 32 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd 33 | - platform: windows 34 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd 35 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd 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 | -------------------------------------------------------------------------------- /lib/features/post/widgets/hashtag_text.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/gestures.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:todoapp/features/post/views/hashtag_view.dart'; 4 | import 'package:todoapp/theme/pallet.dart'; 5 | 6 | class HashtagText extends StatelessWidget { 7 | final String text; 8 | const HashtagText({ 9 | super.key, 10 | required this.text, 11 | }); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | List textspans = []; 16 | 17 | text.split(' ').forEach((element) { 18 | if (element.startsWith('#')) { 19 | textspans.add( 20 | TextSpan( 21 | text: '$element ', 22 | style: const TextStyle( 23 | color: Pallete.blueColor, 24 | fontSize: 18, 25 | fontWeight: FontWeight.bold, 26 | ), 27 | recognizer: TapGestureRecognizer() 28 | ..onTap = () { 29 | Navigator.push( 30 | context, 31 | HashtagView.route(element), 32 | ); 33 | }), 34 | ); 35 | } else if (element.startsWith('www.') || element.startsWith('https://')) { 36 | textspans.add( 37 | TextSpan( 38 | text: '$element ', 39 | style: const TextStyle( 40 | color: Pallete.blueColor, 41 | fontSize: 18, 42 | ), 43 | ), 44 | ); 45 | } else { 46 | textspans.add( 47 | TextSpan( 48 | text: '$element ', 49 | style: const TextStyle( 50 | fontSize: 18, 51 | ), 52 | ), 53 | ); 54 | } 55 | }); 56 | 57 | return RichText( 58 | text: TextSpan( 59 | children: textspans, 60 | ), 61 | ); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /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 | Todoapp 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | todoapp 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 | -------------------------------------------------------------------------------- /lib/features/notifications/controller/notification_controller.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 2 | import 'package:todoapp/api/notification_api.dart'; 3 | import 'package:todoapp/core/enums/notification_type_enum.dart'; 4 | import 'package:todoapp/models/notification_model.dart' as model; 5 | 6 | final notificationControllerProvider = 7 | StateNotifierProvider((ref) { 8 | return NotificationController( 9 | notificationAPI: ref.watch(notificationAPIProvider), 10 | ); 11 | }); 12 | 13 | final getLatestNotificationProvider = StreamProvider((ref) { 14 | final notificationAPI = ref.watch(notificationAPIProvider); 15 | return notificationAPI.getLatestNotification(); 16 | }); 17 | 18 | final getNotificationsProvider = FutureProvider.family((ref, String uid) async { 19 | final notificationController = 20 | ref.watch(notificationControllerProvider.notifier); 21 | return notificationController.getNotifications(uid); 22 | }); 23 | 24 | class NotificationController extends StateNotifier { 25 | final NotificationAPI _notificationAPI; 26 | NotificationController({required NotificationAPI notificationAPI}) 27 | : _notificationAPI = notificationAPI, 28 | super(false); 29 | 30 | void createNotification({ 31 | required String text, 32 | required String postId, 33 | required NotificationType notificationType, 34 | required String uid, 35 | }) async { 36 | final notification = model.Notification( 37 | text: text, 38 | postId: postId, 39 | id: '', 40 | uid: uid, 41 | notificationType: notificationType, 42 | ); 43 | final res = await _notificationAPI.createNotification(notification); 44 | res.fold((l) => null, (r) => null); 45 | } 46 | 47 | Future> getNotifications(String uid) async { 48 | final notifications = await _notificationAPI.getNotifications(uid); 49 | return notifications 50 | .map((e) => model.Notification.fromMap(e.data)) 51 | .toList(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | todoapp 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /lib/models/notification_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:todoapp/core/enums/notification_type_enum.dart'; 2 | 3 | class Notification { 4 | final String text; 5 | final String postId; 6 | final String id; 7 | final String uid; 8 | final NotificationType notificationType; 9 | Notification({ 10 | required this.text, 11 | required this.postId, 12 | required this.id, 13 | required this.uid, 14 | required this.notificationType, 15 | }); 16 | 17 | Notification copyWith({ 18 | String? text, 19 | String? postId, 20 | String? id, 21 | String? uid, 22 | NotificationType? notificationType, 23 | }) { 24 | return Notification( 25 | text: text ?? this.text, 26 | postId: postId ?? this.postId, 27 | id: id ?? this.id, 28 | uid: uid ?? this.uid, 29 | notificationType: notificationType ?? this.notificationType, 30 | ); 31 | } 32 | 33 | Map toMap() { 34 | final result = {}; 35 | 36 | result.addAll({'text': text}); 37 | result.addAll({'postId': postId}); 38 | result.addAll({'uid': uid}); 39 | result.addAll({'notificationType': notificationType.type}); 40 | 41 | return result; 42 | } 43 | 44 | factory Notification.fromMap(Map map) { 45 | return Notification( 46 | text: map['text'] ?? '', 47 | postId: map['postId'] ?? '', 48 | id: map['\$id'] ?? '', 49 | uid: map['uid'] ?? '', 50 | notificationType: 51 | (map['notificationType'] as String).toNotificationTypeEnum(), 52 | ); 53 | } 54 | 55 | @override 56 | String toString() { 57 | return 'Notification(text: $text, postId: $postId, id: $id, uid: $uid, notificationType: $notificationType)'; 58 | } 59 | 60 | @override 61 | bool operator ==(Object other) { 62 | if (identical(this, other)) return true; 63 | 64 | return other is Notification && 65 | other.text == text && 66 | other.postId == postId && 67 | other.id == id && 68 | other.uid == uid && 69 | other.notificationType == notificationType; 70 | } 71 | 72 | @override 73 | int get hashCode { 74 | return text.hashCode ^ 75 | postId.hashCode ^ 76 | id.hashCode ^ 77 | uid.hashCode ^ 78 | notificationType.hashCode; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/features/post/widgets/carousel_image.dart: -------------------------------------------------------------------------------- 1 | import 'package:carousel_slider/carousel_slider.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class CarouselImage extends StatefulWidget { 5 | final List imageLinks; 6 | const CarouselImage({ 7 | super.key, 8 | required this.imageLinks, 9 | }); 10 | 11 | @override 12 | State createState() => _CarouselImageState(); 13 | } 14 | 15 | class _CarouselImageState extends State { 16 | int _current = 0; 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | return Stack( 21 | alignment: Alignment.center, 22 | children: [ 23 | Column( 24 | children: [ 25 | CarouselSlider( 26 | items: widget.imageLinks.map( 27 | (link) { 28 | return Container( 29 | decoration: BoxDecoration( 30 | borderRadius: BorderRadius.circular(25), 31 | ), 32 | margin: const EdgeInsets.all(10), 33 | child: Image.network( 34 | link, 35 | fit: BoxFit.contain, 36 | ), 37 | ); 38 | }, 39 | ).toList(), 40 | options: CarouselOptions( 41 | viewportFraction: 1, 42 | enableInfiniteScroll: false, 43 | onPageChanged: (index, reason) { 44 | setState(() { 45 | _current = index; 46 | }); 47 | }, 48 | ), 49 | ), 50 | Row( 51 | mainAxisAlignment: MainAxisAlignment.center, 52 | children: widget.imageLinks.asMap().entries.map((e) { 53 | return Container( 54 | width: 12, 55 | height: 12, 56 | margin: const EdgeInsets.symmetric( 57 | horizontal: 4, 58 | ), 59 | decoration: BoxDecoration( 60 | shape: BoxShape.circle, 61 | color: Colors.white.withOpacity( 62 | _current == e.key ? 0.9 : 0.4, 63 | ), 64 | ), 65 | ); 66 | }).toList(), 67 | ), 68 | ], 69 | ), 70 | ], 71 | ); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /lib/api/notification_api.dart: -------------------------------------------------------------------------------- 1 | import 'package:appwrite/appwrite.dart'; 2 | import 'package:appwrite/models.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | import 'package:fpdart/fpdart.dart'; 5 | import 'package:todoapp/constants/appwrite_dependency.dart'; 6 | import 'package:todoapp/core/core.dart'; 7 | import 'package:todoapp/core/providers.dart'; 8 | import 'package:todoapp/models/notification_model.dart'; 9 | 10 | final notificationAPIProvider = Provider((ref) { 11 | return NotificationAPI( 12 | db: ref.watch(appwriteDatabaseProvider), 13 | realtime: ref.watch(appwriteRealtimeProvider), 14 | ); 15 | }); 16 | 17 | abstract class INotificationAPI { 18 | FuturEitherVoid createNotification(Notification notification); 19 | Future> getNotifications(String uid); 20 | Stream getLatestNotification(); 21 | } 22 | 23 | class NotificationAPI implements INotificationAPI { 24 | final Databases _db; 25 | final Realtime _realtime; 26 | NotificationAPI({required Databases db, required Realtime realtime}) 27 | : _realtime = realtime, 28 | _db = db; 29 | 30 | @override 31 | FuturEitherVoid createNotification(Notification notification) async { 32 | try { 33 | await _db.createDocument( 34 | databaseId: AppwriteContants.databaseID, 35 | collectionId: AppwriteContants.notificationCollection, 36 | documentId: ID.unique(), 37 | data: notification.toMap(), 38 | ); 39 | return right(null); 40 | } on AppwriteException catch (e, st) { 41 | return left( 42 | Failure( 43 | e.message ?? 'Some unexpected error occurred', 44 | st, 45 | ), 46 | ); 47 | } catch (e, st) { 48 | return left(Failure(e.toString(), st)); 49 | } 50 | } 51 | 52 | @override 53 | Future> getNotifications(String uid) async { 54 | final documents = await _db.listDocuments( 55 | databaseId: AppwriteContants.databaseID, 56 | collectionId: AppwriteContants.notificationCollection, 57 | queries: [ 58 | Query.equal('uid', uid), 59 | ], 60 | ); 61 | return documents.documents; 62 | } 63 | 64 | @override 65 | Stream getLatestNotification() { 66 | return _realtime.subscribe([ 67 | 'databases.${AppwriteContants.databaseID}.collections.${AppwriteContants.notificationCollection}.documents' 68 | ]).stream; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /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 33 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 "com.om.todoapp" 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Devtown 2 | Devtown 3 | 4 | 5 | ## Features 6 | - Sign Up With Email, Password 7 | - Sign In With Email, Password 8 | - Posting Text 9 | - Posting Image 10 | - Posting Link 11 | - Hashtag identification & storage 12 | - Displaying posts 13 | - Liking posts 14 | - Commenting/Replying 15 | - Follow user 16 | - Search users 17 | - Display followers, following, recent tweets 18 | - Edit User Profile 19 | - Show posts that have 1 hashtag 20 | - Dev Green 21 | - Notifications tab (replied to you, followed you, like your pic) 22 | 23 | ## Prerequisites 24 | 25 | Before setting up the project locally, ensure that you have the following installed: 26 | 27 | - Flutter SDK: [Install Flutter](https://flutter.dev/docs/get-started/install) 28 | - Dart: [Install Dart](https://dart.dev/get-dart) 29 | - Appwrite server: [Install Appwrite](https://appwrite.io/docs/installation) 30 | 31 | ## Setup 32 | 33 | Follow these steps to set up the project locally: 34 | 35 | 1. Clone the repository: 36 | 37 | ```bash 38 | git clone https://github.com/ommgh/devtown 39 | ``` 40 | 2. Navigate to the project directory: 41 | 42 | ```bash 43 | cd devtown 44 | ``` 45 | 3. Install the project dependencies: 46 | ```bash 47 | flutter pub get 48 | ``` 49 | 4. Create your Appwrite Cloud account from https://appwrite.io/ 50 | 51 | 5. Configure the Appwrite SDK in the Flutter project: 52 | 53 | - Open the lib/constants/appwrite_dependency.dart file. 54 | - Enter the required IDs for the placeholders. 55 | ```dart 56 | class AppwriteContants { 57 | static const String databaseID = " "; 58 | static const String projectID = " "; 59 | static const String endPoint = "https://cloud.appwrite.io/v1"; 60 | static const String userCollection = " "; 61 | static const String postCollection = " "; 62 | static const String imagesBucket = " "; 63 | static String imageurl(String imageId) => 64 | "$endPoint/storage/buckets/$imagesBucket/files/$imageId/view?project=$projectID&mode=admin"; 65 | } 66 | ``` 67 | 6. Run the app on your preferred device or emulator: 68 | ```bash 69 | flutter run 70 | ``` 71 | ## License 72 | This project is licensed under the MIT License. 73 | 74 | ## Tech Stack 75 | 76 | - Flutter: https://flutter.dev/ 77 | - Appwrite: https://appwrite.io/ 78 | - Riverpod: https://riverpod.dev/ 79 | 80 | ## Contact 81 | 82 | If you have any questions or suggestions, feel free to reach out to me at:- 83 | om.works01@gmail.com . 84 | 85 | 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /lib/features/home/view/home_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | import 'package:flutter_svg/flutter_svg.dart'; 5 | import 'package:todoapp/constants/constants.dart'; 6 | import 'package:todoapp/features/home/widgets/side_drawer.dart'; 7 | 8 | import 'package:todoapp/features/post/views/create_post_view.dart'; 9 | import 'package:todoapp/theme/pallet.dart'; 10 | 11 | class HomeView extends StatefulWidget { 12 | static route() => MaterialPageRoute( 13 | builder: (context) => const HomeView(), 14 | ); 15 | const HomeView({super.key}); 16 | 17 | @override 18 | State createState() => _HomeViewState(); 19 | } 20 | 21 | class _HomeViewState extends State { 22 | int _page = 0; 23 | final appBar = UIConstants.appBar(); 24 | 25 | void onPageChange(int index) { 26 | setState(() { 27 | _page = index; 28 | }); 29 | } 30 | 31 | onCreatePost() { 32 | Navigator.push(context, CreatePost.route()); 33 | } 34 | 35 | @override 36 | Widget build(BuildContext context) { 37 | return Scaffold( 38 | appBar: _page == 0 ? appBar : null, 39 | body: IndexedStack( 40 | index: _page, 41 | children: UIConstants.bottomTabBarPages, 42 | ), 43 | floatingActionButton: FloatingActionButton( 44 | onPressed: onCreatePost, 45 | child: const Icon( 46 | Icons.add, 47 | color: Pallete.whiteColor, 48 | size: 28, 49 | ), 50 | ), 51 | drawer: const SideDrawer(), 52 | bottomNavigationBar: CupertinoTabBar( 53 | currentIndex: _page, 54 | onTap: onPageChange, 55 | backgroundColor: Pallete.backgroundColor, 56 | items: [ 57 | BottomNavigationBarItem( 58 | icon: SvgPicture.asset( 59 | _page == 0 60 | ? AssetsConstants.homeFilled 61 | : AssetsConstants.homeOutlined, 62 | color: Pallete.whiteColor, 63 | ), 64 | ), 65 | BottomNavigationBarItem( 66 | icon: SvgPicture.asset( 67 | AssetsConstants.search, 68 | color: Pallete.whiteColor, 69 | ), 70 | ), 71 | BottomNavigationBarItem( 72 | icon: SvgPicture.asset( 73 | _page == 2 74 | ? AssetsConstants.notificationfilled 75 | : AssetsConstants.notificationoutlined, 76 | color: Pallete.whiteColor, 77 | ), 78 | ), 79 | ], 80 | ), 81 | ); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /lib/features/explore/views/explore_view.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ffi'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 5 | import 'package:todoapp/features/explore/controller/explore_controller.dart'; 6 | import 'package:todoapp/features/explore/widgets/search_tile.dart'; 7 | import 'package:todoapp/common/common.dart'; 8 | import 'package:todoapp/models/user_model.dart'; 9 | import 'package:todoapp/theme/pallet.dart'; 10 | 11 | class ExploreView extends ConsumerStatefulWidget { 12 | const ExploreView({super.key}); 13 | 14 | @override 15 | ConsumerState createState() => _ExploreViewState(); 16 | } 17 | 18 | class _ExploreViewState extends ConsumerState { 19 | final searchController = TextEditingController(); 20 | bool isShowUsers = false; 21 | 22 | @override 23 | void dispose() { 24 | super.dispose(); 25 | searchController.dispose(); 26 | } 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | final appBarTextFieldBorder = OutlineInputBorder( 31 | borderRadius: BorderRadius.circular(50), 32 | borderSide: const BorderSide( 33 | color: Pallete.searchBarColor, 34 | ), 35 | ); 36 | return Scaffold( 37 | appBar: AppBar( 38 | title: SizedBox( 39 | height: 50, 40 | child: TextField( 41 | controller: searchController, 42 | onSubmitted: (value) { 43 | setState(() { 44 | isShowUsers = true; 45 | }); 46 | }, 47 | decoration: InputDecoration( 48 | contentPadding: const EdgeInsets.all(20).copyWith( 49 | left: 20, 50 | ), 51 | hintText: "Search Devtown", 52 | fillColor: Pallete.searchBarColor, 53 | filled: true, 54 | enabledBorder: appBarTextFieldBorder, 55 | focusedBorder: appBarTextFieldBorder, 56 | ), 57 | ), 58 | ), 59 | ), 60 | body: isShowUsers 61 | ? ref.watch(searchUserProvider(searchController.text)).when( 62 | data: (users) { 63 | return ListView.builder( 64 | itemCount: users.length, 65 | itemBuilder: (BuildContext context, int index) { 66 | final user = users[index]; 67 | return SearchTile(userModel: user); 68 | }, 69 | ); 70 | }, 71 | error: (error, st) => ErrorText( 72 | error: error.toString(), 73 | ), 74 | loading: () => const Loader(), 75 | ) 76 | : const SizedBox(), 77 | ); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /lib/features/home/widgets/side_drawer.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:todoapp/features/auth/controller/auth_controller.dart'; 4 | import 'package:todoapp/common/loading_page.dart'; 5 | 6 | import 'package:todoapp/features/user_profile/controller/user_profile_controller.dart'; 7 | import 'package:todoapp/features/user_profile/views/user_profile_view.dart'; 8 | import 'package:todoapp/theme/pallet.dart'; 9 | 10 | class SideDrawer extends ConsumerWidget { 11 | const SideDrawer({super.key}); 12 | 13 | @override 14 | Widget build(BuildContext context, WidgetRef ref) { 15 | final currentUser = ref.watch(currentUserDetailsProvider).value; 16 | 17 | if (currentUser == null) { 18 | return const Loader(); 19 | } 20 | 21 | return SafeArea( 22 | child: Drawer( 23 | backgroundColor: Pallete.backgroundColor, 24 | child: Column( 25 | children: [ 26 | const SizedBox(height: 50), 27 | ListTile( 28 | leading: const Icon( 29 | Icons.person, 30 | size: 30, 31 | ), 32 | title: const Text( 33 | 'My Profile', 34 | style: TextStyle( 35 | fontSize: 22, 36 | ), 37 | ), 38 | onTap: () { 39 | Navigator.push( 40 | context, 41 | UserProfileView.route(currentUser), 42 | ); 43 | }, 44 | ), 45 | ListTile( 46 | leading: const Icon( 47 | Icons.payment, 48 | size: 30, 49 | ), 50 | title: const Text( 51 | 'Dev Green', 52 | style: TextStyle( 53 | fontSize: 22, 54 | ), 55 | ), 56 | onTap: () { 57 | //Payment or Other Verification 58 | ref 59 | .read(userProfileControllerProvider.notifier) 60 | .updateUserProfile( 61 | userModel: currentUser.copyWith(isTwitterBlue: true), 62 | context: context, 63 | bannerFile: null, 64 | profileFile: null, 65 | ); //Verification Logic 66 | }, 67 | ), 68 | ListTile( 69 | leading: const Icon( 70 | Icons.logout, 71 | size: 30, 72 | ), 73 | title: const Text( 74 | 'Log Out', 75 | style: TextStyle( 76 | fontSize: 22, 77 | ), 78 | ), 79 | onTap: () { 80 | ref.read(authControllerProvider.notifier).logout(context); 81 | }, 82 | ), 83 | ], 84 | ), 85 | ), 86 | ); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /lib/features/post/widgets/post_list.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:todoapp/features/post/controllers/post_controller.dart'; 4 | import 'package:todoapp/features/post/widgets/post_card.dart'; 5 | import 'package:todoapp/common/common.dart'; 6 | import 'package:todoapp/models/post_model.dart'; 7 | 8 | import '../../../constants/constants.dart'; 9 | 10 | class PostList extends ConsumerWidget { 11 | const PostList({super.key}); 12 | 13 | @override 14 | Widget build(BuildContext context, WidgetRef ref) { 15 | return ref.watch(getPostsProvider).when( 16 | data: (posts) { 17 | return ref.watch(getLatestPostProvider).when( 18 | data: (data) { 19 | if (data.events.contains( 20 | 'databases.*.collections.${AppwriteContants.postCollection}.documents.*.create', 21 | )) { 22 | posts.insert(0, Post.fromMap(data.payload)); 23 | } else if (data.events.contains( 24 | 'databases.*.collections.${AppwriteContants.postCollection}.documents.*.update', 25 | )) { 26 | final startingPoint = 27 | data.events[0].lastIndexOf('documents.'); 28 | final endPoint = data.events[0].lastIndexOf('.update'); 29 | final postId = data.events[0] 30 | .substring(startingPoint + 10, endPoint); 31 | 32 | var post = 33 | posts.where((element) => element.id == postId).first; 34 | 35 | final postIndex = posts.indexOf(post); 36 | posts.removeWhere((element) => element.id == postId); 37 | 38 | post = Post.fromMap(data.payload); 39 | posts.insert(postIndex, post); 40 | } 41 | 42 | return ListView.builder( 43 | itemCount: posts.length, 44 | itemBuilder: (BuildContext context, int index) { 45 | final post = posts[index]; 46 | return PostCard(post: post); 47 | }, 48 | ); 49 | }, 50 | error: (error, stackTrace) => ErrorText( 51 | error: error.toString(), 52 | ), 53 | loading: () { 54 | return ListView.builder( 55 | itemCount: posts.length, 56 | itemBuilder: (BuildContext context, int index) { 57 | final post = posts[index]; 58 | return PostCard(post: post); 59 | }, 60 | ); 61 | }, 62 | ); 63 | }, 64 | error: (error, stackTrace) => ErrorText( 65 | error: error.toString(), 66 | ), 67 | loading: () => const Loader(), 68 | ); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /lib/api/auth_api.dart: -------------------------------------------------------------------------------- 1 | import 'package:appwrite/appwrite.dart'; 2 | import 'package:appwrite/models.dart' as model; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | import 'package:fpdart/fpdart.dart'; 5 | import 'package:todoapp/core/core.dart'; 6 | import 'package:todoapp/core/providers.dart'; 7 | 8 | final authAPIProvider = Provider((ref) { 9 | final account = ref.watch(appwriteAccountProvider); 10 | return AuthAPI(account: account); 11 | }); 12 | 13 | //For creating a new user profile we use model.account 14 | abstract class IAuthAPI { 15 | FuturEither signUp({ 16 | required String email, 17 | required String password, 18 | }); 19 | 20 | FuturEither login({ 21 | required String email, 22 | required String password, 23 | }); 24 | Future currentUserAccount(); 25 | FuturEitherVoid logout(); 26 | } 27 | 28 | class AuthAPI implements IAuthAPI { 29 | final Account _account; 30 | AuthAPI({required Account account}) : _account = account; 31 | 32 | @override 33 | Future currentUserAccount() async { 34 | try { 35 | return await _account.get(); 36 | } on AppwriteException { 37 | return null; 38 | } catch (e) { 39 | return null; 40 | } 41 | } 42 | 43 | @override 44 | FuturEither signUp({ 45 | required String email, 46 | required String password, 47 | }) async { 48 | try { 49 | final account = await _account.create( 50 | userId: ID.unique(), 51 | email: email, 52 | password: password, 53 | ); 54 | return right(account); 55 | } on AppwriteException catch (e, stackTrace) { 56 | return left( 57 | Failure(e.message ?? "Something unexpected happened ", stackTrace), 58 | ); 59 | } catch (e, stackTrace) { 60 | return left( 61 | Failure(e.toString(), stackTrace), 62 | ); 63 | } 64 | } 65 | 66 | @override 67 | FuturEither login({ 68 | required String email, 69 | required String password, 70 | }) async { 71 | try { 72 | final session = await _account.createEmailSession( 73 | email: email, 74 | password: password, 75 | ); 76 | return right(session); 77 | } on AppwriteException catch (e, stackTrace) { 78 | return left( 79 | Failure(e.message ?? "Something unexpected happened ", stackTrace), 80 | ); 81 | } catch (e, stackTrace) { 82 | return left( 83 | Failure(e.toString(), stackTrace), 84 | ); 85 | } 86 | } 87 | 88 | @override 89 | FuturEitherVoid logout() async { 90 | try { 91 | await _account.deleteSession( 92 | sessionId: 'current', 93 | ); 94 | return right(null); 95 | } on AppwriteException catch (e, stackTrace) { 96 | return left( 97 | Failure(e.message ?? "Something unexpected happened ", stackTrace), 98 | ); 99 | } catch (e, stackTrace) { 100 | return left( 101 | Failure(e.toString(), stackTrace), 102 | ); 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /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/features/notifications/views/notification_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:todoapp/constants/appwrite_dependency.dart'; 4 | import 'package:todoapp/common/common.dart'; 5 | import 'package:todoapp/features/auth/controller/auth_controller.dart'; 6 | import 'package:todoapp/features/notifications/controller/notification_controller.dart'; 7 | import 'package:todoapp/features/notifications/widgets/notification_tile.dart'; 8 | import 'package:todoapp/models/notification_model.dart' as model; 9 | 10 | class NotificationView extends ConsumerWidget { 11 | const NotificationView({super.key}); 12 | 13 | @override 14 | Widget build(BuildContext context, WidgetRef ref) { 15 | final currentUser = ref.watch(currentUserDetailsProvider).value; 16 | 17 | return Scaffold( 18 | appBar: AppBar( 19 | title: const Text('Notifications'), 20 | ), 21 | body: currentUser == null 22 | ? const Loader() 23 | : ref.watch(getNotificationsProvider(currentUser.uid)).when( 24 | data: (notifications) { 25 | return ref.watch(getLatestNotificationProvider).when( 26 | data: (data) { 27 | if (data.events.contains( 28 | 'databases.*.collections.${AppwriteContants.notificationCollection}.documents.*.create', 29 | )) { 30 | final latestNotif = 31 | model.Notification.fromMap(data.payload); 32 | if (latestNotif.uid == currentUser.uid) { 33 | notifications.insert(0, latestNotif); 34 | } 35 | } 36 | 37 | return ListView.builder( 38 | itemCount: notifications.length, 39 | itemBuilder: (BuildContext context, int index) { 40 | final notification = notifications[index]; 41 | return NotificationTile( 42 | notification: notification, 43 | ); 44 | }, 45 | ); 46 | }, 47 | error: (error, stackTrace) => ErrorText( 48 | error: error.toString(), 49 | ), 50 | loading: () { 51 | return ListView.builder( 52 | itemCount: notifications.length, 53 | itemBuilder: (BuildContext context, int index) { 54 | final notification = notifications[index]; 55 | return NotificationTile( 56 | notification: notification, 57 | ); 58 | }, 59 | ); 60 | }, 61 | ); 62 | }, 63 | error: (error, stackTrace) => ErrorText( 64 | error: error.toString(), 65 | ), 66 | loading: () => const Loader(), 67 | ), 68 | ); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /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", "todoapp" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "todoapp" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2023 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "todoapp.exe" "\0" 98 | VALUE "ProductName", "todoapp" "\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 | -------------------------------------------------------------------------------- /lib/models/user_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | 3 | @immutable 4 | class UserModel { 5 | final String email; 6 | final String name; 7 | final String uid; 8 | final List followers; 9 | final List following; 10 | final String profilePic; 11 | final String bannerPic; 12 | final String bio; 13 | final bool isTwitterBlue; 14 | const UserModel({ 15 | required this.email, 16 | required this.name, 17 | required this.uid, 18 | required this.followers, 19 | required this.following, 20 | required this.profilePic, 21 | required this.bannerPic, 22 | required this.bio, 23 | required this.isTwitterBlue, 24 | }); 25 | //UserModel user = UserModel(name : 'Om', ...); 26 | //User.copywith(name : 'Om Mishra'); 27 | 28 | UserModel copyWith({ 29 | String? email, 30 | String? name, 31 | String? uid, 32 | List? followers, 33 | List? following, 34 | String? profilePic, 35 | String? bannerPic, 36 | String? bio, 37 | bool? isTwitterBlue, 38 | }) { 39 | return UserModel( 40 | email: email ?? this.email, 41 | name: name ?? this.name, 42 | uid: uid ?? this.uid, 43 | followers: followers ?? this.followers, 44 | following: following ?? this.following, 45 | profilePic: profilePic ?? this.profilePic, 46 | bannerPic: bannerPic ?? this.bannerPic, 47 | bio: bio ?? this.bio, 48 | isTwitterBlue: isTwitterBlue ?? this.isTwitterBlue, 49 | ); 50 | } 51 | 52 | Map toMap() { 53 | final result = {}; 54 | 55 | result.addAll({'email': email}); 56 | result.addAll({'name': name}); 57 | result.addAll({'followers': followers}); 58 | result.addAll({'following': following}); 59 | result.addAll({'profilePic': profilePic}); 60 | result.addAll({'bannerPic': bannerPic}); 61 | result.addAll({'bio': bio}); 62 | result.addAll({'isTwitterBlue': isTwitterBlue}); 63 | 64 | return result; 65 | } 66 | 67 | factory UserModel.fromMap(Map map) { 68 | return UserModel( 69 | email: map['email'] ?? '', 70 | name: map['name'] ?? '', 71 | uid: map['\$id'] ?? '', 72 | followers: List.from(map['followers']), 73 | following: List.from(map['following']), 74 | profilePic: map['profilePic'] ?? '', 75 | bannerPic: map['bannerPic'] ?? '', 76 | bio: map['bio'] ?? '', 77 | isTwitterBlue: map['isTwitterBlue'] ?? false, 78 | ); 79 | } 80 | 81 | @override 82 | String toString() { 83 | return 'UserModel(email: $email, name: $name, followers: $followers, following: $following, profilePic: $profilePic, bannerPic: $bannerPic, uid: $uid, bio: $bio, isTwitterBlue: $isTwitterBlue)'; 84 | } 85 | 86 | @override 87 | bool operator ==(Object other) { 88 | if (identical(this, other)) return true; 89 | 90 | return other is UserModel && 91 | other.email == email && 92 | other.name == name && 93 | other.uid == uid && 94 | listEquals(other.followers, followers) && 95 | listEquals(other.following, following) && 96 | other.profilePic == profilePic && 97 | other.bannerPic == bannerPic && 98 | other.bio == bio && 99 | other.isTwitterBlue == isTwitterBlue; 100 | } 101 | 102 | @override 103 | int get hashCode { 104 | return email.hashCode ^ 105 | name.hashCode ^ 106 | uid.hashCode ^ 107 | followers.hashCode ^ 108 | following.hashCode ^ 109 | profilePic.hashCode ^ 110 | bannerPic.hashCode ^ 111 | bio.hashCode ^ 112 | isTwitterBlue.hashCode; 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /lib/features/auth/controller/auth_controller.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:todoapp/features/auth/view/login_view.dart'; 4 | import 'package:todoapp/features/auth/view/signup_view.dart'; 5 | import 'package:todoapp/features/home/view/home_view.dart'; 6 | import 'package:todoapp/api/auth_api.dart'; 7 | import 'package:todoapp/api/user_api.dart'; 8 | import 'package:todoapp/core/ustils.dart'; 9 | import 'package:appwrite/models.dart' as model; 10 | import 'package:todoapp/models/user_model.dart'; 11 | 12 | final authControllerProvider = 13 | StateNotifierProvider((ref) { 14 | return Authcontroller( 15 | userAPI: ref.watch(userAPIProvider), 16 | authAPI: ref.watch(authAPIProvider), 17 | ); 18 | }); 19 | 20 | final currentUserDetailsProvider = FutureProvider((ref) { 21 | final currentUserID = ref.watch(currentUserAccountProvider).value!.$id; 22 | final userDetails = ref.watch(userDetailsProvider(currentUserID)); 23 | return userDetails.value; 24 | }); 25 | 26 | final userDetailsProvider = FutureProvider.family((ref, String uid) { 27 | final authController = ref.watch(authControllerProvider.notifier); 28 | return authController.getUserData(uid); 29 | }); 30 | 31 | final currentUserAccountProvider = FutureProvider((ref) { 32 | final authController = ref.watch(authControllerProvider.notifier); 33 | return authController.currentUser(); 34 | }); 35 | 36 | class Authcontroller extends StateNotifier { 37 | final AuthAPI _authAPI; 38 | final UserAPI _userAPI; 39 | Authcontroller({ 40 | required AuthAPI authAPI, 41 | required UserAPI userAPI, 42 | }) : _authAPI = authAPI, 43 | _userAPI = userAPI, 44 | super(false); 45 | //Loading(While Saving data to appwrite dashboard) 46 | 47 | Future currentUser() => _authAPI.currentUserAccount(); 48 | 49 | void signUp({ 50 | required String email, 51 | required String password, 52 | required BuildContext context, 53 | }) async { 54 | state = true; 55 | final res = await _authAPI.signUp( 56 | email: email, 57 | password: password, 58 | ); 59 | state = false; 60 | res.fold( 61 | (l) => showSnackBar(context, l.message), 62 | (r) async { 63 | UserModel userModel = UserModel( 64 | email: email, 65 | name: getNameFromEmail(email), 66 | uid: r.$id, 67 | followers: const [], 68 | following: const [], 69 | profilePic: '', 70 | bannerPic: '', 71 | bio: '', 72 | isTwitterBlue: false, 73 | ); 74 | final res2 = await _userAPI.saveUserData(userModel); 75 | res2.fold((l) => showSnackBar(context, l.message), (r) { 76 | showSnackBar(context, "SignUp Sucessful, Please Login"); 77 | Navigator.push(context, LoginView.route()); 78 | }); 79 | }, 80 | ); 81 | } 82 | 83 | void login({ 84 | required String email, 85 | required String password, 86 | required BuildContext context, 87 | }) async { 88 | state = true; 89 | final res = await _authAPI.login( 90 | email: email, 91 | password: password, 92 | ); 93 | state = false; 94 | res.fold( 95 | (l) => showSnackBar(context, l.message), 96 | (r) { 97 | Navigator.push(context, HomeView.route()); 98 | }, 99 | ); 100 | } 101 | 102 | Future getUserData(String uid) async { 103 | final document = await _userAPI.getUserData(uid); 104 | final updatedUser = UserModel.fromMap(document.data); 105 | return updatedUser; 106 | } 107 | 108 | void logout(BuildContext context) async { 109 | final res = await _authAPI.logout(); 110 | res.fold((l) => null, (r) { 111 | Navigator.pushAndRemoveUntil( 112 | context, 113 | SignUpView.route(), 114 | (route) => false, 115 | ); 116 | }); 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /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, "todoapp"); 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, "todoapp"); 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/features/auth/view/login_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/gestures.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | import 'package:todoapp/constants/constants.dart'; 5 | import 'package:todoapp/features/auth/view/signup_view.dart'; 6 | import 'package:todoapp/features/auth/widgets/auth_field.dart'; 7 | import 'package:todoapp/common/loading_page.dart'; 8 | import 'package:todoapp/common/rounded_small_button.dart'; 9 | import 'package:todoapp/theme/pallet.dart'; 10 | import '../controller/auth_controller.dart'; 11 | 12 | class LoginView extends ConsumerStatefulWidget { 13 | static route() => MaterialPageRoute( 14 | builder: (context) => const LoginView(), 15 | ); 16 | const LoginView({super.key}); 17 | 18 | @override 19 | ConsumerState createState() => _LoginViewState(); 20 | } 21 | 22 | class _LoginViewState extends ConsumerState { 23 | final appbar = UIConstants.appBar(); 24 | final emailController = TextEditingController(); 25 | final passwordController = TextEditingController(); 26 | 27 | @override 28 | void dispose() { 29 | super.dispose(); 30 | emailController.dispose(); 31 | passwordController.dispose(); 32 | } 33 | 34 | void onLogin() { 35 | ref.read(authControllerProvider.notifier).login( 36 | email: emailController.text, 37 | password: passwordController.text, 38 | context: context, 39 | ); 40 | } 41 | 42 | @override 43 | Widget build(BuildContext context) { 44 | final isLoading = ref.watch(authControllerProvider); 45 | return Scaffold( 46 | appBar: appbar, 47 | body: isLoading 48 | ? const Loader() 49 | : Center( 50 | child: SingleChildScrollView( 51 | child: Padding( 52 | padding: const EdgeInsets.symmetric(horizontal: 20), 53 | child: Column( 54 | children: [ 55 | //textfield1 56 | AuthField( 57 | controller: emailController, 58 | hintText: "E-mail", 59 | ), 60 | const SizedBox(height: 25), 61 | //textfield2 62 | AuthField( 63 | controller: passwordController, 64 | hintText: "Password", 65 | ), 66 | const SizedBox(height: 25), 67 | Align( 68 | alignment: Alignment.topRight, 69 | child: RoundedSmallButton( 70 | onTap: onLogin, 71 | label: "Login", 72 | backgroundColor: Pallete.whiteColor, 73 | textColor: Pallete.backgroundColor, 74 | ), 75 | ), 76 | const SizedBox(height: 25), 77 | RichText( 78 | text: TextSpan( 79 | text: "Dont have an account?", 80 | style: const TextStyle( 81 | fontSize: 16, 82 | ), 83 | children: [ 84 | TextSpan( 85 | text: " SignUp", 86 | style: const TextStyle( 87 | color: Pallete.greencolor, 88 | fontSize: 16, 89 | ), 90 | recognizer: TapGestureRecognizer() 91 | ..onTap = () { 92 | Navigator.push( 93 | context, 94 | SignUpView.route(), 95 | ); 96 | }, 97 | ), 98 | ], 99 | ), 100 | ), 101 | ], 102 | ), 103 | ), 104 | ), 105 | ), 106 | ); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /lib/features/user_profile/controller/user_profile_controller.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | import 'package:flutter/widgets.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | import 'package:todoapp/features/notifications/controller/notification_controller.dart'; 5 | import 'package:todoapp/api/post_api.dart'; 6 | import 'package:todoapp/api/storage_api.dart'; 7 | import 'package:todoapp/api/user_api.dart'; 8 | import 'package:todoapp/core/enums/notification_type_enum.dart'; 9 | import 'package:todoapp/core/ustils.dart'; 10 | import 'package:todoapp/models/post_model.dart'; 11 | import 'package:todoapp/models/user_model.dart'; 12 | 13 | final userProfileControllerProvider = 14 | StateNotifierProvider((ref) { 15 | return UserProfileController( 16 | postAPI: ref.watch(postAPIProvider), 17 | storageAPI: ref.watch(storageAPIProvider), 18 | userAPI: ref.watch(userAPIProvider), 19 | notificationController: ref.watch(notificationControllerProvider.notifier), 20 | ); 21 | }); 22 | 23 | final getUserPostsProvider = FutureProvider.family((ref, String uid) async { 24 | final userProfileController = 25 | ref.watch(userProfileControllerProvider.notifier); 26 | return userProfileController.getUserPosts(uid); 27 | }); 28 | 29 | final getLatestUserProfileDataProvider = StreamProvider((ref) { 30 | final userAPI = ref.watch(userAPIProvider); 31 | return userAPI.getLatestUserProfileData(); 32 | }); 33 | 34 | class UserProfileController extends StateNotifier { 35 | final PostAPI _postAPI; 36 | final StorageAPI _storageAPI; 37 | final UserAPI _userAPI; 38 | final NotificationController _notificationController; 39 | 40 | UserProfileController({ 41 | required PostAPI postAPI, 42 | required StorageAPI storageAPI, 43 | required UserAPI userAPI, 44 | required NotificationController notificationController, 45 | }) : _postAPI = postAPI, 46 | _storageAPI = storageAPI, 47 | _userAPI = userAPI, 48 | _notificationController = notificationController, 49 | super(false); 50 | 51 | Future> getUserPosts(String uid) async { 52 | final posts = await _postAPI.getUserPosts(uid); 53 | return posts.map((e) => Post.fromMap(e.data)).toList(); 54 | } 55 | 56 | void updateUserProfile({ 57 | required UserModel userModel, 58 | required BuildContext context, 59 | required File? bannerFile, 60 | required File? profileFile, 61 | }) async { 62 | state = true; 63 | if (bannerFile != null) { 64 | final bannerUrl = await _storageAPI.uploadImage([bannerFile]); 65 | userModel = userModel.copyWith( 66 | bannerPic: bannerUrl[0], 67 | ); 68 | } 69 | 70 | if (profileFile != null) { 71 | final profileUrl = await _storageAPI.uploadImage([profileFile]); 72 | userModel = userModel.copyWith( 73 | profilePic: profileUrl[0], 74 | ); 75 | } 76 | 77 | final res = await _userAPI.updateUserData(userModel); 78 | state = false; 79 | res.fold( 80 | (l) => showSnackBar(context, l.message), 81 | (r) => Navigator.pop(context), 82 | ); 83 | } 84 | 85 | void followUser({ 86 | required UserModel user, 87 | required BuildContext context, 88 | required UserModel currentUser, 89 | }) async { 90 | if (currentUser.following.contains(user.uid)) { 91 | user.followers.remove(currentUser.uid); 92 | currentUser.following.remove(user.uid); 93 | } else { 94 | user.followers.add(currentUser.uid); 95 | currentUser.following.add(user.uid); 96 | } 97 | user = user.copyWith(followers: user.followers); 98 | currentUser = currentUser.copyWith( 99 | following: currentUser.following, 100 | ); 101 | 102 | final res = await _userAPI.followUser(user); 103 | res.fold((l) => showSnackBar(context, l.message), (r) async { 104 | final res2 = await _userAPI.addToFollowing(currentUser); 105 | res2.fold((l) => showSnackBar(context, l.message), (r) { 106 | _notificationController.createNotification( 107 | text: '${currentUser.name} followed you', 108 | postId: '', 109 | notificationType: NotificationType.follow, 110 | uid: user.uid, 111 | ); 112 | }); 113 | }); 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.14) 3 | project(todoapp 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 "todoapp") 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/features/auth/view/signup_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/gestures.dart'; 3 | import 'package:flutter_svg/flutter_svg.dart'; 4 | import 'package:todoapp/constants/constants.dart'; 5 | import 'package:todoapp/features/auth/controller/auth_controller.dart'; 6 | import 'package:todoapp/features/auth/view/login_view.dart'; 7 | import 'package:todoapp/features/auth/widgets/auth_field.dart'; 8 | import 'package:todoapp/common/common.dart'; 9 | import 'package:todoapp/common/loading_page.dart'; 10 | import 'package:todoapp/theme/pallet.dart'; 11 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 12 | 13 | class SignUpView extends ConsumerStatefulWidget { 14 | static route() => MaterialPageRoute( 15 | builder: (context) => const SignUpView(), 16 | ); 17 | 18 | const SignUpView({super.key}); 19 | 20 | @override 21 | ConsumerState createState() => _SignUpViewState(); 22 | } 23 | 24 | class _SignUpViewState extends ConsumerState { 25 | final appbar = UIConstants.appBar(); 26 | final emailController = TextEditingController(); 27 | final passwordController = TextEditingController(); 28 | 29 | @override 30 | void dispose() { 31 | super.dispose(); 32 | emailController.dispose(); 33 | passwordController.dispose(); 34 | } 35 | 36 | void onSignUp() { 37 | final res = ref.read(authControllerProvider.notifier).signUp( 38 | email: emailController.text, 39 | password: passwordController.text, 40 | context: context, 41 | ); 42 | } 43 | 44 | @override 45 | Widget build(BuildContext context) { 46 | final isLoading = ref.watch(authControllerProvider); 47 | return Scaffold( 48 | appBar: appbar, 49 | body: isLoading 50 | ? const Loader() 51 | : Center( 52 | child: SingleChildScrollView( 53 | child: Padding( 54 | padding: const EdgeInsets.symmetric(horizontal: 20), 55 | child: Column( 56 | children: [ 57 | //textfield1 58 | AuthField( 59 | controller: emailController, 60 | hintText: "E-mail", 61 | ), 62 | const SizedBox(height: 25), 63 | //textfield2 64 | AuthField( 65 | controller: passwordController, 66 | hintText: "Password", 67 | ), 68 | const SizedBox(height: 25), 69 | Align( 70 | alignment: Alignment.topRight, 71 | child: RoundedSmallButton( 72 | onTap: onSignUp, 73 | label: "SignUp", 74 | backgroundColor: Pallete.whiteColor, 75 | textColor: Pallete.backgroundColor, 76 | ), 77 | ), 78 | 79 | const SizedBox(height: 25), 80 | RichText( 81 | text: TextSpan( 82 | text: "Already have an account?", 83 | style: const TextStyle( 84 | fontSize: 16, 85 | ), 86 | children: [ 87 | TextSpan( 88 | text: " LogIn", 89 | style: const TextStyle( 90 | color: Pallete.greencolor, 91 | fontSize: 16, 92 | ), 93 | recognizer: TapGestureRecognizer() 94 | ..onTap = () { 95 | Navigator.push( 96 | context, 97 | LoginView.route(), 98 | ); 99 | }, 100 | ), 101 | ], 102 | ), 103 | ), 104 | ], 105 | ), 106 | ), 107 | ), 108 | ), 109 | ); 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: todoapp 2 | description: A new Flutter project. 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `flutter pub publish`. This is preferred for private packages. 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | # In Windows, build-name is used as the major, minor, and patch parts 19 | # of the product and file versions while build-number is used as the build suffix. 20 | version: 1.0.0+1 21 | 22 | environment: 23 | sdk: '>=2.18.6 <3.0.0' 24 | 25 | # Dependencies specify other packages that your package needs in order to work. 26 | # To automatically upgrade your package dependencies to the latest versions 27 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 28 | # dependencies can be manually updated by changing the version numbers below to 29 | # the latest version available on pub.dev. To see which dependencies have newer 30 | # versions available, run `flutter pub outdated`. 31 | dependencies: 32 | flutter: 33 | sdk: flutter 34 | 35 | 36 | # The following adds the Cupertino Icons font to your application. 37 | # Use with the CupertinoIcons class for iOS style icons. 38 | cupertino_icons: ^1.0.2 39 | appwrite: ^8.2.0 40 | flutter_svg: ^1.1.6 41 | flutter_riverpod: ^2.3.6 42 | fpdart: ^0.5.0 43 | image_picker: ^0.8.7+5 44 | carousel_slider: ^4.2.1 45 | timeago: ^3.4.0 46 | any_link_preview: ^3.0.0 47 | like_button: ^2.0.5 48 | google_fonts: ^4.0.4 49 | 50 | dev_dependencies: 51 | flutter_test: 52 | sdk: flutter 53 | 54 | # The "flutter_lints" package below contains a set of recommended lints to 55 | # encourage good coding practices. The lint set provided by the package is 56 | # activated in the `analysis_options.yaml` file located at the root of your 57 | # package. See that file for information about deactivating specific lint 58 | # rules and activating additional ones. 59 | flutter_lints: ^2.0.0 60 | 61 | # For information on the generic Dart part of this file, see the 62 | # following page: https://dart.dev/tools/pub/pubspec 63 | 64 | # The following section is specific to Flutter packages. 65 | flutter: 66 | 67 | # The following line ensures that the Material Icons font is 68 | # included with your application, so that you can use the icons in 69 | # the material Icons class. 70 | uses-material-design: true 71 | 72 | # To add assets to your application, add an assets section, like this: 73 | assets: 74 | - assets/svgs/ 75 | 76 | 77 | # An image asset can refer to one or more resolution-specific "variants", see 78 | # https://flutter.dev/assets-and-images/#resolution-aware 79 | 80 | # For details regarding adding assets from package dependencies, see 81 | # https://flutter.dev/assets-and-images/#from-packages 82 | 83 | # To add custom fonts to your application, add a fonts section here, 84 | # in this "flutter" section. Each entry in this list should have a 85 | # "family" key with the font family name, and a "fonts" key with a 86 | # list giving the asset and other descriptors for the font. For 87 | # example: 88 | # fonts: 89 | # - family: Schyler 90 | # fonts: 91 | # - asset: fonts/Schyler-Regular.ttf 92 | # - asset: fonts/Schyler-Italic.ttf 93 | # style: italic 94 | # - family: Trajan Pro 95 | # fonts: 96 | # - asset: fonts/TrajanPro.ttf 97 | # - asset: fonts/TrajanPro_Bold.ttf 98 | # weight: 700 99 | # 100 | # For details regarding fonts from package dependencies, 101 | # see https://flutter.dev/custom-fonts/#from-packages 102 | -------------------------------------------------------------------------------- /lib/api/post_api.dart: -------------------------------------------------------------------------------- 1 | import 'package:appwrite/appwrite.dart'; 2 | import 'package:appwrite/models.dart'; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | import 'package:fpdart/fpdart.dart'; 5 | 6 | import 'package:todoapp/core/core.dart'; 7 | import 'package:todoapp/core/providers.dart'; 8 | import 'package:todoapp/models/post_model.dart'; 9 | 10 | import '../constants/constants.dart'; 11 | 12 | final postAPIProvider = Provider((ref) { 13 | return PostAPI( 14 | realtime: ref.watch(appwriteRealtimeProvider), 15 | db: ref.watch(appwriteDatabaseProvider), 16 | ); 17 | }); 18 | 19 | abstract class IPostAPI { 20 | FuturEither sharePost(Post post); 21 | Future> getPosts(); 22 | Stream getLatestPost(); 23 | FuturEither likePost(Post post); 24 | Future> getRepliesToPost(Post post); 25 | Future getPostById(String id); 26 | Future> getUserPosts(String uid); 27 | Future> getPostsByHashtags(String hashtag); 28 | } 29 | 30 | class PostAPI implements IPostAPI { 31 | final Databases _db; 32 | final Realtime _realtime; 33 | PostAPI({required Databases db, required Realtime realtime}) 34 | : _db = db, 35 | _realtime = realtime; 36 | 37 | @override 38 | FuturEither sharePost(Post post) async { 39 | try { 40 | final document = await _db.createDocument( 41 | databaseId: AppwriteContants.databaseID, 42 | collectionId: AppwriteContants.postCollection, 43 | documentId: ID.unique(), 44 | data: post.toMap(), 45 | ); 46 | return right(document); 47 | } on AppwriteException catch (e, st) { 48 | return left( 49 | Failure( 50 | e.message ?? 'Some unexpected error occurred', 51 | st, 52 | ), 53 | ); 54 | } catch (e, st) { 55 | return left(Failure(e.toString(), st)); 56 | } 57 | } 58 | 59 | @override 60 | Future> getPosts() async { 61 | final documents = await _db.listDocuments( 62 | databaseId: AppwriteContants.databaseID, 63 | collectionId: AppwriteContants.postCollection, 64 | queries: [ 65 | Query.orderDesc('postedAt'), 66 | ], //if index in appwrite db don't workout remove Query 67 | ); 68 | return documents.documents; 69 | } 70 | 71 | @override 72 | Stream getLatestPost() { 73 | return _realtime.subscribe([ 74 | 'databases.${AppwriteContants.databaseID}.collections.${AppwriteContants.postCollection}.documents' 75 | ]).stream; 76 | } 77 | 78 | @override 79 | FuturEither likePost(Post post) async { 80 | //liking function needs to be updated 81 | try { 82 | final document = await _db.updateDocument( 83 | databaseId: AppwriteContants.databaseID, 84 | collectionId: AppwriteContants.postCollection, 85 | documentId: post.id, 86 | data: { 87 | 'likes': post.likes, 88 | }, 89 | ); 90 | return right(document); 91 | } on AppwriteException catch (e, st) { 92 | return left( 93 | Failure( 94 | e.message ?? 'Some unexpected error occurred', 95 | st, 96 | ), 97 | ); 98 | } catch (e, st) { 99 | return left(Failure(e.toString(), st)); 100 | } 101 | } 102 | 103 | @override 104 | Future> getRepliesToPost(Post post) async { 105 | final document = await _db.listDocuments( 106 | databaseId: AppwriteContants.databaseID, 107 | collectionId: AppwriteContants.postCollection, 108 | queries: [ 109 | Query.equal( 110 | 'repliedTo', 111 | post.id, 112 | ), 113 | ], 114 | ); 115 | return document.documents; 116 | } 117 | 118 | @override 119 | Future getPostById(String id) async { 120 | return _db.getDocument( 121 | databaseId: AppwriteContants.databaseID, 122 | collectionId: AppwriteContants.postCollection, 123 | documentId: id, 124 | ); 125 | } 126 | 127 | @override 128 | Future> getUserPosts(String uid) async { 129 | final documents = await _db.listDocuments( 130 | databaseId: AppwriteContants.databaseID, 131 | collectionId: AppwriteContants.postCollection, 132 | queries: [ 133 | Query.equal('uid', uid), 134 | ], 135 | ); 136 | return documents.documents; 137 | } 138 | 139 | @override 140 | Future> getPostsByHashtags(String hashtag) async { 141 | final documents = await _db.listDocuments( 142 | databaseId: AppwriteContants.databaseID, 143 | collectionId: AppwriteContants.postCollection, 144 | queries: [ 145 | Query.search('hashtags', hashtag), 146 | ], 147 | ); 148 | return documents.documents; 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /lib/api/user_api.dart: -------------------------------------------------------------------------------- 1 | import 'package:appwrite/appwrite.dart'; 2 | import 'package:appwrite/models.dart' as model; 3 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 4 | import 'package:fpdart/fpdart.dart'; 5 | import 'package:todoapp/constants/appwrite_dependency.dart'; 6 | import 'package:todoapp/core/core.dart'; 7 | import 'package:todoapp/core/providers.dart'; 8 | import 'package:todoapp/models/user_model.dart'; 9 | 10 | final userAPIProvider = Provider((ref) { 11 | return UserAPI( 12 | db: ref.watch(appwriteDatabaseProvider), 13 | realtime: ref.watch(appwriteRealtimeProvider), 14 | ); 15 | }); 16 | 17 | abstract class IUserAPI { 18 | FuturEitherVoid saveUserData(UserModel userModel); 19 | Future getUserData(String uid); 20 | Future> searchUserByName(String name); 21 | FuturEitherVoid updateUserData(UserModel userModel); 22 | Stream getLatestUserProfileData(); 23 | FuturEitherVoid followUser(UserModel user); 24 | FuturEitherVoid addToFollowing(UserModel user); 25 | } 26 | 27 | class UserAPI implements IUserAPI { 28 | final Databases _db; 29 | final Realtime _realtime; 30 | UserAPI({ 31 | required Databases db, 32 | required Realtime realtime, 33 | }) : _realtime = realtime, 34 | _db = db; 35 | 36 | @override 37 | FuturEitherVoid saveUserData(UserModel userModel) async { 38 | try { 39 | await _db.createDocument( 40 | databaseId: AppwriteContants.databaseID, 41 | collectionId: AppwriteContants.userCollection, 42 | documentId: userModel.uid, 43 | data: userModel.toMap(), 44 | ); 45 | return right(null); 46 | } on AppwriteException catch (e, st) { 47 | return left( 48 | Failure( 49 | e.message ?? 'Some Unexpected Error Occured', 50 | st, 51 | ), 52 | ); 53 | } catch (e, st) { 54 | return left(Failure(e.toString(), st)); 55 | } 56 | } 57 | 58 | @override 59 | Future getUserData(String uid) { 60 | return _db.getDocument( 61 | databaseId: AppwriteContants.databaseID, 62 | collectionId: AppwriteContants.userCollection, 63 | documentId: uid, 64 | ); 65 | } 66 | 67 | @override 68 | Future> searchUserByName(String name) async { 69 | final documents = await _db.listDocuments( 70 | databaseId: AppwriteContants.databaseID, 71 | collectionId: AppwriteContants.userCollection, 72 | queries: [ 73 | Query.search('name', name), 74 | ], 75 | ); 76 | 77 | return documents.documents; 78 | } 79 | 80 | @override 81 | FuturEitherVoid updateUserData(UserModel userModel) async { 82 | try { 83 | await _db.updateDocument( 84 | databaseId: AppwriteContants.databaseID, 85 | collectionId: AppwriteContants.userCollection, 86 | documentId: userModel.uid, 87 | data: userModel.toMap(), 88 | ); 89 | return right(null); 90 | } on AppwriteException catch (e, st) { 91 | return left( 92 | Failure( 93 | e.message ?? 'Some Unexpected Error Occured', 94 | st, 95 | ), 96 | ); 97 | } catch (e, st) { 98 | return left(Failure(e.toString(), st)); 99 | } 100 | } 101 | 102 | @override 103 | Stream getLatestUserProfileData() { 104 | return _realtime.subscribe([ 105 | 'databases.${AppwriteContants.databaseID}.collections.${AppwriteContants.userCollection}.documents' 106 | ]).stream; 107 | } 108 | 109 | @override 110 | FuturEitherVoid followUser(UserModel user) async { 111 | try { 112 | await _db.updateDocument( 113 | databaseId: AppwriteContants.databaseID, 114 | collectionId: AppwriteContants.userCollection, 115 | documentId: user.uid, 116 | data: { 117 | 'followers': user.followers, 118 | }, 119 | ); 120 | return right(null); 121 | } on AppwriteException catch (e, st) { 122 | return left( 123 | Failure( 124 | e.message ?? 'Some Unexpected Error Occured', 125 | st, 126 | ), 127 | ); 128 | } catch (e, st) { 129 | return left(Failure(e.toString(), st)); 130 | } 131 | } 132 | 133 | @override 134 | FuturEitherVoid addToFollowing(UserModel user) async { 135 | try { 136 | await _db.updateDocument( 137 | databaseId: AppwriteContants.databaseID, 138 | collectionId: AppwriteContants.userCollection, 139 | documentId: user.uid, 140 | data: { 141 | 'following': user.following, 142 | }, 143 | ); 144 | return right(null); 145 | } on AppwriteException catch (e, st) { 146 | return left( 147 | Failure( 148 | e.message ?? 'Some Unexpected Error Occured', 149 | st, 150 | ), 151 | ); 152 | } catch (e, st) { 153 | return left(Failure(e.toString(), st)); 154 | } 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /lib/models/post_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:todoapp/core/enums/post_type.dart'; 3 | 4 | @immutable 5 | class Post { 6 | final String text; 7 | final List hashtags; 8 | final String link; 9 | final List imageLinks; 10 | final String uid; 11 | final PostType postType; 12 | final DateTime postedAt; 13 | final List likes; 14 | final List commentIds; 15 | final String id; 16 | final int reshareCount; 17 | //final String repostedBy; 18 | final String repliedTo; 19 | const Post({ 20 | required this.text, 21 | required this.hashtags, 22 | required this.link, 23 | required this.imageLinks, 24 | required this.uid, 25 | required this.postType, 26 | required this.postedAt, 27 | required this.likes, 28 | required this.commentIds, 29 | required this.id, 30 | required this.reshareCount, 31 | //required this.repostedBy, 32 | required this.repliedTo, 33 | }); 34 | 35 | Post copyWith({ 36 | String? text, 37 | List? hashtags, 38 | String? link, 39 | List? imageLinks, 40 | String? uid, 41 | PostType? postType, 42 | DateTime? postedAt, 43 | List? likes, 44 | List? commentIds, 45 | String? id, 46 | int? reshareCount, 47 | //String? repostedBy, 48 | String? repliedTo, 49 | }) { 50 | return Post( 51 | text: text ?? this.text, 52 | hashtags: hashtags ?? this.hashtags, 53 | link: link ?? this.link, 54 | imageLinks: imageLinks ?? this.imageLinks, 55 | uid: uid ?? this.uid, 56 | postType: postType ?? this.postType, 57 | postedAt: postedAt ?? this.postedAt, 58 | likes: likes ?? this.likes, 59 | commentIds: commentIds ?? this.commentIds, 60 | id: id ?? this.id, 61 | reshareCount: reshareCount ?? this.reshareCount, 62 | //repostedBy: repostedBy ?? this.repostedBy, 63 | repliedTo: repliedTo ?? this.repliedTo, 64 | ); 65 | } 66 | 67 | Map toMap() { 68 | final result = {}; 69 | 70 | result.addAll({'text': text}); 71 | result.addAll({'hashtags': hashtags}); 72 | result.addAll({'link': link}); 73 | result.addAll({'imageLinks': imageLinks}); 74 | result.addAll({'uid': uid}); 75 | result.addAll({'postType': postType.type}); 76 | result.addAll({'postedAt': postedAt.millisecondsSinceEpoch}); 77 | result.addAll({'likes': likes}); 78 | result.addAll({'commentIds': commentIds}); 79 | result.addAll({'reshareCount': reshareCount}); 80 | //result.addAll({'repostedBy': repostedBy}); 81 | result.addAll({'repliedTo': repliedTo}); 82 | 83 | return result; 84 | } 85 | 86 | factory Post.fromMap(Map map) { 87 | return Post( 88 | text: map['text'] ?? '', 89 | hashtags: List.from(map['hashtags']), 90 | link: map['link'] ?? '', 91 | imageLinks: List.from(map['imageLinks']), 92 | uid: map['uid'] ?? '', 93 | postType: (map['postType'] as String).toPostTypeEnum(), 94 | postedAt: DateTime.fromMillisecondsSinceEpoch(map['postedAt']), 95 | likes: List.from(map['likes']), 96 | commentIds: List.from(map['commentIds']), 97 | id: map['\$id'] ?? '', 98 | reshareCount: map['reshareCount']?.toInt() ?? 0, 99 | //repostedBy: map['repostedBy'] ?? '', 100 | repliedTo: map['repliedTo'] ?? '', 101 | ); 102 | } 103 | 104 | @override 105 | String toString() { 106 | return 'post(text: $text, hashtags: $hashtags, link: $link, imageLinks: $imageLinks, uid: $uid, postType: $postType, postedAt: $postedAt, likes: $likes, commentIds: $commentIds, id: $id, reshareCount: $reshareCount, repliedTo : $repliedTo,)'; 107 | } 108 | 109 | @override 110 | bool operator ==(Object other) { 111 | if (identical(this, other)) return true; 112 | 113 | return other is Post && 114 | other.text == text && 115 | listEquals(other.hashtags, hashtags) && 116 | other.link == link && 117 | listEquals(other.imageLinks, imageLinks) && 118 | other.uid == uid && 119 | other.postType == postType && 120 | other.postedAt == postedAt && 121 | listEquals(other.likes, likes) && 122 | listEquals(other.commentIds, commentIds) && 123 | other.id == id && 124 | other.reshareCount == reshareCount && 125 | //other.repostedBy == repostedBy && 126 | other.repliedTo == repliedTo; 127 | } 128 | 129 | @override 130 | int get hashCode { 131 | return text.hashCode ^ 132 | hashtags.hashCode ^ 133 | link.hashCode ^ 134 | imageLinks.hashCode ^ 135 | uid.hashCode ^ 136 | postType.hashCode ^ 137 | postedAt.hashCode ^ 138 | likes.hashCode ^ 139 | commentIds.hashCode ^ 140 | id.hashCode ^ 141 | reshareCount.hashCode ^ 142 | //repostedBy.hashCode ^ 143 | repliedTo.hashCode; 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /lib/features/post/views/post_reply_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_riverpod/flutter_riverpod.dart'; 3 | import 'package:todoapp/features/post/controllers/post_controller.dart'; 4 | import 'package:todoapp/features/post/widgets/post_card.dart'; 5 | import 'package:todoapp/common/common.dart'; 6 | import 'package:todoapp/constants/constants.dart'; 7 | import 'package:todoapp/models/post_model.dart'; 8 | 9 | class PostReplyScreen extends ConsumerWidget { 10 | static route(Post post) => MaterialPageRoute( 11 | builder: (context) => PostReplyScreen( 12 | post: post, 13 | ), 14 | ); 15 | final Post post; 16 | const PostReplyScreen({ 17 | super.key, 18 | required this.post, 19 | }); 20 | 21 | @override 22 | Widget build(BuildContext context, WidgetRef ref) { 23 | return Scaffold( 24 | appBar: AppBar( 25 | title: const Text("Post"), 26 | ), 27 | body: Column( 28 | children: [ 29 | PostCard(post: post), 30 | ref.watch(getRepliesToPostsProvider(post)).when( 31 | data: (posts) { 32 | return ref.watch(getLatestPostProvider).when( 33 | data: (data) { 34 | final latestpost = Post.fromMap(data.payload); 35 | 36 | bool isPostAlreadyPresent = false; 37 | for (final postModel in posts) { 38 | if (postModel.id == latestpost.id) { 39 | isPostAlreadyPresent = true; 40 | break; 41 | } 42 | } 43 | 44 | if (!isPostAlreadyPresent && 45 | latestpost.repliedTo == post.id) { 46 | if (data.events.contains( 47 | 'databases.*.collections.${AppwriteContants.postCollection}.documents.*.create', 48 | )) { 49 | posts.insert(0, Post.fromMap(data.payload)); 50 | } else if (data.events.contains( 51 | 'databases.*.collections.${AppwriteContants.postCollection}.documents.*.update', 52 | )) { 53 | final startingPoint = 54 | data.events[0].lastIndexOf('documents.'); 55 | final endPoint = 56 | data.events[0].lastIndexOf('.update'); 57 | final postId = data.events[0] 58 | .substring(startingPoint + 10, endPoint); 59 | 60 | var post = posts 61 | .where((element) => element.id == postId) 62 | .first; 63 | 64 | final postIndex = posts.indexOf(post); 65 | posts.removeWhere( 66 | (element) => element.id == postId); 67 | 68 | post = Post.fromMap(data.payload); 69 | posts.insert(postIndex, post); 70 | } 71 | } 72 | 73 | return Expanded( 74 | child: ListView.builder( 75 | itemCount: posts.length, 76 | itemBuilder: (BuildContext context, int index) { 77 | final post = posts[index]; 78 | return PostCard(post: post); 79 | }, 80 | ), 81 | ); 82 | }, 83 | error: (error, stackTrace) => ErrorText( 84 | error: error.toString(), 85 | ), 86 | loading: () { 87 | return Expanded( 88 | child: ListView.builder( 89 | itemCount: posts.length, 90 | itemBuilder: (BuildContext context, int index) { 91 | final post = posts[index]; 92 | return PostCard(post: post); 93 | }, 94 | ), 95 | ); 96 | }, 97 | ); 98 | }, 99 | error: (error, stackTrace) => ErrorText( 100 | error: error.toString(), 101 | ), 102 | loading: () => const Loader(), 103 | ), 104 | ], 105 | ), 106 | bottomNavigationBar: TextField( 107 | onSubmitted: (value) { 108 | ref.read(postControllerProvider.notifier).sharePost( 109 | images: [], 110 | text: value, 111 | context: context, 112 | repliedTo: post.id, 113 | repliedToUserId: post.uid, 114 | ); 115 | }, 116 | decoration: const InputDecoration( 117 | hintText: "Your Reply", 118 | ), 119 | ), 120 | ); 121 | } 122 | } 123 | --------------------------------------------------------------------------------