├── .gitattributes ├── README.md ├── furniture_mobile_app ├── .env ├── .gitignore ├── .metadata ├── README.md ├── analysis_options.yaml ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── furniture_mobile_app │ │ │ │ │ └── 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 │ └── lang │ │ └── en-US.json ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── 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 │ │ ├── Info.plist │ │ └── Runner-Bridging-Header.h ├── lib │ ├── core │ │ ├── base │ │ │ ├── base_model.dart │ │ │ └── base_view.dart │ │ ├── constants │ │ │ └── app_constants.dart │ │ ├── init │ │ │ ├── lang │ │ │ │ ├── language_manager.dart │ │ │ │ └── locale_keys.g.dart │ │ │ ├── network │ │ │ │ └── vexana_manager.dart │ │ │ └── theme │ │ │ │ └── furniture_theme.dart │ │ └── widgets │ │ │ ├── if_widget.dart │ │ │ ├── switch_case_widget.dart │ │ │ ├── ternary_widget.dart │ │ │ └── wrap_with_badge.dart │ ├── features │ │ └── home │ │ │ ├── product_detail │ │ │ ├── view │ │ │ │ └── product_detail_view.dart │ │ │ └── viewmodel │ │ │ │ ├── product_detail_viewmodel.dart │ │ │ │ └── product_detail_viewmodel.g.dart │ │ │ └── products_home │ │ │ ├── service │ │ │ └── home_service.dart │ │ │ ├── view │ │ │ └── products_home_view.dart │ │ │ └── viewmodel │ │ │ ├── products_home_viewmodel.dart │ │ │ └── products_home_viewmodel.g.dart │ ├── main.dart │ └── product │ │ ├── constants │ │ ├── api_endpoints.dart │ │ └── custom_colors.dart │ │ ├── extensions │ │ └── string_extensions.dart │ │ ├── managers │ │ ├── basket_manager.dart │ │ ├── theme_manager.dart │ │ └── user_manager.dart │ │ ├── models │ │ ├── category_model.dart │ │ ├── category_model.g.dart │ │ ├── product_model.dart │ │ ├── product_model.g.dart │ │ ├── user_model.dart │ │ └── user_model.g.dart │ │ └── widgets │ │ ├── category_chip_item.dart │ │ ├── number_counter_button.dart │ │ ├── product_card_item │ │ ├── product_card_item.dart │ │ └── product_card_item_shimmer.dart │ │ └── product_fav_button.dart ├── pubspec.lock ├── pubspec.yaml ├── test │ └── widget_test.dart ├── web │ ├── favicon.png │ ├── icons │ │ ├── Icon-192.png │ │ └── Icon-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 │ ├── run_loop.cpp │ ├── run_loop.h │ ├── runner.exe.manifest │ ├── utils.cpp │ ├── utils.h │ ├── win32_window.cpp │ └── win32_window.h ├── message_app ├── .gitignore ├── .metadata ├── README.md ├── analysis_options.yaml ├── android │ ├── .gitignore │ ├── app │ │ ├── build.gradle │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ ├── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── message_app │ │ │ │ │ └── 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 │ └── lang │ │ └── en-US.json ├── ios │ ├── .gitignore │ ├── Flutter │ │ ├── AppFrameworkInfo.plist │ │ ├── Debug.xcconfig │ │ └── Release.xcconfig │ ├── 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 │ │ ├── Info.plist │ │ └── Runner-Bridging-Header.h ├── lib │ ├── core │ │ ├── base │ │ │ ├── base_model.dart │ │ │ └── base_view.dart │ │ ├── constants │ │ │ └── app_constants.dart │ │ ├── init │ │ │ ├── lang │ │ │ │ ├── language_manager.dart │ │ │ │ └── locale_keys.g.dart │ │ │ └── theme │ │ │ │ └── light_theme.dart │ │ └── widgets │ │ │ ├── if_widget.dart │ │ │ ├── switch_case_widget.dart │ │ │ ├── ternary_widget.dart │ │ │ └── wrap_with_badge.dart │ ├── features │ │ └── home │ │ │ ├── home_base_view.dart │ │ │ ├── message_detail │ │ │ ├── view │ │ │ │ └── message_detail_view.dart │ │ │ └── viewmodel │ │ │ │ ├── message_detail_viewmodel.dart │ │ │ │ └── message_detail_viewmodel.g.dart │ │ │ └── messages │ │ │ └── view │ │ │ └── messages_view.dart │ ├── main.dart │ └── product │ │ ├── extensions │ │ └── string_extensions.dart │ │ ├── managers │ │ ├── theme_manager.dart │ │ └── user_manager.dart │ │ ├── models │ │ ├── chat_model.dart │ │ ├── chat_model.g.dart │ │ ├── fake_data.dart │ │ ├── message_model.dart │ │ ├── message_model.g.dart │ │ ├── user_model.dart │ │ └── user_model.g.dart │ │ └── widgets │ │ ├── avatar.dart │ │ ├── chat_card_item.dart │ │ └── message_card_item.dart ├── pubspec.lock ├── pubspec.yaml ├── test │ └── widget_test.dart ├── web │ ├── favicon.png │ ├── icons │ │ ├── Icon-192.png │ │ └── Icon-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 │ ├── run_loop.cpp │ ├── run_loop.h │ ├── runner.exe.manifest │ ├── utils.cpp │ ├── utils.h │ ├── win32_window.cpp │ └── win32_window.h └── showcase ├── furniture_app.gif └── message_app.gif /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # acm_hacettepe_coding_challange 2 | 3 | ## 1 - Furniture App 4 | ![](https://github.com/ahm3tcelik/acm_hacettepe_coding_challange/blob/master/showcase/furniture_app.gif) 5 | 6 | ## 2 - Message App 7 | ![](https://github.com/ahm3tcelik/acm_hacettepe_coding_challange/blob/master/showcase/message_app.gif) 8 | -------------------------------------------------------------------------------- /furniture_mobile_app/.env: -------------------------------------------------------------------------------- 1 | BASE_URL=https://60821dcc827b350017cfbbb1.mockapi.io/api/v1/ -------------------------------------------------------------------------------- /furniture_mobile_app/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | -------------------------------------------------------------------------------- /furniture_mobile_app/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: b1395592de68cc8ac4522094ae59956dd21a91db 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /furniture_mobile_app/README.md: -------------------------------------------------------------------------------- 1 | # furniture_mobile_app 2 | 3 | ![](https://github.com/ahm3tcelik/acm_hacettepe_coding_challange/blob/master/showcase/furniture_app.gif) 4 | -------------------------------------------------------------------------------- /furniture_mobile_app/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file 2 | # for details. All rights reserved. Use of this source code is governed by a 3 | # BSD-style license that can be found in the LICENSE file. 4 | # 5 | # Google internally enforced rules. See README.md for more information, 6 | # including a list of lints that are intentionally _not_ enforced. 7 | 8 | linter: 9 | rules: 10 | - always_declare_return_types 11 | - always_require_non_null_named_parameters 12 | - annotate_overrides 13 | - avoid_init_to_null 14 | - avoid_null_checks_in_equality_operators 15 | - avoid_relative_lib_imports 16 | - avoid_return_types_on_setters 17 | - avoid_shadowing_type_parameters 18 | - avoid_single_cascade_in_expression_statements 19 | - avoid_types_as_parameter_names 20 | - await_only_futures 21 | - camel_case_extensions 22 | - curly_braces_in_flow_control_structures 23 | - empty_catches 24 | - empty_constructor_bodies 25 | - library_names 26 | - library_prefixes 27 | - no_duplicate_case_values 28 | - null_closures 29 | - omit_local_variable_types 30 | - prefer_adjacent_string_concatenation 31 | - prefer_collection_literals 32 | - prefer_conditional_assignment 33 | - prefer_contains 34 | - prefer_equal_for_default_values 35 | - prefer_final_fields 36 | - prefer_for_elements_to_map_fromIterable 37 | - prefer_generic_function_type_aliases 38 | - prefer_if_null_operators 39 | - prefer_inlined_adds 40 | - prefer_is_empty 41 | - prefer_is_not_empty 42 | - prefer_iterable_whereType 43 | - prefer_single_quotes 44 | - prefer_spread_collections 45 | - recursive_getters 46 | - slash_for_doc_comments 47 | - sort_child_properties_last 48 | - type_init_formals 49 | - unawaited_futures 50 | - unnecessary_brace_in_string_interps 51 | - unnecessary_const 52 | - unnecessary_getters_setters 53 | - unnecessary_new 54 | - unnecessary_null_in_if_null_operators 55 | - unnecessary_this 56 | - unrelated_type_equality_checks 57 | - unsafe_html 58 | - use_full_hex_values_for_flutter_colors 59 | - use_function_type_syntax_for_parameters 60 | - use_rethrow_when_possible 61 | - valid_regexps -------------------------------------------------------------------------------- /furniture_mobile_app/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 | -------------------------------------------------------------------------------- /furniture_mobile_app/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 30 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | defaultConfig { 36 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 37 | applicationId "com.example.furniture_mobile_app" 38 | minSdkVersion 16 39 | targetSdkVersion 30 40 | versionCode flutterVersionCode.toInteger() 41 | versionName flutterVersionName 42 | } 43 | 44 | buildTypes { 45 | release { 46 | // TODO: Add your own signing config for the release build. 47 | // Signing with the debug keys for now, so `flutter run --release` works. 48 | signingConfig signingConfigs.debug 49 | } 50 | } 51 | } 52 | 53 | flutter { 54 | source '../..' 55 | } 56 | 57 | dependencies { 58 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 59 | } 60 | -------------------------------------------------------------------------------- /furniture_mobile_app/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /furniture_mobile_app/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 13 | 17 | 21 | 26 | 30 | 31 | 32 | 33 | 34 | 35 | 37 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /furniture_mobile_app/android/app/src/main/kotlin/com/example/furniture_mobile_app/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.furniture_mobile_app 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /furniture_mobile_app/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /furniture_mobile_app/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /furniture_mobile_app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/furniture_mobile_app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /furniture_mobile_app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/furniture_mobile_app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /furniture_mobile_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/furniture_mobile_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /furniture_mobile_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/furniture_mobile_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /furniture_mobile_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/furniture_mobile_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /furniture_mobile_app/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /furniture_mobile_app/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /furniture_mobile_app/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /furniture_mobile_app/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:4.1.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /furniture_mobile_app/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /furniture_mobile_app/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip 7 | -------------------------------------------------------------------------------- /furniture_mobile_app/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 | -------------------------------------------------------------------------------- /furniture_mobile_app/assets/lang/en-US.json: -------------------------------------------------------------------------------- 1 | { 2 | "app_title": "ACM Hacettepe Flutter Challange", 3 | "buy": "Buy", 4 | "search_hint": "Search...", 5 | "home": "Home", 6 | "basket": "Basket", 7 | "star": "Star", 8 | "profile": "Profile", 9 | "product_detail": "Detail Product", 10 | "color": "Color", 11 | "all": "All", 12 | "welcome": "Welcome" 13 | } -------------------------------------------------------------------------------- /furniture_mobile_app/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /furniture_mobile_app/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 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /furniture_mobile_app/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 | -------------------------------------------------------------------------------- /furniture_mobile_app/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 | -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/furniture_mobile_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /furniture_mobile_app/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 | -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/furniture_mobile_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/furniture_mobile_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/furniture_mobile_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /furniture_mobile_app/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. -------------------------------------------------------------------------------- /furniture_mobile_app/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 | -------------------------------------------------------------------------------- /furniture_mobile_app/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 | -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | furniture_mobile_app 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /furniture_mobile_app/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /furniture_mobile_app/lib/core/base/base_model.dart: -------------------------------------------------------------------------------- 1 | abstract class BaseModel { 2 | Map toJson(); 3 | } -------------------------------------------------------------------------------- /furniture_mobile_app/lib/core/base/base_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:mobx/mobx.dart'; 3 | 4 | class BaseView extends StatefulWidget { 5 | final Widget Function(BuildContext context, T value) onPageBuilder; 6 | final Function(BuildContext context)? onContextReady; 7 | final T viewModel; 8 | final Function(T model)? onModelReady; 9 | final VoidCallback? onDispose; 10 | 11 | const BaseView({ 12 | Key? key, 13 | required this.viewModel, 14 | required this.onPageBuilder, 15 | this.onModelReady, 16 | this.onContextReady, 17 | this.onDispose, 18 | }) : super(key: key); 19 | 20 | @override 21 | _BaseViewState createState() => _BaseViewState(); 22 | } 23 | 24 | class _BaseViewState extends State> { 25 | late T model; 26 | 27 | @override 28 | void initState() { 29 | model = widget.viewModel; 30 | widget.onModelReady?.call(model); 31 | super.initState(); 32 | } 33 | 34 | @override 35 | void dispose() { 36 | super.dispose(); 37 | if (widget.onDispose != null) widget.onDispose!(); 38 | } 39 | 40 | @override 41 | Widget build(BuildContext context) { 42 | widget.onContextReady?.call(context); 43 | return widget.onPageBuilder(context, model); 44 | } 45 | } -------------------------------------------------------------------------------- /furniture_mobile_app/lib/core/constants/app_constants.dart: -------------------------------------------------------------------------------- 1 | class AppConstants { 2 | static const LANG_ASSETS_PATH = 'assets/lang'; 3 | } 4 | -------------------------------------------------------------------------------- /furniture_mobile_app/lib/core/init/lang/language_manager.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | // flutter pub run easy_localization:generate -S "assets/lang" -f keys -O "lib/core/init/lang" -o locale_keys.g.dart 4 | 5 | class LanguageManager { 6 | static LanguageManager? _instance; 7 | static LanguageManager get instance { 8 | _instance ??= LanguageManager._init(); 9 | return _instance!; 10 | } 11 | 12 | LanguageManager._init(); 13 | 14 | final enLocale = Locale('en', 'US'); 15 | 16 | List get supportedLocales => [enLocale]; 17 | } -------------------------------------------------------------------------------- /furniture_mobile_app/lib/core/init/lang/locale_keys.g.dart: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This is code generated via package:easy_localization/generate.dart 2 | 3 | abstract class LocaleKeys { 4 | static const app_title = 'app_title'; 5 | static const buy = 'buy'; 6 | static const search_hint = 'search_hint'; 7 | static const home = 'home'; 8 | static const basket = 'basket'; 9 | static const star = 'star'; 10 | static const profile = 'profile'; 11 | static const product_detail = 'product_detail'; 12 | static const color = 'color'; 13 | static const all = 'all'; 14 | static const welcome = 'welcome'; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /furniture_mobile_app/lib/core/init/network/vexana_manager.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_dotenv/flutter_dotenv.dart'; 2 | import 'package:vexana/vexana.dart'; 3 | 4 | class VexanaManager { 5 | static VexanaManager? _instace; 6 | 7 | static VexanaManager get instance { 8 | _instace ??= VexanaManager._init(); 9 | return _instace!; 10 | } 11 | 12 | VexanaManager._init(); 13 | 14 | INetworkManager networkManager = NetworkManager( 15 | isEnableLogger: true, 16 | fileManager: LocalSembast(), 17 | options: BaseOptions( 18 | baseUrl: env['BASE_URL']!, 19 | ), 20 | ); 21 | } -------------------------------------------------------------------------------- /furniture_mobile_app/lib/core/widgets/if_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | class If extends StatelessWidget { 4 | final bool condition; 5 | final Widget widget; 6 | 7 | /// ```dart 8 | /// If(condition: isLoading, widget: Loader()) 9 | /// ``` 10 | const If({required this.condition, required this.widget}); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return condition ? widget : SizedBox(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /furniture_mobile_app/lib/core/widgets/switch_case_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | class Case { 4 | final dynamic value; 5 | final Widget widget; 6 | 7 | ///```dart 8 | /// Case(value: 'customer', widget: _buildGreetCustomer), 9 | ///``` 10 | const Case({required this.widget, required this.value}); 11 | } 12 | 13 | class SwitchCase extends StatelessWidget { 14 | final dynamic value; 15 | final List cases; 16 | final Widget? elseWidget; 17 | 18 | /// 19 | ///```dart 20 | /// var role = 'admin'; 21 | /// return SwitchCase( 22 | /// cases: [ 23 | /// Case(value: 'customer', widget: _buildGreetCustomer), 24 | /// Case(value: 'developer', widget: _buildGreetDeveloper), 25 | /// Case(value: 'admin', widget: _buildGreetAdmin) 26 | /// ], 27 | /// value: role, 28 | /// elseWidget: Text('Unidentified'), 29 | /// ); 30 | ///``` 31 | SwitchCase( 32 | {required this.value, required this.cases, required this.elseWidget}); 33 | 34 | @override 35 | Widget build(BuildContext context) { 36 | var activeCase = cases.firstWhere((c) => c.value == value, 37 | orElse: () => Case(widget: elseWidget ?? SizedBox(), value: null)); 38 | return activeCase.widget; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /furniture_mobile_app/lib/core/widgets/ternary_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | class Ternary extends StatelessWidget { 4 | final bool condition; 5 | final Widget widgetTrue; 6 | final Widget widgetFalse; 7 | 8 | /// 9 | ///```dart 10 | /// Ternary( 11 | /// condition: isLoggedIn, 12 | /// widgetTrue: Text('Logout'), 13 | /// widgetFalse: Text('Login'), 14 | /// ) 15 | ///``` 16 | const Ternary( 17 | {required this.condition, 18 | required this.widgetTrue, 19 | required this.widgetFalse}); 20 | 21 | @override 22 | Widget build(BuildContext context) => condition ? widgetTrue : widgetFalse; 23 | } 24 | -------------------------------------------------------------------------------- /furniture_mobile_app/lib/core/widgets/wrap_with_badge.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:kartal/kartal.dart'; 3 | 4 | class WrapWithBadge extends StatelessWidget { 5 | final Widget child; 6 | final String? badgeLabel; 7 | final Color badgeLabelColor; 8 | final Color badgeColor; 9 | final double? top; 10 | final double? right; 11 | final double? bottom; 12 | final double? left; 13 | 14 | const WrapWithBadge({ 15 | required this.child, 16 | this.badgeLabel, 17 | this.top, 18 | this.right, 19 | this.bottom, 20 | this.left, 21 | this.badgeLabelColor = Colors.white, 22 | this.badgeColor = Colors.red, 23 | }); 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return Stack( 28 | alignment: Alignment.center, 29 | children: [ 30 | child, 31 | Positioned( 32 | top: top, 33 | right: right, 34 | bottom: bottom, 35 | left: left, 36 | child: Container( 37 | width: 20, 38 | height: 20, 39 | decoration: BoxDecoration(shape: BoxShape.circle, color: badgeColor), 40 | alignment: Alignment.center, 41 | child: Text(badgeLabel ?? '', style: context.textTheme.subtitle1!.copyWith( 42 | color: Colors.white, 43 | fontWeight: FontWeight.bold 44 | ),), 45 | ), 46 | ) 47 | ], 48 | ); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /furniture_mobile_app/lib/features/home/product_detail/viewmodel/product_detail_viewmodel.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:mobx/mobx.dart'; 3 | import 'package:provider/provider.dart'; 4 | 5 | import '../../../../product/models/product_model.dart'; 6 | import '../../../../product/managers/basket_manager.dart'; 7 | import '../../../../product/managers/user_manager.dart'; 8 | 9 | part 'product_detail_viewmodel.g.dart'; 10 | 11 | class ProductDetailViewModel = _ProductDetailViewModelBase 12 | with _$ProductDetailViewModel; 13 | 14 | abstract class _ProductDetailViewModelBase with Store { 15 | @observable 16 | int quantity = 1; 17 | 18 | BuildContext? context; 19 | 20 | @action 21 | void changeQuantity(int newQuantity) => quantity = newQuantity; 22 | 23 | void buyProduct(Product product) { 24 | context?.read().increaseProduct(product, quantity); 25 | } 26 | 27 | bool isFavorite(UserManager manager, Product product) { 28 | return manager.isFavorite(product.productId); 29 | } 30 | 31 | void setFav(Product product, bool isChecked) { 32 | if (isChecked) { 33 | context?.read().addProductToFavorites(product); 34 | } 35 | else { 36 | context?.read().removeProductToFavorites(product); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /furniture_mobile_app/lib/features/home/product_detail/viewmodel/product_detail_viewmodel.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'product_detail_viewmodel.dart'; 4 | 5 | // ************************************************************************** 6 | // StoreGenerator 7 | // ************************************************************************** 8 | 9 | // ignore_for_file: non_constant_identifier_names, unnecessary_brace_in_string_interps, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic 10 | 11 | mixin _$ProductDetailViewModel on _ProductDetailViewModelBase, Store { 12 | final _$quantityAtom = Atom(name: '_ProductDetailViewModelBase.quantity'); 13 | 14 | @override 15 | int get quantity { 16 | _$quantityAtom.reportRead(); 17 | return super.quantity; 18 | } 19 | 20 | @override 21 | set quantity(int value) { 22 | _$quantityAtom.reportWrite(value, super.quantity, () { 23 | super.quantity = value; 24 | }); 25 | } 26 | 27 | final _$_ProductDetailViewModelBaseActionController = 28 | ActionController(name: '_ProductDetailViewModelBase'); 29 | 30 | @override 31 | void changeQuantity(int newQuantity) { 32 | final _$actionInfo = _$_ProductDetailViewModelBaseActionController 33 | .startAction(name: '_ProductDetailViewModelBase.changeQuantity'); 34 | try { 35 | return super.changeQuantity(newQuantity); 36 | } finally { 37 | _$_ProductDetailViewModelBaseActionController.endAction(_$actionInfo); 38 | } 39 | } 40 | 41 | @override 42 | String toString() { 43 | return ''' 44 | quantity: ${quantity} 45 | '''; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /furniture_mobile_app/lib/features/home/products_home/service/home_service.dart: -------------------------------------------------------------------------------- 1 | import 'package:vexana/vexana.dart'; 2 | 3 | import '../../../../product/constants/api_endpoints.dart'; 4 | import '../../../../product/models/category_model.dart'; 5 | import '../../../../product/models/product_model.dart'; 6 | 7 | class HomeService implements IHomeService { 8 | final INetworkManager networkManager; 9 | 10 | static HomeService? _instance; 11 | 12 | static HomeService instance(INetworkManager networkManager) { 13 | _instance ??= HomeService._init(networkManager); 14 | return _instance!; 15 | } 16 | 17 | HomeService._init(this.networkManager); 18 | 19 | @override 20 | Future?>> fetchCategories() async { 21 | final response = await networkManager.send>( 22 | ApiEndpoints.Categories, 23 | parseModel: Category(), 24 | method: RequestType.GET 25 | ); 26 | return response; 27 | } 28 | 29 | @override 30 | Future?>> fetchProducts() async { 31 | final response = await networkManager.send>( 32 | ApiEndpoints.Products, 33 | parseModel: Product(), 34 | method: RequestType.GET 35 | ); 36 | return response; 37 | } 38 | } 39 | 40 | abstract class IHomeService { 41 | Future?>> fetchCategories(); 42 | 43 | Future?>> fetchProducts(); 44 | } 45 | -------------------------------------------------------------------------------- /furniture_mobile_app/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:easy_localization/easy_localization.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_dotenv/flutter_dotenv.dart' as dot_env; 4 | import 'package:provider/provider.dart'; 5 | 6 | import 'core/init/lang/locale_keys.g.dart'; 7 | import 'core/constants/app_constants.dart'; 8 | import 'core/init/lang/language_manager.dart'; 9 | import 'features/home/products_home/view/products_home_view.dart'; 10 | import 'product/managers/basket_manager.dart'; 11 | import 'product/managers/user_manager.dart'; 12 | import 'product/managers/theme_manager.dart'; 13 | 14 | void main() async { 15 | WidgetsFlutterBinding.ensureInitialized(); 16 | await EasyLocalization.ensureInitialized(); 17 | await dot_env.load(fileName: '.env'); 18 | 19 | runApp( 20 | MultiProvider( 21 | providers: [ 22 | ChangeNotifierProvider(create: (_) => ThemeManager()), 23 | ChangeNotifierProvider(create: (_) => BasketManager()), 24 | ChangeNotifierProvider(create: (_) => UserManager()), 25 | ], 26 | child: EasyLocalization( 27 | supportedLocales: LanguageManager.instance.supportedLocales, 28 | path: AppConstants.LANG_ASSETS_PATH, 29 | child: MyApp(), 30 | ), 31 | ), 32 | ); 33 | } 34 | 35 | class MyApp extends StatelessWidget { 36 | @override 37 | Widget build(BuildContext context) { 38 | return MaterialApp( 39 | title: LocaleKeys.app_title, 40 | debugShowCheckedModeBanner: false, 41 | theme: context.watch().currentTheme, 42 | localizationsDelegates: context.localizationDelegates, 43 | supportedLocales: context.supportedLocales, 44 | locale: context.locale, 45 | home: HomeView(), 46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /furniture_mobile_app/lib/product/constants/api_endpoints.dart: -------------------------------------------------------------------------------- 1 | abstract class ApiEndpoints { 2 | static const Categories = '/categories'; 3 | static const Products = '/products'; 4 | } -------------------------------------------------------------------------------- /furniture_mobile_app/lib/product/constants/custom_colors.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | abstract class CustomColors { 4 | static const brightSun = Color(0xFFFCD734); 5 | static const crimson = Color(0xFFE41749); 6 | static const shimmer_1 = Color(0xFFEBECF4); 7 | static const shimmer_2 = Color(0xFFF4F4F4); 8 | static const shimmer_3 = Color(0xFFEBEBF4); 9 | } -------------------------------------------------------------------------------- /furniture_mobile_app/lib/product/extensions/string_extensions.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | extension HeroTagExtension on String? { 4 | String get productFavTag { 5 | var tag = this; 6 | return '${tag ?? ''}@product_fav'; 7 | } 8 | 9 | String get productPhotoTag { 10 | var tag = this; 11 | return '${tag ?? ''}@product_photo'; 12 | } 13 | } 14 | 15 | extension ColorExtension on String? { 16 | Color get hexToColor { 17 | var hexColor = this; 18 | hexColor ??= '#FFFFFF'; 19 | final buffer = StringBuffer(); 20 | if (hexColor.length == 6 || hexColor.length == 7) buffer.write('ff'); 21 | buffer.write(hexColor.replaceFirst('#', '')); 22 | return Color(int.parse(buffer.toString(), radix: 16)); 23 | } 24 | } -------------------------------------------------------------------------------- /furniture_mobile_app/lib/product/managers/basket_manager.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | 3 | import '../models/product_model.dart'; 4 | 5 | class BasketManager extends ChangeNotifier implements IBasketManager { 6 | @override 7 | Map get basket => _basket; 8 | final _basket = {}; 9 | 10 | @override 11 | int get productCount { 12 | var sum = 0; 13 | _basket.values.forEach((quantity) { 14 | sum += (quantity ?? 0); 15 | }); 16 | return sum; 17 | /// same operation -> less readable 18 | /// _basket.values.reduce((value, element) => (value ?? 0) + (element ?? 0)) ?? 0; 19 | } 20 | 21 | @override 22 | double get totalPrice { 23 | var sum = 0.0; 24 | _basket.entries.forEach((item) { 25 | // unit price * quantity 26 | sum += (item.key.price ?? 0) * (item.value ?? 0); 27 | }); 28 | return sum; 29 | } 30 | 31 | @override 32 | void decreaseProduct(Product product, int decrementQuantity) { 33 | if (_basket[product] != null) { 34 | _basket[product] = _basket[product]! - decrementQuantity; 35 | notifyListeners(); 36 | if (_basket[product]! <= 1) { 37 | _basket[product] = null; 38 | } 39 | } 40 | } 41 | 42 | @override 43 | void increaseProduct(Product product, int incrementQuantity) { 44 | // initial quantity of product 45 | if (_basket[product] == null) { 46 | _basket[product] = incrementQuantity; 47 | } else { 48 | _basket[product] = _basket[product]! + incrementQuantity; 49 | } 50 | notifyListeners(); 51 | } 52 | 53 | @override 54 | void putQuantityToProduct(Product product, int quantity) { 55 | _basket[product] = quantity; 56 | notifyListeners(); 57 | } 58 | 59 | @override 60 | void clearBasket() { 61 | _basket.clear(); 62 | notifyListeners(); 63 | } 64 | } 65 | 66 | abstract class IBasketManager { 67 | Map get basket; 68 | 69 | double get totalPrice; 70 | 71 | int get productCount; 72 | 73 | void increaseProduct(Product product, int incrementQuantity); 74 | 75 | void decreaseProduct(Product product, int decrementQuantity); 76 | 77 | void putQuantityToProduct(Product product, int quantity); 78 | 79 | void clearBasket(); 80 | } 81 | -------------------------------------------------------------------------------- /furniture_mobile_app/lib/product/managers/theme_manager.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | import '../../core/init/theme/furniture_theme.dart'; 4 | 5 | class ThemeManager extends ChangeNotifier { 6 | ThemeData _currentTheme = furnitureThemeData; 7 | 8 | ThemeData get currentTheme => _currentTheme; 9 | 10 | final _themeDataEnum = ThemeDataEnum.FURNITURE_LIGHT; 11 | 12 | void changeTheme() { 13 | switch (_themeDataEnum) { 14 | case ThemeDataEnum.FURNITURE_LIGHT: 15 | _currentTheme = furnitureThemeData; 16 | break; 17 | case ThemeDataEnum.LIGHT: 18 | _currentTheme = ThemeData.light(); 19 | break; 20 | case ThemeDataEnum.DARK: 21 | _currentTheme = ThemeData.dark(); 22 | break; 23 | } 24 | notifyListeners(); 25 | } 26 | } 27 | 28 | enum ThemeDataEnum { FURNITURE_LIGHT, LIGHT, DARK } -------------------------------------------------------------------------------- /furniture_mobile_app/lib/product/managers/user_manager.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | 3 | import '../../product/models/product_model.dart'; 4 | import '../models/user_model.dart'; 5 | 6 | class UserManager extends ChangeNotifier implements IUserManager { 7 | 8 | @override 9 | User? currentUser = User( 10 | id: 1, 11 | name: 'Courtney', 12 | surname: 'Henry', 13 | photoUrl: 'https://i.pravatar.cc/150?img=7'); 14 | 15 | @override 16 | Set? favoriteProducts = {}; 17 | 18 | @override 19 | bool isFavorite(int? productId) { 20 | if (productId == null) { 21 | return false; 22 | } 23 | return favoriteProducts 24 | ?.any((element) => element.productId == productId) ?? false; 25 | } 26 | 27 | @override 28 | void addProductToFavorites(Product product) { 29 | favoriteProducts?.add(product); 30 | notifyListeners(); 31 | } 32 | 33 | @override 34 | void removeProductToFavorites(Product product) { 35 | favoriteProducts?.remove(product); 36 | notifyListeners(); 37 | } 38 | } 39 | 40 | abstract class IUserManager { 41 | User? currentUser; 42 | Set? favoriteProducts; 43 | void addProductToFavorites(Product product); 44 | void removeProductToFavorites(Product product); 45 | bool isFavorite(int productId); 46 | } 47 | -------------------------------------------------------------------------------- /furniture_mobile_app/lib/product/models/category_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | import 'package:vexana/vexana.dart'; 3 | 4 | part 'category_model.g.dart'; 5 | 6 | @JsonSerializable() 7 | class Category extends INetworkModel { 8 | final int? categoryId; 9 | final String? categoryName; 10 | 11 | Category({this.categoryId, this.categoryName}); 12 | 13 | factory Category.fromJson(Map json) => 14 | _$CategoryFromJson(json); 15 | 16 | @override 17 | Map toJson() => _$CategoryToJson(this); 18 | 19 | @override 20 | Category fromJson(Map json) => _$CategoryFromJson(json); 21 | } 22 | /* FAKE DATA 23 | final categories = [ 24 | Category(categoryId: 1, categoryName: 'Chair'), 25 | Category(categoryId: 2, categoryName: 'Sofa'), 26 | Category(categoryId: 3, categoryName: 'Table'), 27 | Category(categoryId: 4, categoryName: 'Lamp'), 28 | Category(categoryId: 5, categoryName: 'Furniture'), 29 | ]; 30 | */ 31 | -------------------------------------------------------------------------------- /furniture_mobile_app/lib/product/models/category_model.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'category_model.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | Category _$CategoryFromJson(Map json) { 10 | return Category( 11 | categoryId: json['categoryId'] as int?, 12 | categoryName: json['categoryName'] as String?, 13 | ); 14 | } 15 | 16 | Map _$CategoryToJson(Category instance) => { 17 | 'categoryId': instance.categoryId, 18 | 'categoryName': instance.categoryName, 19 | }; 20 | -------------------------------------------------------------------------------- /furniture_mobile_app/lib/product/models/product_model.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'product_model.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | Product _$ProductFromJson(Map json) { 10 | return Product( 11 | productId: json['productId'] as int?, 12 | categoryId: json['categoryId'] as int?, 13 | productName: json['productName'] as String?, 14 | description: json['description'] as String?, 15 | price: (json['price'] as num?)?.toDouble(), 16 | stockQuantity: (json['stockQuantity'] as num?)?.toDouble(), 17 | starRate: (json['starRate'] as num?)?.toDouble(), 18 | photoUrl: json['photoUrl'] as String?, 19 | colors: 20 | (json['colors'] as List?)?.map((e) => e as String).toList(), 21 | ); 22 | } 23 | 24 | Map _$ProductToJson(Product instance) => { 25 | 'productId': instance.productId, 26 | 'categoryId': instance.categoryId, 27 | 'productName': instance.productName, 28 | 'description': instance.description, 29 | 'price': instance.price, 30 | 'stockQuantity': instance.stockQuantity, 31 | 'starRate': instance.starRate, 32 | 'photoUrl': instance.photoUrl, 33 | 'colors': instance.colors, 34 | }; 35 | -------------------------------------------------------------------------------- /furniture_mobile_app/lib/product/models/user_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | 3 | import '../../core/base/base_model.dart'; 4 | 5 | part 'user_model.g.dart'; 6 | 7 | @JsonSerializable() 8 | class User extends BaseModel { 9 | final int id; 10 | final String name; 11 | final String surname; 12 | final String? photoUrl; 13 | 14 | User({ 15 | required this.id, 16 | required this.name, 17 | required this.surname, 18 | this.photoUrl, 19 | }); 20 | 21 | String get fullName => '$name $surname'; 22 | 23 | factory User.fromJson(Map json) => _$UserFromJson(json); 24 | 25 | @override 26 | Map toJson() => _$UserToJson(this); 27 | } 28 | -------------------------------------------------------------------------------- /furniture_mobile_app/lib/product/models/user_model.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'user_model.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | User _$UserFromJson(Map json) { 10 | return User( 11 | id: json['id'] as int, 12 | name: json['name'] as String, 13 | surname: json['surname'] as String, 14 | photoUrl: json['photoUrl'] as String?, 15 | ); 16 | } 17 | 18 | Map _$UserToJson(User instance) => { 19 | 'id': instance.id, 20 | 'name': instance.name, 21 | 'surname': instance.surname, 22 | 'photoUrl': instance.photoUrl, 23 | }; 24 | -------------------------------------------------------------------------------- /furniture_mobile_app/lib/product/widgets/category_chip_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:kartal/kartal.dart'; 3 | import '../models/category_model.dart'; 4 | 5 | class CategoryChipItem extends StatelessWidget { 6 | final bool isSelected; 7 | final Category category; 8 | final VoidCallback? onSelected; 9 | 10 | const CategoryChipItem({ 11 | Key? key, 12 | required this.category, 13 | required this.isSelected, 14 | this.onSelected} 15 | ) : super(key: key); 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | return Container( 20 | margin: context.horizontalPaddingLow, 21 | child: FilterChip( 22 | label: Text(category.categoryName ?? ''), 23 | onSelected: (value) { 24 | if (onSelected != null) { 25 | onSelected!(); 26 | } 27 | }, 28 | selected: isSelected, 29 | showCheckmark: false, 30 | labelStyle: context.appTheme.chipTheme.labelStyle.copyWith( 31 | color: isSelected 32 | ? context.colorScheme.onPrimary 33 | : context.colorScheme.onBackground), 34 | ), 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /furniture_mobile_app/lib/product/widgets/number_counter_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:kartal/kartal.dart'; 4 | 5 | class NumberCounterButton extends StatefulWidget { 6 | final Function(int)? onChanged; 7 | final double? width; 8 | final double? height; 9 | final int minValue; 10 | 11 | const NumberCounterButton({ 12 | Key? key, 13 | this.onChanged, 14 | this.width, 15 | this.height, 16 | this.minValue = 1 17 | }) : super(key: key); 18 | 19 | @override 20 | _NumberCounterButtonState createState() => _NumberCounterButtonState(); 21 | } 22 | 23 | class _NumberCounterButtonState extends State { 24 | 25 | int value = 1; 26 | 27 | @override 28 | Widget build(BuildContext context) { 29 | return SizedBox( 30 | height: widget.height ?? 30, 31 | width: widget.width ?? 100, 32 | child: Row( 33 | crossAxisAlignment: CrossAxisAlignment.stretch, 34 | children: [ 35 | Expanded(flex: 1, child: _buildDecrease(context)), 36 | Expanded(flex: 2, child: _buildShowValue(context)), 37 | Expanded(flex: 1, child: _buildIncrease(context)), 38 | ], 39 | ), 40 | ); 41 | } 42 | 43 | Widget _buildDecrease(BuildContext context) { 44 | return Container( 45 | decoration: BoxDecoration( 46 | borderRadius: BorderRadius.only( 47 | topLeft: context.lowRadius, 48 | bottomLeft: context.lowRadius, 49 | ), 50 | color: Colors.grey), 51 | child: InkWell( 52 | onTap: () { 53 | if (value > widget.minValue) { 54 | setState(() { 55 | value--; 56 | widget.onChanged?.call(value); 57 | }); 58 | } 59 | }, 60 | child: Icon(Icons.remove, color: context.colorScheme.onPrimary), 61 | ), 62 | ); 63 | } 64 | 65 | Widget _buildIncrease(BuildContext context) { 66 | return Container( 67 | decoration: BoxDecoration( 68 | borderRadius: BorderRadius.only( 69 | topRight: context.lowRadius, 70 | bottomRight: context.lowRadius, 71 | ), 72 | color: context.appTheme.primaryColor), 73 | child: InkWell( 74 | onTap: () { 75 | setState(() { 76 | value += 1; 77 | widget.onChanged?.call(value); 78 | }); 79 | }, 80 | child: Icon(Icons.add, color: context.colorScheme.onPrimary), 81 | ), 82 | ); 83 | } 84 | 85 | Widget _buildShowValue(BuildContext context) { 86 | return Container( 87 | alignment: Alignment.center, 88 | color: context.appTheme.scaffoldBackgroundColor, 89 | child: Text('$value', 90 | style: context.textTheme.headline6, 91 | ), 92 | ); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /furniture_mobile_app/lib/product/widgets/product_card_item/product_card_item_shimmer.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:kartal/kartal.dart'; 4 | import 'package:shimmer/shimmer.dart'; 5 | 6 | import '../../constants/custom_colors.dart'; 7 | 8 | class ProductCardItemShimmer extends StatelessWidget { 9 | const ProductCardItemShimmer({Key? key}) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return Card( 14 | clipBehavior: Clip.antiAlias, 15 | child: Padding( 16 | padding: context.paddingLow, 17 | child: Column( 18 | crossAxisAlignment: CrossAxisAlignment.start, 19 | children: [ 20 | Expanded( 21 | child: _buildThumbnail(context), 22 | ), 23 | SizedBox(height: context.normalValue), 24 | Expanded( 25 | child: Column( 26 | crossAxisAlignment: CrossAxisAlignment.start, 27 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 28 | children: [ 29 | _buildProductName(context), 30 | _buildProductPrice(context), 31 | _buildStarRate(context), 32 | _buildBuyButton(context), 33 | ], 34 | ), 35 | ) 36 | ], 37 | ), 38 | ), 39 | ); 40 | } 41 | 42 | Widget _buildThumbnail(BuildContext context) { 43 | return Shimmer.fromColors( 44 | baseColor: CustomColors.shimmer_1, 45 | highlightColor: CustomColors.shimmer_2, 46 | child: Container( 47 | width: double.infinity, 48 | decoration: BoxDecoration( 49 | borderRadius: context.normalBorderRadius, 50 | color: context.appTheme.backgroundColor), 51 | child: SizedBox.expand(), 52 | ), 53 | ); 54 | } 55 | 56 | Widget _buildProductName(BuildContext context) { 57 | return Shimmer.fromColors( 58 | baseColor: CustomColors.shimmer_1, 59 | highlightColor: CustomColors.shimmer_2, 60 | child: Container( 61 | color: Colors.black, 62 | width: context.dynamicWidth(0.3), 63 | height: 15, 64 | ), 65 | ); 66 | } 67 | 68 | Widget _buildProductPrice(BuildContext context) { 69 | return Shimmer.fromColors( 70 | baseColor: CustomColors.shimmer_1, 71 | highlightColor: CustomColors.shimmer_2, 72 | child: Container( 73 | color: Colors.black, 74 | width: context.dynamicWidth(0.2), 75 | height: 10, 76 | ), 77 | ); 78 | } 79 | 80 | Widget _buildStarRate(BuildContext context) { 81 | return Shimmer.fromColors( 82 | baseColor: CustomColors.shimmer_1, 83 | highlightColor: CustomColors.shimmer_2, 84 | child: Container( 85 | color: Colors.black, 86 | width: context.dynamicWidth(0.1), 87 | height: 10, 88 | ), 89 | ); 90 | } 91 | 92 | Widget _buildBuyButton(BuildContext context) { 93 | return Shimmer.fromColors( 94 | baseColor: CustomColors.shimmer_1, 95 | highlightColor: CustomColors.shimmer_2, 96 | child: Container( 97 | width: double.infinity, 98 | color: Colors.black, 99 | height: context.dynamicWidth(0.07), 100 | ), 101 | ); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /furniture_mobile_app/lib/product/widgets/product_fav_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:kartal/kartal.dart'; 4 | 5 | import '../constants/custom_colors.dart'; 6 | 7 | class ProductFavButton extends StatelessWidget { 8 | final bool isFav; 9 | final Function(bool)? onSelected; 10 | 11 | const ProductFavButton({ 12 | Key? key, 13 | required this.isFav, 14 | this.onSelected, 15 | }) : super(key: key); 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | return Card( 20 | color: context.appTheme.cardColor, 21 | elevation: 1, 22 | shape: CircleBorder(), 23 | child: InkWell( 24 | customBorder: CircleBorder(), 25 | onTap: () { 26 | if (onSelected != null) { 27 | onSelected!(!isFav); 28 | } 29 | }, 30 | child: Padding( 31 | padding: context.paddingLow, 32 | child: Icon( 33 | isFav ? CupertinoIcons.heart_fill : CupertinoIcons.heart, 34 | color: isFav ? CustomColors.crimson : context.appTheme.iconTheme.color, 35 | ), 36 | ), 37 | ), 38 | ); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /furniture_mobile_app/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: furniture_mobile_app 2 | description: A new Flutter project. 3 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 4 | version: 1.0.0+1 5 | 6 | environment: 7 | sdk: '>=2.12.0 <3.0.0' 8 | 9 | dependencies: 10 | flutter: 11 | sdk: flutter 12 | provider: ^5.0.0 13 | flutter_mobx: ^2.0.0 14 | mobx: ^2.0.1 15 | kartal: ^2.0.0 16 | vexana: ^2.1.0 17 | flutter_dotenv: ^4.0.0-nullsafety.0 18 | json_serializable: ^4.1.1 19 | json_annotation: ^4.0.1 20 | easy_localization: ^3.0.0 21 | shimmer: ^2.0.0 22 | cached_network_image: ^3.0.0 23 | page_transition: ^2.0.1-nullsafety.0 24 | google_fonts: ^2.0.0 25 | cupertino_icons: ^1.0.2 26 | 27 | dev_dependencies: 28 | flutter_test: 29 | sdk: flutter 30 | build_runner: ^2.0.0 31 | mobx_codegen: ^2.0.1+3 32 | pedantic: ^1.11.0 33 | 34 | 35 | flutter: 36 | uses-material-design: true 37 | 38 | assets: 39 | - assets/lang/ 40 | - .env 41 | -------------------------------------------------------------------------------- /furniture_mobile_app/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 that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:furniture_mobile_app/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /furniture_mobile_app/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/furniture_mobile_app/web/favicon.png -------------------------------------------------------------------------------- /furniture_mobile_app/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/furniture_mobile_app/web/icons/Icon-192.png -------------------------------------------------------------------------------- /furniture_mobile_app/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/furniture_mobile_app/web/icons/Icon-512.png -------------------------------------------------------------------------------- /furniture_mobile_app/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | furniture_mobile_app 30 | 31 | 32 | 33 | 36 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /furniture_mobile_app/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "furniture_mobile_app", 3 | "short_name": "furniture_mobile_app", 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 | } 24 | -------------------------------------------------------------------------------- /furniture_mobile_app/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 | -------------------------------------------------------------------------------- /furniture_mobile_app/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | #include "generated_plugin_registrant.h" 6 | 7 | #include 8 | 9 | void RegisterPlugins(flutter::PluginRegistry* registry) { 10 | UrlLauncherPluginRegisterWithRegistrar( 11 | registry->GetRegistrarForPlugin("UrlLauncherPlugin")); 12 | } 13 | -------------------------------------------------------------------------------- /furniture_mobile_app/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 6 | #define GENERATED_PLUGIN_REGISTRANT_ 7 | 8 | #include 9 | 10 | // Registers Flutter plugins. 11 | void RegisterPlugins(flutter::PluginRegistry* registry); 12 | 13 | #endif // GENERATED_PLUGIN_REGISTRANT_ 14 | -------------------------------------------------------------------------------- /furniture_mobile_app/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | url_launcher_windows 7 | ) 8 | 9 | set(PLUGIN_BUNDLED_LIBRARIES) 10 | 11 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 12 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 13 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 14 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 15 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 16 | endforeach(plugin) 17 | -------------------------------------------------------------------------------- /furniture_mobile_app/windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | project(runner LANGUAGES CXX) 3 | 4 | add_executable(${BINARY_NAME} WIN32 5 | "flutter_window.cpp" 6 | "main.cpp" 7 | "run_loop.cpp" 8 | "utils.cpp" 9 | "win32_window.cpp" 10 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 11 | "Runner.rc" 12 | "runner.exe.manifest" 13 | ) 14 | apply_standard_settings(${BINARY_NAME}) 15 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 16 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 17 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 18 | add_dependencies(${BINARY_NAME} flutter_assemble) 19 | -------------------------------------------------------------------------------- /furniture_mobile_app/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 | #ifdef FLUTTER_BUILD_NUMBER 64 | #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0 67 | #endif 68 | 69 | #ifdef FLUTTER_BUILD_NAME 70 | #define VERSION_AS_STRING #FLUTTER_BUILD_NAME 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", "A new Flutter project." "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "furniture_mobile_app" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2021 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "furniture_mobile_app.exe" "\0" 98 | VALUE "ProductName", "furniture_mobile_app" "\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 | -------------------------------------------------------------------------------- /furniture_mobile_app/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(RunLoop* run_loop, 8 | const flutter::DartProject& project) 9 | : run_loop_(run_loop), project_(project) {} 10 | 11 | FlutterWindow::~FlutterWindow() {} 12 | 13 | bool FlutterWindow::OnCreate() { 14 | if (!Win32Window::OnCreate()) { 15 | return false; 16 | } 17 | 18 | RECT frame = GetClientArea(); 19 | 20 | // The size here must match the window dimensions to avoid unnecessary surface 21 | // creation / destruction in the startup path. 22 | flutter_controller_ = std::make_unique( 23 | frame.right - frame.left, frame.bottom - frame.top, project_); 24 | // Ensure that basic setup of the controller was successful. 25 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 26 | return false; 27 | } 28 | RegisterPlugins(flutter_controller_->engine()); 29 | run_loop_->RegisterFlutterInstance(flutter_controller_->engine()); 30 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 31 | return true; 32 | } 33 | 34 | void FlutterWindow::OnDestroy() { 35 | if (flutter_controller_) { 36 | run_loop_->UnregisterFlutterInstance(flutter_controller_->engine()); 37 | flutter_controller_ = nullptr; 38 | } 39 | 40 | Win32Window::OnDestroy(); 41 | } 42 | 43 | LRESULT 44 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 45 | WPARAM const wparam, 46 | LPARAM const lparam) noexcept { 47 | // Give Flutter, including plugins, an opporutunity to handle window messages. 48 | if (flutter_controller_) { 49 | std::optional result = 50 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 51 | lparam); 52 | if (result) { 53 | return *result; 54 | } 55 | } 56 | 57 | switch (message) { 58 | case WM_FONTCHANGE: 59 | flutter_controller_->engine()->ReloadSystemFonts(); 60 | break; 61 | } 62 | 63 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 64 | } 65 | -------------------------------------------------------------------------------- /furniture_mobile_app/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 "run_loop.h" 10 | #include "win32_window.h" 11 | 12 | // A window that does nothing but host a Flutter view. 13 | class FlutterWindow : public Win32Window { 14 | public: 15 | // Creates a new FlutterWindow driven by the |run_loop|, hosting a 16 | // Flutter view running |project|. 17 | explicit FlutterWindow(RunLoop* run_loop, 18 | const flutter::DartProject& project); 19 | virtual ~FlutterWindow(); 20 | 21 | protected: 22 | // Win32Window: 23 | bool OnCreate() override; 24 | void OnDestroy() override; 25 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 26 | LPARAM const lparam) noexcept override; 27 | 28 | private: 29 | // The run loop driving events for this window. 30 | RunLoop* run_loop_; 31 | 32 | // The project to run. 33 | flutter::DartProject project_; 34 | 35 | // The Flutter instance hosted by this window. 36 | std::unique_ptr flutter_controller_; 37 | }; 38 | 39 | #endif // RUNNER_FLUTTER_WINDOW_H_ 40 | -------------------------------------------------------------------------------- /furniture_mobile_app/windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "run_loop.h" 7 | #include "utils.h" 8 | 9 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 10 | _In_ wchar_t *command_line, _In_ int show_command) { 11 | // Attach to console when present (e.g., 'flutter run') or create a 12 | // new console when running with a debugger. 13 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 14 | CreateAndAttachConsole(); 15 | } 16 | 17 | // Initialize COM, so that it is available for use in the library and/or 18 | // plugins. 19 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 20 | 21 | RunLoop run_loop; 22 | 23 | flutter::DartProject project(L"data"); 24 | 25 | std::vector command_line_arguments = 26 | GetCommandLineArguments(); 27 | 28 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 29 | 30 | FlutterWindow window(&run_loop, project); 31 | Win32Window::Point origin(10, 10); 32 | Win32Window::Size size(1280, 720); 33 | if (!window.CreateAndShow(L"furniture_mobile_app", origin, size)) { 34 | return EXIT_FAILURE; 35 | } 36 | window.SetQuitOnClose(true); 37 | 38 | run_loop.Run(); 39 | 40 | ::CoUninitialize(); 41 | return EXIT_SUCCESS; 42 | } 43 | -------------------------------------------------------------------------------- /furniture_mobile_app/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 | -------------------------------------------------------------------------------- /furniture_mobile_app/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/furniture_mobile_app/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /furniture_mobile_app/windows/runner/run_loop.cpp: -------------------------------------------------------------------------------- 1 | #include "run_loop.h" 2 | 3 | #include 4 | 5 | #include 6 | 7 | RunLoop::RunLoop() {} 8 | 9 | RunLoop::~RunLoop() {} 10 | 11 | void RunLoop::Run() { 12 | bool keep_running = true; 13 | TimePoint next_flutter_event_time = TimePoint::clock::now(); 14 | while (keep_running) { 15 | std::chrono::nanoseconds wait_duration = 16 | std::max(std::chrono::nanoseconds(0), 17 | next_flutter_event_time - TimePoint::clock::now()); 18 | ::MsgWaitForMultipleObjects( 19 | 0, nullptr, FALSE, static_cast(wait_duration.count() / 1000), 20 | QS_ALLINPUT); 21 | bool processed_events = false; 22 | MSG message; 23 | // All pending Windows messages must be processed; MsgWaitForMultipleObjects 24 | // won't return again for items left in the queue after PeekMessage. 25 | while (::PeekMessage(&message, nullptr, 0, 0, PM_REMOVE)) { 26 | processed_events = true; 27 | if (message.message == WM_QUIT) { 28 | keep_running = false; 29 | break; 30 | } 31 | ::TranslateMessage(&message); 32 | ::DispatchMessage(&message); 33 | // Allow Flutter to process messages each time a Windows message is 34 | // processed, to prevent starvation. 35 | next_flutter_event_time = 36 | std::min(next_flutter_event_time, ProcessFlutterMessages()); 37 | } 38 | // If the PeekMessage loop didn't run, process Flutter messages. 39 | if (!processed_events) { 40 | next_flutter_event_time = 41 | std::min(next_flutter_event_time, ProcessFlutterMessages()); 42 | } 43 | } 44 | } 45 | 46 | void RunLoop::RegisterFlutterInstance( 47 | flutter::FlutterEngine* flutter_instance) { 48 | flutter_instances_.insert(flutter_instance); 49 | } 50 | 51 | void RunLoop::UnregisterFlutterInstance( 52 | flutter::FlutterEngine* flutter_instance) { 53 | flutter_instances_.erase(flutter_instance); 54 | } 55 | 56 | RunLoop::TimePoint RunLoop::ProcessFlutterMessages() { 57 | TimePoint next_event_time = TimePoint::max(); 58 | for (auto instance : flutter_instances_) { 59 | std::chrono::nanoseconds wait_duration = instance->ProcessMessages(); 60 | if (wait_duration != std::chrono::nanoseconds::max()) { 61 | next_event_time = 62 | std::min(next_event_time, TimePoint::clock::now() + wait_duration); 63 | } 64 | } 65 | return next_event_time; 66 | } 67 | -------------------------------------------------------------------------------- /furniture_mobile_app/windows/runner/run_loop.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_RUN_LOOP_H_ 2 | #define RUNNER_RUN_LOOP_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | // A runloop that will service events for Flutter instances as well 10 | // as native messages. 11 | class RunLoop { 12 | public: 13 | RunLoop(); 14 | ~RunLoop(); 15 | 16 | // Prevent copying 17 | RunLoop(RunLoop const&) = delete; 18 | RunLoop& operator=(RunLoop const&) = delete; 19 | 20 | // Runs the run loop until the application quits. 21 | void Run(); 22 | 23 | // Registers the given Flutter instance for event servicing. 24 | void RegisterFlutterInstance( 25 | flutter::FlutterEngine* flutter_instance); 26 | 27 | // Unregisters the given Flutter instance from event servicing. 28 | void UnregisterFlutterInstance( 29 | flutter::FlutterEngine* flutter_instance); 30 | 31 | private: 32 | using TimePoint = std::chrono::steady_clock::time_point; 33 | 34 | // Processes all currently pending messages for registered Flutter instances. 35 | TimePoint ProcessFlutterMessages(); 36 | 37 | std::set flutter_instances_; 38 | }; 39 | 40 | #endif // RUNNER_RUN_LOOP_H_ 41 | -------------------------------------------------------------------------------- /furniture_mobile_app/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 | -------------------------------------------------------------------------------- /furniture_mobile_app/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 | if (target_length == 0) { 52 | return std::string(); 53 | } 54 | std::string utf8_string; 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /furniture_mobile_app/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 | -------------------------------------------------------------------------------- /furniture_mobile_app/windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates and shows a win32 window with |title| and position and size using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size to will treat the width height passed in to this function 35 | // as logical pixels and scale to appropriate for the default monitor. Returns 36 | // true if the window was created successfully. 37 | bool CreateAndShow(const std::wstring& title, 38 | const Point& origin, 39 | const Size& size); 40 | 41 | // Release OS resources associated with window. 42 | void Destroy(); 43 | 44 | // Inserts |content| into the window tree. 45 | void SetChildContent(HWND content); 46 | 47 | // Returns the backing Window handle to enable clients to set icon and other 48 | // window properties. Returns nullptr if the window has been destroyed. 49 | HWND GetHandle(); 50 | 51 | // If true, closing this window will quit the application. 52 | void SetQuitOnClose(bool quit_on_close); 53 | 54 | // Return a RECT representing the bounds of the current client area. 55 | RECT GetClientArea(); 56 | 57 | protected: 58 | // Processes and route salient window messages for mouse handling, 59 | // size change and DPI. Delegates handling of these to member overloads that 60 | // inheriting classes can handle. 61 | virtual LRESULT MessageHandler(HWND window, 62 | UINT const message, 63 | WPARAM const wparam, 64 | LPARAM const lparam) noexcept; 65 | 66 | // Called when CreateAndShow is called, allowing subclass window-related 67 | // setup. Subclasses should return false if setup fails. 68 | virtual bool OnCreate(); 69 | 70 | // Called when Destroy is called. 71 | virtual void OnDestroy(); 72 | 73 | private: 74 | friend class WindowClassRegistrar; 75 | 76 | // OS callback called by message pump. Handles the WM_NCCREATE message which 77 | // is passed when the non-client area is being created and enables automatic 78 | // non-client DPI scaling so that the non-client area automatically 79 | // responsponds to changes in DPI. All other messages are handled by 80 | // MessageHandler. 81 | static LRESULT CALLBACK WndProc(HWND const window, 82 | UINT const message, 83 | WPARAM const wparam, 84 | LPARAM const lparam) noexcept; 85 | 86 | // Retrieves a class instance pointer for |window| 87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 88 | 89 | bool quit_on_close_ = false; 90 | 91 | // window handle for top level window. 92 | HWND window_handle_ = nullptr; 93 | 94 | // window handle for hosted content. 95 | HWND child_content_ = nullptr; 96 | }; 97 | 98 | #endif // RUNNER_WIN32_WINDOW_H_ 99 | -------------------------------------------------------------------------------- /message_app/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | -------------------------------------------------------------------------------- /message_app/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: b1395592de68cc8ac4522094ae59956dd21a91db 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /message_app/README.md: -------------------------------------------------------------------------------- 1 | # message_app 2 | 3 | ![](https://github.com/ahm3tcelik/acm_hacettepe_coding_challange/blob/master/showcase/message_app.gif) 4 | -------------------------------------------------------------------------------- /message_app/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file 2 | # for details. All rights reserved. Use of this source code is governed by a 3 | # BSD-style license that can be found in the LICENSE file. 4 | # 5 | # Google internally enforced rules. See README.md for more information, 6 | # including a list of lints that are intentionally _not_ enforced. 7 | 8 | linter: 9 | rules: 10 | - always_declare_return_types 11 | - always_require_non_null_named_parameters 12 | - annotate_overrides 13 | - avoid_init_to_null 14 | - avoid_null_checks_in_equality_operators 15 | - avoid_relative_lib_imports 16 | - avoid_return_types_on_setters 17 | - avoid_shadowing_type_parameters 18 | - avoid_single_cascade_in_expression_statements 19 | - avoid_types_as_parameter_names 20 | - await_only_futures 21 | - camel_case_extensions 22 | - curly_braces_in_flow_control_structures 23 | - empty_catches 24 | - empty_constructor_bodies 25 | - library_names 26 | - library_prefixes 27 | - no_duplicate_case_values 28 | - null_closures 29 | - omit_local_variable_types 30 | - prefer_adjacent_string_concatenation 31 | - prefer_collection_literals 32 | - prefer_conditional_assignment 33 | - prefer_contains 34 | - prefer_equal_for_default_values 35 | - prefer_final_fields 36 | - prefer_for_elements_to_map_fromIterable 37 | - prefer_generic_function_type_aliases 38 | - prefer_if_null_operators 39 | - prefer_inlined_adds 40 | - prefer_is_empty 41 | - prefer_is_not_empty 42 | - prefer_iterable_whereType 43 | - prefer_single_quotes 44 | - prefer_spread_collections 45 | - recursive_getters 46 | - slash_for_doc_comments 47 | - sort_child_properties_last 48 | - type_init_formals 49 | - unawaited_futures 50 | - unnecessary_brace_in_string_interps 51 | - unnecessary_const 52 | - unnecessary_getters_setters 53 | - unnecessary_new 54 | - unnecessary_null_in_if_null_operators 55 | - unnecessary_this 56 | - unrelated_type_equality_checks 57 | - unsafe_html 58 | - use_full_hex_values_for_flutter_colors 59 | - use_function_type_syntax_for_parameters 60 | - use_rethrow_when_possible 61 | - valid_regexps -------------------------------------------------------------------------------- /message_app/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 | -------------------------------------------------------------------------------- /message_app/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 30 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | defaultConfig { 36 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 37 | applicationId "com.example.message_app" 38 | minSdkVersion 16 39 | targetSdkVersion 30 40 | versionCode flutterVersionCode.toInteger() 41 | versionName flutterVersionName 42 | } 43 | 44 | buildTypes { 45 | release { 46 | // TODO: Add your own signing config for the release build. 47 | // Signing with the debug keys for now, so `flutter run --release` works. 48 | signingConfig signingConfigs.debug 49 | } 50 | } 51 | } 52 | 53 | flutter { 54 | source '../..' 55 | } 56 | 57 | dependencies { 58 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 59 | } 60 | -------------------------------------------------------------------------------- /message_app/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /message_app/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 13 | 17 | 21 | 26 | 30 | 31 | 32 | 33 | 34 | 35 | 37 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /message_app/android/app/src/main/kotlin/com/example/message_app/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.message_app 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /message_app/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /message_app/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /message_app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/message_app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /message_app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/message_app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /message_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/message_app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /message_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/message_app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /message_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/message_app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /message_app/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /message_app/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /message_app/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /message_app/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:4.1.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /message_app/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /message_app/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip 7 | -------------------------------------------------------------------------------- /message_app/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 | -------------------------------------------------------------------------------- /message_app/assets/lang/en-US.json: -------------------------------------------------------------------------------- 1 | { 2 | "app_title": "Chat App", 3 | "app_name": "Chatttelr", 4 | "activity": "Activity", 5 | "messages": "Messages", 6 | "call": "Call", 7 | "camera": "Camera", 8 | "settings": "Settings", 9 | "online": "Online", 10 | "offline": "Offline", 11 | "now": "Now", 12 | "min": "min", 13 | "day": "day", 14 | "hour": "hour", 15 | "type_message": "Type a message" 16 | } -------------------------------------------------------------------------------- /message_app/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /message_app/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 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /message_app/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /message_app/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /message_app/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /message_app/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /message_app/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /message_app/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /message_app/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /message_app/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /message_app/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /message_app/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 | -------------------------------------------------------------------------------- /message_app/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 | -------------------------------------------------------------------------------- /message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/message_app/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /message_app/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 | -------------------------------------------------------------------------------- /message_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/message_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /message_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/message_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /message_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/message_app/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /message_app/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. -------------------------------------------------------------------------------- /message_app/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 | -------------------------------------------------------------------------------- /message_app/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 | -------------------------------------------------------------------------------- /message_app/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | message_app 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /message_app/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /message_app/lib/core/base/base_model.dart: -------------------------------------------------------------------------------- 1 | abstract class BaseModel { 2 | Map toJson(); 3 | } -------------------------------------------------------------------------------- /message_app/lib/core/base/base_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:mobx/mobx.dart'; 3 | 4 | class BaseView extends StatefulWidget { 5 | final Widget Function(BuildContext context, T value) onPageBuilder; 6 | final Function(BuildContext context)? onContextReady; 7 | final T viewModel; 8 | final Function(T model)? onModelReady; 9 | final VoidCallback? onDispose; 10 | 11 | const BaseView({ 12 | Key? key, 13 | required this.viewModel, 14 | required this.onPageBuilder, 15 | this.onModelReady, 16 | this.onContextReady, 17 | this.onDispose, 18 | }) : super(key: key); 19 | 20 | @override 21 | _BaseViewState createState() => _BaseViewState(); 22 | } 23 | 24 | class _BaseViewState extends State> { 25 | late T model; 26 | 27 | @override 28 | void initState() { 29 | model = widget.viewModel; 30 | widget.onModelReady?.call(model); 31 | super.initState(); 32 | } 33 | 34 | @override 35 | void dispose() { 36 | super.dispose(); 37 | if (widget.onDispose != null) widget.onDispose!(); 38 | } 39 | 40 | @override 41 | Widget build(BuildContext context) { 42 | widget.onContextReady?.call(context); 43 | return widget.onPageBuilder(context, model); 44 | } 45 | } -------------------------------------------------------------------------------- /message_app/lib/core/constants/app_constants.dart: -------------------------------------------------------------------------------- 1 | class AppConstants { 2 | static const LANG_ASSETS_PATH = 'assets/lang'; 3 | } 4 | -------------------------------------------------------------------------------- /message_app/lib/core/init/lang/language_manager.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | // flutter pub run easy_localization:generate -S "assets/lang" -f keys -O "lib/core/init/lang" -o locale_keys.g.dart 4 | 5 | class LanguageManager { 6 | static LanguageManager? _instance; 7 | static LanguageManager get instance { 8 | _instance ??= LanguageManager._init(); 9 | return _instance!; 10 | } 11 | 12 | LanguageManager._init(); 13 | 14 | final enLocale = Locale('en', 'US'); 15 | 16 | List get supportedLocales => [enLocale]; 17 | } -------------------------------------------------------------------------------- /message_app/lib/core/init/lang/locale_keys.g.dart: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This is code generated via package:easy_localization/generate.dart 2 | 3 | abstract class LocaleKeys { 4 | static const app_title = 'app_title'; 5 | static const app_name = 'app_name'; 6 | static const activity = 'activity'; 7 | static const messages = 'messages'; 8 | static const call = 'call'; 9 | static const camera = 'camera'; 10 | static const settings = 'settings'; 11 | static const online = 'online'; 12 | static const offline = 'offline'; 13 | static const now = 'now'; 14 | static const min = 'min'; 15 | static const day = 'day'; 16 | static const hour = 'hour'; 17 | static const type_message = 'type_message'; 18 | 19 | } 20 | -------------------------------------------------------------------------------- /message_app/lib/core/widgets/if_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | class If extends StatelessWidget { 4 | final bool condition; 5 | final Widget widget; 6 | 7 | /// ```dart 8 | /// If(condition: isLoading, widget: Loader()) 9 | /// ``` 10 | const If({required this.condition, required this.widget}); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return condition ? widget : SizedBox(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /message_app/lib/core/widgets/switch_case_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | class Case { 4 | final dynamic value; 5 | final Widget widget; 6 | 7 | ///```dart 8 | /// Case(value: 'customer', widget: _buildGreetCustomer), 9 | ///``` 10 | const Case({required this.widget, required this.value}); 11 | } 12 | 13 | class SwitchCase extends StatelessWidget { 14 | final dynamic value; 15 | final List cases; 16 | final Widget? elseWidget; 17 | 18 | /// 19 | ///```dart 20 | /// var role = 'admin'; 21 | /// return SwitchCase( 22 | /// cases: [ 23 | /// Case(value: 'customer', widget: _buildGreetCustomer), 24 | /// Case(value: 'developer', widget: _buildGreetDeveloper), 25 | /// Case(value: 'admin', widget: _buildGreetAdmin) 26 | /// ], 27 | /// value: role, 28 | /// elseWidget: Text('Unidentified'), 29 | /// ); 30 | ///``` 31 | SwitchCase( 32 | {required this.value, required this.cases, required this.elseWidget}); 33 | 34 | @override 35 | Widget build(BuildContext context) { 36 | var activeCase = cases.firstWhere((c) => c.value == value, 37 | orElse: () => Case(widget: elseWidget ?? SizedBox(), value: null)); 38 | return activeCase.widget; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /message_app/lib/core/widgets/ternary_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | 3 | class Ternary extends StatelessWidget { 4 | final bool condition; 5 | final Widget widgetTrue; 6 | final Widget widgetFalse; 7 | 8 | /// 9 | ///```dart 10 | /// Ternary( 11 | /// condition: isLoggedIn, 12 | /// widgetTrue: Text('Logout'), 13 | /// widgetFalse: Text('Login'), 14 | /// ) 15 | ///``` 16 | const Ternary( 17 | {required this.condition, 18 | required this.widgetTrue, 19 | required this.widgetFalse}); 20 | 21 | @override 22 | Widget build(BuildContext context) => condition ? widgetTrue : widgetFalse; 23 | } 24 | -------------------------------------------------------------------------------- /message_app/lib/core/widgets/wrap_with_badge.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:kartal/kartal.dart'; 3 | 4 | class WrapWithBadge extends StatelessWidget { 5 | final Widget child; 6 | final String? badgeLabel; 7 | final Color badgeLabelColor; 8 | final Color badgeColor; 9 | final double? top; 10 | final double? right; 11 | final double? bottom; 12 | final double? left; 13 | 14 | const WrapWithBadge({ 15 | required this.child, 16 | this.badgeLabel, 17 | this.top, 18 | this.right, 19 | this.bottom, 20 | this.left, 21 | this.badgeLabelColor = Colors.white, 22 | this.badgeColor = Colors.red, 23 | }); 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return Stack( 28 | alignment: Alignment.center, 29 | children: [ 30 | child, 31 | Positioned( 32 | top: top, 33 | right: right, 34 | bottom: bottom, 35 | left: left, 36 | child: Container( 37 | width: 20, 38 | height: 20, 39 | decoration: BoxDecoration(shape: BoxShape.circle, color: badgeColor), 40 | alignment: Alignment.center, 41 | child: Text(badgeLabel ?? '', style: context.textTheme.subtitle1!.copyWith( 42 | color: Colors.white, 43 | fontWeight: FontWeight.bold 44 | ),), 45 | ), 46 | ) 47 | ], 48 | ); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /message_app/lib/features/home/home_base_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:kartal/kartal.dart'; 4 | import 'package:message_app/core/widgets/switch_case_widget.dart'; 5 | import 'package:message_app/features/home/messages/view/messages_view.dart'; 6 | 7 | class HomeBaseView extends StatefulWidget { 8 | @override 9 | _HomeBaseViewState createState() => _HomeBaseViewState(); 10 | } 11 | 12 | class _HomeBaseViewState extends State { 13 | 14 | var _currentIndex = HomeViewItems.MESSAGES.index; 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return Scaffold( 19 | body: _buildCurrentView, 20 | bottomNavigationBar: _buildBottomBar(context), 21 | ); 22 | } 23 | 24 | Widget get _buildCurrentView { 25 | return SwitchCase( 26 | value: _currentIndex, 27 | cases: [ 28 | Case(widget: MessagesView(), value: HomeViewItems.MESSAGES.index), 29 | // (Other views) 30 | // Case(widget: CallView(), value: HomeViewItems.CALL) 31 | ], 32 | elseWidget: SizedBox(), 33 | ); 34 | } 35 | 36 | Widget _buildBottomBar(BuildContext context) { 37 | return Padding( 38 | padding: context.paddingNormal, 39 | child: ClipRRect( 40 | borderRadius: BorderRadius.all(context.normalRadius), 41 | child: BottomNavigationBar( 42 | onTap: onChangeBottomNavItem, 43 | iconSize: 36, 44 | currentIndex: _currentIndex, 45 | items: [ 46 | BottomNavigationBarItem( 47 | label: 'Messages', 48 | icon: Icon(CupertinoIcons.chat_bubble), 49 | activeIcon: Icon(CupertinoIcons.chat_bubble_fill) 50 | ), 51 | BottomNavigationBarItem( 52 | label: 'Call', 53 | icon: Icon(CupertinoIcons.phone), 54 | activeIcon: Icon(CupertinoIcons.phone_fill), 55 | ), 56 | BottomNavigationBarItem( 57 | label: 'Camera', 58 | icon: Icon(CupertinoIcons.camera), 59 | activeIcon: Icon(CupertinoIcons.camera_fill), 60 | ), 61 | BottomNavigationBarItem( 62 | label: 'Settings', 63 | icon: Icon(CupertinoIcons.settings), 64 | activeIcon: Icon(CupertinoIcons.settings_solid), 65 | ), 66 | ], 67 | ), 68 | ), 69 | ); 70 | } 71 | 72 | void onChangeBottomNavItem(int index) { 73 | if (index != _currentIndex) { 74 | setState(() { 75 | _currentIndex = index; 76 | }); 77 | } 78 | } 79 | } 80 | 81 | enum HomeViewItems { 82 | MESSAGES, 83 | CALL, 84 | CAMERA, 85 | SETTINGS 86 | } 87 | -------------------------------------------------------------------------------- /message_app/lib/features/home/message_detail/viewmodel/message_detail_viewmodel.dart: -------------------------------------------------------------------------------- 1 | import 'dart:collection'; 2 | 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:mobx/mobx.dart'; 5 | import 'package:provider/provider.dart'; 6 | 7 | import '../../../../product/managers/user_manager.dart'; 8 | import '../../../../product/models/chat_model.dart'; 9 | import '../../../../product/models/message_model.dart'; 10 | import '../../../../product/models/user_model.dart'; 11 | 12 | part 'message_detail_viewmodel.g.dart'; 13 | 14 | class MessageDetailViewModel = _MessageDetailViewModelBase 15 | with _$MessageDetailViewModel; 16 | 17 | abstract class _MessageDetailViewModelBase with Store { 18 | var chatMessages = LinkedList(); 19 | 20 | @observable 21 | bool refresh = false; 22 | 23 | final textController = TextEditingController(); 24 | final scrollController = ScrollController(); 25 | 26 | BuildContext? context; 27 | late Chat chat; 28 | 29 | void onInit(Chat _chat) { 30 | chat = _chat; 31 | getMessages(); 32 | } 33 | 34 | void onDispose() { 35 | textController.dispose(); 36 | chatMessages.clear(); 37 | } 38 | 39 | @action 40 | void getMessages() { 41 | if (chat.messages == null) { 42 | return; 43 | } 44 | chatMessages.addAll(chat.messages!); 45 | } 46 | 47 | @action 48 | void sendMessage(String messageContent, User sender) { 49 | chatMessages.add(Message( 50 | sendTime: DateTime.now().toString(), 51 | messageContent: messageContent.trim(), 52 | senderId: sender.userId, 53 | )); 54 | 55 | refresh = !refresh; 56 | scrollController.animateTo( 57 | scrollController.position.maxScrollExtent, 58 | duration: const Duration(milliseconds: 500), 59 | curve: Curves.easeOut, 60 | ); 61 | } 62 | 63 | @action 64 | void receivedMessage(Message message) { 65 | chatMessages.add(message); 66 | refresh = !refresh; 67 | } 68 | 69 | @action 70 | void onSubmitMessage(String value) { 71 | if (value.trim().isNotEmpty) { 72 | sendMessage(value.trim(), currentUser); 73 | textController.clear(); 74 | refresh = !refresh; 75 | } 76 | } 77 | 78 | void clearSearchText() { 79 | textController.clear(); 80 | FocusManager.instance.primaryFocus?.unfocus(); 81 | } 82 | 83 | bool isVisibleAvatar(Message message) { 84 | if (message.next == null) { 85 | return true; 86 | } else if (message.senderId == message.next?.senderId) { 87 | return false; 88 | } 89 | return true; 90 | } 91 | 92 | User get targetUser { 93 | final currentUser = context?.read().currentUser; 94 | return chat.targetUser(currentUser)!; 95 | } 96 | 97 | User get currentUser { 98 | return context!.read().currentUser!; 99 | } 100 | 101 | User sender(String senderId) { 102 | return currentUser.userId == senderId ? currentUser : targetUser; 103 | } 104 | 105 | String get currentUserId { 106 | return context?.read().currentUser?.userId ?? ''; 107 | } 108 | 109 | void empty(bool refresh) { 110 | // empty. 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /message_app/lib/features/home/message_detail/viewmodel/message_detail_viewmodel.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'message_detail_viewmodel.dart'; 4 | 5 | // ************************************************************************** 6 | // StoreGenerator 7 | // ************************************************************************** 8 | 9 | // ignore_for_file: non_constant_identifier_names, unnecessary_brace_in_string_interps, unnecessary_lambdas, prefer_expression_function_bodies, lines_longer_than_80_chars, avoid_as, avoid_annotating_with_dynamic 10 | 11 | mixin _$MessageDetailViewModel on _MessageDetailViewModelBase, Store { 12 | final _$refreshAtom = Atom(name: '_MessageDetailViewModelBase.refresh'); 13 | 14 | @override 15 | bool get refresh { 16 | _$refreshAtom.reportRead(); 17 | return super.refresh; 18 | } 19 | 20 | @override 21 | set refresh(bool value) { 22 | _$refreshAtom.reportWrite(value, super.refresh, () { 23 | super.refresh = value; 24 | }); 25 | } 26 | 27 | final _$_MessageDetailViewModelBaseActionController = 28 | ActionController(name: '_MessageDetailViewModelBase'); 29 | 30 | @override 31 | void getMessages() { 32 | final _$actionInfo = _$_MessageDetailViewModelBaseActionController 33 | .startAction(name: '_MessageDetailViewModelBase.getMessages'); 34 | try { 35 | return super.getMessages(); 36 | } finally { 37 | _$_MessageDetailViewModelBaseActionController.endAction(_$actionInfo); 38 | } 39 | } 40 | 41 | @override 42 | void sendMessage(String messageContent, User sender) { 43 | final _$actionInfo = _$_MessageDetailViewModelBaseActionController 44 | .startAction(name: '_MessageDetailViewModelBase.sendMessage'); 45 | try { 46 | return super.sendMessage(messageContent, sender); 47 | } finally { 48 | _$_MessageDetailViewModelBaseActionController.endAction(_$actionInfo); 49 | } 50 | } 51 | 52 | @override 53 | void receivedMessage(Message message) { 54 | final _$actionInfo = _$_MessageDetailViewModelBaseActionController 55 | .startAction(name: '_MessageDetailViewModelBase.receivedMessage'); 56 | try { 57 | return super.receivedMessage(message); 58 | } finally { 59 | _$_MessageDetailViewModelBaseActionController.endAction(_$actionInfo); 60 | } 61 | } 62 | 63 | @override 64 | void onSubmitMessage(String value) { 65 | final _$actionInfo = _$_MessageDetailViewModelBaseActionController 66 | .startAction(name: '_MessageDetailViewModelBase.onSubmitMessage'); 67 | try { 68 | return super.onSubmitMessage(value); 69 | } finally { 70 | _$_MessageDetailViewModelBaseActionController.endAction(_$actionInfo); 71 | } 72 | } 73 | 74 | @override 75 | String toString() { 76 | return ''' 77 | refresh: ${refresh} 78 | '''; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /message_app/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:easy_localization/easy_localization.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:message_app/product/managers/user_manager.dart'; 4 | import 'package:provider/provider.dart'; 5 | 6 | import 'core/constants/app_constants.dart'; 7 | import 'core/init/lang/language_manager.dart'; 8 | import 'core/init/lang/locale_keys.g.dart'; 9 | import 'features/home/home_base_view.dart'; 10 | import 'product/managers/theme_manager.dart'; 11 | 12 | void main() async { 13 | WidgetsFlutterBinding.ensureInitialized(); 14 | await EasyLocalization.ensureInitialized(); 15 | 16 | runApp( 17 | MultiProvider( 18 | providers: [ 19 | ChangeNotifierProvider(create: (_) => ThemeManager()), 20 | Provider.value(value: UserManager()) 21 | ], 22 | child: EasyLocalization( 23 | supportedLocales: LanguageManager.instance.supportedLocales, 24 | path: AppConstants.LANG_ASSETS_PATH, 25 | child: MyApp(), 26 | ), 27 | ), 28 | ); 29 | } 30 | 31 | class MyApp extends StatelessWidget { 32 | @override 33 | Widget build(BuildContext context) { 34 | return MaterialApp( 35 | title: LocaleKeys.app_title, 36 | debugShowCheckedModeBanner: false, 37 | theme: context.watch().currentTheme, 38 | localizationsDelegates: context.localizationDelegates, 39 | supportedLocales: context.supportedLocales, 40 | locale: context.locale, 41 | home: HomeBaseView(), 42 | ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /message_app/lib/product/extensions/string_extensions.dart: -------------------------------------------------------------------------------- 1 | extension NetworkImageExtension on String? { 2 | String get orDefault { 3 | var url = this; 4 | return url ?? 'https://i.pravatar.cc/150?img=18'; 5 | } 6 | } 7 | 8 | extension HeroTagExtension on String? { 9 | String get avatarTag { 10 | var tag = this; 11 | return '${tag ?? ''}@avatar'; 12 | } 13 | } 14 | 15 | extension StringExtension on String? { 16 | String get orEmpty { 17 | var val = this; 18 | return val ?? ''; 19 | } 20 | } -------------------------------------------------------------------------------- /message_app/lib/product/managers/theme_manager.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | import '../../core/init/theme/light_theme.dart'; 4 | 5 | class ThemeManager extends ChangeNotifier { 6 | ThemeData _currentTheme = lightThemeData; 7 | 8 | ThemeData get currentTheme => _currentTheme; 9 | 10 | final _themeDataEnum = ThemeDataEnum.LIGHT; 11 | 12 | void changeTheme() { 13 | switch (_themeDataEnum) { 14 | case ThemeDataEnum.LIGHT: 15 | _currentTheme = lightThemeData; 16 | break; 17 | case ThemeDataEnum.DARK: 18 | _currentTheme = ThemeData.dark(); 19 | break; 20 | } 21 | notifyListeners(); 22 | } 23 | } 24 | 25 | enum ThemeDataEnum { LIGHT, DARK } -------------------------------------------------------------------------------- /message_app/lib/product/managers/user_manager.dart: -------------------------------------------------------------------------------- 1 | import '../models/fake_data.dart'; 2 | import '../models/user_model.dart'; 3 | 4 | class UserManager implements IUserManager { 5 | 6 | @override 7 | User? currentUser = users[0]; // SET FAKE DATA 8 | 9 | } 10 | abstract class IUserManager { 11 | User? currentUser; 12 | } -------------------------------------------------------------------------------- /message_app/lib/product/models/chat_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | import 'package:message_app/core/base/base_model.dart'; 3 | 4 | import 'message_model.dart'; 5 | import 'user_model.dart'; 6 | 7 | part 'chat_model.g.dart'; 8 | 9 | @JsonSerializable() 10 | class Chat extends BaseModel { 11 | String? chatId; 12 | List? messages; 13 | final User? user1; 14 | final User? user2; 15 | 16 | Chat.createWithId({required this.user1, required this.user2, this.messages}) { 17 | if (user1!.userId.hashCode < user2!.userId.hashCode) { 18 | chatId = user1!.userId! + user2!.userId!; 19 | } 20 | } 21 | 22 | Chat({this.chatId, this.user1, this.user2, this.messages}); 23 | 24 | factory Chat.fromJson(Map json) => _$ChatFromJson(json); 25 | 26 | @override 27 | Map toJson() => _$ChatToJson(this); 28 | 29 | User? targetUser(User? user) { 30 | if (user?.userId == user1?.userId) { 31 | return user2; 32 | } else { 33 | return user1; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /message_app/lib/product/models/chat_model.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'chat_model.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | Chat _$ChatFromJson(Map json) { 10 | return Chat( 11 | chatId: json['chatId'] as String?, 12 | user1: json['user1'] == null 13 | ? null 14 | : User.fromJson(json['user1'] as Map), 15 | user2: json['user2'] == null 16 | ? null 17 | : User.fromJson(json['user2'] as Map), 18 | messages: (json['messages'] as List?) 19 | ?.map((e) => Message.fromJson(e as Map)) 20 | .toList(), 21 | ); 22 | } 23 | 24 | Map _$ChatToJson(Chat instance) => { 25 | 'chatId': instance.chatId, 26 | 'messages': instance.messages, 27 | 'user1': instance.user1, 28 | 'user2': instance.user2, 29 | }; 30 | -------------------------------------------------------------------------------- /message_app/lib/product/models/message_model.dart: -------------------------------------------------------------------------------- 1 | import 'dart:collection'; 2 | 3 | import 'package:json_annotation/json_annotation.dart'; 4 | import 'package:message_app/core/base/base_model.dart'; 5 | 6 | part 'message_model.g.dart'; 7 | 8 | @JsonSerializable() 9 | class Message extends BaseModel with LinkedListEntry { 10 | int? messageId; 11 | String? messageContent; 12 | String? senderId; 13 | String? receiverId; 14 | String? sendTime; 15 | String? receiveTime; 16 | 17 | String get chatId { 18 | return (senderId.hashCode < receiverId.hashCode) 19 | ? '$senderId$receiverId' 20 | : '$receiverId$senderId'; 21 | } 22 | 23 | Message({ 24 | this.messageId, 25 | this.messageContent, 26 | this.senderId, 27 | this.receiverId, 28 | this.receiveTime, 29 | this.sendTime 30 | }); 31 | 32 | factory Message.fromJson(Map json) => _$MessageFromJson(json); 33 | 34 | @override 35 | Map toJson() => _$MessageToJson(this); 36 | } 37 | -------------------------------------------------------------------------------- /message_app/lib/product/models/message_model.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'message_model.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | Message _$MessageFromJson(Map json) { 10 | return Message( 11 | messageId: json['messageId'] as int?, 12 | messageContent: json['messageContent'] as String?, 13 | senderId: json['senderId'] as String?, 14 | receiverId: json['receiverId'] as String?, 15 | receiveTime: json['receiveTime'] as String?, 16 | sendTime: json['sendTime'] as String?, 17 | ); 18 | } 19 | 20 | Map _$MessageToJson(Message instance) => { 21 | 'messageId': instance.messageId, 22 | 'messageContent': instance.messageContent, 23 | 'senderId': instance.senderId, 24 | 'receiverId': instance.receiverId, 25 | 'sendTime': instance.sendTime, 26 | 'receiveTime': instance.receiveTime, 27 | }; 28 | -------------------------------------------------------------------------------- /message_app/lib/product/models/user_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:json_annotation/json_annotation.dart'; 2 | import 'package:message_app/core/base/base_model.dart'; 3 | 4 | part 'user_model.g.dart'; 5 | 6 | @JsonSerializable() 7 | class User extends BaseModel { 8 | String? userId; 9 | String? userName; 10 | String? userSurname; 11 | bool? isOnline; 12 | String? avatarUrl; 13 | 14 | User({ 15 | this.userId, 16 | this.userSurname, 17 | this.userName, 18 | this.isOnline, 19 | this.avatarUrl, 20 | }); 21 | 22 | factory User.fromJson(Map json) => _$UserFromJson(json); 23 | 24 | @override 25 | Map toJson() => _$UserToJson(this); 26 | } 27 | -------------------------------------------------------------------------------- /message_app/lib/product/models/user_model.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'user_model.dart'; 4 | 5 | // ************************************************************************** 6 | // JsonSerializableGenerator 7 | // ************************************************************************** 8 | 9 | User _$UserFromJson(Map json) { 10 | return User( 11 | userId: json['userId'] as String?, 12 | userSurname: json['userSurname'] as String?, 13 | userName: json['userName'] as String?, 14 | isOnline: json['isOnline'] as bool?, 15 | avatarUrl: json['avatarUrl'] as String?, 16 | ); 17 | } 18 | 19 | Map _$UserToJson(User instance) => { 20 | 'userId': instance.userId, 21 | 'userName': instance.userName, 22 | 'userSurname': instance.userSurname, 23 | 'isOnline': instance.isOnline, 24 | 'avatarUrl': instance.avatarUrl, 25 | }; 26 | -------------------------------------------------------------------------------- /message_app/lib/product/widgets/avatar.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:kartal/kartal.dart'; 3 | import '../extensions/string_extensions.dart'; 4 | import '../models/user_model.dart'; 5 | 6 | class Avatar extends StatelessWidget { 7 | final User? user; 8 | 9 | const Avatar({Key? key, required this.user}) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return Container( 14 | padding: EdgeInsets.all(2), 15 | decoration: BoxDecoration( 16 | color: context.appTheme.primaryColor, shape: BoxShape.circle), 17 | child: Container( 18 | padding: EdgeInsets.all(3), 19 | decoration: BoxDecoration( 20 | color: context.appTheme.backgroundColor, shape: BoxShape.circle), 21 | child: CircleAvatar( 22 | backgroundColor: context.appTheme.backgroundColor, 23 | backgroundImage: NetworkImage(user?.avatarUrl.orDefault ?? ''), 24 | ), 25 | ), 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /message_app/lib/product/widgets/chat_card_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:easy_localization/easy_localization.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:kartal/kartal.dart'; 4 | 5 | import '../../core/init/lang/locale_keys.g.dart'; 6 | import '../extensions/string_extensions.dart'; 7 | import '../models/chat_model.dart'; 8 | import '../models/user_model.dart'; 9 | import 'avatar.dart'; 10 | 11 | class ChatCardItem extends StatelessWidget { 12 | final User targetUser; 13 | final Chat chat; 14 | final VoidCallback? onTap; 15 | 16 | const ChatCardItem({ 17 | Key? key, 18 | required this.chat, 19 | required this.targetUser, 20 | this.onTap, 21 | }) : super(key: key); 22 | 23 | @override 24 | Widget build(BuildContext context) { 25 | return ListTile( 26 | shape: RoundedRectangleBorder(borderRadius: context.lowBorderRadius), 27 | onTap: onTap, 28 | contentPadding: EdgeInsets.zero, 29 | leading: Hero( 30 | tag: targetUser.userId.avatarTag, child: Avatar(user: targetUser)), 31 | title: 32 | Text(targetUser.userName.orEmpty, style: context.textTheme.headline6), 33 | subtitle: Text( 34 | chat.messages?.last.messageContent ?? '', 35 | overflow: TextOverflow.ellipsis, 36 | ), 37 | trailing: Column( 38 | mainAxisAlignment: MainAxisAlignment.spaceAround, 39 | crossAxisAlignment: CrossAxisAlignment.end, 40 | children: [ 41 | Expanded(child: _buildTimeAgo(context)), 42 | Expanded(child: _buildUnReadMessagesNum(context)) 43 | ], 44 | ), 45 | ); 46 | } 47 | 48 | Widget _buildTimeAgo(BuildContext context) { 49 | final diff = DateTime.now() 50 | .difference(DateTime.parse(chat.messages?.last.sendTime ?? '')); 51 | var diffText = ''; 52 | if (diff.inDays > 0) { 53 | diffText = '${diff.inDays} ${LocaleKeys.day.tr()}'; 54 | } else if (diff.inHours > 0) { 55 | diffText = '${diff.inHours} ${LocaleKeys.hour.tr()}'; 56 | } else if (diff.inMinutes > 0) { 57 | diffText = '${diff.inMinutes} ${LocaleKeys.min.tr()}'; 58 | } else { 59 | diffText = LocaleKeys.now.tr(); 60 | } 61 | return Text( 62 | diffText, 63 | style: context.textTheme.bodyText1! 64 | .copyWith(color: context.appTheme.primaryColor), 65 | ); 66 | } 67 | 68 | Widget _buildUnReadMessagesNum(BuildContext context) { 69 | return CircleAvatar( 70 | backgroundColor: context.appTheme.primaryColor, 71 | child: Text( 72 | '${(chat.messages ?? []).length}', 73 | style: context.textTheme.bodyText1! 74 | .copyWith(color: context.colorScheme.onPrimary), 75 | ), 76 | ); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /message_app/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: message_app 2 | description: A new Flutter project. 3 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 4 | version: 1.0.0+1 5 | 6 | environment: 7 | sdk: '>=2.12.0 <3.0.0' 8 | 9 | dependencies: 10 | flutter: 11 | sdk: flutter 12 | provider: ^5.0.0 13 | flutter_mobx: ^2.0.0 14 | intl: ^0.17.0 15 | mobx: ^2.0.1 16 | kartal: ^2.0.0 17 | json_serializable: ^4.1.1 18 | json_annotation: ^4.0.1 19 | easy_localization: ^3.0.0 20 | shimmer: ^2.0.0 21 | cached_network_image: ^3.0.0 22 | page_transition: ^2.0.1-nullsafety.0 23 | google_fonts: ^2.0.0 24 | cupertino_icons: ^1.0.2 25 | 26 | dev_dependencies: 27 | flutter_test: 28 | sdk: flutter 29 | build_runner: ^2.0.0 30 | mobx_codegen: ^2.0.1+3 31 | pedantic: ^1.11.0 32 | 33 | 34 | flutter: 35 | uses-material-design: true 36 | 37 | assets: 38 | - assets/lang/ -------------------------------------------------------------------------------- /message_app/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 that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:message_app/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /message_app/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/message_app/web/favicon.png -------------------------------------------------------------------------------- /message_app/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/message_app/web/icons/Icon-192.png -------------------------------------------------------------------------------- /message_app/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/message_app/web/icons/Icon-512.png -------------------------------------------------------------------------------- /message_app/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | message_app 30 | 31 | 32 | 33 | 36 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /message_app/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "message_app", 3 | "short_name": "message_app", 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 | } 24 | -------------------------------------------------------------------------------- /message_app/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 | -------------------------------------------------------------------------------- /message_app/windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | project(message_app LANGUAGES CXX) 3 | 4 | set(BINARY_NAME "message_app") 5 | 6 | cmake_policy(SET CMP0063 NEW) 7 | 8 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 9 | 10 | # Configure build options. 11 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 12 | if(IS_MULTICONFIG) 13 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 14 | CACHE STRING "" FORCE) 15 | else() 16 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 17 | set(CMAKE_BUILD_TYPE "Debug" CACHE 18 | STRING "Flutter build mode" FORCE) 19 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 20 | "Debug" "Profile" "Release") 21 | endif() 22 | endif() 23 | 24 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 25 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 26 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 27 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 28 | 29 | # Use Unicode for all projects. 30 | add_definitions(-DUNICODE -D_UNICODE) 31 | 32 | # Compilation settings that should be applied to most targets. 33 | function(APPLY_STANDARD_SETTINGS TARGET) 34 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 35 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 36 | target_compile_options(${TARGET} PRIVATE /EHsc) 37 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 38 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 39 | endfunction() 40 | 41 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 42 | 43 | # Flutter library and tool build rules. 44 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 45 | 46 | # Application build 47 | add_subdirectory("runner") 48 | 49 | # Generated plugin build rules, which manage building the plugins and adding 50 | # them to the application. 51 | include(flutter/generated_plugins.cmake) 52 | 53 | 54 | # === Installation === 55 | # Support files are copied into place next to the executable, so that it can 56 | # run in place. This is done instead of making a separate bundle (as on Linux) 57 | # so that building and running from within Visual Studio will work. 58 | set(BUILD_BUNDLE_DIR "$") 59 | # Make the "install" step default, as it's required to run. 60 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 61 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 62 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 63 | endif() 64 | 65 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 66 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 67 | 68 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 69 | COMPONENT Runtime) 70 | 71 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 72 | COMPONENT Runtime) 73 | 74 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 75 | COMPONENT Runtime) 76 | 77 | if(PLUGIN_BUNDLED_LIBRARIES) 78 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 79 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 80 | COMPONENT Runtime) 81 | endif() 82 | 83 | # Fully re-copy the assets directory on each build to avoid having stale files 84 | # from a previous install. 85 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 86 | install(CODE " 87 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 88 | " COMPONENT Runtime) 89 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 90 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 91 | 92 | # Install the AOT library on non-Debug builds only. 93 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 94 | CONFIGURATIONS Profile;Release 95 | COMPONENT Runtime) 96 | -------------------------------------------------------------------------------- /message_app/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | #include "generated_plugin_registrant.h" 6 | 7 | #include 8 | 9 | void RegisterPlugins(flutter::PluginRegistry* registry) { 10 | UrlLauncherPluginRegisterWithRegistrar( 11 | registry->GetRegistrarForPlugin("UrlLauncherPlugin")); 12 | } 13 | -------------------------------------------------------------------------------- /message_app/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 6 | #define GENERATED_PLUGIN_REGISTRANT_ 7 | 8 | #include 9 | 10 | // Registers Flutter plugins. 11 | void RegisterPlugins(flutter::PluginRegistry* registry); 12 | 13 | #endif // GENERATED_PLUGIN_REGISTRANT_ 14 | -------------------------------------------------------------------------------- /message_app/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | url_launcher_windows 7 | ) 8 | 9 | set(PLUGIN_BUNDLED_LIBRARIES) 10 | 11 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 12 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 13 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 14 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 15 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 16 | endforeach(plugin) 17 | -------------------------------------------------------------------------------- /message_app/windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | project(runner LANGUAGES CXX) 3 | 4 | add_executable(${BINARY_NAME} WIN32 5 | "flutter_window.cpp" 6 | "main.cpp" 7 | "run_loop.cpp" 8 | "utils.cpp" 9 | "win32_window.cpp" 10 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 11 | "Runner.rc" 12 | "runner.exe.manifest" 13 | ) 14 | apply_standard_settings(${BINARY_NAME}) 15 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 16 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 17 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 18 | add_dependencies(${BINARY_NAME} flutter_assemble) 19 | -------------------------------------------------------------------------------- /message_app/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 | #ifdef FLUTTER_BUILD_NUMBER 64 | #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0 67 | #endif 68 | 69 | #ifdef FLUTTER_BUILD_NAME 70 | #define VERSION_AS_STRING #FLUTTER_BUILD_NAME 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", "A new Flutter project." "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "message_app" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2021 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "message_app.exe" "\0" 98 | VALUE "ProductName", "message_app" "\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 | -------------------------------------------------------------------------------- /message_app/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(RunLoop* run_loop, 8 | const flutter::DartProject& project) 9 | : run_loop_(run_loop), project_(project) {} 10 | 11 | FlutterWindow::~FlutterWindow() {} 12 | 13 | bool FlutterWindow::OnCreate() { 14 | if (!Win32Window::OnCreate()) { 15 | return false; 16 | } 17 | 18 | RECT frame = GetClientArea(); 19 | 20 | // The size here must match the window dimensions to avoid unnecessary surface 21 | // creation / destruction in the startup path. 22 | flutter_controller_ = std::make_unique( 23 | frame.right - frame.left, frame.bottom - frame.top, project_); 24 | // Ensure that basic setup of the controller was successful. 25 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 26 | return false; 27 | } 28 | RegisterPlugins(flutter_controller_->engine()); 29 | run_loop_->RegisterFlutterInstance(flutter_controller_->engine()); 30 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 31 | return true; 32 | } 33 | 34 | void FlutterWindow::OnDestroy() { 35 | if (flutter_controller_) { 36 | run_loop_->UnregisterFlutterInstance(flutter_controller_->engine()); 37 | flutter_controller_ = nullptr; 38 | } 39 | 40 | Win32Window::OnDestroy(); 41 | } 42 | 43 | LRESULT 44 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 45 | WPARAM const wparam, 46 | LPARAM const lparam) noexcept { 47 | // Give Flutter, including plugins, an opporutunity to handle window messages. 48 | if (flutter_controller_) { 49 | std::optional result = 50 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 51 | lparam); 52 | if (result) { 53 | return *result; 54 | } 55 | } 56 | 57 | switch (message) { 58 | case WM_FONTCHANGE: 59 | flutter_controller_->engine()->ReloadSystemFonts(); 60 | break; 61 | } 62 | 63 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 64 | } 65 | -------------------------------------------------------------------------------- /message_app/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 "run_loop.h" 10 | #include "win32_window.h" 11 | 12 | // A window that does nothing but host a Flutter view. 13 | class FlutterWindow : public Win32Window { 14 | public: 15 | // Creates a new FlutterWindow driven by the |run_loop|, hosting a 16 | // Flutter view running |project|. 17 | explicit FlutterWindow(RunLoop* run_loop, 18 | const flutter::DartProject& project); 19 | virtual ~FlutterWindow(); 20 | 21 | protected: 22 | // Win32Window: 23 | bool OnCreate() override; 24 | void OnDestroy() override; 25 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 26 | LPARAM const lparam) noexcept override; 27 | 28 | private: 29 | // The run loop driving events for this window. 30 | RunLoop* run_loop_; 31 | 32 | // The project to run. 33 | flutter::DartProject project_; 34 | 35 | // The Flutter instance hosted by this window. 36 | std::unique_ptr flutter_controller_; 37 | }; 38 | 39 | #endif // RUNNER_FLUTTER_WINDOW_H_ 40 | -------------------------------------------------------------------------------- /message_app/windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "run_loop.h" 7 | #include "utils.h" 8 | 9 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 10 | _In_ wchar_t *command_line, _In_ int show_command) { 11 | // Attach to console when present (e.g., 'flutter run') or create a 12 | // new console when running with a debugger. 13 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 14 | CreateAndAttachConsole(); 15 | } 16 | 17 | // Initialize COM, so that it is available for use in the library and/or 18 | // plugins. 19 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 20 | 21 | RunLoop run_loop; 22 | 23 | flutter::DartProject project(L"data"); 24 | 25 | std::vector command_line_arguments = 26 | GetCommandLineArguments(); 27 | 28 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 29 | 30 | FlutterWindow window(&run_loop, project); 31 | Win32Window::Point origin(10, 10); 32 | Win32Window::Size size(1280, 720); 33 | if (!window.CreateAndShow(L"message_app", origin, size)) { 34 | return EXIT_FAILURE; 35 | } 36 | window.SetQuitOnClose(true); 37 | 38 | run_loop.Run(); 39 | 40 | ::CoUninitialize(); 41 | return EXIT_SUCCESS; 42 | } 43 | -------------------------------------------------------------------------------- /message_app/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 | -------------------------------------------------------------------------------- /message_app/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/message_app/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /message_app/windows/runner/run_loop.cpp: -------------------------------------------------------------------------------- 1 | #include "run_loop.h" 2 | 3 | #include 4 | 5 | #include 6 | 7 | RunLoop::RunLoop() {} 8 | 9 | RunLoop::~RunLoop() {} 10 | 11 | void RunLoop::Run() { 12 | bool keep_running = true; 13 | TimePoint next_flutter_event_time = TimePoint::clock::now(); 14 | while (keep_running) { 15 | std::chrono::nanoseconds wait_duration = 16 | std::max(std::chrono::nanoseconds(0), 17 | next_flutter_event_time - TimePoint::clock::now()); 18 | ::MsgWaitForMultipleObjects( 19 | 0, nullptr, FALSE, static_cast(wait_duration.count() / 1000), 20 | QS_ALLINPUT); 21 | bool processed_events = false; 22 | MSG message; 23 | // All pending Windows messages must be processed; MsgWaitForMultipleObjects 24 | // won't return again for items left in the queue after PeekMessage. 25 | while (::PeekMessage(&message, nullptr, 0, 0, PM_REMOVE)) { 26 | processed_events = true; 27 | if (message.message == WM_QUIT) { 28 | keep_running = false; 29 | break; 30 | } 31 | ::TranslateMessage(&message); 32 | ::DispatchMessage(&message); 33 | // Allow Flutter to process messages each time a Windows message is 34 | // processed, to prevent starvation. 35 | next_flutter_event_time = 36 | std::min(next_flutter_event_time, ProcessFlutterMessages()); 37 | } 38 | // If the PeekMessage loop didn't run, process Flutter messages. 39 | if (!processed_events) { 40 | next_flutter_event_time = 41 | std::min(next_flutter_event_time, ProcessFlutterMessages()); 42 | } 43 | } 44 | } 45 | 46 | void RunLoop::RegisterFlutterInstance( 47 | flutter::FlutterEngine* flutter_instance) { 48 | flutter_instances_.insert(flutter_instance); 49 | } 50 | 51 | void RunLoop::UnregisterFlutterInstance( 52 | flutter::FlutterEngine* flutter_instance) { 53 | flutter_instances_.erase(flutter_instance); 54 | } 55 | 56 | RunLoop::TimePoint RunLoop::ProcessFlutterMessages() { 57 | TimePoint next_event_time = TimePoint::max(); 58 | for (auto instance : flutter_instances_) { 59 | std::chrono::nanoseconds wait_duration = instance->ProcessMessages(); 60 | if (wait_duration != std::chrono::nanoseconds::max()) { 61 | next_event_time = 62 | std::min(next_event_time, TimePoint::clock::now() + wait_duration); 63 | } 64 | } 65 | return next_event_time; 66 | } 67 | -------------------------------------------------------------------------------- /message_app/windows/runner/run_loop.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_RUN_LOOP_H_ 2 | #define RUNNER_RUN_LOOP_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | // A runloop that will service events for Flutter instances as well 10 | // as native messages. 11 | class RunLoop { 12 | public: 13 | RunLoop(); 14 | ~RunLoop(); 15 | 16 | // Prevent copying 17 | RunLoop(RunLoop const&) = delete; 18 | RunLoop& operator=(RunLoop const&) = delete; 19 | 20 | // Runs the run loop until the application quits. 21 | void Run(); 22 | 23 | // Registers the given Flutter instance for event servicing. 24 | void RegisterFlutterInstance( 25 | flutter::FlutterEngine* flutter_instance); 26 | 27 | // Unregisters the given Flutter instance from event servicing. 28 | void UnregisterFlutterInstance( 29 | flutter::FlutterEngine* flutter_instance); 30 | 31 | private: 32 | using TimePoint = std::chrono::steady_clock::time_point; 33 | 34 | // Processes all currently pending messages for registered Flutter instances. 35 | TimePoint ProcessFlutterMessages(); 36 | 37 | std::set flutter_instances_; 38 | }; 39 | 40 | #endif // RUNNER_RUN_LOOP_H_ 41 | -------------------------------------------------------------------------------- /message_app/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 | -------------------------------------------------------------------------------- /message_app/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 | if (target_length == 0) { 52 | return std::string(); 53 | } 54 | std::string utf8_string; 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /message_app/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 | -------------------------------------------------------------------------------- /message_app/windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates and shows a win32 window with |title| and position and size using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size to will treat the width height passed in to this function 35 | // as logical pixels and scale to appropriate for the default monitor. Returns 36 | // true if the window was created successfully. 37 | bool CreateAndShow(const std::wstring& title, 38 | const Point& origin, 39 | const Size& size); 40 | 41 | // Release OS resources associated with window. 42 | void Destroy(); 43 | 44 | // Inserts |content| into the window tree. 45 | void SetChildContent(HWND content); 46 | 47 | // Returns the backing Window handle to enable clients to set icon and other 48 | // window properties. Returns nullptr if the window has been destroyed. 49 | HWND GetHandle(); 50 | 51 | // If true, closing this window will quit the application. 52 | void SetQuitOnClose(bool quit_on_close); 53 | 54 | // Return a RECT representing the bounds of the current client area. 55 | RECT GetClientArea(); 56 | 57 | protected: 58 | // Processes and route salient window messages for mouse handling, 59 | // size change and DPI. Delegates handling of these to member overloads that 60 | // inheriting classes can handle. 61 | virtual LRESULT MessageHandler(HWND window, 62 | UINT const message, 63 | WPARAM const wparam, 64 | LPARAM const lparam) noexcept; 65 | 66 | // Called when CreateAndShow is called, allowing subclass window-related 67 | // setup. Subclasses should return false if setup fails. 68 | virtual bool OnCreate(); 69 | 70 | // Called when Destroy is called. 71 | virtual void OnDestroy(); 72 | 73 | private: 74 | friend class WindowClassRegistrar; 75 | 76 | // OS callback called by message pump. Handles the WM_NCCREATE message which 77 | // is passed when the non-client area is being created and enables automatic 78 | // non-client DPI scaling so that the non-client area automatically 79 | // responsponds to changes in DPI. All other messages are handled by 80 | // MessageHandler. 81 | static LRESULT CALLBACK WndProc(HWND const window, 82 | UINT const message, 83 | WPARAM const wparam, 84 | LPARAM const lparam) noexcept; 85 | 86 | // Retrieves a class instance pointer for |window| 87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 88 | 89 | bool quit_on_close_ = false; 90 | 91 | // window handle for top level window. 92 | HWND window_handle_ = nullptr; 93 | 94 | // window handle for hosted content. 95 | HWND child_content_ = nullptr; 96 | }; 97 | 98 | #endif // RUNNER_WIN32_WINDOW_H_ 99 | -------------------------------------------------------------------------------- /showcase/furniture_app.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/showcase/furniture_app.gif -------------------------------------------------------------------------------- /showcase/message_app.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ahm3tcelik/acm_hacettepe_coding_challange/ae95042b9a1b5f87df92a4931b839a17f875c77c/showcase/message_app.gif --------------------------------------------------------------------------------