├── .gitignore ├── .metadata ├── README.md ├── analysis_options.yaml ├── android ├── .gitignore ├── app │ ├── build.gradle │ ├── google-services.json │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── flutter_getx_base_project │ │ │ │ └── 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 ├── assets_readme │ ├── get_init_with_template.png │ ├── helperwidget_search_api.png │ ├── helperwidget_search_ui.gif │ ├── printt_color.png │ ├── printt_log_api.png │ └── test_get_command.png ├── import_response.json ├── svg │ ├── facebook.svg │ ├── github.svg │ ├── google-plus.svg │ ├── search_2.svg │ └── twitter.svg └── translations │ ├── en_US.json │ ├── ja_JP.json │ └── vi_VN.json ├── 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 │ │ │ ├── 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 │ ├── GoogleService-Info.plist │ ├── Info.plist │ └── Runner-Bridging-Header.h ├── RunnerTests │ └── RunnerTests.swift └── firebase_app_id_file.json ├── lib ├── app │ ├── core │ │ ├── base │ │ │ ├── base_connect.dart │ │ │ ├── base_controller.dart │ │ │ ├── base_model.dart │ │ │ └── base_project.dart │ │ ├── config │ │ │ ├── api_url.dart │ │ │ └── theme_config.dart │ │ ├── constants │ │ │ ├── app_constant.dart │ │ │ ├── color_constant.dart │ │ │ ├── global_constant.dart │ │ │ └── storage_constant.dart │ │ ├── services │ │ │ ├── notification_service.dart │ │ │ └── translation_service.dart │ │ └── utils │ │ │ ├── all_flutter_icon.dart │ │ │ ├── extension │ │ │ ├── app_extension.dart │ │ │ ├── datetime_extension.dart │ │ │ ├── iterable_extension.dart │ │ │ ├── list_extension.dart │ │ │ ├── map_extension.dart │ │ │ ├── num_extension.dart │ │ │ ├── string_extension.dart │ │ │ └── text_editing_controller_extension.dart │ │ │ ├── helper.dart │ │ │ ├── helper_reflect.dart │ │ │ ├── helper_widget.dart │ │ │ ├── limit_range_text_input.dart │ │ │ ├── print.dart │ │ │ └── utils.dart │ ├── custom │ │ ├── other │ │ │ ├── more_dropdown_search_custom.dart │ │ │ └── search_controller_custom.dart │ │ └── widget │ │ │ └── loadding_widget.dart │ ├── models │ │ └── users_model.dart │ ├── modules │ │ ├── authentication │ │ │ ├── bindings │ │ │ │ └── authentication_binding.dart │ │ │ ├── controllers │ │ │ │ └── authentication_controller.dart │ │ │ ├── views │ │ │ │ └── authentication_view.dart │ │ │ └── widget │ │ │ │ ├── custom_prefix_icon_widget.dart │ │ │ │ ├── forgot_password_tab_widget.dart │ │ │ │ ├── sign_in_tab_widget.dart │ │ │ │ ├── sign_up_tab_widget.dart │ │ │ │ ├── social_icon_widget.dart │ │ │ │ ├── wave_clipper.dart │ │ │ │ └── wave_draw_clippath_widget.dart │ │ └── home │ │ │ ├── controllers │ │ │ └── home_controller.dart │ │ │ └── views │ │ │ └── home_view.dart │ └── routes │ │ ├── app_pages.dart │ │ └── app_routes.dart ├── firebase_options.dart ├── generated │ └── locales.g.dart ├── main.dart └── package │ └── cupertino_datetime_picker │ └── cupertino_datetime_picker.dart ├── linux ├── .gitignore ├── CMakeLists.txt ├── flutter │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake ├── main.cc ├── my_application.cc └── my_application.h ├── macos ├── .gitignore ├── Flutter │ ├── Flutter-Debug.xcconfig │ ├── Flutter-Release.xcconfig │ └── GeneratedPluginRegistrant.swift ├── 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 │ ├── GoogleService-Info.plist │ ├── Info.plist │ ├── MainFlutterWindow.swift │ └── Release.entitlements ├── RunnerTests │ └── RunnerTests.swift └── firebase_app_id_file.json ├── pubspec.lock ├── 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 ├── generated_plugin_registrant.cc ├── generated_plugin_registrant.h └── generated_plugins.cmake └── 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 /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Symbolication related 36 | app.*.symbols 37 | 38 | # Obfuscation related 39 | app.*.map.json 40 | 41 | # Android Studio will place build artifacts here 42 | /android/app/debug 43 | /android/app/profile 44 | /android/app/release 45 | -------------------------------------------------------------------------------- /.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: 84a1e904f44f9b0e9c4510138010edcc653163f8 8 | channel: stable 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8 17 | base_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8 18 | - platform: android 19 | create_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8 20 | base_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8 21 | - platform: ios 22 | create_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8 23 | base_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8 24 | - platform: linux 25 | create_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8 26 | base_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8 27 | - platform: macos 28 | create_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8 29 | base_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8 30 | - platform: web 31 | create_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8 32 | base_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8 33 | - platform: windows 34 | create_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8 35 | base_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8 36 | 37 | # User provided section 38 | 39 | # List of Local paths (relative to this file) that should be 40 | # ignored by the migrate tool. 41 | # 42 | # Files that are not part of the templates will be ignored by default. 43 | unmanaged_files: 44 | - 'lib/main.dart' 45 | - 'ios/Runner.xcodeproj/project.pbxproj' 46 | -------------------------------------------------------------------------------- /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 | //upload firebase can` cai nay` 25 | // def keystoreProperties = new Properties() 26 | // def keystorePropertiesFile = rootProject.file('key.properties') 27 | // if (keystorePropertiesFile.exists()) { 28 | // keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) 29 | // } 30 | 31 | apply plugin: 'com.android.application' 32 | // START: FlutterFire Configuration 33 | apply plugin: 'com.google.gms.google-services' 34 | // END: FlutterFire Configuration 35 | apply plugin: 'kotlin-android' 36 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 37 | 38 | android { 39 | namespace "com.example.flutter_getx_base_project" 40 | compileSdkVersion flutter.compileSdkVersion 41 | ndkVersion flutter.ndkVersion 42 | 43 | compileOptions { 44 | // Flag to enable support for the new language APIs 45 | coreLibraryDesugaringEnabled true 46 | // Sets Java compatibility to Java 8 47 | sourceCompatibility JavaVersion.VERSION_1_8 48 | targetCompatibility JavaVersion.VERSION_1_8 49 | } 50 | 51 | kotlinOptions { 52 | jvmTarget = '1.8' 53 | } 54 | 55 | sourceSets { 56 | main.java.srcDirs += 'src/main/kotlin' 57 | } 58 | 59 | defaultConfig { 60 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 61 | applicationId "com.example.flutter_getx_base_project" 62 | // You can update the following values to match your application needs. 63 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. 64 | minSdkVersion 19 //flutter.minSdkVersion 65 | targetSdkVersion 33 //flutter.targetSdkVersion 66 | versionCode flutterVersionCode.toInteger() 67 | versionName flutterVersionName 68 | multiDexEnabled true 69 | } 70 | 71 | 72 | //upload firebase can` cai nay` 73 | // signingConfigs { 74 | // release { 75 | // keyAlias keystoreProperties['keyAlias'] 76 | // keyPassword keystoreProperties['keyPassword'] 77 | // storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null 78 | // storePassword keystoreProperties['storePassword'] 79 | // } 80 | // } 81 | 82 | 83 | buildTypes { 84 | release { 85 | // TODO: Add your own signing config for the release build. 86 | // Signing with the debug keys for now, so `flutter run --release` works. 87 | signingConfig signingConfigs.debug 88 | 89 | // Enables code shrinking, obfuscation, and optimization for only 90 | // your project's release build type. 91 | // minifyEnabled true 92 | // Enables resource shrinking, which is performed by the 93 | // Android Gradle plugin. 94 | // shrinkResources true 95 | 96 | // signingConfig signingConfigs.release 97 | } 98 | } 99 | 100 | //FIX: [INSTALL_FAILED_NO_MATCHING_ABIS: Failed to extract native libraries, res=-113] 101 | splits { 102 | abi { 103 | enable true 104 | reset() 105 | include 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64', 'armeabi', 'mips', 'mips64' 106 | universalApk true 107 | } 108 | } 109 | } 110 | 111 | flutter { 112 | source '../..' 113 | } 114 | 115 | dependencies { 116 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 117 | // Import the BoM for the Firebase platform 118 | implementation platform('com.google.firebase:firebase-bom:31.2.3') 119 | implementation 'com.google.android.material:material:1.9.0-alpha02' 120 | // Add the dependency for the Firebase Authentication library 121 | // When using the BoM, you don't specify versions in Firebase library dependencies 122 | implementation 'com.google.firebase:firebase-auth-ktx' 123 | implementation 'androidx.window:window:1.0.0' 124 | implementation 'androidx.window:window-java:1.0.0' 125 | coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' 126 | implementation "androidx.work:work-runtime-ktx:2.8.0" 127 | 128 | } 129 | -------------------------------------------------------------------------------- /android/app/google-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_info": { 3 | "project_number": "754653310732", 4 | "project_id": "flutter-getx-base-project", 5 | "storage_bucket": "flutter-getx-base-project.appspot.com" 6 | }, 7 | "client": [ 8 | { 9 | "client_info": { 10 | "mobilesdk_app_id": "1:754653310732:android:4aa8db9afd4cb26763a329", 11 | "android_client_info": { 12 | "package_name": "com.example.flutter_getx_base_project" 13 | } 14 | }, 15 | "oauth_client": [ 16 | { 17 | "client_id": "754653310732-98hdjads98bo6uls10ebiksd85nunsum.apps.googleusercontent.com", 18 | "client_type": 3 19 | } 20 | ], 21 | "api_key": [ 22 | { 23 | "current_key": "AIzaSyBd67LXICMeNxCDe3BAnmioWkckIRZ3k1Y" 24 | } 25 | ], 26 | "services": { 27 | "appinvite_service": { 28 | "other_platform_oauth_client": [ 29 | { 30 | "client_id": "754653310732-98hdjads98bo6uls10ebiksd85nunsum.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 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/flutter_getx_base_project/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.flutter_getx_base_project 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/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/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 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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.4.2' 10 | // START: FlutterFire Configuration 11 | classpath 'com.google.gms:google-services:4.3.15' 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/assets_readme/get_init_with_template.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/assets/assets_readme/get_init_with_template.png -------------------------------------------------------------------------------- /assets/assets_readme/helperwidget_search_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/assets/assets_readme/helperwidget_search_api.png -------------------------------------------------------------------------------- /assets/assets_readme/helperwidget_search_ui.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/assets/assets_readme/helperwidget_search_ui.gif -------------------------------------------------------------------------------- /assets/assets_readme/printt_color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/assets/assets_readme/printt_color.png -------------------------------------------------------------------------------- /assets/assets_readme/printt_log_api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/assets/assets_readme/printt_log_api.png -------------------------------------------------------------------------------- /assets/assets_readme/test_get_command.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/assets/assets_readme/test_get_command.png -------------------------------------------------------------------------------- /assets/import_response.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/assets/import_response.json -------------------------------------------------------------------------------- /assets/svg/facebook.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svg/github.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/svg/google-plus.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /assets/svg/twitter.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /assets/translations/en_US.json: -------------------------------------------------------------------------------- 1 | { 2 | "en_US": "English", 3 | "vi_VN": "Vietnamese", 4 | "ja_JP": "Japanese", 5 | "Language": "Language", 6 | "SignIn": "Sign In", 7 | "SignUp": "Sign Up", 8 | "LogOut": "Log Out", 9 | "UserName": "User Name", 10 | "Email": "Email", 11 | "Phone": "Phone", 12 | "Password": "Password", 13 | "ConfirmPassword": "Confirm Password", 14 | "ForgotPassword": "Forgot Password", 15 | "Add": "Add", 16 | "PleaseWait": "Please wait...", 17 | "Confirm": "Confirm", 18 | "MustNotBeEmpty": "Must not be empty", 19 | "Cancel": "Cancel", 20 | "DoYouWantToTryIt": "Do you want to try it?", 21 | "TryNow": "Try now !", 22 | "RankingTable": "Ranking Table", 23 | "Classify": "Classify", 24 | "Favorite": "Favorite", 25 | "Another": "Another", 26 | "Home": "Home", 27 | "Setting": "Setting", 28 | "Views": "Views", 29 | "Episode": "Episode", 30 | "Episodes": "Episodes", 31 | "Infomation": "Infomation", 32 | "Comment": "Comment", 33 | "Genres": "Genres", 34 | "RememberPassword": "Remember Password" 35 | } 36 | -------------------------------------------------------------------------------- /assets/translations/ja_JP.json: -------------------------------------------------------------------------------- 1 | { 2 | "en_US": "英語", 3 | "vi_VN": "ベトナム語", 4 | "ja_JP": "日本語", 5 | "Language": "言語", 6 | "SignIn": "サインイン", 7 | "SignUp": "サインアップ", 8 | "LogOut": "ログアウト", 9 | "UserName": "ユーザー名", 10 | "Email": "メールアドレス", 11 | "Phone": "電話番号", 12 | "Password": "パスワード", 13 | "ConfirmPassword": "パスワードの確認", 14 | "ForgotPassword": "パスワードをお忘れですか", 15 | "Add": "追加", 16 | "PleaseWait": "お待ちください...", 17 | "Confirm": "確認", 18 | "MustNotBeEmpty": "空にすることはできません", 19 | "Cancel": "キャンセル", 20 | "DoYouWantToTryIt": "試してみますか", 21 | "TryNow": "今すぐ試す!", 22 | "RankingTable": "ランキングテーブル", 23 | "Classify": "分類", 24 | "Favorite": "お気に入り", 25 | "Another": "別の", 26 | "Home": "ホーム", 27 | "Setting": "設定", 28 | "Views": "ビュー", 29 | "Episode": "エピソード", 30 | "Episodes": "エピソード", 31 | "Infomation": "情報", 32 | "Comment": "コメント", 33 | "Genres": "ジャンル", 34 | "RememberPassword":"パスワードを覚えていますか" 35 | } 36 | -------------------------------------------------------------------------------- /assets/translations/vi_VN.json: -------------------------------------------------------------------------------- 1 | { 2 | "en_US": "Tiếng Anh", 3 | "vi_VN": "Tiếng Việt", 4 | "ja_JP": "Tiếng Nhật", 5 | "Language": "Ngôn ngữ", 6 | "SignIn": "Đăng nhập", 7 | "SignUp": "Đăng ký", 8 | "LogOut": "Đăng xuất", 9 | "UserName": "Tên đăng nhập", 10 | "Email": "Email", 11 | "Phone": "Số điện thoại", 12 | "Password": "Mật khẩu", 13 | "ConfirmPassword": "Xác nhận mật khẩu", 14 | "ForgotPassword": "Quên mật khẩu", 15 | "Add": "Thêm", 16 | "PleaseWait": "Vui lòng đợi ...", 17 | "Confirm": "Xác nhận", 18 | "MustNotBeEmpty": "không được để trống!", 19 | "Cancel": "Huỷ", 20 | "DoYouWantToTryIt": "Bạn muốn dùng thử ?", 21 | "TryNow": "Thử ngay !", 22 | "RankingTable": "Bảng xếp hạng", 23 | "Classify": "Phân loại", 24 | "Favorite": "Yêu thích", 25 | "Another": "Khác", 26 | "Home": "Trang chủ", 27 | "Setting": "Cài đặt", 28 | "Views": "Lượt xem", 29 | "Episode": "Tập", 30 | "Episodes": "Danh sách tập", 31 | "Infomation": "Thông tin", 32 | "Comment": "Bình luận", 33 | "Genres": "Thể loại", 34 | "RememberPassword":"Ghi nhớ mật khẩu" 35 | } 36 | -------------------------------------------------------------------------------- /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 | target 'RunnerTests' do 36 | inherit! :search_paths 37 | end 38 | end 39 | 40 | post_install do |installer| 41 | installer.pods_project.targets.each do |target| 42 | flutter_additional_ios_build_settings(target) 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /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 | 43 | 49 | 50 | 51 | 52 | 53 | 63 | 65 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/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/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/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/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/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/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/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/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/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/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/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/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/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/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/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/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/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/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/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/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/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/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/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/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/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/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/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/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/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/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/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/GoogleService-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CLIENT_ID 6 | 754653310732-8c9mmaebb5ovme4ooarl93d1uakfcqiu.apps.googleusercontent.com 7 | REVERSED_CLIENT_ID 8 | com.googleusercontent.apps.754653310732-8c9mmaebb5ovme4ooarl93d1uakfcqiu 9 | API_KEY 10 | AIzaSyDppyMn5WF93R0bDmqcU5BfkGyoq8teRlU 11 | GCM_SENDER_ID 12 | 754653310732 13 | PLIST_VERSION 14 | 1 15 | BUNDLE_ID 16 | com.example.flutterGetxBaseProject 17 | PROJECT_ID 18 | flutter-getx-base-project 19 | STORAGE_BUCKET 20 | flutter-getx-base-project.appspot.com 21 | IS_ADS_ENABLED 22 | 23 | IS_ANALYTICS_ENABLED 24 | 25 | IS_APPINVITE_ENABLED 26 | 27 | IS_GCM_ENABLED 28 | 29 | IS_SIGNIN_ENABLED 30 | 31 | GOOGLE_APP_ID 32 | 1:754653310732:ios:becae31c543c040b63a329 33 | 34 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Flutter Getx Base Project 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | flutter_getx_base_project 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UIViewControllerBasedStatusBarAppearance 45 | 46 | CADisableMinimumFrameDurationOnPhone 47 | 48 | UIApplicationSupportsIndirectInputEvents 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /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:754653310732:ios:becae31c543c040b63a329", 5 | "FIREBASE_PROJECT_ID": "flutter-getx-base-project", 6 | "GCM_SENDER_ID": "754653310732" 7 | } -------------------------------------------------------------------------------- /lib/app/core/base/base_connect.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:convert'; 3 | 4 | import 'package:get/get.dart'; 5 | import 'package:get/get_connect/http/src/request/request.dart'; 6 | 7 | import '/app/core/base/base_model.dart'; 8 | import '/app/core/config/api_url.dart'; 9 | import '/app/core/utils/utils.dart'; 10 | import '/app/custom/widget/loadding_widget.dart'; 11 | import '/app/modules/authentication/controllers/authentication_controller.dart'; 12 | import '../constants/app_constant.dart'; 13 | 14 | // ignore: constant_identifier_names 15 | enum RequestMethod { GET, POST, PUT, DELETE } 16 | 17 | class BaseConnect extends GetConnect { 18 | int get requestAgainSecond => 10; //neu request loi~ thi` se tu dong goi call api sau khoang thoi gian nao` do' 19 | int get timeOutSecond => 60; 20 | bool isShowLoading = true; 21 | 22 | @override 23 | void onInit() { 24 | super.onInit(); 25 | httpClient.baseUrl = ApiUrl.base_url; 26 | httpClient.timeout = Duration(seconds: timeOutSecond); 27 | // httpClient.addAuthenticator(authInterceptor); 28 | httpClient.addRequestModifier(requestInterceptor); 29 | httpClient.addResponseModifier(responseInterceptor); 30 | } 31 | 32 | FutureOr requestInterceptor(Request request) async { 33 | request.headers['Authorization'] = 'Bearer ${AuthenticationController.userAccount?.token}'; 34 | 35 | request.headers['Accept'] = 'application/json, text/plain, */*'; 36 | request.headers['Charset'] = 'utf-8'; 37 | // request.headers['Content-Type'] = 'application/json;charset=UTF-8'; 38 | 39 | // tự động mở loadding khi Request 40 | if (isShowLoading) Loadding.show(); 41 | Printt.yellow("${request.method}: ${request.url.toString()} ------------request"); 42 | return request; 43 | } 44 | 45 | FutureOr responseInterceptor(Request request, Response response) async { 46 | // tự động tắt loadding khi có response 47 | Loadding.dismiss(); 48 | 49 | if (response.hasError) { 50 | handleErrorStatus(response); 51 | return; 52 | } 53 | 54 | return response; 55 | } 56 | 57 | FutureOr onTimeout() { 58 | throw TimeoutException( 59 | 'Không có phản hồi từ máy chủ trong ${httpClient.timeout.inSeconds} giây, yêu cầu có thể đã được gửi đi, xin hãy kiểm tra lại'); 60 | } 61 | 62 | void handleErrorStatus(Response response) { 63 | switch (response.statusCode) { 64 | case 400: 65 | case 404: 66 | case 500: 67 | // 68 | final Map errorMessage = jsonDecode(response.bodyString!); 69 | 70 | String message = ''; 71 | if (errorMessage.containsKey('error') || errorMessage.containsKey('message')) { 72 | if (errorMessage['error'] is Map) { 73 | //cho nay` bat' loi~ OpenAI 74 | message = errorMessage['error']['message']; 75 | } else { 76 | message = (errorMessage['message'] ?? errorMessage['error']).toString(); 77 | } 78 | } else { 79 | errorMessage.forEach((key, value) { 80 | if (value is List) { 81 | message += '${value.join('\n')}\n'; 82 | } else { 83 | message += value.toString(); 84 | } 85 | }); 86 | } 87 | HelperWidget.showToast('CODE (${response.statusCode}):\n$message'); 88 | Printt.red(message); 89 | break; 90 | case 401: 91 | //401: Print token expired 92 | String message = 'CODE (${response.statusCode}):\n${response.statusText}'; 93 | HelperWidget.showToast(message); 94 | Printt.red(message); 95 | AuthenticationController.userAccount = null; 96 | //Remove token 97 | Global.sharedPreferences.remove(StorageConstants.userAccount); 98 | Get.toNamed('/authentication'); 99 | break; 100 | default: 101 | break; 102 | } 103 | } 104 | 105 | // ------------------------- 106 | 107 | /// [body] gửi request cho các phương thức POST, PUT, PATCH 108 | /// 109 | /// [queryParam] gửi request dạng queryParam cho các phương thức GET 110 | /// 111 | /// [baseModel] dùng để parse dữ liệu mong muốn trả về 112 | Future onRequest( 113 | String url, 114 | RequestMethod method, { 115 | dynamic body, 116 | BaseModel? baseModel, //muon tra ve kieu du lieu nao` ?, neu null thi` tra? ve` Response 117 | Map? queryParam, 118 | bool? isShowLoading, 119 | }) async { 120 | try { 121 | this.isShowLoading = isShowLoading ??= true; 122 | 123 | if (body is List) { 124 | //cho no' theo kieu? nhu vay` [{},{},{}...] 125 | body = body.map((e) => e.toJson()).toList(); 126 | } else if (body != null && body is BaseModel) { 127 | body = body.toJson(); 128 | } 129 | 130 | if (body is FormData) { 131 | Printt.green(jsonEncode(Map.fromEntries(body.fields))); 132 | } else { 133 | Printt.green(jsonEncode(body)); 134 | } 135 | 136 | final res = await request( 137 | url, 138 | method.name, 139 | body: body, 140 | query: queryParam?.map((key, value) => MapEntry(key, value.toString())), 141 | decoder: (data) { 142 | if (baseModel == null) return data; //return Response 143 | if (data is List) return data.map((e) => baseModel.fromJson(e)).toList(); 144 | if (data is Map) return baseModel.fromJson(data); 145 | return null; 146 | }, 147 | ).timeout(httpClient.timeout, onTimeout: onTimeout).then((value) { 148 | Printt.magenta(value.bodyString.toString()); 149 | return value; 150 | }); 151 | // 152 | return res.body; 153 | } on TimeoutException catch (_) { 154 | HelperWidget.showToast(_.message!); 155 | // catch timeout here.. 156 | } catch (e) { 157 | //? tự động gọi lại api 158 | // return await Future.delayed( 159 | // Duration(seconds: requestAgainSecond), 160 | // () => onRequest( 161 | // url, 162 | // method, 163 | // body: body, 164 | // baseModel: baseModel, 165 | // queryParam: queryParam, 166 | // isShowLoading: isShowLoading, 167 | // )); 168 | } 169 | return null; 170 | } 171 | } 172 | -------------------------------------------------------------------------------- /lib/app/core/base/base_controller.dart: -------------------------------------------------------------------------------- 1 | import 'package:get/get.dart'; 2 | 3 | import '/app/core/base/base_project.dart'; 4 | 5 | export '../config/api_url.dart'; 6 | 7 | abstract class BaseController extends GetxController { 8 | BaseConnect get apiCall => Get.find(); 9 | } 10 | -------------------------------------------------------------------------------- /lib/app/core/base/base_model.dart: -------------------------------------------------------------------------------- 1 | // get generate model on response with assets/import_response.json 2 | //get generate model with assets/import_response.json 3 | abstract class BaseModel { 4 | R fromJson(Map json); 5 | 6 | Map toJson(); 7 | } 8 | 9 | // abstract class SearchDelegateQueryName { 10 | // String get queryName; 11 | // set queryName(String value) => queryName = value; 12 | // Object? objectt; 13 | // String? description; 14 | // } 15 | 16 | mixin BaseSelectedModel { 17 | bool isSelected = false; 18 | } 19 | -------------------------------------------------------------------------------- /lib/app/core/base/base_project.dart: -------------------------------------------------------------------------------- 1 | export 'base_connect.dart'; 2 | export 'base_controller.dart'; 3 | export 'base_model.dart'; 4 | -------------------------------------------------------------------------------- /lib/app/core/config/api_url.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: non_constant_identifier_names 2 | 3 | class ApiUrl { 4 | static String get base_url => 'https://127.0.0.1'; //baseUrl 5 | 6 | // 7 | static String post_auth_login() => '/api/auth/login'; 8 | static String post_auth_register() => '/api/auth/register'; 9 | } 10 | -------------------------------------------------------------------------------- /lib/app/core/config/theme_config.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '../constants/color_constant.dart'; 4 | 5 | // https://flutter.github.io/samples/web/material_3_demo/#/ 6 | class ThemeConfig with ColorConstants { 7 | ThemeData get lightTheme => ThemeData.light().copyWith( 8 | // useMaterial3: true, 9 | brightness: Brightness.light, 10 | primaryColor: ColorConstants.pink800, 11 | colorScheme: ColorScheme.fromSwatch().copyWith( 12 | secondary: ColorConstants.pink500, 13 | ), 14 | 15 | popupMenuTheme: const PopupMenuThemeData( 16 | shape: RoundedRectangleBorder( 17 | borderRadius: BorderRadius.all(Radius.circular(10.0)), 18 | //side: const BorderSide(color: Colors.pink) 19 | ), 20 | ), 21 | outlinedButtonTheme: OutlinedButtonThemeData( 22 | style: OutlinedButton.styleFrom( 23 | shape: const StadiumBorder(), 24 | ), 25 | ), 26 | 27 | elevatedButtonTheme: ElevatedButtonThemeData( 28 | style: ElevatedButton.styleFrom( 29 | shape: const RoundedRectangleBorder( 30 | borderRadius: BorderRadius.all(Radius.circular(10.0)), 31 | //side: const BorderSide(color: Colors.pink) 32 | ), 33 | //shadowColor: MaterialStateProperty.all(Colors.red), 34 | //elevation: MaterialStateProperty.all(0), 35 | // backgroundColor: ColorConstants.pink800, //background 36 | )), 37 | ); 38 | 39 | ThemeData get dartTheme => ThemeData.dark( 40 | // useMaterial3: true, 41 | ); 42 | } 43 | -------------------------------------------------------------------------------- /lib/app/core/constants/app_constant.dart: -------------------------------------------------------------------------------- 1 | export 'color_constant.dart'; 2 | export 'global_constant.dart'; 3 | export 'storage_constant.dart'; 4 | -------------------------------------------------------------------------------- /lib/app/core/constants/color_constant.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '/app/core/utils/extension/app_extension.dart'; 4 | 5 | mixin class ColorConstants { 6 | //0xFF vao` hex 7 | // static final MaterialColor blue100 = MaterialColor(0xFFE1EDF9, getSwatch(const Color(0xFFE1EDF9))); 8 | static final MaterialColor pink500 = MaterialColor(0xFFFFE6E6, getSwatch(const Color(0xFFFFE6E6))); 9 | static final MaterialColor pink800 = MaterialColor(0xFFF76969, getSwatch(const Color(0xFFF76969))); 10 | 11 | static Map getSwatch(Color color) { 12 | final hslColor = HSLColor.fromColor(color); 13 | final lightness = hslColor.lightness; 14 | 15 | /// if [500] is the default color, there are at LEAST five 16 | /// steps below [500]. (i.e. 400, 300, 200, 100, 50.) A 17 | /// divisor of 5 would mean [50] is a lightness of 1.0 or 18 | /// a color of #ffffff. A value of six would be near white 19 | /// but not quite. 20 | const lowDivisor = 6; 21 | 22 | /// if [500] is the default color, there are at LEAST four 23 | /// steps above [500]. A divisor of 4 would mean [900] is 24 | /// a lightness of 0.0 or color of #000000 25 | const highDivisor = 5; 26 | 27 | final lowStep = (1.0 - lightness) / lowDivisor; 28 | final highStep = lightness / highDivisor; 29 | 30 | return { 31 | 50: (hslColor.withLightness(lightness + (lowStep * 5))).toColor(), 32 | 100: (hslColor.withLightness(lightness + (lowStep * 4))).toColor(), 33 | 200: (hslColor.withLightness(lightness + (lowStep * 3))).toColor(), 34 | 300: (hslColor.withLightness(lightness + (lowStep * 2))).toColor(), 35 | 400: (hslColor.withLightness(lightness + lowStep)).toColor(), 36 | 500: (hslColor.withLightness(lightness)).toColor(), 37 | 600: (hslColor.withLightness(lightness - highStep)).toColor(), 38 | 700: (hslColor.withLightness(lightness - (highStep * 2))).toColor(), 39 | 800: (hslColor.withLightness(lightness - (highStep * 3))).toColor(), 40 | 900: (hslColor.withLightness(lightness - (highStep * 4))).toColor(), 41 | }; 42 | } 43 | 44 | static Color hexToColor(String hex) { 45 | assert(hex.isHexColor, 'hex color must be #rrggbb or #rrggbbaa'); 46 | 47 | return Color( 48 | int.parse(hex.substring(1), radix: 16) + (hex.length == 7 ? 0xff000000 : 0x00000000), 49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /lib/app/core/constants/global_constant.dart: -------------------------------------------------------------------------------- 1 | import 'package:shared_preferences/shared_preferences.dart'; 2 | 3 | abstract class Global { 4 | static late final SharedPreferences sharedPreferences; 5 | } 6 | -------------------------------------------------------------------------------- /lib/app/core/constants/storage_constant.dart: -------------------------------------------------------------------------------- 1 | // storage key (shared preferences) 2 | abstract class StorageConstants { 3 | static const String langCode = 'langCode'; 4 | static const String userAccount = 'userAccount'; 5 | } 6 | -------------------------------------------------------------------------------- /lib/app/core/services/notification_service.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:convert'; 3 | 4 | import 'package:firebase_core/firebase_core.dart'; 5 | import 'package:firebase_messaging/firebase_messaging.dart'; 6 | import 'package:flutter/services.dart'; 7 | import 'package:flutter_local_notifications/flutter_local_notifications.dart'; 8 | import 'package:get/get.dart'; 9 | 10 | import '../../../firebase_options.dart'; 11 | import '../utils/utils.dart'; 12 | 13 | /// flutter_local_notifications: ^14.0.0+1 14 | class NotificationService extends GetxService { 15 | final localNotification = FlutterLocalNotificationsPlugin(); 16 | AndroidNotificationChannel get androidNotifiChannel => const AndroidNotificationChannel( 17 | 'notify_app', 18 | 'my_default_notification_channel_id', 19 | description: 'Cái này là channel mặc định cho app', 20 | enableLights: true, 21 | importance: Importance.max, 22 | enableVibration: true, 23 | playSound: true, 24 | //sound: RawResourceAndroidNotificationSound('social_app_notification_sound'), 25 | // sound: UriAndroidNotificationSound('assets/sound/gmc_notification_sound.mp3') 26 | ); 27 | 28 | Future notificationServiceInitialize() async { 29 | await _initLocalNotification(); 30 | 31 | await _requestPermissionApp(); 32 | 33 | // getDeviceFirebaseToken(); 34 | 35 | firebaseMessagingForegroundHandler(); 36 | } 37 | 38 | Future _initLocalNotification() async { 39 | // ở android, tạo channel cho notification 40 | await localNotification 41 | .resolvePlatformSpecificImplementation() 42 | ?.createNotificationChannel(androidNotifiChannel); 43 | // 44 | 45 | //setting notification 46 | const settings = InitializationSettings( 47 | android: AndroidInitializationSettings('@mipmap/ic_launcher'), 48 | // iOS: DarwinInitializationSettings(), 49 | ); 50 | 51 | //add setting 52 | localNotification.initialize( 53 | settings, 54 | onDidReceiveNotificationResponse: (details) async { 55 | //bắt sự kiện click vào notification đẩy nó vào stream 56 | Printt.white('onDidReceiveNotificationResponse ${details.payload}'); 57 | }, 58 | onDidReceiveBackgroundNotificationResponse: onDidReceiveBackgroundNotificationResponse, 59 | ); 60 | } 61 | 62 | // gửi yêu cầu đến người dùng cấp quyền cho app 63 | Future _requestPermissionApp() async { 64 | await FirebaseMessaging.instance.requestPermission( 65 | alert: true, 66 | announcement: true, 67 | badge: true, 68 | carPlay: true, 69 | criticalAlert: true, 70 | provisional: true, 71 | sound: true, 72 | ); 73 | } 74 | 75 | Future getDeviceFirebaseToken() async { 76 | final token = await FirebaseMessaging.instance.getToken(); 77 | Printt.cyan('TOKEN DEVICE: $token'); 78 | return token; 79 | } 80 | 81 | Future showNotification(RemoteMessage message) async { 82 | ByteArrayAndroidBitmap? imageBitMap; 83 | if (message.data['image'] != null) { 84 | Uint8List bodyBytes = (await NetworkAssetBundle(Uri.parse(message.data['image'])).load(message.data['image'])).buffer.asUint8List(); 85 | 86 | imageBitMap = ByteArrayAndroidBitmap.fromBase64String(base64Encode(bodyBytes)); 87 | } 88 | 89 | return localNotification.show( 90 | message.messageId.hashCode, 91 | message.notification?.title, 92 | message.notification?.body, 93 | NotificationDetails( 94 | android: AndroidNotificationDetails( 95 | androidNotifiChannel.id, 96 | androidNotifiChannel.name, 97 | channelDescription: androidNotifiChannel.description, 98 | enableLights: androidNotifiChannel.enableLights, 99 | importance: androidNotifiChannel.importance, 100 | enableVibration: androidNotifiChannel.enableVibration, 101 | playSound: androidNotifiChannel.playSound, 102 | priority: Priority.max, 103 | sound: androidNotifiChannel.sound, 104 | icon: '@mipmap/ic_launcher', 105 | // largeIcon: const DrawableResourceAndroidBitmap('@mipmap/ic_launcher'), 106 | largeIcon: imageBitMap, 107 | styleInformation: imageBitMap != null ? BigPictureStyleInformation(imageBitMap) : null, 108 | ), 109 | // iOS: const DarwinNotificationDetails(), 110 | ), 111 | payload: message.data['payload'], 112 | ); 113 | } 114 | 115 | void firebaseMessagingForegroundHandler() { 116 | FirebaseMessaging.onMessage.listen((RemoteMessage message) { 117 | if (message.notification != null) { 118 | Printt.white('show notification from ${message.from}}'); 119 | showNotification(message); 120 | } 121 | }); 122 | } 123 | 124 | @pragma('vm:entry-point') 125 | static Future firebaseMessagingBackgroundHandler(RemoteMessage message) async { 126 | // If you're going to use other Firebase services in the background, such as Firestore, 127 | // make sure you call `initializeApp` before using other Firebase services. 128 | await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); 129 | 130 | Printt.white('Handling a background messagee: ${message.messageId}'); 131 | } 132 | 133 | static void onDidReceiveBackgroundNotificationResponse(NotificationResponse details) { 134 | Printt.white('onDidReceiveBackgroundNotificationResponse ${details.payload}'); 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /lib/app/core/services/translation_service.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:get/get.dart'; 3 | 4 | import '../../../generated/locales.g.dart'; 5 | import '../constants/app_constant.dart'; 6 | 7 | // get generate locales assets/translations 8 | //nguồn: https://viblo.asia/p/getx-flutter-multiple-language-support-with-getx-part-3-GrLZDDqBZk0 9 | class TranslationService extends Translations { 10 | // locale sẽ được get mỗi khi mới mở app (phụ thuộc vào locale hệ thống hoặc bạn có thể cache lại locale mà người dùng đã setting và set nó ở đây) 11 | static Locale? locale = Get.deviceLocale; 12 | // fallbackLocale là locale default nếu locale được set không nằm trong những Locale support 13 | static const fallbackLocale = Locale('en', 'US'); 14 | // các Locale được support 15 | static const locales = [ 16 | Locale('en', 'US'), 17 | Locale('vi', 'VN'), 18 | Locale('ja', 'JP'), 19 | ]; 20 | 21 | // function change language 22 | static void changeLocale(Locale localeee) { 23 | Get.updateLocale(localeee); 24 | locale = localeee; 25 | Global.sharedPreferences.setString(StorageConstants.langCode, localeee.languageCode); 26 | } 27 | 28 | static Future getLocaleFromLanguage() async { 29 | final langCode = Global.sharedPreferences.getString(StorageConstants.langCode); 30 | 31 | if (langCode == null) return Get.deviceLocale; 32 | 33 | for (int i = 0; i < locales.length; i++) { 34 | if (langCode == locales[i].languageCode) return locales[i]; 35 | } 36 | 37 | return Get.deviceLocale; 38 | } 39 | 40 | @override 41 | Map> get keys => AppTranslation.translations; 42 | } 43 | -------------------------------------------------------------------------------- /lib/app/core/utils/extension/app_extension.dart: -------------------------------------------------------------------------------- 1 | export 'datetime_extension.dart'; 2 | export 'iterable_extension.dart'; 3 | export 'list_extension.dart'; 4 | export 'map_extension.dart'; 5 | export 'num_extension.dart'; 6 | export 'string_extension.dart'; 7 | export 'text_editing_controller_extension.dart'; 8 | -------------------------------------------------------------------------------- /lib/app/core/utils/extension/datetime_extension.dart: -------------------------------------------------------------------------------- 1 | import 'package:intl/intl.dart'; 2 | 3 | extension DateTimeExtension on DateTime { 4 | String toDateFormat() => DateFormat('yyyy-MM-dd').format(this); 5 | 6 | String timeAgoSinceDate({bool numericDates = true}) { 7 | final date2 = DateTime.now(); 8 | final difference = date2.difference(this); 9 | 10 | if (difference.inDays > 8) { 11 | return toDateFormat(); 12 | } else if ((difference.inDays / 7).floor() >= 1) { 13 | return (numericDates) ? '1 week ago' : 'Last week'; 14 | } else if (difference.inDays >= 2) { 15 | return '${difference.inDays} days ago'; 16 | } else if (difference.inDays >= 1) { 17 | return (numericDates) ? '1 day ago' : 'Yesterday'; 18 | } else if (difference.inHours >= 2) { 19 | return '${difference.inHours} hours ago'; 20 | } else if (difference.inHours >= 1) { 21 | return (numericDates) ? '1 hour ago' : 'An hour ago'; 22 | } else if (difference.inMinutes >= 2) { 23 | return '${difference.inMinutes} minutes ago'; 24 | } else if (difference.inMinutes >= 1) { 25 | return (numericDates) ? '1 minute ago' : 'A minute ago'; 26 | } else if (difference.inSeconds >= 3) { 27 | return '${difference.inSeconds} seconds ago'; 28 | } else { 29 | return 'Just now'; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/app/core/utils/extension/iterable_extension.dart: -------------------------------------------------------------------------------- 1 | //Searching List> in Dart 2 | extension FlattenFind on Iterable> { 3 | bool containsElement(T value) { 4 | for (final arr in this) { 5 | if (arr.contains(value)) return true; 6 | } 7 | return false; 8 | } 9 | } -------------------------------------------------------------------------------- /lib/app/core/utils/extension/list_extension.dart: -------------------------------------------------------------------------------- 1 | typedef Condition = bool Function(); 2 | 3 | extension ListExtension on List { 4 | /// Provide access to the generic type at runtime. 5 | Type get subType => E; 6 | // Type typeOfElementsInList(List e) => T; 7 | 8 | //[100,5,2].reduce(plus); //=107 9 | T plus(T first, T second) => (first + second) as T; 10 | //[100,5,2].reduce(minus); //=97 11 | T minus(T first, T second) => (first - second) as T; 12 | //[100,5,2].reduce(multiphy); //=1000 13 | T multiphy(T first, T second) => (first * second) as T; 14 | //[100,5,2].reduce(divide); //=10 15 | T divide(T first, T second) { 16 | // ignore: unnecessary_type_check 17 | return ((first ~/ second) is int) ? (first ~/ second) as T : (first / second) as T; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /lib/app/core/utils/extension/map_extension.dart: -------------------------------------------------------------------------------- 1 | import 'list_extension.dart'; 2 | 3 | extension MapExtension on Map { 4 | Iterable> _filterr(bool Function(MapEntry entry) f) sync* { 5 | for (final entry in entries) { 6 | if (f(entry)) yield entry; 7 | } 8 | } 9 | 10 | //get list value with key 11 | List getValues(List keys) => keys.map((key) => this[key]!).toList(); 12 | //get map value with key 13 | Map getMap(List keys) => Map.fromEntries(_filterr((entry) => keys.contains(entry.key))); 14 | 15 | //filter 16 | Map filter(bool Function(K key, V value) test) { 17 | final result = {}; 18 | for (final entry in entries) { 19 | if (test(entry.key, entry.value)) result[entry.key] = entry.value; 20 | } 21 | return result; 22 | } 23 | 24 | //insert index 25 | void insert({required int index, required K key, required V value}) { 26 | final result = {}; 27 | var i = 0; 28 | for (final entry in entries) { 29 | if (i == index) result[key] = value; 30 | result[entry.key] = entry.value; 31 | i++; 32 | } 33 | clear(); 34 | addAll(result); 35 | } 36 | 37 | /// * if [addNew] is true, add new key 38 | /// 39 | /// * if [noCopyIfIsEmpty] is true, not copy if value is empty 40 | /// 41 | /// example: 42 | /// ```dart 43 | /// final map = {"1": "key1", "2": "key2"}; 44 | /// final copy = {"1": "newKey1", "3": "addNewKey","empty":""}; 45 | /// final result1 = map.copyWith(copy, addNew: true, noCopyIfIsEmpty: true); 46 | /// // {"1": "newKey1", "2": "key2", "3": "addNewKey"} 47 | /// final result2 = map.copyWith(copy, addNew: false, noCopyIfIsEmpty: true); 48 | /// // {"1": "newKey1", "2": "key2"} 49 | /// final result3 = map.copyWith(copy, addNew: true, noCopyIfIsEmpty: false); 50 | /// // {"1": "newKey1", "2": "key2", "3": "addNewKey", "empty": ""} 51 | /// final result4 = map.copyWith(copy, addNew: false, noCopyIfIsEmpty: false); 52 | /// // {"1": "newKey1", "2": "key2"} 53 | /// ``` 54 | /// 55 | Map copyWith(Map copy, {bool addNew = false, bool noCopyIfIsEmpty = false}) { 56 | final result = Map.from(this); 57 | for (final entry in copy.entries) { 58 | if (!(noCopyIfIsEmpty && (entry.value == null || entry.value == '')) && (containsKey(entry.key) || addNew)) { 59 | result[entry.key] = entry.value; 60 | } 61 | } 62 | return result; 63 | } 64 | 65 | /// return key of element index 66 | /// ```dart 67 | /// final mapData = { 68 | /// "index1": "value1", 69 | /// "index2": "value2", 70 | /// "index3": "value3", 71 | /// "index4": "value4", 72 | /// "index5": "value5", 73 | /// }; 74 | /// // swap data 75 | /// final keyOfIndex = mapData.keyOfIndex(3); //"index4" 76 | /// final removeIndex = mapData.remove(keyOfIndex!); //"value4" 77 | /// final newInsert = mapData.insert(index: 0, key: keyOfIndex, value: removeIndex!); // 78 | /// print(newInsert);// {"index4": "value4", "index1": "value1", "index2": "value2", "index3": "value3", "index5": "value5"} 79 | /// ``` 80 | K? keyOfIndex(int index) { 81 | if (index < 0 || index >= length) return null; 82 | return keys.elementAt(index); 83 | } 84 | 85 | // from GetX 86 | 87 | void addIf(dynamic condition, K key, V value) { 88 | if (condition is Condition) condition = condition(); 89 | if (condition is bool && condition) { 90 | this[key] = value; 91 | } 92 | } 93 | 94 | void addAllIf(dynamic condition, Map values) { 95 | if (condition is Condition) condition = condition(); 96 | if (condition is bool && condition) addAll(values); 97 | } 98 | 99 | void assign(K key, V val) { 100 | clear(); 101 | this[key] = val; 102 | } 103 | 104 | void assignAll(Map val) { 105 | if (this == val) return; 106 | clear(); 107 | addAll(val); 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /lib/app/core/utils/extension/num_extension.dart: -------------------------------------------------------------------------------- 1 | import 'package:intl/intl.dart'; 2 | 3 | extension NumExtension on num { 4 | // Vietnam 5 | // NumberFormat.simpleCurrency(locale: 'vi-VN', decimalDigits: 2).format(10000) //10.000,00 ₫ 6 | // NumberFormat.simpleCurrency(name: 'VND', decimalDigits: 2).format(10000) //₫10,000.00 7 | 8 | // String formatNumberMoney([String? symbol]) => NumberFormat.currency(customPattern: '#,### \u00a4', symbol: symbol, decimalDigits: 5).format(this); 9 | String formatNumber() => NumberFormat('#,###', 'en_US').format(this); 10 | String formatNumberCompact() => NumberFormat.compact(locale: 'en_US').format(this); 11 | } 12 | -------------------------------------------------------------------------------- /lib/app/core/utils/extension/string_extension.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'dart:math'; 3 | 4 | extension StringExtension on String { 5 | bool get isHexColor => RegExp(r'^#([0-9a-fA-F]{6})|([0-9a-fA-F]{8})$').hasMatch(this); 6 | 7 | int toInt() => int.tryParse(replaceAll(',', '')) ?? 0; 8 | 9 | double toDouble() => double.tryParse(replaceAll(',', '')) ?? 0; 10 | 11 | num? toNumber() => num.tryParse(replaceAll(',', '')); 12 | //random String 13 | static String randomString(int length) { 14 | var random = Random(); 15 | var values = List.generate(length, (i) => random.nextInt(256)); 16 | return base64UrlEncode(values); 17 | } 18 | 19 | String toCapitalized() => length > 0 ? '${this[0].toUpperCase()}${substring(1).toLowerCase()}' : ''; 20 | String toTitleCase() => replaceAll(RegExp(' +'), ' ').split(' ').map((str) => str.toCapitalized()).join(' '); 21 | } 22 | -------------------------------------------------------------------------------- /lib/app/core/utils/extension/text_editing_controller_extension.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | 4 | extension TextEditingControllerExtension on TextEditingController { 5 | void selectionAll() { 6 | if (selection.extentOffset != text.length) selection = TextSelection(baseOffset: 0, extentOffset: text.length); 7 | } 8 | } -------------------------------------------------------------------------------- /lib/app/core/utils/helper.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'dart:math'; 3 | 4 | // import 'package:collection/collection.dart'; //sort AZ 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter/services.dart'; 7 | import 'package:intl/intl.dart'; 8 | 9 | class Helper { 10 | static String tryFormatDateTime(String dateString) { 11 | if (dateString.isEmpty) { 12 | return ''; 13 | } 14 | var inputDate = DateTime.tryParse(dateString); 15 | if (inputDate == null) return dateString; 16 | String output = DateFormat('dd-MM-yyyy').format(inputDate); 17 | return output; 18 | } 19 | 20 | //limitShowList 21 | static void limitShowList(List list, [int limit = 5]) => (list.length > limit) ? list.removeRange(limit, list.length) : null; 22 | 23 | static Color get randomColor => Colors.primaries[Random().nextInt(Colors.primaries.length)]; 24 | // static Color get randomColorAccents => Colors.accents[Random().nextInt(Colors.accents.length)]; 25 | static num randomNumber({num min = 0, required num max}) { 26 | if (max is double || min is double) { 27 | return min.toDouble() + Random().nextDouble() * (max.toDouble() - min.toDouble()); 28 | } 29 | return min.toInt() + Random().nextInt(max.toInt() - min.toInt()); 30 | } 31 | 32 | //List.separated count,generator,separator 33 | //input: cout=> 7, generator=> 1 , separator=> 0 34 | //output: [1,0,1,0,1,0,1] 35 | static List listGenerateSeparated(int count, {required T Function(int index) generator, required T Function(int index) separator}) { 36 | final List list = []; 37 | for (int i = 0; i < count; i++) { 38 | list.add(generator(i)); 39 | if (i < count - 1) { 40 | list.add(separator(i)); 41 | } 42 | } 43 | return list; 44 | } 45 | 46 | static Future readFileJson(String assets) async => jsonDecode(await rootBundle.loadString(assets)); 47 | 48 | static bool containsToLowerCase(String? source, String? target) { 49 | if (source == null || target == null) return false; 50 | return source.toLowerCase().contains(target.toLowerCase()); 51 | } 52 | 53 | static String generateIdFromDateTimeNow() => DateFormat('yyyyMMddHHmmssSSS').format(DateTime.now()); 54 | 55 | static List> convertToListMap(List list) => 56 | List>.from(list.map((e) => Map.from(e))); 57 | } 58 | -------------------------------------------------------------------------------- /lib/app/core/utils/helper_reflect.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: depend_on_referenced_packages 2 | 3 | import 'package:collection/collection.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | import '../../custom/other/search_controller_custom.dart'; 7 | import '../base/base_project.dart'; //sort AZ 8 | 9 | class HelperReflect { 10 | //muon su dung ham` nay` thi` phai co' reflectable moi xai dc 11 | static void search( 12 | {required Iterable listOrigin, required ValueNotifier> listSearch, required String nameModel, required String keywordSearch}) { 13 | keywordSearch = keywordSearch.toLowerCase().trim(); 14 | var newList = listOrigin.where((element) { 15 | String? insMirror; 16 | if ((element is SearchDelegateQueryName) && nameModel == 'queryName') { 17 | insMirror = element.queryName; 18 | } else { 19 | final splitt = nameModel.split('??'); 20 | for (var s in splitt) { 21 | if (element is BaseModel) { 22 | insMirror = (element).toJson()[s.trim()] as String?; 23 | } else { 24 | insMirror = (element as dynamic).toJson()[s.trim()] as String?; 25 | } 26 | if (insMirror?.isNotEmpty ?? false) break; 27 | } 28 | } 29 | return insMirror?.toLowerCase().contains(keywordSearch) ?? false; 30 | }).toList(); 31 | listSearch.value = newList; 32 | } 33 | 34 | static void sortAZ({required ValueNotifier isSort, required String nameModelSortAZ, required ValueNotifier> listSearch}) { 35 | (isSort.value) 36 | ? listSearch.value.sort((a, b) { 37 | final insMirrorA = (a as BaseModel).toJson()[nameModelSortAZ] as String; 38 | final insMirrorB = (b as BaseModel).toJson()[nameModelSortAZ] as String; 39 | return compareNatural(insMirrorA, insMirrorB); 40 | }) 41 | : listSearch.value.sort((a, b) { 42 | final insMirrorA = (a as BaseModel).toJson()[nameModelSortAZ] as String; 43 | final insMirrorB = (b as BaseModel).toJson()[nameModelSortAZ] as String; 44 | return compareNatural(insMirrorB, insMirrorA); 45 | }); 46 | isSort.value = !isSort.value; 47 | 48 | // listSearch.refresh(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /lib/app/core/utils/limit_range_text_input.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/services.dart'; 2 | 3 | import '/app/core/utils/extension/app_extension.dart'; 4 | 5 | class LimitRangeTextInput extends TextInputFormatter { 6 | LimitRangeTextInput({ 7 | required this.minRange, 8 | required this.maxRange, 9 | }) : assert(minRange <= maxRange); 10 | 11 | final double minRange; 12 | final double maxRange; 13 | 14 | @override 15 | TextEditingValue formatEditUpdate(TextEditingValue oldValue, TextEditingValue newValue) { 16 | int count = 0; 17 | for (int i = 0; i < newValue.text.length; i++) { 18 | if (newValue.text[i] == '.') { 19 | count++; 20 | } 21 | if (count == 2) return oldValue; 22 | } 23 | 24 | //neu nhap dau' thap phan (.) giua~ chung` ma` phia' sau ko co' so' thi` tra? ve` dau' . con` nguyen vi tri' ko thay doi? 25 | final arrayS = newValue.text.split('.'); 26 | 27 | if (arrayS.last.isEmpty) return newValue; 28 | //ep' kieu?, format so' 29 | 30 | var value = newValue.text.toDouble(); 31 | if (value < minRange) return TextEditingValue(text: '$minRange'); 32 | 33 | // return value > maxRange ? oldValue : newValue; 34 | if (value > maxRange) { 35 | final format = maxRange.formatNumber(); 36 | return oldValue.copyWith(text: format, selection: TextSelection.collapsed(offset: format.length)); 37 | } 38 | String format; 39 | try { 40 | format = value.formatNumber(); 41 | } catch (e) { 42 | format = ''; 43 | } 44 | return newValue.copyWith(text: format, selection: TextSelection.collapsed(offset: format.length)); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/app/core/utils/print.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: avoid_print 2 | //https://stackoverflow.com/questions/54018071/how-to-call-print-with-colorful-text-to-android-studio-console-in-flutter 3 | import 'dart:developer'; 4 | 5 | class Printt { 6 | static void defaultt(Object? object) => log('$object'); 7 | static void black(Object? object) => log('\x1B[30m$object\x1B[0m'); 8 | static void red(Object? object) => log('\x1B[31m$object\x1B[0m'); 9 | static void green(Object? object) => log('\x1B[32m$object\x1B[0m'); 10 | static void yellow(Object? object) => log('\x1B[33m$object\x1B[0m'); 11 | static void blue(Object? object) => log('\x1B[34m$object\x1B[0m'); 12 | static void magenta(Object? object) => log('\x1B[35m$object\x1B[0m'); 13 | static void cyan(Object? object) => log('\x1B[36m$object\x1B[0m'); 14 | static void white(Object? object) => log('\x1B[37m$object\x1B[0m'); 15 | static void reset(Object? object) => log('\x1B[38m$object\x1B[0m'); 16 | } 17 | -------------------------------------------------------------------------------- /lib/app/core/utils/utils.dart: -------------------------------------------------------------------------------- 1 | export '../../../generated/locales.g.dart'; 2 | export 'all_flutter_icon.dart'; 3 | export 'extension/app_extension.dart'; 4 | export 'helper.dart'; 5 | export 'helper_reflect.dart'; 6 | export 'helper_widget.dart'; 7 | export 'limit_range_text_input.dart'; 8 | export 'print.dart'; 9 | -------------------------------------------------------------------------------- /lib/app/custom/other/more_dropdown_search_custom.dart: -------------------------------------------------------------------------------- 1 | typedef MoreDropDownSearchAsyncCallBack = Future Function(dynamic); 2 | 3 | class MoreDropDownSearchCustom { 4 | final String key; 5 | final String queryName; 6 | final MoreDropDownSearchAsyncCallBack apiCall; 7 | dynamic dataResponse; 8 | MoreDropDownSearchCustom({ 9 | required this.key, 10 | required this.queryName, 11 | required this.apiCall, 12 | this.dataResponse, 13 | }); 14 | } 15 | -------------------------------------------------------------------------------- /lib/app/custom/other/search_controller_custom.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | // https://api.flutter.dev/flutter/material/SearchAnchor-class.html 4 | class SearchControllerCustom extends SearchController { 5 | SearchControllerCustom({required this.searchSuggestions}); 6 | final List searchSuggestions; 7 | List searchHistory = []; 8 | T? selectedItem; 9 | 10 | void handleSelection(T item) { 11 | closeView(item.queryName); 12 | // 13 | selectedItem = item; 14 | if (searchHistory.length >= 5) { 15 | searchHistory.removeLast(); 16 | } 17 | searchHistory.insert(0, item); 18 | } 19 | 20 | Iterable getHistoryList() { 21 | return searchHistory.map((item) => ListTile( 22 | leading: const Icon(Icons.history), 23 | title: Text(item.queryName), 24 | trailing: _buildTrailingIconButton(item), 25 | onTap: () => handleSelection(item), 26 | )); 27 | } 28 | 29 | Iterable getSuggestions() { 30 | final String input = value.text; 31 | return searchSuggestions.where((element) => element.queryName.contains(input)).map((item) => ListTile( 32 | title: Text(item.queryName), 33 | trailing: _buildTrailingIconButton(item), 34 | onTap: () => handleSelection(item), 35 | )); 36 | } 37 | 38 | Widget _buildTrailingIconButton(T item) => IconButton( 39 | icon: const Icon(Icons.call_missed), 40 | onPressed: () { 41 | text = item.queryName; 42 | selection = TextSelection.collapsed(offset: text.length); 43 | }); 44 | } 45 | 46 | abstract class SearchDelegateQueryName { 47 | String get queryName; 48 | set queryName(String value) => queryName = value; 49 | Object? objectt; 50 | } 51 | 52 | class TesttSearchDelegateModel extends SearchDelegateQueryName { 53 | final String? id; 54 | final String? no; 55 | final String? name; 56 | 57 | TesttSearchDelegateModel({this.id, this.no, this.name}); 58 | 59 | @override 60 | String get queryName => name ?? ''; 61 | } 62 | 63 | /* 64 | searchController = CSearchController(searchSuggestions: [ 65 | ...List.generate(10, (index) => TesttSearchDelegateModel(id: '$index', no: 'no $index', name: 'name $index')), 66 | ]); 67 | 68 | SearchAnchor( 69 | searchController: searchController, 70 | viewHintText: 'Search friends', 71 | headerHintStyle: Theme.of(context).textTheme.bodySmall, 72 | builder: (context, searchController) => AppBarIcon( 73 | icon: const Icon(MdiIcons.magnify), 74 | onPressed: () => searchController.openView(), 75 | ), 76 | suggestionsBuilder: (context, searchController) { 77 | searchController = (searchController as CSearchController); 78 | if (searchController.text.isEmpty) { 79 | if (searchController.searchHistory.isNotEmpty) { 80 | return searchController.getHistoryList(); 81 | } 82 | return [ 83 | const Center( 84 | child: Text('No search history.', style: TextStyle(color: Colors.grey)), 85 | ) 86 | ]; 87 | } 88 | return searchController.getSuggestions(); 89 | }), 90 | */ -------------------------------------------------------------------------------- /lib/app/custom/widget/loadding_widget.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: library_private_types_in_public_api 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:get/get.dart'; 5 | 6 | class Loadding { 7 | static GlobalKey<_LoaddingWidgetState> key = GlobalKey<_LoaddingWidgetState>(); 8 | 9 | static List stacKLoadding = []; 10 | 11 | static void show() async { 12 | stacKLoadding.add(true); 13 | if (key.currentContext == null && stacKLoadding.length == 1) { 14 | showDialog( 15 | context: Get.context!, 16 | barrierDismissible: true, 17 | builder: (context) => LoaddingWidget(key: key), 18 | ); 19 | } 20 | } 21 | 22 | static void dismiss() { 23 | if (stacKLoadding.isNotEmpty) stacKLoadding.removeLast(); 24 | if (stacKLoadding.isEmpty && key.currentContext != null) { 25 | Navigator.of(key.currentContext!, rootNavigator: true).pop(); 26 | key = GlobalKey<_LoaddingWidgetState>(); 27 | } 28 | } 29 | } 30 | 31 | class LoaddingWidget extends StatefulWidget { 32 | const LoaddingWidget({super.key}); 33 | 34 | @override 35 | State createState() => _LoaddingWidgetState(); 36 | } 37 | 38 | class _LoaddingWidgetState extends State { 39 | // late final AssetImage imageLoadding; 40 | 41 | @override 42 | void initState() { 43 | // imageLoadding = AssetImage("assets/images/loading/loading-loop.gif"); 44 | super.initState(); 45 | } 46 | 47 | @override 48 | void dispose() { 49 | // imageLoadding.evict(); 50 | super.dispose(); 51 | } 52 | 53 | @override 54 | Widget build(BuildContext context) { 55 | return IgnorePointer( 56 | child: Dialog( 57 | elevation: 0, 58 | shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)), 59 | backgroundColor: Colors.transparent, 60 | child: Center( 61 | child: Container( 62 | decoration: BoxDecoration( 63 | color: Colors.white, 64 | shape: BoxShape.rectangle, 65 | borderRadius: BorderRadius.circular(20), 66 | boxShadow: const [ 67 | BoxShadow( 68 | color: Colors.black26, 69 | blurRadius: 10.0, 70 | offset: Offset(0.0, 10.0), 71 | ), 72 | ], 73 | ), 74 | child: const CircularProgressIndicator() 75 | // Image( 76 | // image: imageLoadding, 77 | // width: 200, 78 | // height: 200, 79 | // ), 80 | ), 81 | ), 82 | ), 83 | ); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /lib/app/models/users_model.dart: -------------------------------------------------------------------------------- 1 | import '../core/base/base_model.dart'; 2 | 3 | class UsersModel extends BaseModel with BaseSelectedModel { 4 | int? id; 5 | String? username; 6 | String? email; 7 | String? password; 8 | String? avatar; 9 | String? token; 10 | 11 | UsersModel({ 12 | this.id, 13 | this.username, 14 | this.email, 15 | this.password, 16 | this.avatar, 17 | this.token, 18 | }); 19 | 20 | @override 21 | UsersModel fromJson(Map json) { 22 | return UsersModel( 23 | id: (json['id'] as num?)?.toInt(), 24 | username: json['username'], 25 | email: json['email'], 26 | password: json['password'], 27 | avatar: json['avatar'], 28 | token: token ?? json['token'], 29 | ); 30 | } 31 | 32 | @override 33 | Map toJson() { 34 | final data = {}; 35 | if (id != null) { 36 | data['id'] = id; 37 | } 38 | if (username != null) { 39 | data['username'] = username; 40 | } 41 | if (email != null) { 42 | data['email'] = email; 43 | } 44 | if (password != null) { 45 | data['password'] = password; 46 | } 47 | if (avatar != null) { 48 | data['avatar'] = avatar; 49 | } 50 | 51 | if (token != null) { 52 | data['token'] = token; 53 | } 54 | 55 | return data; 56 | } 57 | 58 | UsersModel copyWith({ 59 | int? id, 60 | String? username, 61 | String? email, 62 | String? password, 63 | String? avatar, 64 | String? token, 65 | }) => 66 | UsersModel( 67 | id: id ?? this.id, 68 | username: username ?? this.username, 69 | email: email ?? this.email, 70 | password: password ?? this.password, 71 | avatar: avatar ?? this.avatar, 72 | token: token ?? this.token, 73 | ); 74 | } 75 | -------------------------------------------------------------------------------- /lib/app/modules/authentication/bindings/authentication_binding.dart: -------------------------------------------------------------------------------- 1 | import 'package:get/get.dart'; 2 | 3 | import '../controllers/authentication_controller.dart'; 4 | 5 | class AuthenticationBinding extends Bindings { 6 | @override 7 | void dependencies() { 8 | Get.lazyPut( 9 | () => AuthenticationController(), 10 | ); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /lib/app/modules/authentication/controllers/authentication_controller.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_form_builder/flutter_form_builder.dart'; 5 | import 'package:get/get.dart'; 6 | 7 | import '../../../core/base/base_project.dart'; 8 | import '../../../core/constants/app_constant.dart'; 9 | import '../../../core/utils/utils.dart'; 10 | import '../../../models/users_model.dart'; 11 | 12 | class AuthenticationController extends BaseController { 13 | static UsersModel? userAccount; 14 | final formSignInKey = GlobalKey(); 15 | final formSignUpKey = GlobalKey(); 16 | final formForgotPasswordKey = GlobalKey(); 17 | bool isRememberPassword = true; 18 | 19 | @override 20 | void onInit() { 21 | super.onInit(); 22 | onInitData(); 23 | } 24 | 25 | Future onInitData() async { 26 | final userAccountString = Global.sharedPreferences.getString(StorageConstants.userAccount); 27 | if (userAccountString != null) { 28 | userAccount = UsersModel().fromJson(jsonDecode(userAccountString)); 29 | //set field username, password 30 | WidgetsBinding.instance.addPostFrameCallback((timeStamp) { 31 | formSignInKey.currentState?.fields['email']?.didChange(userAccount?.email); 32 | formSignInKey.currentState?.fields['password']?.didChange(userAccount?.password); 33 | }); 34 | } 35 | } 36 | 37 | void onSignIn() { 38 | if (formSignInKey.currentState?.saveAndValidate() ?? false) { 39 | apiCall 40 | .onRequest( 41 | ApiUrl.post_auth_login(), 42 | RequestMethod.POST, 43 | body: formSignInKey.currentState?.value, 44 | baseModel: UsersModel(), 45 | ) 46 | .then((result) { 47 | if (result == null) return; 48 | userAccount = result as UsersModel; 49 | //luu lai username, password 50 | _saveRememberPassword(userAccount!..password = formSignInKey.currentState?.value['password']); 51 | 52 | Get.toNamed('/home'); 53 | }); 54 | } 55 | // else { 56 | // Printt.white(formSignInKey.currentState?.value.toString()); 57 | // Printt.white('validation failed'); 58 | // } 59 | } 60 | 61 | void onSignUp() { 62 | if (formSignUpKey.currentState?.saveAndValidate() ?? false) { 63 | apiCall.onRequest( 64 | ApiUrl.post_auth_register(), 65 | RequestMethod.POST, 66 | body: { 67 | ...formSignUpKey.currentState!.value, 68 | }, 69 | ).then((result) { 70 | if (result == null) return; 71 | HelperWidget.showSnackBar(message: result['message']); 72 | }); 73 | } 74 | } 75 | 76 | void onSignOut() { 77 | saveAccount(null); 78 | Get.toNamed('/authentication'); 79 | } 80 | 81 | void onTryApp() { 82 | Get.toNamed('/home'); 83 | } 84 | 85 | void saveAccount(UsersModel? user) { 86 | (user == null) 87 | ? Global.sharedPreferences.remove(StorageConstants.userAccount) 88 | : Global.sharedPreferences.setString(StorageConstants.userAccount, jsonEncode(user.toJson())); 89 | } 90 | 91 | void _saveRememberPassword(UsersModel user) { 92 | isRememberPassword ? saveAccount(user) : saveAccount(null); 93 | } 94 | 95 | void onForgotPassword() { 96 | if (formForgotPasswordKey.currentState?.saveAndValidate() ?? false) {} 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /lib/app/modules/authentication/widget/custom_prefix_icon_widget.dart: -------------------------------------------------------------------------------- 1 | part of '../views/authentication_view.dart'; 2 | 3 | class CustomPrefixIconWidget extends StatelessWidget { 4 | const CustomPrefixIconWidget({super.key, required this.color, required this.icon}); 5 | 6 | final Color color; 7 | final Widget icon; 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return Container( 12 | padding: const EdgeInsets.only(top: 16.0, bottom: 16.0), 13 | margin: const EdgeInsets.only(right: 8.0), 14 | decoration: BoxDecoration( 15 | color: color, 16 | borderRadius: const BorderRadius.only( 17 | topLeft: Radius.circular(30.0), 18 | bottomLeft: Radius.circular(30.0), 19 | topRight: Radius.circular(30.0), 20 | bottomRight: Radius.circular(10.0))), 21 | child: icon); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /lib/app/modules/authentication/widget/forgot_password_tab_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_form_builder/flutter_form_builder.dart'; 3 | import '/app/modules/authentication/controllers/authentication_controller.dart'; 4 | import '/generated/locales.g.dart'; 5 | import 'package:flutter_svg/flutter_svg.dart'; 6 | import 'package:form_builder_validators/form_builder_validators.dart'; 7 | import 'package:get/get.dart'; 8 | 9 | import '../views/authentication_view.dart'; 10 | 11 | class ForgotPasswordTapWidget extends GetView { 12 | const ForgotPasswordTapWidget({Key? key}) : super(key: key); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return FormBuilder( 17 | key: controller.formForgotPasswordKey, 18 | child: ListView( 19 | padding: const EdgeInsets.all(15.0), 20 | physics: const BouncingScrollPhysics(), //remove Glow effect 21 | children: [ 22 | FormBuilderTextField( 23 | name: 'email', 24 | decoration: InputDecoration( 25 | contentPadding: EdgeInsets.zero, 26 | prefixIcon: CustomPrefixIconWidget( 27 | icon: SvgPicture.asset( 28 | 'assets/svg/google-plus.svg', 29 | height: 20, 30 | width: 20, 31 | colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn), 32 | ), 33 | color: Colors.red, 34 | ), 35 | // suffixIcon: Icon( 36 | // Icons.check_circle, 37 | // color: Colors.black26, 38 | // ), 39 | labelText: LocaleKeys.Email.tr, 40 | // hintStyle: const TextStyle(color: Colors.yellow), 41 | filled: true, 42 | fillColor: Colors.lightBlueAccent.withOpacity(0.1), 43 | border: OutlineInputBorder(borderRadius: BorderRadius.circular(30.0), borderSide: BorderSide.none), 44 | ), 45 | validator: FormBuilderValidators.compose([ 46 | FormBuilderValidators.required(), 47 | FormBuilderValidators.email(), 48 | ]), 49 | ), 50 | const SizedBox(height: 163.0), 51 | Container( 52 | width: double.infinity, 53 | padding: const EdgeInsets.symmetric(horizontal: 30.0), 54 | child: ElevatedButton( 55 | onPressed: () => controller.onForgotPassword(), 56 | child: const Text('OK'), 57 | ), 58 | ), 59 | ], 60 | ), 61 | ); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /lib/app/modules/authentication/widget/sign_in_tab_widget.dart: -------------------------------------------------------------------------------- 1 | part of '../views/authentication_view.dart'; 2 | 3 | class SignInTabWidget extends GetView { 4 | const SignInTabWidget({Key? key}) : super(key: key); 5 | 6 | @override 7 | Widget build(BuildContext context) { 8 | return FormBuilder( 9 | key: controller.formSignInKey, 10 | child: ListView( 11 | padding: const EdgeInsets.all(15.0), 12 | physics: const BouncingScrollPhysics(), //remove Glow effect 13 | children: [ 14 | ...buildTextField_UserNamePassWord(), 15 | const SizedBox(height: 15.0), 16 | StatefulBuilder( 17 | builder: (context, setState) => CheckboxListTile( 18 | activeColor: Colors.green, 19 | title: Text(LocaleKeys.RememberPassword.tr), 20 | value: controller.isRememberPassword, 21 | onChanged: (value) => setState(() => controller.isRememberPassword = value!), 22 | )), 23 | const SizedBox(height: 15.0), 24 | Container( 25 | width: double.infinity, 26 | padding: const EdgeInsets.symmetric(horizontal: 30.0), 27 | child: ElevatedButton( 28 | onPressed: () => controller.onSignIn(), 29 | child: Text(LocaleKeys.SignIn.tr), 30 | ), 31 | ), 32 | ], 33 | ), 34 | ); 35 | } 36 | } 37 | 38 | List buildTextField_UserNamePassWord() { 39 | bool isVisiblePassword = true; 40 | return [ 41 | FormBuilderTextField( 42 | name: 'email', 43 | initialValue: 'email@gmail.com', // 44 | decoration: InputDecoration( 45 | contentPadding: EdgeInsets.zero, 46 | prefixIcon: CustomPrefixIconWidget( 47 | icon: const Icon(Icons.email, color: Colors.green), 48 | color: Colors.greenAccent.withOpacity(0.5), 49 | ), 50 | // suffixIcon: Icon( 51 | // Icons.check_circle, 52 | // color: Colors.black26, 53 | // ), 54 | labelText: LocaleKeys.Email.tr, 55 | // hintStyle: const TextStyle(color: Colors.yellow), 56 | filled: true, 57 | fillColor: Colors.lightBlueAccent.withOpacity(0.1), 58 | border: OutlineInputBorder(borderRadius: BorderRadius.circular(30.0), borderSide: BorderSide.none), 59 | ), 60 | // style: TextStyle(color: Theme.of(context).colorScheme.primary), 61 | validator: FormBuilderValidators.compose([ 62 | FormBuilderValidators.required(), 63 | ]), 64 | ), 65 | const SizedBox(height: 15.0), 66 | StatefulBuilder( 67 | builder: (context, setState) => FormBuilderTextField( 68 | name: 'password', 69 | initialValue: 'password', 70 | obscureText: isVisiblePassword, 71 | decoration: InputDecoration( 72 | contentPadding: EdgeInsets.zero, 73 | prefixIcon: CustomPrefixIconWidget( 74 | icon: const Icon(Icons.key, color: Colors.pinkAccent), 75 | color: Colors.yellowAccent.withOpacity(0.5), 76 | ), 77 | suffixIcon: IconButton( 78 | onPressed: () => setState(() => isVisiblePassword = !isVisiblePassword), 79 | icon: Icon( 80 | isVisiblePassword ? Icons.visibility : Icons.visibility_off, 81 | size: 24.0, 82 | ), 83 | ), 84 | labelText: LocaleKeys.Password.tr, 85 | // hintStyle: const TextStyle(color: Colors.yellow), 86 | filled: true, 87 | fillColor: Colors.lightBlueAccent.withOpacity(0.1), 88 | border: OutlineInputBorder(borderRadius: BorderRadius.circular(30.0), borderSide: BorderSide.none), 89 | ), 90 | validator: FormBuilderValidators.compose([ 91 | FormBuilderValidators.required(), 92 | ]), 93 | )), 94 | ]; 95 | } 96 | -------------------------------------------------------------------------------- /lib/app/modules/authentication/widget/sign_up_tab_widget.dart: -------------------------------------------------------------------------------- 1 | part of '../views/authentication_view.dart'; 2 | 3 | class SignUpTapWidget extends GetView { 4 | const SignUpTapWidget({Key? key}) : super(key: key); 5 | 6 | @override 7 | Widget build(BuildContext context) { 8 | return FormBuilder( 9 | key: controller.formSignUpKey, 10 | child: ListView( 11 | padding: const EdgeInsets.all(15.0), 12 | physics: const BouncingScrollPhysics(), //remove Glow effect 13 | children: [ 14 | ...buildTextField_UserNamePassWord(), 15 | const SizedBox(height: 15.0), 16 | FormBuilderTextField( 17 | name: 'confirmPassword', 18 | decoration: InputDecoration( 19 | contentPadding: EdgeInsets.zero, 20 | prefixIcon: CustomPrefixIconWidget( 21 | icon: const Icon(Icons.vpn_key, color: Colors.white), 22 | color: Colors.blueAccent.withOpacity(0.5), 23 | ), 24 | // suffixIcon: Icon( 25 | // Icons.check_circle, 26 | // color: Colors.black26, 27 | // ), 28 | labelText: LocaleKeys.ConfirmPassword.tr, 29 | // hintStyle: const TextStyle(color: Colors.yellow), 30 | filled: true, 31 | fillColor: Colors.lightBlueAccent.withOpacity(0.1), 32 | border: OutlineInputBorder(borderRadius: BorderRadius.circular(30.0), borderSide: BorderSide.none), 33 | ), 34 | validator: FormBuilderValidators.compose([ 35 | FormBuilderValidators.required(), 36 | ]), 37 | ), 38 | const SizedBox(height: 15.0), 39 | Container( 40 | width: double.infinity, 41 | padding: const EdgeInsets.symmetric(horizontal: 30.0), 42 | child: ElevatedButton( 43 | onPressed: () => controller.onSignUp(), 44 | child: Text(LocaleKeys.SignUp.tr), 45 | ), 46 | ), 47 | ], 48 | ), 49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /lib/app/modules/authentication/widget/social_icon_widget.dart: -------------------------------------------------------------------------------- 1 | part of '../views/authentication_view.dart'; 2 | 3 | class SocialIcon extends StatelessWidget { 4 | final List colors; 5 | final String iconURL; 6 | final void Function() onPressed; 7 | const SocialIcon({Key? key, required this.colors, required this.iconURL, required this.onPressed}) : super(key: key); 8 | @override 9 | Widget build(BuildContext context) { 10 | return Container( 11 | width: 35, 12 | height: 35, 13 | decoration: BoxDecoration(shape: BoxShape.circle, gradient: LinearGradient(colors: colors)), 14 | child: RawMaterialButton( 15 | shape: const CircleBorder(), 16 | onPressed: onPressed, 17 | child: SvgPicture.asset( 18 | iconURL, 19 | height: 20, 20 | width: 20, 21 | colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn), 22 | ), 23 | ), 24 | ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/app/modules/authentication/widget/wave_clipper.dart: -------------------------------------------------------------------------------- 1 | part of '../views/authentication_view.dart'; 2 | 3 | class WaveClipper1 extends CustomClipper { 4 | @override 5 | Path getClip(Size size) { 6 | final path = Path(); 7 | path.lineTo(0.0, size.height - 50); 8 | 9 | var firstEndPoint = Offset(size.width * 0.6, size.height - 29 - 50); 10 | var firstControlPoint = Offset(size.width * .25, size.height - 60 - 50); 11 | path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy, 12 | firstEndPoint.dx, firstEndPoint.dy); 13 | 14 | var secondEndPoint = Offset(size.width, size.height - 60); 15 | var secondControlPoint = Offset(size.width * 0.84, size.height - 50); 16 | path.quadraticBezierTo(secondControlPoint.dx, secondControlPoint.dy, 17 | secondEndPoint.dx, secondEndPoint.dy); 18 | path.lineTo(size.width, size.height); 19 | path.lineTo(size.width, 0); 20 | path.close(); 21 | return path; 22 | } 23 | 24 | @override 25 | bool shouldReclip(CustomClipper oldClipper) { 26 | return false; 27 | } 28 | } 29 | 30 | class WaveClipper3 extends CustomClipper { 31 | @override 32 | Path getClip(Size size) { 33 | final path = Path(); 34 | path.lineTo(0.0, size.height - 50); 35 | 36 | var firstEndPoint = Offset(size.width * 0.6, size.height - 15 - 50); 37 | var firstControlPoint = Offset(size.width * .25, size.height - 60 - 50); 38 | path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy, 39 | firstEndPoint.dx, firstEndPoint.dy); 40 | 41 | var secondEndPoint = Offset(size.width, size.height - 40); 42 | var secondControlPoint = Offset(size.width * 0.84, size.height - 30); 43 | path.quadraticBezierTo(secondControlPoint.dx, secondControlPoint.dy, 44 | secondEndPoint.dx, secondEndPoint.dy); 45 | path.lineTo(size.width, size.height); 46 | path.lineTo(size.width, 0); 47 | path.close(); 48 | return path; 49 | } 50 | 51 | @override 52 | bool shouldReclip(CustomClipper oldClipper) { 53 | return false; 54 | } 55 | } 56 | 57 | class WaveClipper2 extends CustomClipper { 58 | @override 59 | Path getClip(Size size) { 60 | final path = Path(); 61 | path.lineTo(0.0, size.height - 50); 62 | 63 | var firstEndPoint = Offset(size.width * .7, size.height - 40); 64 | var firstControlPoint = Offset(size.width * .25, size.height); 65 | path.quadraticBezierTo(firstControlPoint.dx, firstControlPoint.dy, 66 | firstEndPoint.dx, firstEndPoint.dy); 67 | 68 | var secondEndPoint = Offset(size.width, size.height - 45); 69 | var secondControlPoint = Offset(size.width * 0.84, size.height - 50); 70 | path.quadraticBezierTo(secondControlPoint.dx, secondControlPoint.dy, 71 | secondEndPoint.dx, secondEndPoint.dy); 72 | path.lineTo(size.width, size.height); 73 | path.lineTo(size.width, 0); 74 | path.close(); 75 | return path; 76 | } 77 | 78 | @override 79 | bool shouldReclip(CustomClipper oldClipper) { 80 | return false; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /lib/app/modules/authentication/widget/wave_draw_clippath_widget.dart: -------------------------------------------------------------------------------- 1 | part of '../views/authentication_view.dart'; 2 | 3 | class WaveDrawClipPathWidget extends StatelessWidget { 4 | const WaveDrawClipPathWidget({super.key, required this.title}); 5 | final String title; 6 | 7 | @override 8 | Widget build(BuildContext context) { 9 | return Stack( 10 | children: [ 11 | ClipPath( 12 | clipper: WaveClipper2(), 13 | child: Container( 14 | width: double.infinity, 15 | height: 250, 16 | decoration: BoxDecoration(gradient: LinearGradient(colors: [Colors.green.shade50, Colors.blue.shade50])), 17 | ), 18 | ), 19 | ClipPath( 20 | clipper: WaveClipper3(), 21 | child: Container( 22 | width: double.infinity, 23 | height: 250, 24 | decoration: BoxDecoration(gradient: LinearGradient(colors: [Colors.green.shade100, Colors.blue.shade100])), 25 | child: const Column(), 26 | ), 27 | ), 28 | ClipPath( 29 | clipper: WaveClipper1(), 30 | child: Container( 31 | width: double.infinity, 32 | height: 250, 33 | decoration: BoxDecoration(gradient: LinearGradient(colors: [Colors.green, Theme.of(context).colorScheme.primary])), 34 | child: Column( 35 | children: [ 36 | const SizedBox(height: 20), 37 | const Icon( 38 | Icons.fastfood, 39 | color: Colors.white, 40 | size: 60, 41 | ), 42 | const SizedBox(height: 20), 43 | Text( 44 | title, 45 | style: TextStyle(color: Theme.of(context).colorScheme.inversePrimary, fontWeight: FontWeight.w700, fontSize: 30), 46 | ), 47 | ], 48 | ), 49 | ), 50 | ), 51 | ], 52 | ); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /lib/app/modules/home/controllers/home_controller.dart: -------------------------------------------------------------------------------- 1 | import '/app/core/base/base_project.dart'; 2 | import 'package:get/get.dart'; 3 | 4 | class HomeController extends BaseController {} 5 | -------------------------------------------------------------------------------- /lib/app/modules/home/views/home_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '/app/core/base/base_project.dart'; 3 | import '/app/core/services/notification_service.dart'; 4 | import 'package:get/get.dart'; 5 | import 'package:get/get_connect/http/src/request/request.dart'; 6 | 7 | import '../controllers/home_controller.dart'; 8 | 9 | class HomeView extends GetView { 10 | const HomeView({Key? key}) : super(key: key); 11 | @override 12 | Widget build(BuildContext context) { 13 | return Scaffold( 14 | appBar: AppBar( 15 | title: const Text('HomeView'), 16 | centerTitle: true, 17 | ), 18 | body: Center( 19 | child: Column( 20 | mainAxisAlignment: MainAxisAlignment.center, 21 | children: [ 22 | ElevatedButton( 23 | onPressed: () async { 24 | final token = await Get.find().getDeviceFirebaseToken(); 25 | controller.apiCall 26 | ..httpClient.baseUrl = "" 27 | ..httpClient.addRequestModifier((Request request) { 28 | request.headers['Authorization'] = 29 | 'key=AAAAr7TXrww:APA91bEGiTJpOTQsGQV_xgrOpfXusCusoRm0CEaHLroIyGC54JussIXfIuU95CeCa-lI92DxmNO95ce9tDt-G-kPDGLV1QeMBuuIY5WkQEpiLAYPzjvs5p-i95RuQj8YPolNLwyKObqj'; 30 | return request; 31 | }) 32 | ..onRequest( 33 | "https://fcm.googleapis.com/fcm/send", 34 | RequestMethod.POST, 35 | body: { 36 | "priority": "HIGH", 37 | "data": { 38 | "title": "Global Postman Message", 39 | "body": "Topic(global) time: 12:388", 40 | "image": "https://picsum.photos/536/354", 41 | "priority": "HIGH", 42 | "content_available": true 43 | }, 44 | "notification": { 45 | "title": "Global Postman Message", 46 | "body": "Topic(global) time: 12:38", 47 | "image": "https://picsum.photos/536/354", 48 | "priority": "HIGH", 49 | "content_available": true 50 | }, 51 | "registration_ids": [ 52 | token, 53 | ] 54 | }, 55 | ); 56 | }, 57 | child: const Text('Push notification with api'), 58 | ), 59 | ], 60 | ), 61 | ), 62 | ); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /lib/app/routes/app_pages.dart: -------------------------------------------------------------------------------- 1 | import 'package:get/get.dart'; 2 | 3 | import '/app/modules/home/controllers/home_controller.dart'; 4 | import '../modules/authentication/bindings/authentication_binding.dart'; 5 | import '../modules/authentication/views/authentication_view.dart'; 6 | import '../modules/home/views/home_view.dart'; 7 | 8 | // ignore_for_file: constant_identifier_names 9 | 10 | part 'app_routes.dart'; 11 | 12 | class AppPages { 13 | AppPages._(); 14 | 15 | static const INITIAL = Routes.AUTHENTICATION; 16 | 17 | static final routes = [ 18 | GetPage( 19 | name: _Paths.AUTHENTICATION, 20 | page: () => const AuthenticationView(), 21 | binding: AuthenticationBinding(), 22 | ), 23 | GetPage( 24 | name: _Paths.HOME, 25 | page: () => const HomeView(), 26 | binding: BindingsBuilder(() => Get.lazyPut(() => HomeController())), 27 | ), 28 | ]; 29 | } 30 | -------------------------------------------------------------------------------- /lib/app/routes/app_routes.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: constant_identifier_names 2 | 3 | part of 'app_pages.dart'; 4 | // DO NOT EDIT. This is code generated via package:get_cli/get_cli.dart 5 | 6 | abstract class Routes { 7 | Routes._(); 8 | static const AUTHENTICATION = _Paths.AUTHENTICATION; 9 | static const HOME = _Paths.HOME; 10 | } 11 | 12 | abstract class _Paths { 13 | _Paths._(); 14 | static const AUTHENTICATION = '/authentication'; 15 | static const HOME = '/home'; 16 | } 17 | -------------------------------------------------------------------------------- /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 | 7 | /// Default [FirebaseOptions] for use with your Firebase apps. 8 | /// 9 | /// Example: 10 | /// ```dart 11 | /// import 'firebase_options.dart'; 12 | /// // ... 13 | /// await Firebase.initializeApp( 14 | /// options: DefaultFirebaseOptions.currentPlatform, 15 | /// ); 16 | /// ``` 17 | class DefaultFirebaseOptions { 18 | static FirebaseOptions get currentPlatform { 19 | if (kIsWeb) { 20 | return web; 21 | } 22 | switch (defaultTargetPlatform) { 23 | case TargetPlatform.android: 24 | return android; 25 | case TargetPlatform.iOS: 26 | return ios; 27 | case TargetPlatform.macOS: 28 | return macos; 29 | case TargetPlatform.windows: 30 | throw UnsupportedError( 31 | 'DefaultFirebaseOptions have not been configured for windows - ' 32 | 'you can reconfigure this by running the FlutterFire CLI again.', 33 | ); 34 | case TargetPlatform.linux: 35 | throw UnsupportedError( 36 | 'DefaultFirebaseOptions have not been configured for linux - ' 37 | 'you can reconfigure this by running the FlutterFire CLI again.', 38 | ); 39 | default: 40 | throw UnsupportedError( 41 | 'DefaultFirebaseOptions are not supported for this platform.', 42 | ); 43 | } 44 | } 45 | 46 | static const FirebaseOptions web = FirebaseOptions( 47 | apiKey: 'AIzaSyBtYdM7Og4Ymnlta67Gyt0qy2enpV1e_Zc', 48 | appId: '1:754653310732:web:28e7fb020ffca05363a329', 49 | messagingSenderId: '754653310732', 50 | projectId: 'flutter-getx-base-project', 51 | authDomain: 'flutter-getx-base-project.firebaseapp.com', 52 | storageBucket: 'flutter-getx-base-project.appspot.com', 53 | ); 54 | 55 | static const FirebaseOptions android = FirebaseOptions( 56 | apiKey: 'AIzaSyBd67LXICMeNxCDe3BAnmioWkckIRZ3k1Y', 57 | appId: '1:754653310732:android:4aa8db9afd4cb26763a329', 58 | messagingSenderId: '754653310732', 59 | projectId: 'flutter-getx-base-project', 60 | storageBucket: 'flutter-getx-base-project.appspot.com', 61 | ); 62 | 63 | static const FirebaseOptions ios = FirebaseOptions( 64 | apiKey: 'AIzaSyDppyMn5WF93R0bDmqcU5BfkGyoq8teRlU', 65 | appId: '1:754653310732:ios:becae31c543c040b63a329', 66 | messagingSenderId: '754653310732', 67 | projectId: 'flutter-getx-base-project', 68 | storageBucket: 'flutter-getx-base-project.appspot.com', 69 | iosClientId: '754653310732-8c9mmaebb5ovme4ooarl93d1uakfcqiu.apps.googleusercontent.com', 70 | iosBundleId: 'com.example.flutterGetxBaseProject', 71 | ); 72 | 73 | static const FirebaseOptions macos = FirebaseOptions( 74 | apiKey: 'AIzaSyDppyMn5WF93R0bDmqcU5BfkGyoq8teRlU', 75 | appId: '1:754653310732:ios:ff2e3ab58365433a63a329', 76 | messagingSenderId: '754653310732', 77 | projectId: 'flutter-getx-base-project', 78 | storageBucket: 'flutter-getx-base-project.appspot.com', 79 | iosClientId: '754653310732-pts83iokp28j8l1kqimpq4n80f8p0osg.apps.googleusercontent.com', 80 | iosBundleId: 'com.example.flutterGetxBaseProject.RunnerTests', 81 | ); 82 | } 83 | -------------------------------------------------------------------------------- /lib/generated/locales.g.dart: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This is code generated via package:get_cli/get_cli.dart 2 | 3 | // ignore_for_file: lines_longer_than_80_chars, constant_identifier_names 4 | // ignore: avoid_classes_with_only_static_members 5 | class AppTranslation { 6 | 7 | static Map> translations = { 8 | 'ja_JP' : Locales.ja_JP, 9 | 'en_US' : Locales.en_US, 10 | 'vi_VN' : Locales.vi_VN, 11 | 12 | }; 13 | 14 | } 15 | 16 | class LocaleKeys { 17 | LocaleKeys._(); 18 | static const en_US = 'en_US'; 19 | static const vi_VN = 'vi_VN'; 20 | static const ja_JP = 'ja_JP'; 21 | static const Language = 'Language'; 22 | static const SignIn = 'SignIn'; 23 | static const SignUp = 'SignUp'; 24 | static const LogOut = 'LogOut'; 25 | static const UserName = 'UserName'; 26 | static const Email = 'Email'; 27 | static const Phone = 'Phone'; 28 | static const Password = 'Password'; 29 | static const ConfirmPassword = 'ConfirmPassword'; 30 | static const ForgotPassword = 'ForgotPassword'; 31 | static const Add = 'Add'; 32 | static const PleaseWait = 'PleaseWait'; 33 | static const Confirm = 'Confirm'; 34 | static const MustNotBeEmpty = 'MustNotBeEmpty'; 35 | static const Cancel = 'Cancel'; 36 | static const DoYouWantToTryIt = 'DoYouWantToTryIt'; 37 | static const TryNow = 'TryNow'; 38 | static const RankingTable = 'RankingTable'; 39 | static const Classify = 'Classify'; 40 | static const Favorite = 'Favorite'; 41 | static const Another = 'Another'; 42 | static const Home = 'Home'; 43 | static const Setting = 'Setting'; 44 | static const Views = 'Views'; 45 | static const Episode = 'Episode'; 46 | static const Episodes = 'Episodes'; 47 | static const Infomation = 'Infomation'; 48 | static const Comment = 'Comment'; 49 | static const Genres = 'Genres'; 50 | static const RememberPassword = 'RememberPassword'; 51 | } 52 | 53 | class Locales { 54 | 55 | static const ja_JP = { 56 | 'en_US': '英語', 57 | 'vi_VN': 'ベトナム語', 58 | 'ja_JP': '日本語', 59 | 'Language': '言語', 60 | 'SignIn': 'サインイン', 61 | 'SignUp': 'サインアップ', 62 | 'LogOut': 'ログアウト', 63 | 'UserName': 'ユーザー名', 64 | 'Email': 'メールアドレス', 65 | 'Phone': '電話番号', 66 | 'Password': 'パスワード', 67 | 'ConfirmPassword': 'パスワードの確認', 68 | 'ForgotPassword': 'パスワードをお忘れですか', 69 | 'Add': '追加', 70 | 'PleaseWait': 'お待ちください...', 71 | 'Confirm': '確認', 72 | 'MustNotBeEmpty': '空にすることはできません', 73 | 'Cancel': 'キャンセル', 74 | 'DoYouWantToTryIt': '試してみますか', 75 | 'TryNow': '今すぐ試す!', 76 | 'RankingTable': 'ランキングテーブル', 77 | 'Classify': '分類', 78 | 'Favorite': 'お気に入り', 79 | 'Another': '別の', 80 | 'Home': 'ホーム', 81 | 'Setting': '設定', 82 | 'Views': 'ビュー', 83 | 'Episode': 'エピソード', 84 | 'Episodes': 'エピソード', 85 | 'Infomation': '情報', 86 | 'Comment': 'コメント', 87 | 'Genres': 'ジャンル', 88 | 'RememberPassword': 'パスワードを覚えていますか', 89 | }; 90 | static const en_US = { 91 | 'en_US': 'English', 92 | 'vi_VN': 'Vietnamese', 93 | 'ja_JP': 'Japanese', 94 | 'Language': 'Language', 95 | 'SignIn': 'Sign In', 96 | 'SignUp': 'Sign Up', 97 | 'LogOut': 'Log Out', 98 | 'UserName': 'User Name', 99 | 'Email': 'Email', 100 | 'Phone': 'Phone', 101 | 'Password': 'Password', 102 | 'ConfirmPassword': 'Confirm Password', 103 | 'ForgotPassword': 'Forgot Password', 104 | 'Add': 'Add', 105 | 'PleaseWait': 'Please wait...', 106 | 'Confirm': 'Confirm', 107 | 'MustNotBeEmpty': 'Must not be empty', 108 | 'Cancel': 'Cancel', 109 | 'DoYouWantToTryIt': 'Do you want to try it?', 110 | 'TryNow': 'Try now !', 111 | 'RankingTable': 'Ranking Table', 112 | 'Classify': 'Classify', 113 | 'Favorite': 'Favorite', 114 | 'Another': 'Another', 115 | 'Home': 'Home', 116 | 'Setting': 'Setting', 117 | 'Views': 'Views', 118 | 'Episode': 'Episode', 119 | 'Episodes': 'Episodes', 120 | 'Infomation': 'Infomation', 121 | 'Comment': 'Comment', 122 | 'Genres': 'Genres', 123 | 'RememberPassword': 'Remember Password', 124 | }; 125 | static const vi_VN = { 126 | 'en_US': 'Tiếng Anh', 127 | 'vi_VN': 'Tiếng Việt', 128 | 'ja_JP': 'Tiếng Nhật', 129 | 'Language': 'Ngôn ngữ', 130 | 'SignIn': 'Đăng nhập', 131 | 'SignUp': 'Đăng ký', 132 | 'LogOut': 'Đăng xuất', 133 | 'UserName': 'Tên đăng nhập', 134 | 'Email': 'Email', 135 | 'Phone': 'Số điện thoại', 136 | 'Password': 'Mật khẩu', 137 | 'ConfirmPassword': 'Xác nhận mật khẩu', 138 | 'ForgotPassword': 'Quên mật khẩu', 139 | 'Add': 'Thêm', 140 | 'PleaseWait': 'Vui lòng đợi ...', 141 | 'Confirm': 'Xác nhận', 142 | 'MustNotBeEmpty': 'không được để trống!', 143 | 'Cancel': 'Huỷ', 144 | 'DoYouWantToTryIt': 'Bạn muốn dùng thử ?', 145 | 'TryNow': 'Thử ngay !', 146 | 'RankingTable': 'Bảng xếp hạng', 147 | 'Classify': 'Phân loại', 148 | 'Favorite': 'Yêu thích', 149 | 'Another': 'Khác', 150 | 'Home': 'Trang chủ', 151 | 'Setting': 'Cài đặt', 152 | 'Views': 'Lượt xem', 153 | 'Episode': 'Tập', 154 | 'Episodes': 'Danh sách tập', 155 | 'Infomation': 'Thông tin', 156 | 'Comment': 'Bình luận', 157 | 'Genres': 'Thể loại', 158 | 'RememberPassword': 'Ghi nhớ mật khẩu', 159 | }; 160 | 161 | } 162 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:firebase_core/firebase_core.dart'; 2 | import 'package:firebase_messaging/firebase_messaging.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter/services.dart'; 5 | import 'package:flutter_localizations/flutter_localizations.dart'; 6 | import 'package:form_builder_validators/form_builder_validators.dart'; 7 | import 'package:get/get.dart'; 8 | import 'package:shared_preferences/shared_preferences.dart'; 9 | 10 | import '/app/core/base/base_project.dart'; 11 | import 'app/core/config/theme_config.dart'; 12 | import 'app/core/constants/app_constant.dart'; 13 | import 'app/core/services/notification_service.dart'; 14 | import 'app/core/services/translation_service.dart'; 15 | import 'app/routes/app_pages.dart'; 16 | import 'firebase_options.dart'; 17 | 18 | void main() async { 19 | WidgetsFlutterBinding.ensureInitialized(); 20 | //with Flutter Fire 21 | await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); 22 | //if is Mobile 23 | if (GetPlatform.isMobile) { 24 | FirebaseMessaging.onBackgroundMessage(NotificationService.firebaseMessagingBackgroundHandler); 25 | } 26 | // FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding); 27 | // 28 | SharedPreferences.getInstance().then((value) => Global.sharedPreferences = value); 29 | runApp(const MyApp()); 30 | 31 | SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle( 32 | statusBarColor: Colors.transparent, // status bar color 33 | // systemNavigationBarColor: Colors.blue, // navigation bar color 34 | )); 35 | } 36 | 37 | class MyApp extends StatelessWidget { 38 | // const MyApp({Key? key}) : super(key: key); 39 | const MyApp({super.key}); 40 | 41 | @override 42 | Widget build(BuildContext context) { 43 | final themeConfig = ThemeConfig(); 44 | return GetMaterialApp( 45 | title: "Application", 46 | // tắt cái banner ở appBar 47 | debugShowCheckedModeBanner: false, 48 | // luôn show cái log của GetX 49 | enableLog: true, 50 | //routing 51 | initialRoute: Routes.AUTHENTICATION, 52 | getPages: AppPages.routes, 53 | initialBinding: BindingsBuilder(() { 54 | Get.put(BaseConnect()); 55 | Get.put(NotificationService()).notificationServiceInitialize(); 56 | }), 57 | //theme 58 | theme: themeConfig.lightTheme, 59 | darkTheme: themeConfig.dartTheme, 60 | themeMode: ThemeMode.light, 61 | //language 62 | locale: TranslationService.locale, //Get.deviceLocale 63 | translations: TranslationService(), 64 | fallbackLocale: TranslationService.fallbackLocale, //Locale('vi', 'VN') 65 | //ngon ngu he thong' 66 | localizationsDelegates: const [ 67 | GlobalMaterialLocalizations.delegate, 68 | GlobalWidgetsLocalizations.delegate, 69 | GlobalCupertinoLocalizations.delegate, 70 | FormBuilderLocalizations.delegate, 71 | ], 72 | supportedLocales: TranslationService.locales, 73 | // 74 | 75 | // builder: EasyLoading.init(), 76 | ); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /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 "flutter_getx_base_project") 8 | # The unique GTK application identifier for this application. See: 9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID 10 | set(APPLICATION_ID "com.example.flutter_getx_base_project") 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 | 90 | # Generated plugin build rules, which manage building the plugins and adding 91 | # them to the application. 92 | include(flutter/generated_plugins.cmake) 93 | 94 | 95 | # === Installation === 96 | # By default, "installing" just makes a relocatable bundle in the build 97 | # directory. 98 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 99 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 100 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 101 | endif() 102 | 103 | # Start with a clean build bundle directory every time. 104 | install(CODE " 105 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 106 | " COMPONENT Runtime) 107 | 108 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 109 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 110 | 111 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 112 | COMPONENT Runtime) 113 | 114 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 115 | COMPONENT Runtime) 116 | 117 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 118 | COMPONENT Runtime) 119 | 120 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) 121 | install(FILES "${bundled_library}" 122 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 123 | COMPONENT Runtime) 124 | endforeach(bundled_library) 125 | 126 | # Fully re-copy the assets directory on each build to avoid having stale files 127 | # from a previous install. 128 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 129 | install(CODE " 130 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 131 | " COMPONENT Runtime) 132 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 133 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 134 | 135 | # Install the AOT library on non-Debug builds only. 136 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 137 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 138 | COMPONENT Runtime) 139 | endif() 140 | -------------------------------------------------------------------------------- /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/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void fl_register_plugins(FlPluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /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, "flutter_getx_base_project"); 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, "flutter_getx_base_project"); 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/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import cloud_firestore 9 | import firebase_auth 10 | import firebase_core 11 | import firebase_messaging 12 | import flutter_local_notifications 13 | import shared_preferences_foundation 14 | 15 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 16 | FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin")) 17 | FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin")) 18 | FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) 19 | FLTFirebaseMessagingPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseMessagingPlugin")) 20 | FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin")) 21 | SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) 22 | } 23 | -------------------------------------------------------------------------------- /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 | target 'RunnerTests' do 35 | inherit! :search_paths 36 | end 37 | end 38 | 39 | post_install do |installer| 40 | installer.pods_project.targets.each do |target| 41 | flutter_additional_macos_build_settings(target) 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /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 | 43 | 49 | 50 | 51 | 52 | 53 | 63 | 65 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/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 = flutter_getx_base_project 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterGetxBaseProject 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/GoogleService-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CLIENT_ID 6 | 754653310732-pts83iokp28j8l1kqimpq4n80f8p0osg.apps.googleusercontent.com 7 | REVERSED_CLIENT_ID 8 | com.googleusercontent.apps.754653310732-pts83iokp28j8l1kqimpq4n80f8p0osg 9 | API_KEY 10 | AIzaSyDppyMn5WF93R0bDmqcU5BfkGyoq8teRlU 11 | GCM_SENDER_ID 12 | 754653310732 13 | PLIST_VERSION 14 | 1 15 | BUNDLE_ID 16 | com.example.flutterGetxBaseProject.RunnerTests 17 | PROJECT_ID 18 | flutter-getx-base-project 19 | STORAGE_BUCKET 20 | flutter-getx-base-project.appspot.com 21 | IS_ADS_ENABLED 22 | 23 | IS_ANALYTICS_ENABLED 24 | 25 | IS_APPINVITE_ENABLED 26 | 27 | IS_GCM_ENABLED 28 | 29 | IS_SIGNIN_ENABLED 30 | 31 | GOOGLE_APP_ID 32 | 1:754653310732:ios:ff2e3ab58365433a63a329 33 | 34 | -------------------------------------------------------------------------------- /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() 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/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import FlutterMacOS 2 | import Cocoa 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /macos/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:754653310732:ios:ff2e3ab58365433a63a329", 5 | "FIREBASE_PROJECT_ID": "flutter-getx-base-project", 6 | "GCM_SENDER_ID": "754653310732" 7 | } -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_getx_base_project 2 | version: 1.0.0+1 3 | publish_to: none 4 | description: A new Flutter project. 5 | environment: 6 | sdk: ">=3.0.0 <4.0.0" 7 | flutter: ^3.10.0 8 | 9 | dependencies: 10 | cupertino_icons: ^1.0.2 11 | get: 4.6.5 12 | intl: any 13 | firebase_core: ^2.9.0 14 | firebase_auth: any 15 | flutter_local_notifications: ^14.0.0+1 16 | cloud_firestore: any #dung de load data notify 17 | firebase_messaging: any 18 | shared_preferences: any 19 | flutter_form_builder: any #bingding form 20 | form_builder_validators: any 21 | fluttertoast: any 22 | flutter_svg: any 23 | flutter_localizations: 24 | sdk: flutter 25 | flutter: 26 | sdk: flutter 27 | 28 | dev_dependencies: 29 | flutter_lints: ^2.0.0 30 | flutter_test: 31 | sdk: flutter 32 | 33 | flutter: 34 | uses-material-design: true 35 | assets: 36 | - assets/images/ 37 | - assets/svg/ 38 | - assets/gif/ 39 | - assets/translations/ 40 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility in the flutter_test package. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_getx_base_project/main.dart'; 10 | import 'package:flutter_test/flutter_test.dart'; 11 | 12 | void main() { 13 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 14 | // Build our app and trigger a frame. 15 | await tester.pumpWidget(const MyApp()); 16 | 17 | // Verify that our counter starts at 0. 18 | expect(find.text('0'), findsOneWidget); 19 | expect(find.text('1'), findsNothing); 20 | 21 | // Tap the '+' icon and trigger a frame. 22 | await tester.tap(find.byIcon(Icons.add)); 23 | await tester.pump(); 24 | 25 | // Verify that our counter has incremented. 26 | expect(find.text('0'), findsNothing); 27 | expect(find.text('1'), findsOneWidget); 28 | }); 29 | } 30 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/web/favicon.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/web/icons/Icon-512.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/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 | flutter_getx_base_project 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "flutter_getx_base_project", 3 | "short_name": "flutter_getx_base_project", 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(flutter_getx_base_project 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 "flutter_getx_base_project") 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 | 56 | # Generated plugin build rules, which manage building the plugins and adding 57 | # them to the application. 58 | include(flutter/generated_plugins.cmake) 59 | 60 | 61 | # === Installation === 62 | # Support files are copied into place next to the executable, so that it can 63 | # run in place. This is done instead of making a separate bundle (as on Linux) 64 | # so that building and running from within Visual Studio will work. 65 | set(BUILD_BUNDLE_DIR "$") 66 | # Make the "install" step default, as it's required to run. 67 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 68 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 69 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 70 | endif() 71 | 72 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 73 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 74 | 75 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 76 | COMPONENT Runtime) 77 | 78 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 79 | COMPONENT Runtime) 80 | 81 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 82 | COMPONENT Runtime) 83 | 84 | if(PLUGIN_BUNDLED_LIBRARIES) 85 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 86 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 87 | COMPONENT Runtime) 88 | endif() 89 | 90 | # Fully re-copy the assets directory on each build to avoid having stale files 91 | # from a previous install. 92 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 93 | install(CODE " 94 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 95 | " COMPONENT Runtime) 96 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 97 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 98 | 99 | # Install the AOT library on non-Debug builds only. 100 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 101 | CONFIGURATIONS Profile;Release 102 | COMPONENT Runtime) 103 | -------------------------------------------------------------------------------- /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/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | 11 | void RegisterPlugins(flutter::PluginRegistry* registry) { 12 | FirebaseCorePluginCApiRegisterWithRegistrar( 13 | registry->GetRegistrarForPlugin("FirebaseCorePluginCApi")); 14 | } 15 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | firebase_core 7 | ) 8 | 9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 10 | ) 11 | 12 | set(PLUGIN_BUNDLED_LIBRARIES) 13 | 14 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 19 | endforeach(plugin) 20 | 21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 24 | endforeach(ffi_plugin) 25 | -------------------------------------------------------------------------------- /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", "flutter_getx_base_project" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "flutter_getx_base_project" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2023 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "flutter_getx_base_project.exe" "\0" 98 | VALUE "ProductName", "flutter_getx_base_project" "\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"flutter_getx_base_project", 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/phatdat-dev/flutter_getx_base_project/2cfc63661a118c93d7c2f9694f098d012724703d/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 | -1; // remove the trailing null character 52 | int input_length = (int)wcslen(utf16_string); 53 | std::string utf8_string; 54 | if (target_length <= 0 || target_length > utf8_string.max_size()) { 55 | return utf8_string; 56 | } 57 | utf8_string.resize(target_length); 58 | int converted_length = ::WideCharToMultiByte( 59 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 60 | input_length, utf8_string.data(), target_length, nullptr, nullptr); 61 | if (converted_length == 0) { 62 | return std::string(); 63 | } 64 | return utf8_string; 65 | } 66 | -------------------------------------------------------------------------------- /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 | // responds to changes in DPI. All other messages are handled by 81 | // MessageHandler. 82 | static LRESULT CALLBACK WndProc(HWND const window, 83 | UINT const message, 84 | WPARAM const wparam, 85 | LPARAM const lparam) noexcept; 86 | 87 | // Retrieves a class instance pointer for |window| 88 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 89 | 90 | // Update the window frame's theme to match the system theme. 91 | static void UpdateTheme(HWND const window); 92 | 93 | bool quit_on_close_ = false; 94 | 95 | // window handle for top level window. 96 | HWND window_handle_ = nullptr; 97 | 98 | // window handle for hosted content. 99 | HWND child_content_ = nullptr; 100 | }; 101 | 102 | #endif // RUNNER_WIN32_WINDOW_H_ 103 | --------------------------------------------------------------------------------