├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.yaml │ └── feature_request.yaml └── workflows │ └── ci.yml ├── .gitignore ├── .metadata ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── android ├── .gitignore ├── app │ ├── build.gradle │ ├── google-services.json │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── twitter_gpt │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-v21 │ │ │ └── launch_background.xml │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── 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 │ │ │ ├── values-night │ │ │ └── styles.xml │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── assets ├── animations │ ├── confetti.json │ ├── page1_animation.json │ ├── page2_animation.json │ ├── page3_animation.json │ └── page4_animation.json ├── appstore.png ├── icons │ ├── home_page_logo_selected.png │ ├── home_page_logo_unselected.png │ ├── reply_page_logo_selected.png │ ├── reply_page_logo_unselected.png │ ├── twitter.png │ ├── twitterGPT_logo_blue.png │ ├── twitterGPT_logo_green.png │ └── twitterGPT_logo_white.png └── playstore.png ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Podfile ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings ├── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── 1024.png │ │ │ ├── 114.png │ │ │ ├── 120.png │ │ │ ├── 180.png │ │ │ ├── 29.png │ │ │ ├── 40.png │ │ │ ├── 57.png │ │ │ ├── 58.png │ │ │ ├── 60.png │ │ │ ├── 80.png │ │ │ ├── 87.png │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── 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-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ └── Runner-Bridging-Header.h ├── RunnerTests │ └── RunnerTests.swift └── firebase_app_id_file.json ├── lib ├── blocs │ └── app_init │ │ ├── app_init_bloc.dart │ │ ├── app_init_event.dart │ │ └── app_init_state.dart ├── config │ ├── paths.dart │ └── route_generator.dart ├── firebase_options.dart ├── main.dart ├── models │ ├── tweet_model.dart │ ├── user_model.dart │ └── user_preference.dart ├── repositories │ ├── appwrite_repo │ │ └── appwrite_repo.dart │ ├── authentication │ │ ├── auth_repo.dart │ │ └── base_auth_repo.dart │ ├── tweets │ │ ├── base_tweet_repo.dart │ │ └── tweet_repo.dart │ └── user │ │ ├── base_user_repo.dart │ │ └── user_repo.dart ├── screens │ ├── homepage │ │ ├── homepage.dart │ │ └── write_tweet_screen.dart │ ├── login │ │ ├── signin_screen.dart │ │ ├── signup_screen.dart │ │ ├── twitter_screen.dart │ │ └── welcome_screen.dart │ ├── navbar │ │ └── bottom_navbar_screen.dart │ ├── onboarding │ │ └── screens │ │ │ ├── apikey_screen.dart │ │ │ ├── custom_onboarding_screen.dart │ │ │ ├── link_twitter_screen.dart │ │ │ ├── onboarding_pageview.dart │ │ │ └── stay_informed.dart │ ├── reply │ │ └── replypage.dart │ ├── screens.dart │ ├── settings │ │ └── settings_screen.dart │ ├── splashscreen.dart │ └── widgets │ │ ├── custom_button.dart │ │ └── dot_indicator.dart └── utils │ ├── asset_constants.dart │ ├── enums.dart │ ├── onboarding_data.dart │ ├── session_helper.dart │ ├── session_manager.dart │ └── theme_constants.dart ├── linux ├── .gitignore ├── CMakeLists.txt ├── flutter │ └── CMakeLists.txt ├── main.cc ├── my_application.cc └── my_application.h ├── macos ├── .gitignore ├── Flutter │ ├── Flutter-Debug.xcconfig │ └── Flutter-Release.xcconfig ├── Podfile ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── app_icon_1024.png │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_512.png │ │ │ └── app_icon_64.png │ ├── Base.lproj │ │ └── MainMenu.xib │ ├── Configs │ │ ├── AppInfo.xcconfig │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── Warnings.xcconfig │ ├── DebugProfile.entitlements │ ├── Info.plist │ ├── MainFlutterWindow.swift │ └── Release.entitlements └── firebase_app_id_file.json ├── pubspec.yaml ├── test └── widget_test.dart ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── index.html └── manifest.json └── windows ├── .gitignore ├── CMakeLists.txt ├── flutter └── CMakeLists.txt └── runner ├── CMakeLists.txt ├── Runner.rc ├── flutter_window.cpp ├── flutter_window.h ├── main.cpp ├── resource.h ├── resources └── app_icon.ico ├── runner.exe.manifest ├── utils.cpp ├── utils.h ├── win32_window.cpp └── win32_window.h /.github/ISSUE_TEMPLATE/bug_report.yaml: -------------------------------------------------------------------------------- 1 | name: Bug Report 2 | description: File a bug report 3 | title: "[Bug]: " 4 | labels: ["bug"] 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | Thanks for taking the time to fill out this bug report! 10 | 11 | - type: textarea 12 | id: bug-description 13 | attributes: 14 | label: Describe the bug 15 | description: A clear and concise description of what the bug is. 16 | validations: 17 | required: true 18 | 19 | - type: textarea 20 | id: reproduction-steps 21 | attributes: 22 | label: Steps to Reproduce 23 | description: Steps to reproduce the behavior. 24 | validations: 25 | required: true 26 | 27 | - type: textarea 28 | id: expected-behavior 29 | attributes: 30 | label: Expected Behavior 31 | description: A clear and concise description of what you expected to happen. 32 | validations: 33 | required: true 34 | 35 | - type: textarea 36 | id: screenshots 37 | attributes: 38 | label: Screenshots 39 | description: If applicable, add screenshots to help explain your problem. 40 | 41 | - type: input 42 | id: os 43 | attributes: 44 | label: OS 45 | description: Your operating system 46 | validations: 47 | required: true 48 | 49 | - type: input 50 | id: browser 51 | attributes: 52 | label: Browser 53 | description: Your browser 54 | validations: 55 | required: true 56 | 57 | - type: textarea 58 | id: additional-context 59 | attributes: 60 | label: Additional Context 61 | description: Add any other context about the problem here. 62 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.yaml: -------------------------------------------------------------------------------- 1 | name: Feature Request 2 | description: Suggest an idea for this project 3 | title: "[Feature]: " 4 | labels: ["enhancement"] 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | Thanks for taking the time to suggest this feature request! 10 | 11 | - type: textarea 12 | id: feature-description 13 | attributes: 14 | label: Describe the feature you'd like 15 | description: A clear and concise description of what you want to happen. 16 | validations: 17 | required: true 18 | 19 | - type: textarea 20 | id: problem-solution 21 | attributes: 22 | label: Is your feature request related to a problem? Please describe. 23 | description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 24 | validations: 25 | required: true 26 | 27 | - type: textarea 28 | id: alternatives 29 | attributes: 30 | label: Describe alternatives you've considered 31 | description: A clear and concise description of any alternative solutions or features you've considered. 32 | validations: 33 | required: true 34 | 35 | - type: textarea 36 | id: additional-context 37 | attributes: 38 | label: Additional Context 39 | description: Add any other context or screenshots about the feature request here. 40 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: twitterGPT 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - uses: actions/checkout@v2 17 | 18 | - name: Setup Flutter 19 | uses: subosito/flutter-action@v1 20 | with: 21 | flutter-version: "3.10.6" 22 | 23 | - name: Get Dependencies 24 | run: flutter pub get 25 | 26 | - name: Create .env file 27 | run: | 28 | echo '${{ secrets.ENV_FILE_CONTENT }}' > .env 29 | 30 | - name: Run Analyzer 31 | run: flutter analyze 32 | 33 | - name: Build APK 34 | run: flutter build apk 35 | 36 | # - name: Build iOS 37 | # run: flutter build ios --no-codesign 38 | 39 | - name: Archive APK 40 | uses: actions/upload-artifact@v2 41 | with: 42 | name: app-release.apk 43 | path: build/app/outputs/flutter-apk/app-release.apk 44 | 45 | # - name: Archive iOS build 46 | # uses: actions/upload-artifact@v2 47 | # with: 48 | # name: Runner.app 49 | # path: build/ios/iphoneos/Runner.app 50 | 51 | # - name: Deploy to Server 52 | # run: | 53 | # Your deployment commands here 54 | # env: 55 | # DEPLOYMENT_SERVER: ${{ secrets.DEPLOYMENT_SERVER }} 56 | # DEPLOYMENT_USER: ${{ secrets.DEPLOYMENT_USER }} 57 | # DEPLOYMENT_PASSWORD: ${{ secrets.DEPLOYMENT_PASSWORD }} 58 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.lock 4 | *.log 5 | *.pyc 6 | *.swp 7 | .DS_Store 8 | .atom/ 9 | .buildlog/ 10 | .history 11 | .svn/ 12 | .env 13 | 14 | # Remove firebase files 15 | /macos/Runner/GoogleService-Info.plist 16 | /ios/Runner/GoogleService-Info.plist 17 | 18 | # IntelliJ related 19 | *.iml 20 | *.ipr 21 | *.iws 22 | .idea/ 23 | 24 | # Visual Studio Code related 25 | .classpath 26 | .project 27 | .settings/ 28 | .vscode/* 29 | 30 | # Flutter repo-specific 31 | /bin/cache/ 32 | /bin/internal/bootstrap.bat 33 | /bin/internal/bootstrap.sh 34 | /bin/mingit/ 35 | /dev/benchmarks/mega_gallery/ 36 | /dev/bots/.recipe_deps 37 | /dev/bots/android_tools/ 38 | /dev/devicelab/ABresults*.json 39 | /dev/docs/doc/ 40 | /dev/docs/flutter.docs.zip 41 | /dev/docs/lib/ 42 | /dev/docs/pubspec.yaml 43 | /dev/integration_tests/**/xcuserdata 44 | /dev/integration_tests/**/Pods 45 | /packages/flutter/coverage/ 46 | version 47 | analysis_benchmark.json 48 | 49 | # packages file containing multi-root paths 50 | .packages.generated 51 | 52 | # Flutter/Dart/Pub related 53 | **/doc/api/ 54 | .dart_tool/ 55 | .flutter-plugins 56 | .flutter-plugins-dependencies 57 | **/generated_plugin_registrant.dart 58 | .packages 59 | .pub-preload-cache/ 60 | .pub/ 61 | build/ 62 | flutter_*.png 63 | linked_*.ds 64 | unlinked.ds 65 | unlinked_spec.ds 66 | 67 | # Android related 68 | **/android/**/gradle-wrapper.jar 69 | .gradle/ 70 | **/android/captures/ 71 | **/android/gradlew 72 | **/android/gradlew.bat 73 | **/android/local.properties 74 | **/android/**/GeneratedPluginRegistrant.java 75 | **/android/key.properties 76 | *.jks 77 | 78 | # iOS/XCode related 79 | **/ios/**/*.mode1v3 80 | **/ios/**/*.mode2v3 81 | **/ios/**/*.moved-aside 82 | **/ios/**/*.pbxuser 83 | **/ios/**/*.perspectivev3 84 | **/ios/**/*sync/ 85 | **/ios/**/.sconsign.dblite 86 | **/ios/**/.tags* 87 | **/ios/**/.vagrant/ 88 | **/ios/**/DerivedData/ 89 | **/ios/**/Icon? 90 | **/ios/**/Pods/ 91 | **/ios/**/.symlinks/ 92 | **/ios/**/profile 93 | **/ios/**/xcuserdata 94 | **/ios/.generated/ 95 | **/ios/Flutter/.last_build_id 96 | **/ios/Flutter/App.framework 97 | **/ios/Flutter/Flutter.framework 98 | **/ios/Flutter/Flutter.podspec 99 | **/ios/Flutter/Generated.xcconfig 100 | **/ios/Flutter/ephemeral 101 | **/ios/Flutter/app.flx 102 | **/ios/Flutter/app.zip 103 | **/ios/Flutter/flutter_assets/ 104 | **/ios/Flutter/flutter_export_environment.sh 105 | **/ios/ServiceDefinitions.json 106 | **/ios/Runner/GeneratedPluginRegistrant.* 107 | 108 | # macOS 109 | **/Flutter/ephemeral/ 110 | **/Pods/ 111 | **/macos/Flutter/GeneratedPluginRegistrant.swift 112 | **/macos/Flutter/ephemeral 113 | **/xcuserdata/ 114 | 115 | # Windows 116 | **/windows/flutter/generated_plugin_registrant.cc 117 | **/windows/flutter/generated_plugin_registrant.h 118 | **/windows/flutter/generated_plugins.cmake 119 | 120 | # Linux 121 | **/linux/flutter/generated_plugin_registrant.cc 122 | **/linux/flutter/generated_plugin_registrant.h 123 | **/linux/flutter/generated_plugins.cmake 124 | 125 | # Coverage 126 | coverage/ 127 | 128 | # Symbols 129 | app.*.symbols 130 | 131 | # Exceptions to above rules. 132 | !**/ios/**/default.mode1v3 133 | !**/ios/**/default.mode2v3 134 | !**/ios/**/default.pbxuser 135 | !**/ios/**/default.perspectivev3 136 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 137 | !/dev/ci/**/Gemfile.lock 138 | !.vscode/settings.json -------------------------------------------------------------------------------- /.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: 350d2c3a6ca4c3c39787e1c18a8ddf0aca8d2ae2 8 | channel: beta 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: 350d2c3a6ca4c3c39787e1c18a8ddf0aca8d2ae2 17 | base_revision: 350d2c3a6ca4c3c39787e1c18a8ddf0aca8d2ae2 18 | - platform: ios 19 | create_revision: 350d2c3a6ca4c3c39787e1c18a8ddf0aca8d2ae2 20 | base_revision: 350d2c3a6ca4c3c39787e1c18a8ddf0aca8d2ae2 21 | 22 | # User provided section 23 | 24 | # List of Local paths (relative to this file) that should be 25 | # ignored by the migrate tool. 26 | # 27 | # Files that are not part of the templates will be ignored by default. 28 | unmanaged_files: 29 | - 'lib/main.dart' 30 | - 'ios/Runner.xcodeproj/project.pbxproj' 31 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to TwitterGPT 2 | 3 | Hello and welcome! We're thrilled that you're considering contributing to TwitterGPT. Your contributions directly enhance app functionality and provide a great learning opportunity. The following guidelines will help you navigate the process. 4 | 5 | ## Code of Conduct 6 | 7 | By participating in this project, you're expected to uphold our [Code of Conduct](https://www.contributor-covenant.org/version/2/1/code_of_conduct/code_of_conduct.txt). 8 | 9 | ## Getting Started 10 | 11 | Set up your local project in your computer 12 | 13 | ```bash 14 | git clone https://github.com/yatendra2001/TwitterGPT.git 15 | cd TwitterGPT 16 | ``` 17 | 18 | Create a new branch 19 | 20 | ```bash 21 | git checkout -b feature/ 22 | ``` 23 | 24 | ## Contributions 25 | 26 | Contributions to TwitterGPT are made through GitHub Pull Requests. Most pull requests start by opening an issue. This lets others in the community know you are working on something and gives them an opportunity to provide feedback and discuss the use case. 27 | 28 | 1. **Find an issue to work on:** Check the 'Issues' tab in GitHub repository and find an issue you're interested in working on. 29 | 30 | 2. **Fork the repository:** Click on 'Fork' at the top right corner of the page and clone the repository to your local machine. This will create a copy of the repository within your personal GitHub account, enabling you to propose changes. 31 | 32 | 3. **Create a new branch:** It's best practice to create a new branch for each new feature or bugfix you'll be working on. Not only is it proper git etiquette, but it also keeps your changes organized and separated from the master branch. 33 | 34 | 4. **Work on the issue in your forked repository:** Now that you're ready to contribute, start modifying the code on your forked repository. 35 | 36 | 5. **Commit your changes:** After making your changes, commit them with a clear and concise commit message. 37 | 38 | 6. **Submit a pull request:** Navigate to your forked repository and click on 'New Pull Request' next to your branch, then 'Create Pull Request'. Ensure you provide a brief description of the proposed changes. 39 | 40 | ## Pull Request Process 41 | 42 | 1. Ensure any install or build dependencies are removed before the end of the layer when doing a build. 43 | 44 | 2. Update the README.md with details of changes to the interface, this includes new environment variables, exposed ports, useful file locations and container parameters. 45 | 46 | 3. Increase the version numbers in any examples files and the README.md to the new version that this Pull Request would represent. 47 | 48 | ## Community 49 | 50 | You can chat with the community [here](https://discord.gg/7udyaThamZ). Feel free to ask questions and share your ideas about the project. 51 | 52 | Remember, the best way to gain contributions is by being respectful and welcoming to new contributors. 53 | 54 | We're so excited to see the contributions you'll make! 55 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Yatendra Kumar 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | [![Contributors][contributors-shield]][contributors-url] 8 | [![Forks][forks-shield]][forks-url] 9 | [![Stargazers][stars-shield]][stars-url] 10 | [![Issues][issues-shield]][issues-url] 11 | [![MIT License][license-shield]][license-url] 12 | 13 | 14 | 15 | 16 |
17 |
18 | 19 | Logo 20 | 21 | 22 |
23 | 24 | ## TwitterGPT 25 | 26 | TwitterGPT aims to bring the power of AI to social media, starting with Twitter. It allows users to automate their Twitter content generation, personalizing tweets and threads based on their unique style and preferred topics. 27 | 28 | ![App Screenshot](https://firebasestorage.googleapis.com/v0/b/twittergpt-7d0dc.appspot.com/o/assets%2Ffinal%20new%20new%20new%20(2).png?alt=media&token=6acc5cbb-fbf3-4b8d-a293-e53dea0a525d) 29 | 30 | 31 | ## Introduction 32 | 33 | TwitterGPT is a mobile app that utilizes OpenAI's GPT-4 to simplify the Twitter content creation process, making it accessible to a wider audience. The AI-generated content is unique and reflects the personal preferences and styles of the user, resulting in personalized Twitter threads. 34 | 35 | 36 | ## Usage 37 | 38 | 1. Clone the repository from GitHub: 39 | 40 | ```bash 41 | git clone https://github.com/your-github-username/twittergpt.git 42 | ``` 43 | 44 | 2. Create a .env file under the root directory and set up the following environment variables: 45 | 46 | ```bash 47 | # Twitter Credentials 48 | ACCESS_TOKEN=Your_Twitter_Access_Token 49 | ACCESS_TOKEN_SECRET=Your_Twitter_Access_Token_Secret 50 | 51 | API_KEY=Your_Twitter_API_Key 52 | API_SECRET_KEY=Your_Twitter_API_Secret_Key 53 | 54 | CALLBACK_URL=Your_Callback_URL 55 | 56 | CLIENT_ID=Your_Client_ID 57 | CLIENT_SECRET=Your_Client_Secret 58 | 59 | # AppWrite Data 60 | APPWRITE_PROJECT_ID=YOUR_PROJECT_ID 61 | 62 | # Open AI 63 | OPEN_AI_API_KEY=Your_OpenAI_API_Key 64 | ``` 65 | 66 | 3. Check for Flutter setup and connected devices: 67 | 68 | ```bash 69 | flutter doctor 70 | ``` 71 | 72 | 4. Get all dependencies: 73 | ```bash 74 | flutter pub get 75 | ``` 76 | 77 | 5. Run the app: 78 | 79 | ```bash 80 | flutter run 81 | ``` 82 | 83 | ## Contributing 84 | 85 | Contribution to the project can be made if you have some improvements for the project or if you find some bugs. 86 | 87 | You can contribute to the project by reporting issues, forking it, modifying the code and making a pull request to the repository. 88 | 89 | Please make sure you specify the commit type when opening pull requests: 90 | 91 | ``` 92 | feat: The new feature you're proposing 93 | 94 | fix: A bug fix in the project 95 | 96 | style: Feature and updates related to UI improvements and styling 97 | 98 | test: Everything related to testing 99 | 100 | docs: Everything related to documentation 101 | 102 | refactor: Regular code refactoring and maintenance 103 | ``` 104 | 105 | To know more extensively about how to contribute to this project, read our [Contribution Guide](https://github.com/yatendra2001/TwitterGPT/blob/master/CONTRIBUTING.md). 106 | 107 | ## Community 108 | 109 | You can chat with the community [here](https://discord.gg/7udyaThamZ). Feel free to ask questions and share your ideas about the project. 110 | 111 | Remember, the best way to gain contributions is by being respectful and welcoming to new contributors. 112 | 113 | ## License 114 | 115 | The project is released under the [MIT License](http://www.opensource.org/licenses/mit-license.php). The license can be found [here](LICENSE). 116 | 117 | ## Flutter 118 | 119 | For help getting started with Flutter, view 120 | [online documentation](https://flutter.dev/docs), which offers tutorials, 121 | samples, guidance on mobile development, and a full API reference. 122 | 123 | 124 | ### If you like it, make sure to star our repo :) 125 | 126 | 127 | 128 | 129 | [contributors-shield]: https://img.shields.io/github/contributors/yatendra2001/twitter_gpt.svg?style=for-the-badge 130 | [contributors-url]: https://github.com/yatendra2001/twitter_gpt/graphs/contributors 131 | [forks-shield]: https://img.shields.io/github/forks/yatendra2001/twitter_gpt.svg?style=for-the-badge 132 | [forks-url]: https://github.com/yatendra2001/twitter_gpt/network/members 133 | [stars-shield]: https://img.shields.io/github/stars/yatendra2001/twitter_gpt.svg?style=for-the-badge 134 | [stars-url]: https://github.com/yatendra2001/twitter_gpt/stargazers 135 | [issues-shield]: https://img.shields.io/github/issues/yatendra2001/twitter_gpt.svg?style=for-the-badge 136 | [issues-url]: https://github.com/yatendra2001/twitter_gpt/issues 137 | [license-shield]: https://img.shields.io/github/license/yatendra2001/twitter_gpt.svg?style=for-the-badge 138 | [license-url]: https://github.com/yatendra2001/twitter_gpt/blob/master/LICENSE 139 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | // START: FlutterFire Configuration 26 | apply plugin: 'com.google.gms.google-services' 27 | // END: FlutterFire Configuration 28 | apply plugin: 'kotlin-android' 29 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 30 | 31 | android { 32 | compileSdkVersion 33 33 | // ndkVersion flutter.ndkVersion 34 | 35 | compileOptions { 36 | sourceCompatibility JavaVersion.VERSION_1_8 37 | targetCompatibility JavaVersion.VERSION_1_8 38 | } 39 | 40 | kotlinOptions { 41 | jvmTarget = '1.8' 42 | } 43 | 44 | sourceSets { 45 | main.java.srcDirs += 'src/main/kotlin' 46 | } 47 | 48 | defaultConfig { 49 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 50 | applicationId "com.superawesomeapps.twitter_gpt" 51 | // You can update the following values to match your application needs. 52 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. 53 | minSdkVersion 19 54 | targetSdkVersion flutter.targetSdkVersion 55 | versionCode flutterVersionCode.toInteger() 56 | versionName flutterVersionName 57 | multiDexEnabled true 58 | } 59 | 60 | buildTypes { 61 | release { 62 | // TODO: Add your own signing config for the release build. 63 | // Signing with the debug keys for now, so `flutter run --release` works. 64 | signingConfig signingConfigs.debug 65 | } 66 | } 67 | } 68 | 69 | flutter { 70 | source '../..' 71 | } 72 | 73 | dependencies { 74 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 75 | } 76 | -------------------------------------------------------------------------------- /android/app/google-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_info": { 3 | "project_number": "1057730238062", 4 | "project_id": "twittergpt-7d0dc", 5 | "storage_bucket": "twittergpt-7d0dc.appspot.com" 6 | }, 7 | "client": [ 8 | { 9 | "client_info": { 10 | "mobilesdk_app_id": "1:1057730238062:android:05d0bb81d7861c13f2f87f", 11 | "android_client_info": { 12 | "package_name": "com.superawesomeapps.twitter_gpt" 13 | } 14 | }, 15 | "oauth_client": [ 16 | { 17 | "client_id": "1057730238062-cr9u39k2kg85rkn0tu9ek6tvclkcbrk9.apps.googleusercontent.com", 18 | "client_type": 3 19 | } 20 | ], 21 | "api_key": [ 22 | { 23 | "current_key": "AIzaSyDDYYUdredgQV4qeabDLpEDZAbTr0dsVGs" 24 | } 25 | ], 26 | "services": { 27 | "appinvite_service": { 28 | "other_platform_oauth_client": [ 29 | { 30 | "client_id": "1057730238062-cr9u39k2kg85rkn0tu9ek6tvclkcbrk9.apps.googleusercontent.com", 31 | "client_type": 3 32 | } 33 | ] 34 | } 35 | } 36 | } 37 | ], 38 | "configuration_version": "1" 39 | } -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 16 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 39 | 42 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/twitter_gpt/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.superawesomeapps.twitter_gpt 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.7.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.2.0' 10 | // START: FlutterFire Configuration 11 | classpath 'com.google.gms:google-services:4.3.10' 12 | // END: FlutterFire Configuration 13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 14 | } 15 | } 16 | 17 | allprojects { 18 | repositories { 19 | google() 20 | mavenCentral() 21 | } 22 | } 23 | 24 | rootProject.buildDir = '../build' 25 | subprojects { 26 | project.buildDir = "${rootProject.buildDir}/${project.name}" 27 | } 28 | subprojects { 29 | project.evaluationDependsOn(':app') 30 | } 31 | 32 | tasks.register("clean", Delete) { 33 | delete rootProject.buildDir 34 | } 35 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /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.5-all.zip 6 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /assets/appstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/assets/appstore.png -------------------------------------------------------------------------------- /assets/icons/home_page_logo_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/assets/icons/home_page_logo_selected.png -------------------------------------------------------------------------------- /assets/icons/home_page_logo_unselected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/assets/icons/home_page_logo_unselected.png -------------------------------------------------------------------------------- /assets/icons/reply_page_logo_selected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/assets/icons/reply_page_logo_selected.png -------------------------------------------------------------------------------- /assets/icons/reply_page_logo_unselected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/assets/icons/reply_page_logo_unselected.png -------------------------------------------------------------------------------- /assets/icons/twitter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/assets/icons/twitter.png -------------------------------------------------------------------------------- /assets/icons/twitterGPT_logo_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/assets/icons/twitterGPT_logo_blue.png -------------------------------------------------------------------------------- /assets/icons/twitterGPT_logo_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/assets/icons/twitterGPT_logo_green.png -------------------------------------------------------------------------------- /assets/icons/twitterGPT_logo_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/assets/icons/twitterGPT_logo_white.png -------------------------------------------------------------------------------- /assets/playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/assets/playstore.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | platform :ios, '11.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.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/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 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 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 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/ios/Runner/Assets.xcassets/AppIcon.appiconset/1024.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/114.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/ios/Runner/Assets.xcassets/AppIcon.appiconset/114.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/ios/Runner/Assets.xcassets/AppIcon.appiconset/120.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/ios/Runner/Assets.xcassets/AppIcon.appiconset/180.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/ios/Runner/Assets.xcassets/AppIcon.appiconset/29.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/ios/Runner/Assets.xcassets/AppIcon.appiconset/40.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/ios/Runner/Assets.xcassets/AppIcon.appiconset/57.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/ios/Runner/Assets.xcassets/AppIcon.appiconset/58.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/ios/Runner/Assets.xcassets/AppIcon.appiconset/60.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/ios/Runner/Assets.xcassets/AppIcon.appiconset/80.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/87.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/ios/Runner/Assets.xcassets/AppIcon.appiconset/87.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | {"images":[{"size":"60x60","expected-size":"180","filename":"180.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"40x40","expected-size":"80","filename":"80.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"40x40","expected-size":"120","filename":"120.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"60x60","expected-size":"120","filename":"120.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"57x57","expected-size":"57","filename":"57.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"1x"},{"size":"29x29","expected-size":"58","filename":"58.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"29x29","expected-size":"29","filename":"29.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"1x"},{"size":"29x29","expected-size":"87","filename":"87.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"57x57","expected-size":"114","filename":"114.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"20x20","expected-size":"40","filename":"40.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"2x"},{"size":"20x20","expected-size":"60","filename":"60.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"iphone","scale":"3x"},{"size":"1024x1024","filename":"1024.png","expected-size":"1024","idiom":"ios-marketing","folder":"Assets.xcassets/AppIcon.appiconset/","scale":"1x"}]} -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/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/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/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/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/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/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/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/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/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/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/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/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/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/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/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/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/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/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/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/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/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/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/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/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CADisableMinimumFrameDurationOnPhone 6 | 7 | CFBundleDevelopmentRegion 8 | $(DEVELOPMENT_LANGUAGE) 9 | CFBundleDisplayName 10 | TwitterGPT 11 | CFBundleExecutable 12 | $(EXECUTABLE_NAME) 13 | CFBundleIdentifier 14 | $(PRODUCT_BUNDLE_IDENTIFIER) 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | twitter_gpt 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | $(FLUTTER_BUILD_NAME) 23 | CFBundleSignature 24 | ???? 25 | CFBundleURLTypes 26 | 27 | 28 | CFBundleTypeRole 29 | Editor 30 | CFBundleURLName 31 | 32 | CFBundleURLSchemes 33 | 34 | twitterGPTAuth 35 | 36 | 37 | 38 | CFBundleVersion 39 | $(FLUTTER_BUILD_NUMBER) 40 | LSRequiresIPhoneOS 41 | 42 | NSCameraUsageDescription 43 | 44 | NSMicrophoneUsageDescription 45 | 46 | NSPhotoLibraryUsageDescription 47 | 48 | UIApplicationSupportsIndirectInputEvents 49 | 50 | UILaunchStoryboardName 51 | LaunchScreen 52 | UIMainStoryboardFile 53 | Main 54 | UISupportedInterfaceOrientations 55 | 56 | UIInterfaceOrientationPortrait 57 | UIInterfaceOrientationLandscapeLeft 58 | UIInterfaceOrientationLandscapeRight 59 | 60 | UISupportedInterfaceOrientations~ipad 61 | 62 | UIInterfaceOrientationPortrait 63 | UIInterfaceOrientationPortraitUpsideDown 64 | UIInterfaceOrientationLandscapeLeft 65 | UIInterfaceOrientationLandscapeRight 66 | 67 | UIViewControllerBasedStatusBarAppearance 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /ios/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /ios/firebase_app_id_file.json: -------------------------------------------------------------------------------- 1 | { 2 | "file_generated_by": "FlutterFire CLI", 3 | "purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory", 4 | "GOOGLE_APP_ID": "1:1057730238062:ios:1f631ab1697df1d5f2f87f", 5 | "FIREBASE_PROJECT_ID": "twittergpt-7d0dc", 6 | "GCM_SENDER_ID": "1057730238062" 7 | } -------------------------------------------------------------------------------- /lib/blocs/app_init/app_init_bloc.dart: -------------------------------------------------------------------------------- 1 | // 🎯 Dart imports: 2 | import 'dart:async'; 3 | 4 | // 🐦 Flutter imports: 5 | import 'package:equatable/equatable.dart'; 6 | import 'package:firebase_auth/firebase_auth.dart' as auth; 7 | import 'package:flutter_bloc/flutter_bloc.dart'; 8 | 9 | // 🌎 Project imports: 10 | import 'package:twitter_gpt/utils/session_helper.dart'; 11 | import '../../repositories/authentication/auth_repo.dart'; 12 | 13 | part 'app_init_event.dart'; 14 | part 'app_init_state.dart'; 15 | 16 | class AppInitBloc extends Bloc { 17 | final AuthRepository _authRepository; 18 | late StreamSubscription _userSubscription; 19 | 20 | AppInitBloc({required AuthRepository authRepository}) 21 | : _authRepository = authRepository, 22 | super(AppInitState.unknown()) { 23 | _userSubscription = 24 | _authRepository.user.listen((user) => add(AuthUserChanged(user: user))); 25 | } 26 | 27 | @override 28 | Future close() { 29 | _userSubscription.cancel(); 30 | return super.close(); 31 | } 32 | 33 | @override 34 | Stream mapEventToState(AppInitEvent event) async* { 35 | if (event is AuthUserChanged) { 36 | yield* _mapAuthUserChangedToState(event); 37 | } else if (event is AuthLogoutRequested) { 38 | await _authRepository.logOut(); 39 | } 40 | } 41 | 42 | Stream _mapAuthUserChangedToState( 43 | AuthUserChanged event) async* { 44 | yield AppInitState.loading(); 45 | if (event.user != null) { 46 | SessionHelper.displayName = event.user!.displayName; 47 | SessionHelper.phone = event.user!.phoneNumber; 48 | SessionHelper.uid = event.user!.uid; 49 | SessionHelper.bearerToken = await event.user!.getIdToken(); 50 | // log('bearer token: ${SessionHelper.bearerToken}'); 51 | yield AppInitState.authenticated(user: event.user!); 52 | } else { 53 | yield AppInitState.unauthenticated(); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /lib/blocs/app_init/app_init_event.dart: -------------------------------------------------------------------------------- 1 | part of 'app_init_bloc.dart'; 2 | 3 | abstract class AppInitEvent extends Equatable { 4 | const AppInitEvent(); 5 | @override 6 | bool? get stringify => true; 7 | 8 | @override 9 | List get props => []; 10 | } 11 | 12 | class AuthUserChanged extends AppInitEvent { 13 | final auth.User? user; 14 | 15 | const AuthUserChanged({required this.user}); 16 | 17 | @override 18 | List get props => [user]; 19 | } 20 | 21 | class AuthLogoutRequested extends AppInitEvent {} 22 | -------------------------------------------------------------------------------- /lib/blocs/app_init/app_init_state.dart: -------------------------------------------------------------------------------- 1 | part of 'app_init_bloc.dart'; 2 | 3 | enum AuthStatus { unknown, authenticated, loading, unauthenticated } 4 | 5 | class AppInitState extends Equatable { 6 | final auth.User? user; 7 | final AuthStatus status; 8 | 9 | const AppInitState({this.user, this.status = AuthStatus.unknown}); 10 | 11 | factory AppInitState.unknown() => const AppInitState(); 12 | 13 | factory AppInitState.authenticated({required auth.User user}) { 14 | return AppInitState(status: AuthStatus.authenticated, user: user); 15 | } 16 | 17 | factory AppInitState.unauthenticated() => 18 | const AppInitState(status: AuthStatus.unauthenticated); 19 | 20 | factory AppInitState.loading() => 21 | const AppInitState(status: AuthStatus.loading); 22 | 23 | @override 24 | bool get stringify => true; 25 | @override 26 | List get props => [user, status]; 27 | } 28 | -------------------------------------------------------------------------------- /lib/config/paths.dart: -------------------------------------------------------------------------------- 1 | class Paths { 2 | // Top level collections. 3 | static const String users = 'users'; 4 | 5 | // Subcollections 6 | } 7 | -------------------------------------------------------------------------------- /lib/config/route_generator.dart: -------------------------------------------------------------------------------- 1 | // 🐦 Flutter imports: 2 | import 'package:flutter/material.dart'; 3 | import 'package:twitter_gpt/screens/homepage/write_tweet_screen.dart'; 4 | import 'package:twitter_gpt/screens/login/twitter_screen.dart'; 5 | 6 | // 🌎 Project imports: 7 | import 'package:twitter_gpt/screens/login/welcome_screen.dart'; 8 | import 'package:twitter_gpt/screens/login/signin_screen.dart'; 9 | import 'package:twitter_gpt/screens/login/signup_screen.dart'; 10 | import 'package:twitter_gpt/screens/navbar/bottom_navbar_screen.dart'; 11 | import 'package:twitter_gpt/screens/onboarding/screens/apikey_screen.dart'; 12 | import 'package:twitter_gpt/screens/onboarding/screens/onboarding_pageview.dart'; 13 | import 'package:twitter_gpt/screens/settings/settings_screen.dart'; 14 | import 'package:twitter_gpt/screens/splashscreen.dart'; 15 | 16 | class RouteGenerator { 17 | static Route generateRoute(RouteSettings settings) { 18 | // final args = settings.arguments; 19 | 20 | switch (settings.name) { 21 | case '/': 22 | return MaterialPageRoute( 23 | settings: const RouteSettings(name: '/'), 24 | builder: (_) => const Scaffold(), 25 | ); 26 | 27 | case OnboardingPageview.routeName: 28 | return OnboardingPageview.route(); 29 | case SplashScreen.routeName: 30 | return SplashScreen.route(); 31 | case BottomNavBarScreen.routeName: 32 | return BottomNavBarScreen.route(); 33 | case WelcomeScreen.routeName: 34 | return WelcomeScreen.route(); 35 | case SignInScreen.routeName: 36 | return SignInScreen.route(); 37 | case SignUpScreen.routeName: 38 | return SignUpScreen.route(); 39 | case TwitterScreen.routeName: 40 | return TwitterScreen.route(); 41 | case ApiKeyScreen.routeName: 42 | return ApiKeyScreen.route(); 43 | case SettingsScreen.routeName: 44 | return SettingsScreen.route(); 45 | case WriteTweetScreen.routeName: 46 | return WriteTweetScreen.route(); 47 | default: 48 | return _errorRoute(); 49 | } 50 | } 51 | 52 | static Route _errorRoute() { 53 | return MaterialPageRoute( 54 | builder: (_) => Scaffold( 55 | appBar: AppBar( 56 | title: const Text('Error'), 57 | ), 58 | body: Center( 59 | child: Text( 60 | 'Something Went Wrong!', 61 | style: TextStyle(color: Colors.grey[600], fontSize: 24), 62 | ), 63 | ), 64 | )); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /lib/firebase_options.dart: -------------------------------------------------------------------------------- 1 | // File generated by FlutterFire CLI. 2 | // ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members 3 | import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; 4 | import 'package:flutter/foundation.dart' 5 | show defaultTargetPlatform, kIsWeb, TargetPlatform; 6 | import 'package:flutter_dotenv/flutter_dotenv.dart'; 7 | 8 | class DefaultFirebaseOptions { 9 | static FirebaseOptions get currentPlatform { 10 | if (kIsWeb) { 11 | return web; 12 | } 13 | switch (defaultTargetPlatform) { 14 | case TargetPlatform.android: 15 | return android; 16 | case TargetPlatform.iOS: 17 | return ios; 18 | case TargetPlatform.macOS: 19 | return macos; 20 | case TargetPlatform.windows: 21 | throw UnsupportedError( 22 | 'DefaultFirebaseOptions have not been configured for windows - ' 23 | 'you can reconfigure this by running the FlutterFire CLI again.', 24 | ); 25 | case TargetPlatform.linux: 26 | throw UnsupportedError( 27 | 'DefaultFirebaseOptions have not been configured for linux - ' 28 | 'you can reconfigure this by running the FlutterFire CLI again.', 29 | ); 30 | default: 31 | throw UnsupportedError( 32 | 'DefaultFirebaseOptions are not supported for this platform.', 33 | ); 34 | } 35 | } 36 | 37 | static FirebaseOptions web = FirebaseOptions( 38 | apiKey: dotenv.get('API_KEY_WEB'), 39 | appId: dotenv.get('APP_ID_WEB'), 40 | messagingSenderId: dotenv.get('MESSAGING_SENDER_ID_WEB'), 41 | projectId: dotenv.get('PROJECT_ID_WEB'), 42 | authDomain: dotenv.get('AUTH_DOMAIN_WEB'), 43 | storageBucket: dotenv.get('STORAGE_BUCKET_WEB'), 44 | measurementId: dotenv.get('MEASUREMENT_ID_WEB'), 45 | ); 46 | 47 | static FirebaseOptions android = FirebaseOptions( 48 | apiKey: dotenv.get('API_KEY_ANDROID'), 49 | appId: dotenv.get('APP_ID_ANDROID'), 50 | messagingSenderId: dotenv.get('MESSAGING_SENDER_ID_ANDROID'), 51 | projectId: dotenv.get('PROJECT_ID_ANDROID'), 52 | storageBucket: dotenv.get('STORAGE_BUCKET_ANDROID'), 53 | ); 54 | 55 | static FirebaseOptions ios = FirebaseOptions( 56 | apiKey: dotenv.get('API_KEY_IOS'), 57 | appId: dotenv.get('APP_ID_IOS'), 58 | messagingSenderId: dotenv.get('MESSAGING_SENDER_ID_IOS'), 59 | projectId: dotenv.get('PROJECT_ID_IOS'), 60 | storageBucket: dotenv.get('STORAGE_BUCKET_IOS'), 61 | iosClientId: dotenv.get('IOS_CLIENT_ID_IOS'), 62 | iosBundleId: dotenv.get('IOS_BUNDLE_ID_IOS'), 63 | ); 64 | 65 | static FirebaseOptions macos = FirebaseOptions( 66 | apiKey: dotenv.get('API_KEY_MACOS'), 67 | appId: dotenv.get('APP_ID_MACOS'), 68 | messagingSenderId: dotenv.get('MESSAGING_SENDER_ID_MACOS'), 69 | projectId: dotenv.get('PROJECT_ID_MACOS'), 70 | storageBucket: dotenv.get('STORAGE_BUCKET_MACOS'), 71 | iosClientId: dotenv.get('IOS_CLIENT_ID_MACOS'), 72 | iosBundleId: dotenv.get('IOS_BUNDLE_ID_MACOS'), 73 | ); 74 | } 75 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | // 🎯 Dart imports: 2 | import 'dart:developer'; 3 | 4 | // 🐦 Flutter imports: 5 | import 'package:equatable/equatable.dart'; 6 | import 'package:flutter/foundation.dart'; 7 | import 'package:flutter/material.dart'; 8 | import 'package:flutter_bloc/flutter_bloc.dart'; 9 | import 'package:flutter_dotenv/flutter_dotenv.dart'; 10 | import 'package:flutter_mentions/flutter_mentions.dart'; 11 | import 'package:google_fonts/google_fonts.dart'; 12 | import 'package:sizer/sizer.dart'; 13 | import 'package:twitter_gpt/config/route_generator.dart'; 14 | import 'package:twitter_gpt/repositories/tweets/tweet_repo.dart'; 15 | import 'package:twitter_gpt/screens/splashscreen.dart'; 16 | import 'package:twitter_gpt/utils/theme_constants.dart'; 17 | 18 | // 🌎 Project imports: 19 | import 'blocs/app_init/app_init_bloc.dart'; 20 | import 'repositories/authentication/auth_repo.dart'; 21 | 22 | Future main() async { 23 | WidgetsFlutterBinding.ensureInitialized(); 24 | await dotenv.load(fileName: ".env"); 25 | 26 | // await Firebase.initializeApp( 27 | // options: DefaultFirebaseOptions.currentPlatform, 28 | // ); 29 | EquatableConfig.stringify = kDebugMode; 30 | Bloc.observer = SimpleBlocObserver(); 31 | 32 | runApp(const MyApp()); 33 | } 34 | 35 | class MyApp extends StatelessWidget { 36 | const MyApp({super.key}); 37 | 38 | // This widget is the root of your application. 39 | @override 40 | Widget build(BuildContext context) { 41 | return Sizer(builder: (context, orientation, deviceType) { 42 | return MultiRepositoryProvider( 43 | providers: [ 44 | RepositoryProvider(create: (_) => AuthRepository()), 45 | RepositoryProvider(create: (_) => AuthRepository()), 46 | RepositoryProvider(create: (_) => TweetRepo()), 47 | ], 48 | child: MultiBlocProvider( 49 | providers: [ 50 | BlocProvider( 51 | create: (context) => 52 | AppInitBloc(authRepository: context.read()), 53 | ), 54 | ], 55 | child: Portal( 56 | child: MaterialApp( 57 | debugShowCheckedModeBanner: false, 58 | title: 'twitterGPT', 59 | theme: ThemeData.dark().copyWith( 60 | brightness: Brightness.dark, 61 | primaryColor: AppColor.kGreenColor, 62 | scaffoldBackgroundColor: AppColor.kColorBlack, 63 | appBarTheme: const AppBarTheme( 64 | backgroundColor: AppColor.kColorBlack, 65 | ), 66 | textTheme: 67 | GoogleFonts.interTextTheme(Theme.of(context).textTheme) 68 | .apply(bodyColor: AppColor.kColorWhite), 69 | ), 70 | onGenerateRoute: RouteGenerator.generateRoute, 71 | initialRoute: SplashScreen.routeName, 72 | ), 73 | ), 74 | ), 75 | ); 76 | }); 77 | } 78 | } 79 | 80 | class SimpleBlocObserver extends BlocObserver { 81 | @override 82 | void onEvent(Bloc bloc, Object? event) { 83 | log(event.toString()); 84 | super.onEvent(bloc, event!); 85 | } 86 | 87 | @override 88 | void onTransition(Bloc bloc, Transition transition) { 89 | log(transition.toString()); 90 | super.onTransition(bloc, transition); 91 | } 92 | 93 | @override 94 | Future onError( 95 | BlocBase bloc, Object error, StackTrace stackTrace) async { 96 | log(error.toString()); 97 | super.onError(bloc, error, stackTrace); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /lib/models/tweet_model.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: public_member_api_docs, sort_constructors_first 2 | // 🎯 Dart imports: 3 | import 'dart:convert'; 4 | 5 | import 'package:equatable/equatable.dart'; 6 | 7 | // 🐦 Flutter imports: 8 | 9 | class TweetModel extends Equatable { 10 | final String? uid; 11 | final String? prompt; 12 | final String? text; 13 | final String? fileId; 14 | const TweetModel({ 15 | this.uid, 16 | this.prompt, 17 | this.text, 18 | this.fileId, 19 | }); 20 | 21 | TweetModel copyWith({ 22 | String? uid, 23 | String? prompt, 24 | String? text, 25 | String? fileId, 26 | }) { 27 | return TweetModel( 28 | uid: uid ?? this.uid, 29 | prompt: prompt ?? this.prompt, 30 | text: text ?? this.text, 31 | fileId: fileId ?? this.fileId, 32 | ); 33 | } 34 | 35 | Map toMap() { 36 | return { 37 | 'uid': uid, 38 | 'prompt': prompt, 39 | 'text': text, 40 | 'fileId': fileId, 41 | }; 42 | } 43 | 44 | factory TweetModel.fromMap(Map map) { 45 | return TweetModel( 46 | uid: map['uid'] != null ? map['uid'] as String : null, 47 | prompt: map['prompt'] != null ? map['prompt'] as String : null, 48 | text: map['text'] != null ? map['text'] as String : null, 49 | fileId: map['fileId'] != null ? map['fileId'] as String : null, 50 | ); 51 | } 52 | 53 | String toJson() => json.encode(toMap()); 54 | 55 | factory TweetModel.fromJson(String source) => 56 | TweetModel.fromMap(json.decode(source) as Map); 57 | 58 | @override 59 | bool get stringify => true; 60 | 61 | @override 62 | List get props => [uid!, prompt!, text!, fileId!]; 63 | } 64 | -------------------------------------------------------------------------------- /lib/models/user_model.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: public_member_api_docs, sort_constructors_first 2 | // 🎯 Dart imports: 3 | import 'dart:convert'; 4 | 5 | import 'package:equatable/equatable.dart'; 6 | 7 | // 🐦 Flutter imports: 8 | 9 | class User extends Equatable { 10 | final String? uid; 11 | final String? accessToken; 12 | final String? accessTokenSecret; 13 | final String? name; 14 | final String? username; 15 | final String? profileImageUrl; 16 | final String? email; 17 | const User({ 18 | this.uid, 19 | this.accessToken, 20 | this.accessTokenSecret, 21 | this.name, 22 | this.username, 23 | this.profileImageUrl, 24 | this.email, 25 | }); 26 | 27 | User copyWith({ 28 | String? uid, 29 | String? accessToken, 30 | String? accessTokenSecret, 31 | String? name, 32 | String? username, 33 | String? profileImageUrl, 34 | String? email, 35 | }) { 36 | return User( 37 | uid: uid ?? this.uid, 38 | accessToken: accessToken ?? this.accessToken, 39 | accessTokenSecret: accessTokenSecret ?? this.accessTokenSecret, 40 | name: name ?? this.name, 41 | username: username ?? this.username, 42 | profileImageUrl: profileImageUrl ?? this.profileImageUrl, 43 | email: email ?? this.email, 44 | ); 45 | } 46 | 47 | Map toMap() { 48 | return { 49 | 'uid': uid, 50 | 'accessToken': accessToken, 51 | 'accessTokenSecret': accessTokenSecret, 52 | 'name': name, 53 | 'username': username, 54 | 'profileImageUrl': profileImageUrl, 55 | 'email': email, 56 | }; 57 | } 58 | 59 | factory User.fromMap(Map map) { 60 | return User( 61 | uid: map['uid'] != null ? map['uid'] as String : null, 62 | accessToken: 63 | map['accessToken'] != null ? map['accessToken'] as String : null, 64 | accessTokenSecret: map['accessTokenSecret'] != null 65 | ? map['accessTokenSecret'] as String 66 | : null, 67 | name: map['name'] != null ? map['name'] as String : null, 68 | username: map['username'] != null ? map['username'] as String : null, 69 | profileImageUrl: map['profileImageUrl'] != null 70 | ? map['profileImageUrl'] as String 71 | : null, 72 | email: map['email'] != null ? map['email'] as String : null, 73 | ); 74 | } 75 | 76 | String toJson() => json.encode(toMap()); 77 | 78 | factory User.fromJson(String source) => 79 | User.fromMap(json.decode(source) as Map); 80 | 81 | @override 82 | bool get stringify => true; 83 | 84 | @override 85 | List get props { 86 | return [ 87 | uid!, 88 | accessToken!, 89 | accessTokenSecret!, 90 | name!, 91 | username!, 92 | profileImageUrl!, 93 | email!, 94 | ]; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /lib/models/user_preference.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: public_member_api_docs, sort_constructors_first 2 | // 🎯 Dart imports: 3 | import 'dart:convert'; 4 | 5 | import 'package:equatable/equatable.dart'; 6 | 7 | // 🐦 Flutter imports: 8 | 9 | class UserPreference extends Equatable { 10 | final String? uid; 11 | final List? userTopics; 12 | final List? userWritingStyle; 13 | final List? userWritingTone; 14 | final String userFormattingPreferenceMap; 15 | const UserPreference({ 16 | this.uid, 17 | this.userTopics, 18 | this.userWritingStyle, 19 | this.userWritingTone, 20 | required this.userFormattingPreferenceMap, 21 | }); 22 | 23 | UserPreference copyWith({ 24 | String? uid, 25 | List? userTopics, 26 | List? userWritingStyle, 27 | List? userWritingTone, 28 | String? userFormattingPreferenceMap, 29 | }) { 30 | return UserPreference( 31 | uid: uid ?? this.uid, 32 | userTopics: userTopics ?? this.userTopics, 33 | userWritingStyle: userWritingStyle ?? this.userWritingStyle, 34 | userWritingTone: userWritingTone ?? this.userWritingTone, 35 | userFormattingPreferenceMap: 36 | userFormattingPreferenceMap ?? this.userFormattingPreferenceMap, 37 | ); 38 | } 39 | 40 | Map toMap() { 41 | return { 42 | 'uid': uid, 43 | 'userTopics': userTopics, 44 | 'userWritingStyle': userWritingStyle, 45 | 'userWritingTone': userWritingTone, 46 | 'userFormattingPreferenceMap': userFormattingPreferenceMap, 47 | }; 48 | } 49 | 50 | factory UserPreference.fromMap(Map map) { 51 | return UserPreference( 52 | uid: map['uid'] != null ? map['uid'] as String : null, 53 | userTopics: map['userTopics'] != null 54 | ? List.from((map['userTopics'])) 55 | : null, 56 | userWritingStyle: map['userWritingStyle'] != null 57 | ? List.from((map['userWritingStyle'])) 58 | : null, 59 | userWritingTone: map['userWritingTone'] != null 60 | ? List.from((map['userWritingTone'])) 61 | : null, 62 | userFormattingPreferenceMap: map['userFormattingPreferenceMap'] as String, 63 | ); 64 | } 65 | 66 | String toJson() => json.encode(toMap()); 67 | 68 | factory UserPreference.fromJson(String source) => 69 | UserPreference.fromMap(json.decode(source) as Map); 70 | 71 | @override 72 | bool get stringify => true; 73 | 74 | @override 75 | List get props { 76 | return [ 77 | uid!, 78 | userTopics!, 79 | userWritingStyle!, 80 | userWritingTone!, 81 | userFormattingPreferenceMap, 82 | ]; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /lib/repositories/appwrite_repo/appwrite_repo.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'dart:developer'; 3 | 4 | import 'package:appwrite/appwrite.dart'; 5 | import 'package:appwrite/models.dart' as appwrite_models; 6 | import 'package:flutter/foundation.dart'; 7 | import 'package:flutter_dotenv/flutter_dotenv.dart'; 8 | import 'package:twitter_gpt/models/tweet_model.dart'; 9 | import 'package:twitter_gpt/models/user_model.dart'; 10 | import 'package:twitter_gpt/models/user_preference.dart'; 11 | import 'package:twitter_gpt/utils/session_helper.dart'; 12 | import 'package:twitter_gpt/utils/session_manager.dart'; 13 | 14 | class AppwriteRepo { 15 | late Client client; 16 | late Account account; 17 | late Databases database; 18 | late Storage storage; 19 | 20 | final String databaseId = "6489ea336933d937754c"; 21 | final String userCollectionId = "648a092418104075ffbe"; 22 | final String userPreferenceDataCollectionID = "648a2c199299d5c4769a"; 23 | final String tweetCollectionID = "648b93cf7718b139bae5"; 24 | final String storageBucketId = "6489ea5014920431de2b"; 25 | final SessionManager sessionManager = SessionManager(); 26 | 27 | AppwriteRepo() { 28 | client = Client() 29 | ..setEndpoint("https://cloud.appwrite.io/v1") 30 | ..setProject(dotenv.get("APPWRITE_PROJECT_ID")) 31 | ..setSelfSigned(status: true); 32 | account = Account(client); 33 | database = Databases(client); 34 | storage = Storage(client); 35 | } 36 | 37 | Future signInWithEmailAndPassword( 38 | {required String email, required String password}) async { 39 | try { 40 | await account.createEmailSession( 41 | email: email, 42 | password: password, 43 | ); 44 | final user = await account.get(); 45 | await sessionManager 46 | .setData(jsonEncode({"isLoggedIn": true, "uid": user.$id})); 47 | debugPrint(user.toMap().toString()); 48 | return user; 49 | } catch (err) { 50 | debugPrint(err.toString()); 51 | } 52 | return null; 53 | } 54 | 55 | Future signUpWithEmailAndPassword( 56 | {required String email, 57 | required String password, 58 | required String name}) async { 59 | await account.create( 60 | userId: ID.unique(), 61 | email: email, 62 | password: password, 63 | name: name, 64 | ); 65 | } 66 | 67 | Future addUserDataToUserCollection({required User user}) async { 68 | try { 69 | await database.createDocument( 70 | databaseId: databaseId, 71 | collectionId: userCollectionId, 72 | documentId: ID.unique(), 73 | data: user.toMap()); 74 | return true; 75 | } on AppwriteException catch (e) { 76 | debugPrint("Appwrite addUserDataToDatabase error: $e"); 77 | } 78 | return false; 79 | } 80 | 81 | Future addUserPreferenceToUserPreferenceDataCollection( 82 | {required UserPreference userPreference}) async { 83 | try { 84 | await database.createDocument( 85 | databaseId: databaseId, 86 | collectionId: userPreferenceDataCollectionID, 87 | documentId: ID.unique(), 88 | data: userPreference.toMap()); 89 | return true; 90 | } on AppwriteException catch (e) { 91 | debugPrint( 92 | "Appwrite addUserPreferenceToUserPreferenceDataCollection error: $e"); 93 | } 94 | return false; 95 | } 96 | 97 | Future updateUserPreferenceToUserPreferenceDataCollection( 98 | {required UserPreference userPreference}) async { 99 | try { 100 | final documents = await database.listDocuments( 101 | databaseId: databaseId, 102 | collectionId: userPreferenceDataCollectionID, 103 | queries: [Query.equal('uid', SessionHelper.uid)]); 104 | await database.updateDocument( 105 | databaseId: databaseId, 106 | collectionId: userPreferenceDataCollectionID, 107 | documentId: documents.documents[0].$id, 108 | data: userPreference.toMap()); 109 | debugPrint("Check 2"); 110 | return true; 111 | } on AppwriteException catch (e) { 112 | debugPrint( 113 | "Appwrite addUserPreferenceToUserPreferenceDataCollection error: $e"); 114 | } 115 | return false; 116 | } 117 | 118 | Future uploadDataToStorageBucket({required InputFile image}) async { 119 | final appwrite_models.File file = await storage.createFile( 120 | bucketId: storageBucketId, 121 | fileId: ID.unique(), 122 | file: image, 123 | ); 124 | 125 | debugPrint(file.toMap().toString()); 126 | return file.$id; 127 | } 128 | 129 | Future addTweetDataToUserCollection({required TweetModel tweet}) async { 130 | try { 131 | await database.createDocument( 132 | databaseId: databaseId, 133 | collectionId: tweetCollectionID, 134 | documentId: ID.unique(), 135 | data: tweet.toMap()); 136 | return true; 137 | } on AppwriteException catch (e) { 138 | debugPrint("Appwrite addUserDataToDatabase error: $e"); 139 | } 140 | return false; 141 | } 142 | 143 | Future getUserData({required String uid}) async { 144 | try { 145 | final documents = await database.listDocuments( 146 | databaseId: databaseId, 147 | collectionId: userCollectionId, 148 | queries: [Query.equal('uid', uid)]); 149 | final user = User.fromMap(documents.documents[0].data); 150 | return user; 151 | } on AppwriteException catch (e) { 152 | debugPrint("Appwrite getUserData error: $e"); 153 | } 154 | return null; 155 | } 156 | 157 | Future getUserPreferenceData({required String uid}) async { 158 | try { 159 | final documents = await database.listDocuments( 160 | databaseId: databaseId, 161 | collectionId: userPreferenceDataCollectionID, 162 | queries: [Query.equal('uid', uid)]); 163 | final userPreference = 164 | UserPreference.fromMap(documents.documents[0].data); 165 | return userPreference; 166 | } on AppwriteException catch (e) { 167 | debugPrint("Appwrite getUserPreferenceData error: $e"); 168 | } 169 | return null; 170 | } 171 | 172 | Future createPasswordRecovery({ 173 | required String email, 174 | required String url, 175 | }) async { 176 | try { 177 | final user = await account.createRecovery( 178 | email: email, 179 | url: url, 180 | ); 181 | debugPrint("Token $user"); 182 | } catch (error) { 183 | debugPrint("Create Password Recovery Error: $error"); 184 | } 185 | } 186 | 187 | Future logout() { 188 | log("Logging out"); 189 | 190 | return Future.wait([ 191 | account.deleteSession(sessionId: 'current'), 192 | sessionManager.setData(jsonEncode({"isLoggedIn": false, "uid": ""})), 193 | ]); 194 | } 195 | } 196 | -------------------------------------------------------------------------------- /lib/repositories/authentication/auth_repo.dart: -------------------------------------------------------------------------------- 1 | // 🎯 Dart imports: 2 | import 'dart:developer'; 3 | 4 | // 🐦 Flutter imports: 5 | import 'package:cloud_firestore/cloud_firestore.dart'; 6 | import 'package:firebase_auth/firebase_auth.dart' as auth; 7 | import 'package:flutter/material.dart'; 8 | import 'package:flutter_dotenv/flutter_dotenv.dart'; 9 | import 'package:twitter_gpt/utils/session_helper.dart'; 10 | import 'package:twitter_login/twitter_login.dart'; 11 | 12 | // 🌎 Project imports: 13 | import 'package:twitter_gpt/config/paths.dart'; 14 | import 'package:twitter_gpt/repositories/authentication/base_auth_repo.dart'; 15 | import 'package:twitter_gpt/models/user_model.dart' as user_model; 16 | 17 | class AuthRepository extends BaseAuthRepository { 18 | final FirebaseFirestore _firebaseFirestore; 19 | final auth.FirebaseAuth _firebaseAuth; 20 | final usersRef = FirebaseFirestore.instance.collection('users'); 21 | 22 | AuthRepository({ 23 | FirebaseFirestore? firebaseFirestore, 24 | auth.FirebaseAuth? firebaseAuth, 25 | }) : _firebaseFirestore = firebaseFirestore ?? FirebaseFirestore.instance, 26 | _firebaseAuth = firebaseAuth ?? auth.FirebaseAuth.instance; 27 | 28 | @override 29 | Stream get user => _firebaseAuth.userChanges(); 30 | 31 | @override 32 | Future checkUserDataExists({required String userId}) async { 33 | String errorMessage = 'Something went wrong'; 34 | try { 35 | final user = await usersRef.doc(userId).get(); 36 | return user.exists; 37 | } catch (e) { 38 | errorMessage = e.toString(); 39 | debugPrint(e.toString()); 40 | } 41 | throw Exception(errorMessage); 42 | } 43 | 44 | @override 45 | Future updateData( 46 | {required Map json, 47 | required String uid, 48 | required bool check}) async { 49 | check 50 | ? _firebaseFirestore.collection(Paths.users).doc(uid).update(json) 51 | : _firebaseFirestore.collection(Paths.users).doc(uid).set(json); 52 | } 53 | 54 | @override 55 | Future logOut() async { 56 | await _firebaseAuth.signOut(); 57 | } 58 | 59 | @override 60 | Future loginUsingTwitter() async { 61 | try { 62 | // TWITTER Login 63 | final twitterLogin = TwitterLogin( 64 | apiKey: dotenv.get('API_KEY'), 65 | apiSecretKey: dotenv.get('API_SECRET_KEY'), 66 | redirectURI: 'twitterGPTAuth://'); 67 | 68 | // Trigger the sign-in flow 69 | final authResult = await twitterLogin.login(); 70 | authResult.status == TwitterLoginStatus.loggedIn 71 | ? log("twitter login success") 72 | : log("twitter login failed"); 73 | 74 | log("accessToken: ${authResult.authToken}"); 75 | log("authTokenSecret: ${authResult.authTokenSecret}"); 76 | 77 | SessionHelper.accessToken = authResult.authToken; 78 | SessionHelper.accessTokenSecret = authResult.authTokenSecret; 79 | 80 | // // Create a credential from the access token 81 | // final twitterAuthCredential = TwitterAuthProvider.credential( 82 | // accessToken: authResult.authToken!, 83 | // secret: authResult.authTokenSecret!, 84 | // ); 85 | 86 | // _firebaseAuth.signInWithCredential(twitterAuthCredential); 87 | // final userDetails = authResult.user; 88 | // final user = user_model.User( 89 | // twitterId: userDetails!.id, 90 | // name: userDetails.name, 91 | // screenName: userDetails.screenName, 92 | // thumbnailImage: userDetails.thumbnailImage, 93 | // ); 94 | 95 | // return user; 96 | } catch (error) { 97 | log("twitter auth error: $error"); 98 | } 99 | return null; 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /lib/repositories/authentication/base_auth_repo.dart: -------------------------------------------------------------------------------- 1 | import 'package:firebase_auth/firebase_auth.dart' as auth; 2 | import 'package:twitter_gpt/models/user_model.dart' as user_model; 3 | 4 | abstract class BaseAuthRepository { 5 | Stream get user; 6 | Future loginUsingTwitter(); 7 | 8 | Future checkUserDataExists({required String userId}); 9 | 10 | Future updateData( 11 | {required Map json, 12 | required String uid, 13 | required bool check}); 14 | 15 | Future logOut(); 16 | } 17 | -------------------------------------------------------------------------------- /lib/repositories/tweets/base_tweet_repo.dart: -------------------------------------------------------------------------------- 1 | import 'package:twitter_api_v2/twitter_api_v2.dart'; 2 | import 'package:twitter_gpt/models/user_model.dart'; 3 | 4 | abstract class BaseTweetRepo { 5 | Future getTwitterUserProfile(); 6 | Future generateTweet(); 7 | Future?> generateThread({required String userProfile}); 8 | Future postTweet( 9 | {required String tweetText, required String tweetMediaID}); 10 | Future> postThread({required List thread}); 11 | } 12 | -------------------------------------------------------------------------------- /lib/repositories/user/base_user_repo.dart: -------------------------------------------------------------------------------- 1 | import 'package:twitter_gpt/models/user_model.dart'; 2 | 3 | abstract class BaseUserRepo { 4 | Future addData({required User user}); 5 | } 6 | -------------------------------------------------------------------------------- /lib/repositories/user/user_repo.dart: -------------------------------------------------------------------------------- 1 | // // 🎯 Dart imports: 2 | // import 'dart:developer'; 3 | 4 | // // 🐦 Flutter imports: 5 | // import 'package:cloud_firestore/cloud_firestore.dart'; 6 | // import 'package:twitter_gpt/config/paths.dart'; 7 | // import 'package:twitter_gpt/repositories/user/base_user_repo.dart'; 8 | 9 | // // 🌎 Project imports: 10 | // import '../../models/user_model.dart'; 11 | 12 | // class UserRepo extends BaseUserRepo { 13 | // CollectionReference users = 14 | // FirebaseFirestore.instance.collection(Paths.users); 15 | 16 | // @override 17 | // Future addData({required User user}) async { 18 | // try { 19 | // await users.add(User( 20 | // twitterId: user.twitterId, 21 | // name: user.name, 22 | // screenName: user.screenName, 23 | // thumbnailImage: user.thumbnailImage, 24 | // ).toMap()); 25 | // } catch (error) { 26 | // log("user repo addData error: $error"); 27 | // } 28 | // } 29 | // } 30 | -------------------------------------------------------------------------------- /lib/screens/login/twitter_screen.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: public_member_api_docs, sort_constructors_first 2 | import 'dart:developer'; 3 | 4 | import 'package:flutter/material.dart'; 5 | import 'package:page_transition/page_transition.dart'; 6 | import 'package:sizer/sizer.dart'; 7 | import 'package:twitter_gpt/repositories/authentication/auth_repo.dart'; 8 | import 'package:twitter_gpt/screens/onboarding/screens/onboarding_pageview.dart'; 9 | import 'package:twitter_gpt/screens/widgets/custom_button.dart'; 10 | 11 | import 'package:twitter_gpt/utils/asset_constants.dart'; 12 | import 'package:twitter_gpt/utils/theme_constants.dart'; 13 | 14 | class TwitterScreen extends StatefulWidget { 15 | static const routeName = '/twitter-screen'; 16 | const TwitterScreen({Key? key}) : super(key: key); 17 | 18 | static Route route() { 19 | return PageTransition( 20 | settings: const RouteSettings(name: routeName), 21 | type: PageTransitionType.rightToLeft, 22 | child: const TwitterScreen(), 23 | ); 24 | } 25 | 26 | @override 27 | State createState() => _TwitterScreenState(); 28 | } 29 | 30 | class _TwitterScreenState extends State { 31 | bool _isLoading = false; 32 | @override 33 | Widget build(BuildContext context) { 34 | return Scaffold( 35 | resizeToAvoidBottomInset: true, 36 | body: Padding( 37 | padding: EdgeInsets.symmetric(horizontal: 4.w, vertical: 3.h), 38 | child: Column( 39 | crossAxisAlignment: CrossAxisAlignment.center, 40 | children: [ 41 | SizedBox( 42 | height: 10.h, 43 | width: double.infinity, 44 | child: Row( 45 | mainAxisAlignment: MainAxisAlignment.start, 46 | children: [ 47 | TextButton( 48 | child: Text("Cancel", 49 | style: Theme.of(context) 50 | .textTheme 51 | .titleSmall! 52 | .copyWith(color: AppColor.kColorWhite)), 53 | onPressed: () => Navigator.pop(context), 54 | ), 55 | SizedBox(width: 22.3.w), 56 | Image.asset( 57 | twitterGPTLogoGreen, 58 | scale: 8.5, 59 | filterQuality: FilterQuality.low, 60 | ), 61 | ], 62 | ), 63 | ), 64 | SizedBox(height: 4.h), 65 | SizedBox( 66 | height: 6.h, 67 | width: double.infinity, 68 | child: Text( 69 | "Create an account", 70 | style: Theme.of(context) 71 | .textTheme 72 | .headlineSmall! 73 | .copyWith(fontWeight: FontWeight.w900), 74 | ), 75 | ), 76 | Text( 77 | "Welcome to TwitterGPT! Please enter the following details to create an account.", 78 | style: Theme.of(context).textTheme.bodySmall!.copyWith( 79 | color: AppColor.kColorGrey, 80 | height: 1.5, 81 | wordSpacing: 2, 82 | )), 83 | SizedBox(height: 40.h), 84 | _isLoading == true 85 | ? SizedBox( 86 | height: 2.5.h, 87 | width: 2.5.h, 88 | child: const CircularProgressIndicator( 89 | color: AppColor.kColorWhite, 90 | strokeWidth: 3, 91 | ), 92 | ) 93 | : CustomButton( 94 | height: 6.3.h, 95 | width: double.infinity, 96 | icon: Image.asset( 97 | twitterLogo, 98 | scale: 13, 99 | filterQuality: FilterQuality.low, 100 | ), 101 | text: "Continue with Twitter", 102 | onPressed: () async { 103 | setState(() { 104 | _isLoading = true; 105 | }); 106 | log("Signing in"); 107 | await AuthRepository().loginUsingTwitter(); 108 | // await AppwriteRepo().signInWithOAuth(); 109 | log("SignedIn Successfully"); 110 | setState(() { 111 | _isLoading = false; 112 | }); 113 | // ignore: use_build_context_synchronously 114 | Navigator.of(context) 115 | .pushNamed(OnboardingPageview.routeName); 116 | }, 117 | ), 118 | SizedBox(height: 3.5.h), 119 | SizedBox( 120 | height: 10.h, 121 | width: double.infinity, 122 | child: Text( 123 | "Rest assured, we will never post without your consent. Our authorization process is safe and secure, ensuring your privacy is respected.", 124 | style: Theme.of(context).textTheme.bodySmall!.copyWith( 125 | color: AppColor.kColorGrey, height: 1.5, wordSpacing: 2), 126 | ), 127 | ) 128 | ], 129 | ), 130 | ), 131 | ); 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /lib/screens/login/welcome_screen.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: public_member_api_docs, sort_constructors_first 2 | import 'dart:developer'; 3 | 4 | import 'package:flutter/gestures.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:page_transition/page_transition.dart'; 7 | import 'package:sizer/sizer.dart'; 8 | import 'package:twitter_gpt/screens/login/signin_screen.dart'; 9 | import 'package:twitter_gpt/screens/login/signup_screen.dart'; 10 | import 'package:twitter_gpt/screens/widgets/custom_button.dart'; 11 | 12 | import 'package:twitter_gpt/utils/asset_constants.dart'; 13 | import 'package:twitter_gpt/utils/theme_constants.dart'; 14 | 15 | class WelcomeScreen extends StatelessWidget { 16 | static const routeName = '/welcome-screen'; 17 | const WelcomeScreen({Key? key}) : super(key: key); 18 | 19 | static Route route() { 20 | return PageTransition( 21 | settings: const RouteSettings(name: routeName), 22 | type: PageTransitionType.fade, 23 | child: const WelcomeScreen(), 24 | ); 25 | } 26 | 27 | @override 28 | Widget build(BuildContext context) { 29 | return Scaffold( 30 | resizeToAvoidBottomInset: true, 31 | body: Padding( 32 | padding: EdgeInsets.symmetric(horizontal: 4.w, vertical: 3.h), 33 | child: Column( 34 | crossAxisAlignment: CrossAxisAlignment.center, 35 | children: [ 36 | SizedBox(height: 3.h), 37 | SizedBox( 38 | height: 8.h, 39 | width: double.infinity, 40 | child: Image.asset( 41 | twitterGPTLogoGreen, 42 | scale: 8.5, 43 | filterQuality: FilterQuality.low, 44 | ), 45 | ), 46 | SizedBox(height: 20.h), 47 | SizedBox( 48 | height: 40.h, 49 | width: double.infinity, 50 | child: Text( 51 | "Leverage AI to\nsupercharge your tweets\nand amplify your reach.", 52 | style: Theme.of(context) 53 | .textTheme 54 | .headlineSmall! 55 | .copyWith(fontWeight: FontWeight.w900), 56 | ), 57 | ), 58 | CustomButton( 59 | height: 6.3.h, 60 | width: double.infinity, 61 | text: "Create Account", 62 | onPressed: () async { 63 | log("Signing in"); 64 | // await AuthRepository().loginUsingTwitter(); 65 | // await AppwriteRepo().signInWithOAuth(); 66 | log("SignedIn Successfully"); 67 | 68 | Navigator.of(context).pushNamed(SignUpScreen.routeName); 69 | }, 70 | ), 71 | SizedBox(height: 3.5.h), 72 | SizedBox( 73 | height: 10.h, 74 | width: double.infinity, 75 | child: RichText( 76 | text: TextSpan( 77 | text: "By signing up, you agree to our ", 78 | style: Theme.of(context).textTheme.bodySmall!.copyWith( 79 | color: AppColor.kColorGrey, 80 | height: 1.5, 81 | wordSpacing: 2), 82 | children: [ 83 | TextSpan( 84 | text: "Terms, ", 85 | style: Theme.of(context).textTheme.bodySmall!.copyWith( 86 | color: AppColor.kGreenColor, 87 | letterSpacing: 0.5, 88 | height: 1.5, 89 | ), 90 | ), 91 | TextSpan( 92 | text: "Privacy Policy ", 93 | style: Theme.of(context).textTheme.bodySmall!.copyWith( 94 | color: AppColor.kGreenColor, 95 | letterSpacing: 0.5, 96 | height: 1.5, 97 | ), 98 | ), 99 | TextSpan( 100 | text: "and ", 101 | style: Theme.of(context).textTheme.bodySmall!.copyWith( 102 | color: AppColor.kColorGrey, 103 | height: 1.5, 104 | wordSpacing: 2), 105 | ), 106 | TextSpan( 107 | text: "Cookie Use.", 108 | style: Theme.of(context).textTheme.bodySmall!.copyWith( 109 | color: AppColor.kGreenColor, 110 | letterSpacing: 0.5, 111 | height: 1.5, 112 | ), 113 | ), 114 | TextSpan( 115 | text: "\n\nHave an account already?", 116 | style: Theme.of(context).textTheme.bodySmall!.copyWith( 117 | color: AppColor.kColorGrey, 118 | height: 1.5, 119 | wordSpacing: 2), 120 | ), 121 | TextSpan( 122 | recognizer: TapGestureRecognizer() 123 | ..onTap = () { 124 | Navigator.of(context) 125 | .pushNamed(SignInScreen.routeName); 126 | }, 127 | text: " Log in.", 128 | style: Theme.of(context).textTheme.bodySmall!.copyWith( 129 | color: AppColor.kGreenColor, 130 | letterSpacing: 0.5, 131 | height: 1.5, 132 | ), 133 | ), 134 | ]), 135 | ), 136 | ) 137 | ], 138 | ), 139 | ), 140 | ); 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /lib/screens/navbar/bottom_navbar_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:page_transition/page_transition.dart'; 3 | 4 | import 'package:sizer/sizer.dart'; 5 | import 'package:twitter_gpt/screens/homepage/homepage.dart'; 6 | import 'package:twitter_gpt/screens/reply/replypage.dart'; 7 | import 'package:twitter_gpt/utils/asset_constants.dart'; 8 | import 'package:twitter_gpt/utils/theme_constants.dart'; 9 | 10 | class BottomNavBarScreen extends StatefulWidget { 11 | static const routeName = '/bottom-nav-bar'; 12 | const BottomNavBarScreen({super.key}); 13 | static Route route() { 14 | return PageTransition( 15 | settings: const RouteSettings(name: routeName), 16 | child: const BottomNavBarScreen(), 17 | type: PageTransitionType.fade); 18 | } 19 | 20 | @override 21 | State createState() => _BottomNavBarScreenState(); 22 | } 23 | 24 | class _BottomNavBarScreenState extends State { 25 | int _selectedIndex = 0; 26 | static const List _widgetOptions = [ 27 | HomePage(), 28 | ReplyPage(), 29 | ]; 30 | 31 | @override 32 | Widget build(BuildContext context) { 33 | return WillPopScope( 34 | onWillPop: () async => false, 35 | child: Scaffold( 36 | body: Center( 37 | child: _widgetOptions.elementAt(_selectedIndex), 38 | ), 39 | bottomNavigationBar: Container( 40 | height: 8.h, 41 | width: double.infinity, 42 | decoration: const BoxDecoration( 43 | color: AppColor.kColorBlack, 44 | border: Border( 45 | top: BorderSide(color: AppColor.kColorGrey, width: 0.5), 46 | ), 47 | ), 48 | child: Row( 49 | mainAxisAlignment: MainAxisAlignment.spaceAround, 50 | children: [ 51 | IconButton( 52 | onPressed: () { 53 | setState(() { 54 | _selectedIndex = 0; 55 | }); 56 | }, 57 | icon: Image.asset(_selectedIndex == 0 58 | ? homePageLogoSelected 59 | : homePageLogoUnselected), 60 | ), 61 | IconButton( 62 | onPressed: () { 63 | setState(() { 64 | _selectedIndex = 1; 65 | }); 66 | }, 67 | icon: Image.asset(_selectedIndex == 1 68 | ? replyPageLogoSelected 69 | : replyPageLogoUnselected), 70 | ), 71 | ], 72 | ), 73 | ), 74 | ), 75 | ); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /lib/screens/onboarding/screens/apikey_screen.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: public_member_api_docs, sort_constructors_first 2 | import 'package:flutter/gestures.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:page_transition/page_transition.dart'; 5 | import 'package:sizer/sizer.dart'; 6 | import 'package:twitter_gpt/screens/onboarding/screens/onboarding_pageview.dart'; 7 | import 'package:twitter_gpt/screens/widgets/custom_button.dart'; 8 | 9 | import 'package:twitter_gpt/utils/asset_constants.dart'; 10 | import 'package:twitter_gpt/utils/theme_constants.dart'; 11 | import 'package:url_launcher/url_launcher.dart'; 12 | 13 | class ApiKeyScreen extends StatelessWidget { 14 | static const routeName = '/apikey-screen'; 15 | const ApiKeyScreen({Key? key}) : super(key: key); 16 | 17 | static Route route() { 18 | return PageTransition( 19 | settings: const RouteSettings(name: routeName), 20 | type: PageTransitionType.rightToLeft, 21 | child: const ApiKeyScreen(), 22 | ); 23 | } 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return Scaffold( 28 | resizeToAvoidBottomInset: false, 29 | body: Padding( 30 | padding: EdgeInsets.symmetric(horizontal: 4.w, vertical: 3.h), 31 | child: Column( 32 | crossAxisAlignment: CrossAxisAlignment.center, 33 | children: [ 34 | SizedBox( 35 | height: 10.h, 36 | width: double.infinity, 37 | child: Row( 38 | mainAxisAlignment: MainAxisAlignment.start, 39 | children: [ 40 | TextButton( 41 | child: Text("Cancel", 42 | style: Theme.of(context) 43 | .textTheme 44 | .titleSmall! 45 | .copyWith(color: AppColor.kColorWhite)), 46 | onPressed: () => Navigator.pop(context), 47 | ), 48 | SizedBox(width: 22.3.w), 49 | Image.asset( 50 | twitterGPTLogoGreen, 51 | scale: 8.5, 52 | filterQuality: FilterQuality.low, 53 | ), 54 | ], 55 | ), 56 | ), 57 | SizedBox(height: 4.h), 58 | SizedBox( 59 | height: 7.h, 60 | width: double.infinity, 61 | child: Text( 62 | "Enter your OpenAI key", 63 | style: Theme.of(context) 64 | .textTheme 65 | .headlineSmall! 66 | .copyWith(fontWeight: FontWeight.w900), 67 | ), 68 | ), 69 | SizedBox( 70 | height: 15.h, 71 | width: double.infinity, 72 | child: RichText( 73 | text: TextSpan( 74 | text: 75 | "To fully harness the potential of TwiiterGPT, you'll need an OpenAI key. An OpenAI key grants access to the advanced language models that power our platform, enabling us to deliver cutting-edge features and personalized recommendations.\nMore details can be found ", 76 | style: Theme.of(context).textTheme.bodySmall!.copyWith( 77 | color: AppColor.kColorGrey, 78 | height: 1.5, 79 | wordSpacing: 2), 80 | children: [ 81 | TextSpan( 82 | recognizer: TapGestureRecognizer() 83 | ..onTap = () async { 84 | final uri = Uri.https( 85 | "platform.openai.com", "/account/api-keys"); 86 | if (await canLaunchUrl(uri)) { 87 | await launchUrl(uri); 88 | } 89 | }, 90 | text: "here.", 91 | style: Theme.of(context).textTheme.bodySmall!.copyWith( 92 | color: AppColor.kGreenColor, 93 | letterSpacing: 0.5, 94 | height: 1.5, 95 | ), 96 | ), 97 | ]), 98 | ), 99 | ), 100 | SizedBox(height: 5.h), 101 | TextField( 102 | cursorColor: AppColor.kColorGrey, 103 | autofocus: true, 104 | obscureText: true, 105 | decoration: InputDecoration( 106 | hintText: "OpenAI key", 107 | hintStyle: Theme.of(context) 108 | .textTheme 109 | .bodyMedium! 110 | .copyWith(color: AppColor.kColorGrey), 111 | border: null, 112 | focusedBorder: const UnderlineInputBorder( 113 | borderSide: BorderSide(color: AppColor.kColorGrey), 114 | ), 115 | filled: true, 116 | fillColor: AppColor.kColorGrey.withOpacity(0.1), 117 | ), 118 | ), 119 | SizedBox(height: 37.h), 120 | CustomButton( 121 | height: 6.3.h, 122 | width: double.infinity, 123 | text: "Continue", 124 | onPressed: () => Navigator.of(context) 125 | .pushNamed(OnboardingPageview.routeName)), 126 | ], 127 | ), 128 | ), 129 | ); 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /lib/screens/onboarding/screens/onboarding_pageview.dart: -------------------------------------------------------------------------------- 1 | // 🐦 Flutter imports: 2 | import 'package:flutter/material.dart'; 3 | import 'package:page_transition/page_transition.dart'; 4 | 5 | // 🌎 Project imports: 6 | import 'package:twitter_gpt/screens/onboarding/screens/custom_onboarding_screen.dart'; 7 | import 'package:twitter_gpt/utils/onboarding_data.dart'; 8 | 9 | class OnboardingPageview extends StatefulWidget { 10 | static const routeName = '/onboarding-pageview'; 11 | const OnboardingPageview({Key? key}) : super(key: key); 12 | 13 | static Route route() { 14 | return PageTransition( 15 | settings: const RouteSettings(name: routeName), 16 | type: PageTransitionType.rightToLeft, 17 | child: const OnboardingPageview(), 18 | ); 19 | } 20 | 21 | @override 22 | State createState() => _OnboardingPageviewState(); 23 | } 24 | 25 | class _OnboardingPageviewState extends State { 26 | @override 27 | void initState() { 28 | super.initState(); 29 | } 30 | 31 | final PageController _pageController = PageController(initialPage: 0); 32 | 33 | @override 34 | Widget build(BuildContext context) { 35 | return Scaffold( 36 | resizeToAvoidBottomInset: false, 37 | body: PageView( 38 | clipBehavior: Clip.none, 39 | physics: const NeverScrollableScrollPhysics(), 40 | controller: _pageController, 41 | children: _buildPages(), 42 | ), 43 | ); 44 | } 45 | 46 | List _buildPages() { 47 | return [ 48 | CustomScreen( 49 | pageName: OnboardingData.topics, 50 | pageController: _pageController, 51 | title: "What do you want to tweet about on Twitter?", 52 | text: 53 | "Select at least 3 interests to personalize your TwitterGPT experience.", 54 | ), 55 | CustomScreen( 56 | pageName: OnboardingData.writingStyle, 57 | pageController: _pageController, 58 | title: "What is your go to writing style?", 59 | text: 60 | "This will effect the way your tweets and replies are constructed. They can be edited in settings. Selecting multiple styles may impact accuracy.", 61 | ), 62 | CustomScreen( 63 | pageName: OnboardingData.conversationTone, 64 | pageController: _pageController, 65 | title: "What is your desired conversation tone?", 66 | text: 67 | "This will effect the way your tweets and replies are constructed. They can be edited in settings. Selecting multiple tones may impact accuracy.", 68 | ), 69 | ]; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /lib/screens/onboarding/screens/stay_informed.dart: -------------------------------------------------------------------------------- 1 | // 🐦 Flutter imports: 2 | import 'package:flutter/material.dart'; 3 | import 'package:google_fonts/google_fonts.dart'; 4 | import 'package:lottie/lottie.dart'; 5 | import 'package:sizer/sizer.dart'; 6 | 7 | // 🌎 Project imports: 8 | import 'package:twitter_gpt/screens/onboarding/screens/link_twitter_screen.dart'; 9 | import '../../../utils/asset_constants.dart'; 10 | import '../../widgets/dot_indicator.dart'; 11 | 12 | class StayInformedScreen extends StatefulWidget { 13 | final PageController pageController; 14 | static const routename = '/custom-screeen'; 15 | 16 | final double pageNumber; 17 | final String title; 18 | final String text; 19 | 20 | const StayInformedScreen({ 21 | Key? key, 22 | required this.pageController, 23 | required this.pageNumber, 24 | required this.title, 25 | required this.text, 26 | }) : super(key: key); 27 | 28 | @override 29 | State createState() => _StayInformedScreenState(); 30 | } 31 | 32 | class _StayInformedScreenState extends State { 33 | @override 34 | void initState() { 35 | Future.delayed( 36 | const Duration(seconds: 0), 37 | () { 38 | showModalBottomSheet( 39 | isScrollControlled: true, 40 | backgroundColor: Colors.transparent, 41 | context: context, 42 | builder: (context) { 43 | return LinkTwitterScreen( 44 | afterConnect: () {}, 45 | ); 46 | }, 47 | ); 48 | }, 49 | ); 50 | super.initState(); 51 | } 52 | 53 | @override 54 | Widget build(BuildContext context) { 55 | return WillPopScope( 56 | onWillPop: () async => false, 57 | child: Scaffold( 58 | body: SingleChildScrollView( 59 | child: SizedBox( 60 | height: MediaQuery.of(context).size.height, 61 | child: Padding( 62 | padding: const EdgeInsets.symmetric(horizontal: 16), 63 | child: Column( 64 | crossAxisAlignment: CrossAxisAlignment.start, 65 | children: [ 66 | buildAnimation(), 67 | Expanded( 68 | flex: 4, 69 | child: Column( 70 | crossAxisAlignment: CrossAxisAlignment.center, 71 | children: [ 72 | Text( 73 | widget.title, 74 | style: GoogleFonts.lexend().copyWith( 75 | fontWeight: FontWeight.w700, fontSize: 24.sp), 76 | textAlign: TextAlign.center, 77 | ), 78 | SizedBox( 79 | height: 4.h, 80 | ), 81 | Text( 82 | widget.text, 83 | style: GoogleFonts.lexend().copyWith( 84 | fontWeight: FontWeight.w600, 85 | fontSize: 11.sp, 86 | color: const Color(0XFF8F9BBA), 87 | height: 1.5, 88 | letterSpacing: 1, 89 | ), 90 | textAlign: TextAlign.center, 91 | ), 92 | SizedBox( 93 | height: 4.h, 94 | ), 95 | CustomDotIndicator( 96 | curPageIndex: widget.pageNumber, 97 | onTap: (page) { 98 | widget.pageController.jumpToPage(page.round()); 99 | }, 100 | ), 101 | SizedBox( 102 | height: 4.h, 103 | ), 104 | // CustomButton( 105 | // text: "Get Started", 106 | // onPressed: () { 107 | // showModalBottomSheet( 108 | // isScrollControlled: true, 109 | // backgroundColor: Colors.transparent, 110 | // context: context, 111 | // builder: (context) { 112 | // return LinkTwitterScreen( 113 | // afterConnect: () {}, 114 | // ); 115 | // }, 116 | // ); 117 | // }, 118 | // ), 119 | ], 120 | ), 121 | ), 122 | SizedBox( 123 | height: 4.h, 124 | ) 125 | ], 126 | ), 127 | ), 128 | ), 129 | ), 130 | ), 131 | ); 132 | } 133 | 134 | Widget buildAnimation() { 135 | return Expanded( 136 | flex: 3, 137 | child: Lottie.asset(kPage4Animation), 138 | ); 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /lib/screens/reply/replypage.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:sizer/sizer.dart'; 3 | import 'package:twitter_gpt/screens/widgets/custom_button.dart'; 4 | import 'package:twitter_gpt/utils/asset_constants.dart'; 5 | import 'package:twitter_gpt/utils/theme_constants.dart'; 6 | 7 | class ReplyPage extends StatefulWidget { 8 | const ReplyPage({super.key}); 9 | 10 | @override 11 | State createState() => _ReplyPageState(); 12 | } 13 | 14 | class _ReplyPageState extends State { 15 | final TextEditingController _textEditingController = TextEditingController(); 16 | bool isEmpty = true; 17 | @override 18 | Widget build(BuildContext context) { 19 | return SafeArea( 20 | child: Scaffold( 21 | body: SingleChildScrollView( 22 | child: Padding( 23 | padding: EdgeInsets.symmetric(horizontal: 5.w, vertical: 2.h), 24 | child: Column( 25 | crossAxisAlignment: CrossAxisAlignment.end, 26 | children: [ 27 | CustomButton( 28 | height: 5.h, 29 | width: 45.w, 30 | padding: 0, 31 | onPressed: isEmpty ? null : () {}, 32 | text: "Generate replies", 33 | isColorGreen: true, 34 | ), 35 | SizedBox(height: 5.h), 36 | Row( 37 | children: [ 38 | SizedBox( 39 | height: 40.h, 40 | width: 14.w, 41 | child: Align( 42 | alignment: Alignment.topLeft, 43 | child: Image.asset( 44 | twitterGPTLogoGreen, 45 | scale: 10.5, 46 | filterQuality: FilterQuality.low, 47 | ), 48 | ), 49 | ), 50 | SizedBox(width: 2.w), 51 | SizedBox( 52 | height: 40.h, 53 | width: 74.w, 54 | child: TextField( 55 | cursorColor: AppColor.kColorGrey, 56 | controller: _textEditingController, 57 | onChanged: (value) => setState(() { 58 | value.isNotEmpty ? isEmpty = false : isEmpty = true; 59 | }), 60 | keyboardType: TextInputType.multiline, 61 | minLines: 10, 62 | maxLines: 20, 63 | maxLength: 250, 64 | style: Theme.of(context).textTheme.bodyMedium!.copyWith( 65 | color: AppColor.kColorWhite, 66 | height: 1.2, 67 | fontWeight: FontWeight.w400, 68 | ), 69 | decoration: InputDecoration( 70 | border: InputBorder.none, 71 | hintText: 'Paste the text of original tweet here.', 72 | hintStyle: Theme.of(context) 73 | .textTheme 74 | .labelMedium! 75 | .copyWith(color: AppColor.kColorGrey)), 76 | ), 77 | ), 78 | ], 79 | ), 80 | ], 81 | ), 82 | ), 83 | )), 84 | ); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /lib/screens/screens.dart: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/lib/screens/screens.dart -------------------------------------------------------------------------------- /lib/screens/splashscreen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:twitter_gpt/repositories/appwrite_repo/appwrite_repo.dart'; 3 | import 'package:twitter_gpt/screens/login/welcome_screen.dart'; 4 | import 'package:twitter_gpt/screens/navbar/bottom_navbar_screen.dart'; 5 | import 'package:twitter_gpt/utils/session_helper.dart'; 6 | import 'package:twitter_gpt/utils/theme_constants.dart'; 7 | import '../utils/asset_constants.dart'; 8 | 9 | class SplashScreen extends StatefulWidget { 10 | static const routeName = '/splash-screen'; 11 | const SplashScreen({Key? key}) : super(key: key); 12 | static Route route() { 13 | return MaterialPageRoute( 14 | settings: const RouteSettings(name: routeName), 15 | builder: (context) => const SplashScreen(), 16 | ); 17 | } 18 | 19 | @override 20 | State createState() => _SplashScreenState(); 21 | } 22 | 23 | class _SplashScreenState extends State { 24 | @override 25 | Widget build(BuildContext context) { 26 | return FutureBuilder>( 27 | future: AppwriteRepo().sessionManager.getData(), 28 | builder: (context, snapshot) { 29 | if (snapshot.connectionState == ConnectionState.done) { 30 | if (snapshot.data?["isLoggedIn"] ?? false) { 31 | SessionHelper.uid = snapshot.data?["uid"]; 32 | return const BottomNavBarScreen(); 33 | } else { 34 | return const WelcomeScreen(); 35 | } 36 | } else { 37 | return Scaffold( 38 | backgroundColor: AppColor.kGreenColor, 39 | body: Center( 40 | child: Image.asset( 41 | twitterGPTLogoWhite, 42 | scale: 5, 43 | filterQuality: FilterQuality.low, 44 | ), 45 | ), 46 | ); 47 | } 48 | }, 49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /lib/screens/widgets/custom_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:sizer/sizer.dart'; 3 | import 'package:twitter_gpt/utils/theme_constants.dart'; 4 | 5 | class CustomButton extends StatelessWidget { 6 | final double height; 7 | final double width; 8 | final Image? icon; 9 | final VoidCallback? onPressed; 10 | final String text; 11 | final bool? isColorGreen; 12 | final double? padding; 13 | const CustomButton({ 14 | Key? key, 15 | required this.height, 16 | required this.width, 17 | required this.onPressed, 18 | required this.text, 19 | this.icon, 20 | this.isColorGreen, 21 | this.padding, 22 | }) : super(key: key); 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | return SizedBox( 27 | height: height, 28 | width: width, 29 | child: icon != null 30 | ? ElevatedButton.icon( 31 | style: ElevatedButton.styleFrom( 32 | backgroundColor: AppColor.kColorWhite, 33 | padding: EdgeInsets.symmetric( 34 | horizontal: padding == null ? 10.w : padding!), 35 | shape: RoundedRectangleBorder( 36 | borderRadius: BorderRadius.circular(30), 37 | ), 38 | ), 39 | icon: icon!, 40 | label: Text( 41 | text, 42 | style: Theme.of(context).textTheme.bodyMedium!.copyWith( 43 | color: AppColor.kColorBlack, fontWeight: FontWeight.w600), 44 | ), 45 | onPressed: onPressed, 46 | ) 47 | : ElevatedButton( 48 | style: ElevatedButton.styleFrom( 49 | backgroundColor: isColorGreen == null 50 | ? AppColor.kColorWhite 51 | : AppColor.kGreenColor, 52 | padding: EdgeInsets.symmetric( 53 | horizontal: padding == null ? 10.w : padding!), 54 | shape: RoundedRectangleBorder( 55 | borderRadius: BorderRadius.circular(30), 56 | ), 57 | ), 58 | onPressed: onPressed, 59 | child: Text( 60 | text, 61 | style: Theme.of(context).textTheme.bodyMedium!.copyWith( 62 | color: isColorGreen == null 63 | ? AppColor.kColorBlack 64 | : AppColor.kColorWhite, 65 | fontWeight: FontWeight.w600), 66 | ), 67 | ), 68 | ); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /lib/screens/widgets/dot_indicator.dart: -------------------------------------------------------------------------------- 1 | import 'package:dots_indicator/dots_indicator.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class CustomDotIndicator extends StatelessWidget { 5 | final double curPageIndex; 6 | final Function(int) onTap; 7 | 8 | const CustomDotIndicator({ 9 | Key? key, 10 | required this.curPageIndex, 11 | required this.onTap, 12 | }) : super(key: key); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return DotsIndicator( 17 | dotsCount: 4, 18 | position: curPageIndex.toInt(), 19 | onTap: onTap, 20 | decorator: DotsDecorator( 21 | spacing: const EdgeInsets.all(8), 22 | size: const Size.fromRadius(6), 23 | activeSize: const Size(25.0, 9.0), 24 | activeShape: 25 | RoundedRectangleBorder(borderRadius: BorderRadius.circular(5.0)), 26 | color: const Color(0XFFE0E5F2), 27 | activeColor: const Color(0XFF4318FF), 28 | ), 29 | ); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/utils/asset_constants.dart: -------------------------------------------------------------------------------- 1 | const String baseImagesPath = 'assets/images'; 2 | const String baseIconsPath = 'assets/icons'; 3 | const String baseAnimationsPath = 'assets/animations'; 4 | 5 | // Icons Paths 6 | const String twitterGPTLogoWhite = '$baseIconsPath/twitterGPT_logo_white.png'; 7 | const String twitterGPTLogoBlue = '$baseIconsPath/twitterGPT_logo_blue.png'; 8 | const String twitterGPTLogoGreen = '$baseIconsPath/twitterGPT_logo_green.png'; 9 | const String twitterLogo = '$baseIconsPath/twitter.png'; 10 | const String homePageLogoSelected = 11 | '$baseIconsPath/home_page_logo_selected.png'; 12 | const String homePageLogoUnselected = 13 | '$baseIconsPath/home_page_logo_unselected.png'; 14 | const String replyPageLogoUnselected = 15 | '$baseIconsPath/reply_page_logo_unselected.png'; 16 | const String replyPageLogoSelected = 17 | '$baseIconsPath/reply_page_logo_selected.png'; 18 | // Images Paths 19 | 20 | // Animations Paths 21 | const String kPage1Animation = '$baseAnimationsPath/page1_animation.json'; 22 | const String kPage2Animation = '$baseAnimationsPath/page2_animation.json'; 23 | const String kPage3Animation = '$baseAnimationsPath/page3_animation.json'; 24 | const String kPage4Animation = '$baseAnimationsPath/page4_animation.json'; 25 | const String kConfettiJson = '$baseAnimationsPath/confetti.json'; 26 | -------------------------------------------------------------------------------- /lib/utils/enums.dart: -------------------------------------------------------------------------------- 1 | enum UserDataStatus { initial, loading, loaded, error } 2 | 3 | enum UserPreferenceDataStatus { initial, loading, loaded, error } 4 | 5 | enum TweetsGeneratedStatus { initial, loading, loaded, error } 6 | -------------------------------------------------------------------------------- /lib/utils/onboarding_data.dart: -------------------------------------------------------------------------------- 1 | class OnboardingData { 2 | static const String topics = "topics"; 3 | static const String writingStyle = "writingStyle"; 4 | static const String conversationTone = "conversationTone"; 5 | static const Map> onboardingDataMap = { 6 | topics: [ 7 | "AI", 8 | "Technology", 9 | "Coding", 10 | "Writing", 11 | "Marketing", 12 | "Science", 13 | "Fashion & beauty", 14 | "Health & Fitness", 15 | "Web designer", 16 | "Freelancer", 17 | "Politics", 18 | "Gaming", 19 | "Food", 20 | "Business & finance", 21 | ], 22 | writingStyle: [ 23 | "Informative", 24 | "Conversational", 25 | "Inspirational", 26 | "Humorous", 27 | "Provocative", 28 | "Personal", 29 | "Curiosity-driven", 30 | "Interactive", 31 | "Timely/Current", 32 | "Inspirational", 33 | ], 34 | conversationTone: [ 35 | "Friendly", 36 | "Supportive", 37 | "Collaborative", 38 | "Appreciative", 39 | "Inquisitive", 40 | "Encouraging", 41 | "Informal", 42 | "Educational", 43 | "Problem-solving", 44 | "Celebratory", 45 | ], 46 | }; 47 | } 48 | -------------------------------------------------------------------------------- /lib/utils/session_helper.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:twitter_gpt/models/user_model.dart'; 4 | import 'package:twitter_gpt/models/user_preference.dart'; 5 | import 'package:twitter_gpt/utils/onboarding_data.dart'; 6 | 7 | class SessionHelper { 8 | static String? displayName; 9 | static String? firstName; 10 | static String? lastName; 11 | 12 | static String? username; 13 | static String? phone; 14 | static String? age; 15 | static String? uid; 16 | static String? profileImageUrl; 17 | static String? bearerToken; 18 | static String? prompt; 19 | 20 | static String? appwriteName; 21 | static String? appwriteEmail; 22 | static String? appwritePassword; 23 | 24 | static String? accessToken; 25 | static String? accessTokenSecret; 26 | 27 | static List? thread; 28 | 29 | static User? user; 30 | static UserPreference? userPreference; 31 | 32 | static String? tweet; 33 | 34 | static File? currentFile; 35 | static String? currentImageUrl; 36 | 37 | static bool? isHomePageLoaded = false; 38 | static bool? isTweetDataLoaded = false; 39 | 40 | static Map>? userOnboardedData = { 41 | OnboardingData.topics: [], 42 | OnboardingData.writingStyle: [], 43 | OnboardingData.conversationTone: [] 44 | }; 45 | } 46 | 47 | class SessionHelperEmpty { 48 | SessionHelperEmpty() { 49 | SessionHelper.age = null; 50 | SessionHelper.displayName = null; 51 | SessionHelper.firstName = null; 52 | SessionHelper.lastName = null; 53 | SessionHelper.username = null; 54 | SessionHelper.phone = null; 55 | SessionHelper.uid = null; 56 | SessionHelper.bearerToken = null; 57 | SessionHelper.profileImageUrl = null; 58 | SessionHelper.prompt = null; 59 | SessionHelper.thread = null; 60 | SessionHelper.currentFile = null; 61 | SessionHelper.currentImageUrl = null; 62 | SessionHelper.userOnboardedData = { 63 | OnboardingData.topics: [], 64 | OnboardingData.writingStyle: [], 65 | OnboardingData.conversationTone: [] 66 | }; 67 | SessionHelper.appwriteName = null; 68 | SessionHelper.appwriteEmail = null; 69 | SessionHelper.appwritePassword = null; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /lib/utils/session_manager.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:shared_preferences/shared_preferences.dart'; 4 | 5 | class SessionManager { 6 | static const String _isDataSaved = 'isDataSaved'; 7 | 8 | Future> getData() async { 9 | final prefs = await SharedPreferences.getInstance(); 10 | final data = prefs.getString(_isDataSaved) ?? 11 | jsonEncode({ 12 | {"isLoggedIn": false} 13 | }); 14 | return jsonDecode(data); 15 | } 16 | 17 | Future setData(String data) async { 18 | final prefs = await SharedPreferences.getInstance(); 19 | prefs.setString(_isDataSaved, data); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /lib/utils/theme_constants.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:google_fonts/google_fonts.dart'; 3 | import 'package:sizer/sizer.dart'; 4 | 5 | class AppColor { 6 | static const Color kGreenColor = Color(0xff00BA7C); 7 | static const Color kColorOffWhite = Color(0xffF6F8FD); 8 | static const Color kColorWhite = Color(0xffFFFFFF); 9 | static const Color kColorNotBlack = Color(0xff131313); 10 | static const Color kColorBlack = Color(0xff000000); 11 | static const Color kColorGrey = Color(0xff566470); 12 | static const Color kBorderColorGrey = Color(0xffCBD0D9); 13 | static const Color kBoxesColorGrey = Color(0xff3A3D45); 14 | static const Color kBottomNavBarBorderColorGrey = Color(0xff2F3336); 15 | static const Color kUnselectedTabLabelColorGrey = Color(0xff72767A); 16 | static const Color kPlaceholderProfileImageBackgroundColorGrey = 17 | Color(0xffE4E4E4); 18 | 19 | static const Color kUsernameColorGrey = Color(0xff6E767D); 20 | } 21 | 22 | final kTitleTextStyle = TextStyle( 23 | fontSize: 20.sp, 24 | fontFamily: GoogleFonts.inter().fontFamily, 25 | color: AppColor.kColorOffWhite, 26 | fontWeight: FontWeight.w900, 27 | ); 28 | 29 | final kBackButtonTextStyle = TextStyle( 30 | fontSize: 12.sp, 31 | color: AppColor.kColorOffWhite, 32 | fontWeight: FontWeight.normal, 33 | fontFamily: GoogleFonts.inter().fontFamily, 34 | ); 35 | 36 | final kDivider = Divider( 37 | color: AppColor.kColorGrey, 38 | height: 4.h, 39 | ); 40 | -------------------------------------------------------------------------------- /linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.10) 3 | project(runner LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "twitter_gpt") 8 | # The unique GTK application identifier for this application. See: 9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID 10 | set(APPLICATION_ID "com.superawesomeapps.twitter_gpt") 11 | 12 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 13 | # versions of CMake. 14 | cmake_policy(SET CMP0063 NEW) 15 | 16 | # Load bundled libraries from the lib/ directory relative to the binary. 17 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 18 | 19 | # Root filesystem for cross-building. 20 | if(FLUTTER_TARGET_PLATFORM_SYSROOT) 21 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) 22 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) 23 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 24 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 27 | endif() 28 | 29 | # Define build configuration options. 30 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 31 | set(CMAKE_BUILD_TYPE "Debug" CACHE 32 | STRING "Flutter build mode" FORCE) 33 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 34 | "Debug" "Profile" "Release") 35 | endif() 36 | 37 | # Compilation settings that should be applied to most targets. 38 | # 39 | # Be cautious about adding new options here, as plugins use this function by 40 | # default. In most cases, you should add new options to specific targets instead 41 | # of modifying this function. 42 | function(APPLY_STANDARD_SETTINGS TARGET) 43 | target_compile_features(${TARGET} PUBLIC cxx_std_14) 44 | target_compile_options(${TARGET} PRIVATE -Wall -Werror) 45 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") 46 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") 47 | endfunction() 48 | 49 | # Flutter library and tool build rules. 50 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 51 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 52 | 53 | # System-level dependencies. 54 | find_package(PkgConfig REQUIRED) 55 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 56 | 57 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 58 | 59 | # Define the application target. To change its name, change BINARY_NAME above, 60 | # not the value here, or `flutter run` will no longer work. 61 | # 62 | # Any new source files that you add to the application should be added here. 63 | add_executable(${BINARY_NAME} 64 | "main.cc" 65 | "my_application.cc" 66 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 67 | ) 68 | 69 | # Apply the standard set of build settings. This can be removed for applications 70 | # that need different build settings. 71 | apply_standard_settings(${BINARY_NAME}) 72 | 73 | # Add dependency libraries. Add any application-specific dependencies here. 74 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 75 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 76 | 77 | # Run the Flutter tool portions of the build. This must not be removed. 78 | add_dependencies(${BINARY_NAME} flutter_assemble) 79 | 80 | # Only the install-generated bundle's copy of the executable will launch 81 | # correctly, since the resources must in the right relative locations. To avoid 82 | # people trying to run the unbundled copy, put it in a subdirectory instead of 83 | # the default top-level location. 84 | set_target_properties(${BINARY_NAME} 85 | PROPERTIES 86 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 87 | ) 88 | 89 | # Generated plugin build rules, which manage building the plugins and adding 90 | # them to the application. 91 | include(flutter/generated_plugins.cmake) 92 | 93 | 94 | # === Installation === 95 | # By default, "installing" just makes a relocatable bundle in the build 96 | # directory. 97 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 98 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 99 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 100 | endif() 101 | 102 | # Start with a clean build bundle directory every time. 103 | install(CODE " 104 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 105 | " COMPONENT Runtime) 106 | 107 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 108 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 109 | 110 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 111 | COMPONENT Runtime) 112 | 113 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 114 | COMPONENT Runtime) 115 | 116 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 117 | COMPONENT Runtime) 118 | 119 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) 120 | install(FILES "${bundled_library}" 121 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 122 | COMPONENT Runtime) 123 | endforeach(bundled_library) 124 | 125 | # Fully re-copy the assets directory on each build to avoid having stale files 126 | # from a previous install. 127 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 128 | install(CODE " 129 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 130 | " COMPONENT Runtime) 131 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 132 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 133 | 134 | # Install the AOT library on non-Debug builds only. 135 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 136 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 137 | COMPONENT Runtime) 138 | endif() 139 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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, "twitter_gpt"); 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, "twitter_gpt"); 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 | -------------------------------------------------------------------------------- /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/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "ephemeral/Flutter-Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Podfile: -------------------------------------------------------------------------------- 1 | platform :osx, '10.14' 2 | 3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 5 | 6 | project 'Runner', { 7 | 'Debug' => :debug, 8 | 'Profile' => :release, 9 | 'Release' => :release, 10 | } 11 | 12 | def flutter_root 13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) 14 | unless File.exist?(generated_xcode_build_settings_path) 15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" 16 | end 17 | 18 | File.foreach(generated_xcode_build_settings_path) do |line| 19 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 20 | return matches[1].strip if matches 21 | end 22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" 23 | end 24 | 25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 26 | 27 | flutter_macos_podfile_setup 28 | 29 | target 'Runner' do 30 | use_frameworks! 31 | use_modular_headers! 32 | 33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) 34 | end 35 | 36 | post_install do |installer| 37 | installer.pods_project.targets.each do |target| 38 | flutter_additional_macos_build_settings(target) 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /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 = twitter_gpt 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.superawesomeapps.twitterGpt 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2023 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/firebase_app_id_file.json: -------------------------------------------------------------------------------- 1 | { 2 | "file_generated_by": "FlutterFire CLI", 3 | "purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory", 4 | "GOOGLE_APP_ID": "1:1057730238062:ios:1f631ab1697df1d5f2f87f", 5 | "FIREBASE_PROJECT_ID": "twittergpt-7d0dc", 6 | "GCM_SENDER_ID": "1057730238062" 7 | } -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: twitter_gpt 2 | description: A new Flutter project. 3 | # The following line prevents the package from being accidentally published to 4 | # pub.dev using `flutter pub publish`. This is preferred for private packages. 5 | publish_to: "none" # Remove this line if you wish to publish to pub.dev 6 | 7 | # The following defines the version and build number for your application. 8 | # A version number is three numbers separated by dots, like 1.2.43 9 | # followed by an optional build number separated by a +. 10 | # Both the version and the builder number may be overridden in flutter 11 | # build by specifying --build-name and --build-number, respectively. 12 | # In Android, build-name is used as versionName while build-number used as versionCode. 13 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 14 | # In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. 15 | # Read more about iOS versioning at 16 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 17 | # In Windows, build-name is used as the major, minor, and patch parts 18 | # of the product and file versions while build-number is used as the build suffix. 19 | version: 1.0.0+1 20 | 21 | environment: 22 | sdk: ">=2.19.2 <3.0.0" 23 | 24 | # Dependencies specify other packages that your package needs in order to work. 25 | # To automatically upgrade your package dependencies to the latest versions 26 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 27 | # dependencies can be manually updated by changing the version numbers below to 28 | # the latest version available on pub.dev. To see which dependencies have newer 29 | # versions available, run `flutter pub outdated`. 30 | dependencies: 31 | flutter: 32 | sdk: flutter 33 | 34 | # The following adds the Cupertino Icons font to your application. 35 | # Use with the CupertinoIcons class for iOS style icons. 36 | cupertino_icons: ^1.0.2 37 | sizer: ^2.0.15 38 | firebase_core: ^2.12.0 39 | twitter_api_v2: ^4.9.4 40 | dots_indicator: ^3.0.0 41 | lottie: ^2.3.2 42 | google_fonts: ^4.0.4 43 | font_awesome_flutter: ^10.4.0 44 | twitter_oauth2_pkce: ^1.0.2 45 | firebase_auth: ^4.6.0 46 | cloud_firestore: ^4.7.0 47 | flutter_dotenv: ^5.0.2 48 | twitter_login: ^4.3.2 49 | supabase_flutter: ^1.9.1 50 | supabase_auth_ui: ^0.1.0+2 51 | fl_chart: ^0.62.0 52 | equatable: ^2.0.5 53 | flutter_bloc: ^7.0.0 54 | http: ^0.13.6 55 | flutter_spinkit: ^5.2.0 56 | url_launcher: ^6.1.11 57 | cached_network_image: ^3.2.3 58 | appwrite: ^9.0.0 59 | page_transition: ^2.0.9 60 | shared_preferences: ^2.1.2 61 | flutter_mentions: ^2.0.1 62 | image_picker: ^0.8.9 63 | 64 | dev_dependencies: 65 | flutter_test: 66 | sdk: flutter 67 | 68 | # The "flutter_lints" package below contains a set of recommended lints to 69 | # encourage good coding practices. The lint set provided by the package is 70 | # activated in the `analysis_options.yaml` file located at the root of your 71 | # package. See that file for information about deactivating specific lint 72 | # rules and activating additional ones. 73 | flutter_lints: ^2.0.0 74 | 75 | # For information on the generic Dart part of this file, see the 76 | # following page: https://dart.dev/tools/pub/pubspec 77 | 78 | # The following section is specific to Flutter packages. 79 | flutter: 80 | # The following line ensures that the Material Icons font is 81 | # included with your application, so that you can use the icons in 82 | # the material Icons class. 83 | uses-material-design: true 84 | 85 | # To add assets to your application, add an assets section, like this: 86 | assets: 87 | - assets/icons/ 88 | - assets/animations/ 89 | - assets/ 90 | - .env 91 | 92 | # An image asset can refer to one or more resolution-specific "variants", see 93 | # https://flutter.dev/assets-and-images/#resolution-aware 94 | 95 | # For details regarding adding assets from package dependencies, see 96 | # https://flutter.dev/assets-and-images/#from-packages 97 | 98 | # To add custom fonts to your application, add a fonts section here, 99 | # in this "flutter" section. Each entry in this list should have a 100 | # "family" key with the font family name, and a "fonts" key with a 101 | # list giving the asset and other descriptors for the font. For 102 | # example: 103 | # fonts: 104 | # - family: Schyler 105 | # fonts: 106 | # - asset: fonts/Schyler-Regular.ttf 107 | # - asset: fonts/Schyler-Italic.ttf 108 | # style: italic 109 | # - family: Trajan Pro 110 | # fonts: 111 | # - asset: fonts/TrajanPro.ttf 112 | # - asset: fonts/TrajanPro_Bold.ttf 113 | # weight: 700 114 | # 115 | # For details regarding fonts from package dependencies, 116 | # see https://flutter.dev/custom-fonts/#from-packages 117 | -------------------------------------------------------------------------------- /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 | void main() {} 9 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/web/favicon.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/web/icons/Icon-512.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | twitter_gpt 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "twitter_gpt", 3 | "short_name": "twitter_gpt", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /windows/.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 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.14) 3 | project(twitter_gpt 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 "twitter_gpt") 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Add preprocessor definitions for the build version. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") 25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") 26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") 27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") 28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") 29 | 30 | # Disable Windows macros that collide with C++ standard library functions. 31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 32 | 33 | # Add dependency libraries and include directories. Add any application-specific 34 | # dependencies here. 35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 36 | target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") 37 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 38 | 39 | # Run the Flutter tool portions of the build. This must not be removed. 40 | add_dependencies(${BINARY_NAME} flutter_assemble) 41 | -------------------------------------------------------------------------------- /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", "twitter_gpt" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "twitter_gpt" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2023 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "twitter_gpt.exe" "\0" 98 | VALUE "ProductName", "twitter_gpt" "\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/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | 30 | flutter_controller_->engine()->SetNextFrameCallback([&]() { 31 | this->Show(); 32 | }); 33 | 34 | return true; 35 | } 36 | 37 | void FlutterWindow::OnDestroy() { 38 | if (flutter_controller_) { 39 | flutter_controller_ = nullptr; 40 | } 41 | 42 | Win32Window::OnDestroy(); 43 | } 44 | 45 | LRESULT 46 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 47 | WPARAM const wparam, 48 | LPARAM const lparam) noexcept { 49 | // Give Flutter, including plugins, an opportunity to handle window messages. 50 | if (flutter_controller_) { 51 | std::optional result = 52 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 53 | lparam); 54 | if (result) { 55 | return *result; 56 | } 57 | } 58 | 59 | switch (message) { 60 | case WM_FONTCHANGE: 61 | flutter_controller_->engine()->ReloadSystemFonts(); 62 | break; 63 | } 64 | 65 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 66 | } 67 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.Create(L"twitter_gpt", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /windows/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 | -------------------------------------------------------------------------------- /windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yatendra2001/twitterGPT/de52b93163babb5d75729179839abd024edb157a/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates a win32 window with |title| that is positioned and sized using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size this function will scale the inputted width and height as 35 | // as appropriate for the default monitor. The window is invisible until 36 | // |Show| is called. Returns true if the window was created successfully. 37 | bool Create(const std::wstring& title, const Point& origin, const Size& size); 38 | 39 | // Show the current window. Returns true if the window was successfully shown. 40 | bool Show(); 41 | 42 | // Release OS resources associated with window. 43 | void Destroy(); 44 | 45 | // Inserts |content| into the window tree. 46 | void SetChildContent(HWND content); 47 | 48 | // Returns the backing Window handle to enable clients to set icon and other 49 | // window properties. Returns nullptr if the window has been destroyed. 50 | HWND GetHandle(); 51 | 52 | // If true, closing this window will quit the application. 53 | void SetQuitOnClose(bool quit_on_close); 54 | 55 | // Return a RECT representing the bounds of the current client area. 56 | RECT GetClientArea(); 57 | 58 | protected: 59 | // Processes and route salient window messages for mouse handling, 60 | // size change and DPI. Delegates handling of these to member overloads that 61 | // inheriting classes can handle. 62 | virtual LRESULT MessageHandler(HWND window, 63 | UINT const message, 64 | WPARAM const wparam, 65 | LPARAM const lparam) noexcept; 66 | 67 | // Called when CreateAndShow is called, allowing subclass window-related 68 | // setup. Subclasses should return false if setup fails. 69 | virtual bool OnCreate(); 70 | 71 | // Called when Destroy is called. 72 | virtual void OnDestroy(); 73 | 74 | private: 75 | friend class WindowClassRegistrar; 76 | 77 | // OS callback called by message pump. Handles the WM_NCCREATE message which 78 | // is passed when the non-client area is being created and enables automatic 79 | // non-client DPI scaling so that the non-client area automatically 80 | // responsponds to changes in DPI. All other messages are handled by 81 | // MessageHandler. 82 | static LRESULT CALLBACK WndProc(HWND const window, 83 | UINT const message, 84 | WPARAM const wparam, 85 | LPARAM const lparam) noexcept; 86 | 87 | // Retrieves a class instance pointer for |window| 88 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 89 | 90 | // Update the window frame's theme to match the system theme. 91 | static void UpdateTheme(HWND const window); 92 | 93 | bool quit_on_close_ = false; 94 | 95 | // window handle for top level window. 96 | HWND window_handle_ = nullptr; 97 | 98 | // window handle for hosted content. 99 | HWND child_content_ = nullptr; 100 | }; 101 | 102 | #endif // RUNNER_WIN32_WINDOW_H_ 103 | --------------------------------------------------------------------------------