├── .gitignore ├── .metadata ├── README.md ├── analysis_options.yaml ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── todo │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-v21 │ │ │ └── launch_background.xml │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── launcher_icon.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── launcher_icon.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── launcher_icon.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── launcher_icon.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── launcher_icon.png │ │ │ ├── values-night │ │ │ └── styles.xml │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── assets ├── Screenshot 2024-05-01 195214.png ├── ZJCAbhVLNmkrXFf5RhUllXdyqOmKrox8.pdf ├── fonts │ ├── Baloo-Regular.ttf │ ├── Lato-Black.ttf │ ├── Lato-Bold.ttf │ └── Lato-Regular.ttf ├── images │ ├── app_bar_icon.png │ ├── bg_.png │ ├── bg_drawar.png │ ├── c.png │ ├── health.png │ ├── location.png │ ├── logo.png │ ├── other.png │ ├── shop.png │ └── sport.png └── todo.mp4 ├── design └── TODO_App.xd ├── devtools_options.yaml ├── 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-50x50@1x.png │ │ │ ├── Icon-App-50x50@2x.png │ │ │ ├── Icon-App-57x57@1x.png │ │ │ ├── Icon-App-57x57@2x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-72x72@1x.png │ │ │ ├── Icon-App-72x72@2x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ └── Runner-Bridging-Header.h └── RunnerTests │ └── RunnerTests.swift ├── lib ├── core │ ├── class │ │ └── drawer_date_time_piker.dart │ ├── constant │ │ ├── app_colors.dart │ │ ├── app_image.dart │ │ ├── app_route.dart │ │ └── app_strings.dart │ ├── database │ │ └── todo_data_base.dart │ ├── error │ │ ├── expetion.dart │ │ └── failur.dart │ ├── functions │ │ └── show_time_data_piker.dart │ ├── my_bloc_observer.dart │ └── services │ │ └── my_services.dart ├── features │ └── todo │ │ ├── data │ │ ├── datasources │ │ │ ├── .gitkeep │ │ │ ├── local_data_source.dart │ │ │ └── static │ │ │ │ └── colors_status_image.dart │ │ ├── models │ │ │ ├── color_status_image.dart │ │ │ └── todo_model.dart │ │ └── repositories │ │ │ └── todo_repo_imp.dart │ │ ├── domain │ │ ├── entities │ │ │ └── todo_enti.dart │ │ ├── repositories │ │ │ └── todo_repo.dart │ │ └── usecases │ │ │ ├── get_done_todo.dart │ │ │ ├── get_not_done_todo.dart │ │ │ ├── insert_todo_usecase.dart │ │ │ └── update_todo_usecase.dart │ │ └── presentation │ │ ├── bloc │ │ └── bloc │ │ │ ├── todo_bloc.dart │ │ │ ├── todo_event.dart │ │ │ └── todo_state.dart │ │ ├── pages │ │ ├── done_todo_page.dart │ │ ├── splash_screen.dart │ │ └── todo_page.dart │ │ └── widgets │ │ ├── done_todo_page │ │ ├── app_bar_done_todo.dart │ │ └── done_todo_posts_widget.dart │ │ ├── public │ │ └── dialog_widget.dart │ │ └── todo_page │ │ ├── app_bar_widget.dart │ │ ├── bg_bottom_bar.dart │ │ ├── bg_drawer.dart │ │ ├── bg_widget.dart │ │ ├── button_add_and_done.dart │ │ ├── drawer_widget.dart │ │ ├── drawer_widgets │ │ ├── description_form_field.dart │ │ ├── drawer_time_and_data.dart │ │ ├── icon_widget.dart │ │ ├── name_form_filed.dart │ │ └── title_drawer_widget.dart │ │ ├── icon_bottom_gradent.dart │ │ ├── main_bottom_bar.dart │ │ ├── second_bottom_bar.dart │ │ ├── todo_post_widget.dart │ │ └── todo_posts_checkout.dart ├── main.dart └── theme │ └── my_theme.dart ├── linux ├── .gitignore ├── CMakeLists.txt ├── flutter │ ├── CMakeLists.txt │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ └── generated_plugins.cmake ├── main.cc ├── my_application.cc └── my_application.h ├── macos ├── .gitignore ├── Flutter │ ├── Flutter-Debug.xcconfig │ ├── Flutter-Release.xcconfig │ └── GeneratedPluginRegistrant.swift ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── app_icon_1024.png │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_512.png │ │ │ └── app_icon_64.png │ ├── Base.lproj │ │ └── MainMenu.xib │ ├── Configs │ │ ├── AppInfo.xcconfig │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── Warnings.xcconfig │ ├── DebugProfile.entitlements │ ├── Info.plist │ ├── MainFlutterWindow.swift │ └── Release.entitlements └── RunnerTests │ └── RunnerTests.swift ├── new.xml ├── pubspec.lock ├── pubspec.yaml ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── index.html └── manifest.json └── windows ├── .gitignore ├── CMakeLists.txt ├── flutter ├── CMakeLists.txt ├── generated_plugin_registrant.cc ├── generated_plugin_registrant.h └── generated_plugins.cmake └── runner ├── CMakeLists.txt ├── Runner.rc ├── flutter_window.cpp ├── flutter_window.h ├── main.cpp ├── resource.h ├── resources └── app_icon.ico ├── runner.exe.manifest ├── utils.cpp ├── utils.h ├── win32_window.cpp └── win32_window.h /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Symbolication related 35 | app.*.symbols 36 | 37 | # Obfuscation related 38 | app.*.map.json 39 | 40 | # Android Studio will place build artifacts here 41 | /android/app/debug 42 | /android/app/profile 43 | /android/app/release 44 | -------------------------------------------------------------------------------- /.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: "78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9" 8 | channel: "stable" 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9 17 | base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9 18 | - platform: android 19 | create_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9 20 | base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9 21 | - platform: ios 22 | create_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9 23 | base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9 24 | - platform: linux 25 | create_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9 26 | base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9 27 | - platform: macos 28 | create_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9 29 | base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9 30 | - platform: web 31 | create_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9 32 | base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9 33 | - platform: windows 34 | create_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9 35 | base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9 36 | 37 | # User provided section 38 | 39 | # List of Local paths (relative to this file) that should be 40 | # ignored by the migrate tool. 41 | # 42 | # Files that are not part of the templates will be ignored by default. 43 | unmanaged_files: 44 | - 'lib/main.dart' 45 | - 'ios/Runner.xcodeproj/project.pbxproj' 46 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ![Logo](https://live.staticflickr.com/2890/11026225464_721d2d4d69_b.jpg) 4 | 5 | ## 🚀 What Is TODO 6 | TODO App is a task management application with a modern and unique design. It is easy to use and was built using FLUTTER. It is based on a local SQFlite database. 7 | 8 | ![Logo](https://github.com/najm-flutter/Todo-flutter/blob/main/assets/Screenshot%202024-05-01%20195214.png?raw=true) 9 | 10 | 11 | 12 | 13 | ## dependencies 14 | ``` 15 | flutter_bloc: ^8.1.5 16 | equatable: ^2.0.5 17 | dartz: ^0.10.1 18 | sqflite: ^2.3.2 19 | path: ^1.8.3 20 | bloc: ^8.1.4 21 | page_transition: ^2.1.0 22 | get_it: ^7.6.7 23 | jiffy: ^6.3.0 24 | gradient_icon: ^2.0.9 25 | uicons: ^1.0.1 26 | flutter_launcher_icons: ^0.13.1 27 | ``` 28 | 29 | 30 | ## Technologies Used 31 | 32 | - Clean Architecture 33 | - Bloc 34 | - SQFlite (Local DB) 35 | 36 | 37 | 38 | ## More Info 39 | The application is currently being tested on Android. 40 | 41 | 42 | ``` 43 | Flutter SDK 44 | sdk: '>=3.2.3 <4.0.0' 45 | 46 | kotlin version = 1.9.0 47 | 48 | gradle = 8.3.0 49 | ``` 50 | 51 | 52 | ## Build By 53 | 54 | [Najm Al-Den](https://github.com/najm-flutter) 55 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at https://dart.dev/lints. 17 | # 18 | # Instead of disabling a lint rule for the entire project in the 19 | # section below, it can also be suppressed for a single line of code 20 | # or a specific dart file by using the `// ignore: name_of_lint` and 21 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 22 | # producing the lint. 23 | rules: 24 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 25 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 26 | 27 | # Additional information about this file can be found at 28 | # https://dart.dev/guides/language/analysis-options 29 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "com.android.application" 3 | id "kotlin-android" 4 | id "dev.flutter.flutter-gradle-plugin" 5 | } 6 | 7 | def localProperties = new Properties() 8 | def localPropertiesFile = rootProject.file('local.properties') 9 | if (localPropertiesFile.exists()) { 10 | localPropertiesFile.withReader('UTF-8') { reader -> 11 | localProperties.load(reader) 12 | } 13 | } 14 | 15 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 16 | if (flutterVersionCode == null) { 17 | flutterVersionCode = '1' 18 | } 19 | 20 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 21 | if (flutterVersionName == null) { 22 | flutterVersionName = '1.0' 23 | } 24 | 25 | android { 26 | namespace "com.example.todo" 27 | compileSdkVersion 34 28 | ndkVersion flutter.ndkVersion 29 | 30 | compileOptions { 31 | sourceCompatibility JavaVersion.VERSION_1_8 32 | targetCompatibility JavaVersion.VERSION_1_8 33 | } 34 | 35 | kotlinOptions { 36 | jvmTarget = '1.8' 37 | } 38 | 39 | sourceSets { 40 | main.java.srcDirs += 'src/main/kotlin' 41 | } 42 | 43 | defaultConfig { 44 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 45 | applicationId "com.example.todo" 46 | // You can update the following values to match your application needs. 47 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. 48 | minSdkVersion flutter.minSdkVersion 49 | targetSdkVersion flutter.targetSdkVersion 50 | versionCode flutterVersionCode.toInteger() 51 | versionName flutterVersionName 52 | } 53 | 54 | buildTypes { 55 | release { 56 | // TODO: Add your own signing config for the release build. 57 | // Signing with the debug keys for now, so `flutter run --release` works. 58 | signingConfig signingConfigs.debug 59 | } 60 | } 61 | } 62 | 63 | flutter { 64 | source '../..' 65 | } 66 | 67 | dependencies {} 68 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 14 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | 29 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/todo/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.todo 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/android/app/src/main/res/mipmap-hdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/android/app/src/main/res/mipmap-mdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.9.0' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath "com.android.tools.build:gradle:8.3.0" 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | tasks.register("clean", Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx4G 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip 6 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | def flutterSdkPath = { 3 | def properties = new Properties() 4 | file("local.properties").withInputStream { properties.load(it) } 5 | def flutterSdkPath = properties.getProperty("flutter.sdk") 6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 7 | return flutterSdkPath 8 | } 9 | settings.ext.flutterSdkPath = flutterSdkPath() 10 | 11 | includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle") 12 | 13 | repositories { 14 | google() 15 | mavenCentral() 16 | gradlePluginPortal() 17 | } 18 | 19 | plugins { 20 | id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false 21 | } 22 | } 23 | 24 | plugins { 25 | id "dev.flutter.flutter-plugin-loader" version "1.0.0" 26 | id "com.android.application" version "7.3.0" apply false 27 | } 28 | 29 | include ":app" 30 | -------------------------------------------------------------------------------- /assets/Screenshot 2024-05-01 195214.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/assets/Screenshot 2024-05-01 195214.png -------------------------------------------------------------------------------- /assets/ZJCAbhVLNmkrXFf5RhUllXdyqOmKrox8.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/assets/ZJCAbhVLNmkrXFf5RhUllXdyqOmKrox8.pdf -------------------------------------------------------------------------------- /assets/fonts/Baloo-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/assets/fonts/Baloo-Regular.ttf -------------------------------------------------------------------------------- /assets/fonts/Lato-Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/assets/fonts/Lato-Black.ttf -------------------------------------------------------------------------------- /assets/fonts/Lato-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/assets/fonts/Lato-Bold.ttf -------------------------------------------------------------------------------- /assets/fonts/Lato-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/assets/fonts/Lato-Regular.ttf -------------------------------------------------------------------------------- /assets/images/app_bar_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/assets/images/app_bar_icon.png -------------------------------------------------------------------------------- /assets/images/bg_.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/assets/images/bg_.png -------------------------------------------------------------------------------- /assets/images/bg_drawar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/assets/images/bg_drawar.png -------------------------------------------------------------------------------- /assets/images/c.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/assets/images/c.png -------------------------------------------------------------------------------- /assets/images/health.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/assets/images/health.png -------------------------------------------------------------------------------- /assets/images/location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/assets/images/location.png -------------------------------------------------------------------------------- /assets/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/assets/images/logo.png -------------------------------------------------------------------------------- /assets/images/other.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/assets/images/other.png -------------------------------------------------------------------------------- /assets/images/shop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/assets/images/shop.png -------------------------------------------------------------------------------- /assets/images/sport.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/assets/images/sport.png -------------------------------------------------------------------------------- /assets/todo.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/assets/todo.mp4 -------------------------------------------------------------------------------- /design/TODO_App.xd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/design/TODO_App.xd -------------------------------------------------------------------------------- /devtools_options.yaml: -------------------------------------------------------------------------------- 1 | extensions: 2 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 11.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 43 | 49 | 50 | 51 | 52 | 53 | 63 | 65 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Todo 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | todo 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | CADisableMinimumFrameDurationOnPhone 45 | 46 | UIApplicationSupportsIndirectInputEvents 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /ios/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /lib/core/class/drawer_date_time_piker.dart: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/lib/core/class/drawer_date_time_piker.dart -------------------------------------------------------------------------------- /lib/core/constant/app_colors.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class AppColors { 4 | static Color bgGrandentTop = const Color(0xFF181743) ; 5 | static Color bgGrandentDown = const Color(0xff030091) ; 6 | static Color iconAddBgGrandentTop = const Color(0xff00FFFF); 7 | static Color iconAddBgGrandentDown = const Color(0xff254DDE); 8 | static Color iconDoneBgGrandentTop = const Color(0xffFE1E9A); 9 | static Color iconDoneBgGrandentDown = const Color(0xff254DDE); 10 | static Color iconCancelBgGrandentDown = const Color(0xff88889F); 11 | static Color gray = const Color(0xffDFDFDF); 12 | static Color filterColor = const Color(0xffCAEBFE) ; 13 | static Color orange = const Color(0xffFEA64C) ; 14 | static Color white = const Color(0xFFFFFFFF) ; 15 | static Color black = const Color(0xFF000000) ; 16 | static Color shop = const Color(0xFFFEA64C).withOpacity(0.3) ; 17 | static Color sport = const Color(0xFFFE1E9A).withOpacity(0.3) ; 18 | static Color location = const Color(0xFF254DDE).withOpacity(0.3) ; 19 | static Color health= const Color(0xFFFE1E9A).withOpacity(0.3) ; 20 | static Color other = const Color(0xFF181743).withOpacity(0.3) ; 21 | } -------------------------------------------------------------------------------- /lib/core/constant/app_image.dart: -------------------------------------------------------------------------------- 1 | class AppImages { 2 | static String imageRoute = 'assets/images' ; 3 | static String bgImage = '$imageRoute/bg_.png' ; 4 | static String bgDrawer = '$imageRoute/bg_drawar.png' ; 5 | static String appBarIcon = '$imageRoute/app_bar_icon.png' ; 6 | static String shop = '$imageRoute/shop.png' ; 7 | static String health = '$imageRoute/health.png' ; 8 | static String location = '$imageRoute/location.png' ; 9 | static String other = '$imageRoute/other.png' ; 10 | static String sport = '$imageRoute/sport.png' ; 11 | static String main = '$imageRoute/c.png' ; 12 | static String logo = '$imageRoute/logo.png' ; 13 | } -------------------------------------------------------------------------------- /lib/core/constant/app_route.dart: -------------------------------------------------------------------------------- 1 | class AppRoute { 2 | static String done = '/done' ; 3 | static String todo = '/todo' ; 4 | 5 | } -------------------------------------------------------------------------------- /lib/core/constant/app_strings.dart: -------------------------------------------------------------------------------- 1 | class AppStrings { 2 | static String newTask = "NEW TASK" ; 3 | static String icon = "Icon" ; 4 | static String name = "Name" ; 5 | static String description = "Description" ; 6 | static String data = "Data" ; 7 | static String time = "Time" ; 8 | static String add = "Add" ; 9 | static String done = "Done" ; 10 | static String dONETASKS = "DONE TASKS" ; 11 | } -------------------------------------------------------------------------------- /lib/core/database/todo_data_base.dart: -------------------------------------------------------------------------------- 1 | import 'package:sqflite/sqflite.dart'; 2 | import 'package:path/path.dart'; 3 | import 'package:todo/features/todo/data/models/todo_model.dart'; 4 | 5 | const String todo = "todo"; 6 | const String id = "id"; 7 | const String iconId = "iconId"; 8 | const String isDone = "isDone"; 9 | const String title = "title"; 10 | const String description = "description"; 11 | const String time = "time"; 12 | 13 | class TodoDataBase { 14 | static Database? _db; 15 | 16 | Future get db async { 17 | if (_db == null) { 18 | _db = await initDataBase(); 19 | return _db; 20 | } else { 21 | return _db; 22 | } 23 | } 24 | 25 | Future initDataBase() async { 26 | String pathDataBase = await getDatabasesPath(); 27 | String pathDataBaseName = join(pathDataBase, 'todo.db'); 28 | Database mydb = await openDatabase(pathDataBaseName, version: 1, onCreate: _onCraete); 29 | return mydb; 30 | } 31 | 32 | _onCraete(Database database, int version) { 33 | database.execute(''' 34 | CREATE TABLE todo ( 35 | id INTEGER PRIMARY KEY AUTOINCREMENT, 36 | iconId INTEGER, 37 | isDone INTEGER, 38 | title TEXT, 39 | description TEXT, 40 | time TEXT 41 | ) 42 | '''); 43 | } 44 | 45 | Future insertTodo(TodoModel todoModel) async { 46 | Database? database = await db; 47 | int status = await database!.insert(todo, todoModel.toJson()); 48 | return status; 49 | } 50 | 51 | Future updateTodo(int idTodo) async { 52 | Database? database = await db; 53 | int status = await database!.rawUpdate('UPDATE $todo SET $isDone = ? WHERE $id = ?', [1, idTodo]); 54 | return status; 55 | } 56 | 57 | Future getDoneTodo() async { 58 | Database? database = await db; 59 | List status = await database!.rawQuery('SELECT * FROM $todo WHERE $isDone = 1 ORDER BY $id DESC'); 60 | return status; 61 | } 62 | 63 | Future getNotDoneTodo() async { 64 | Database? database = await db; 65 | // List status = await database! 66 | // .query(todo, columns: [id, iconId, isDone, title, description, time], where: '$isDone = ?', whereArgs: [0]); 67 | List status = await database!.rawQuery('SELECT * FROM $todo WHERE $isDone = 0 ORDER BY $id DESC'); 68 | return status; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /lib/core/error/expetion.dart: -------------------------------------------------------------------------------- 1 | class EmpityException implements Exception {} 2 | class SqlException implements Exception {} -------------------------------------------------------------------------------- /lib/core/error/failur.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | abstract class Failur extends Equatable { 4 | @override 5 | List get props => []; 6 | } 7 | 8 | class EmpityFailur extends Failur { 9 | @override 10 | List get props => []; 11 | } 12 | 13 | class SqlFailur extends Failur { 14 | @override 15 | List get props => []; 16 | } 17 | 18 | -------------------------------------------------------------------------------- /lib/core/functions/show_time_data_piker.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:todo/core/constant/app_colors.dart'; 4 | 5 | void showTimeDataPiker({required BuildContext context, required DateTime initialDateTime ,required String type, required void Function(DateTime) onDateTimeChanged}) { 6 | showDialog( 7 | context: context, 8 | builder: (context) { 9 | return Container( 10 | margin: const EdgeInsets.symmetric(horizontal: 20), 11 | child: Dialog( 12 | backgroundColor: AppColors.white, 13 | insetPadding: const EdgeInsets.all(0), 14 | child: SizedBox( 15 | height: 200, 16 | child: CupertinoDatePicker( 17 | mode: type == "time" ? CupertinoDatePickerMode.time : CupertinoDatePickerMode.date , 18 | initialDateTime: initialDateTime, 19 | onDateTimeChanged: onDateTimeChanged, 20 | ), 21 | )), 22 | ); 23 | }, 24 | ); 25 | } -------------------------------------------------------------------------------- /lib/core/my_bloc_observer.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_bloc/flutter_bloc.dart'; 2 | 3 | class MyBlocObserver extends BlocObserver { 4 | @override 5 | void onCreate(BlocBase bloc) { 6 | super.onCreate(bloc); 7 | print('onCreate -- ${bloc.runtimeType}'); 8 | } 9 | 10 | @override 11 | void onEvent(Bloc bloc, Object? event) { 12 | super.onEvent(bloc, event); 13 | print('onEvent -- ${bloc.runtimeType}, $event'); 14 | } 15 | 16 | @override 17 | void onChange(BlocBase bloc, Change change) { 18 | super.onChange(bloc, change); 19 | print('onChange -- ${bloc.runtimeType}, $change'); 20 | } 21 | 22 | @override 23 | void onTransition(Bloc bloc, Transition transition) { 24 | super.onTransition(bloc, transition); 25 | print('onTransition -- ${bloc.runtimeType}, $transition'); 26 | } 27 | 28 | @override 29 | void onError(BlocBase bloc, Object error, StackTrace stackTrace) { 30 | print('onError -- ${bloc.runtimeType}, $error'); 31 | super.onError(bloc, error, stackTrace); 32 | } 33 | 34 | @override 35 | void onClose(BlocBase bloc) { 36 | super.onClose(bloc); 37 | print('onClose -- ${bloc.runtimeType}'); 38 | } 39 | } -------------------------------------------------------------------------------- /lib/core/services/my_services.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:get_it/get_it.dart'; 3 | import 'package:todo/core/database/todo_data_base.dart'; 4 | import 'package:todo/features/todo/data/datasources/local_data_source.dart'; 5 | import 'package:todo/features/todo/data/repositories/todo_repo_imp.dart'; 6 | import 'package:todo/features/todo/domain/repositories/todo_repo.dart'; 7 | import 'package:todo/features/todo/domain/usecases/update_todo_usecase.dart'; 8 | import 'package:todo/features/todo/domain/usecases/get_done_todo.dart'; 9 | import 'package:todo/features/todo/domain/usecases/get_not_done_todo.dart'; 10 | import 'package:todo/features/todo/domain/usecases/insert_todo_usecase.dart'; 11 | import 'package:todo/features/todo/presentation/bloc/bloc/todo_bloc.dart'; 12 | 13 | GetIt ls = GetIt.instance; 14 | 15 | void init() { 16 | //features 17 | 18 | //! Bloc 19 | ls.registerFactory(() => TodoBloc( 20 | getDoneTodoUsecase: ls(), getNotDoneTodoUsecase: ls(), insertTodoUsecase: ls(), updateTodoUsecase: ls())); 21 | //!Usecases 22 | ls.registerLazySingleton(() => GetDoneTodoUsecase(todoRepo: ls())); 23 | ls.registerLazySingleton(() => GetNotDoneTodoUsecase(todoRepo: ls())); 24 | ls.registerLazySingleton(() => InsertTodoUsecase(todoRepo: ls())); 25 | ls.registerLazySingleton(() => UpdateTodoUsecase(todoRepo: ls())); 26 | //!REPO 27 | ls.registerLazySingleton(() => TodoRepoImp(localDataSource: ls())); 28 | //!data Sorce 29 | ls.registerLazySingleton(() => LocalDataSourceImp(todoDataBase: ls())); 30 | //!core 31 | ls.registerLazySingleton(() => TodoDataBase()); 32 | } 33 | -------------------------------------------------------------------------------- /lib/features/todo/data/datasources/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/lib/features/todo/data/datasources/.gitkeep -------------------------------------------------------------------------------- /lib/features/todo/data/datasources/local_data_source.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:todo/core/database/todo_data_base.dart'; 3 | import 'package:todo/core/error/expetion.dart'; 4 | import 'package:todo/features/todo/data/models/todo_model.dart'; 5 | 6 | abstract class LocalDataSource { 7 | Future> getDoneTodo(); 8 | Future> getNotDoneTodo(); 9 | Future insertTodo(TodoModel todoModel); 10 | Future updateTodo(int idTodo); 11 | } 12 | 13 | class LocalDataSourceImp implements LocalDataSource { 14 | final TodoDataBase todoDataBase; 15 | 16 | LocalDataSourceImp({required this.todoDataBase}); 17 | @override 18 | Future updateTodo(int idTodo) async { 19 | int status = await todoDataBase.updateTodo(idTodo) ; 20 | if (status == 1) { 21 | return Future.value(unit) ; 22 | } else { 23 | throw SqlException() ; 24 | } 25 | } 26 | 27 | @override 28 | Future> getDoneTodo() async { 29 | try { 30 | List data = await todoDataBase.getDoneTodo() ; 31 | List dataToModel = data.map((e) => TodoModel.fromJson(e)).toList() ; 32 | return dataToModel ; 33 | } catch (e) { 34 | throw EmpityException() ; 35 | } 36 | 37 | 38 | } 39 | 40 | @override 41 | Future> getNotDoneTodo() async{ 42 | try { 43 | List data = await todoDataBase.getNotDoneTodo() ; 44 | List dataToModel = data.map((e) => TodoModel.fromJson(e)).toList() ; 45 | return dataToModel ; 46 | } catch (e) { 47 | throw EmpityException() ; 48 | } 49 | } 50 | 51 | @override 52 | Future insertTodo(TodoModel todoModel) async{ 53 | int status = await todoDataBase.insertTodo(todoModel) ; 54 | if (status == 1) { 55 | return Future.value(unit); 56 | } else { 57 | throw SqlException() ; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /lib/features/todo/data/datasources/static/colors_status_image.dart: -------------------------------------------------------------------------------- 1 | import 'package:todo/core/constant/app_colors.dart'; 2 | import 'package:todo/core/constant/app_image.dart'; 3 | import 'package:todo/features/todo/data/models/color_status_image.dart'; 4 | 5 | class StaticData { 6 | static List colorsStatusImage =[ 7 | ColorStatusImageModel(colorStatus: AppColors.health, images: AppImages.health) , 8 | ColorStatusImageModel(colorStatus: AppColors.location, images: AppImages.location) , 9 | ColorStatusImageModel(colorStatus: AppColors.shop, images: AppImages.shop) , 10 | ColorStatusImageModel(colorStatus: AppColors.sport, images: AppImages.sport) , 11 | ColorStatusImageModel(colorStatus: AppColors.other, images: AppImages.other) , 12 | ] ; 13 | } -------------------------------------------------------------------------------- /lib/features/todo/data/models/color_status_image.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class ColorStatusImageModel { 4 | final Color colorStatus ; 5 | final String images ; 6 | ColorStatusImageModel({required this.colorStatus, required this.images}); 7 | } 8 | -------------------------------------------------------------------------------- /lib/features/todo/data/models/todo_model.dart: -------------------------------------------------------------------------------- 1 | import 'package:todo/features/todo/domain/entities/todo_enti.dart'; 2 | 3 | class TodoModel extends TodoEnti { 4 | const TodoModel( 5 | { super.id, 6 | required super.iconId, 7 | required super.isDone, 8 | required super.title, 9 | required super.description, 10 | required super.time}); 11 | 12 | factory TodoModel.fromJson(Map data) { 13 | return TodoModel( 14 | id: data["id"], 15 | iconId: data["iconId"], 16 | isDone: data["isDone"], 17 | title: data["title"], 18 | description: data["description"], 19 | time: data["time"]); 20 | } 21 | Map toJson() { 22 | final Map data = {}; 23 | data["iconId"] = iconId; 24 | data["isDone"] = isDone; 25 | data["title"] = title; 26 | data["description"] = description; 27 | data["time"] = time; 28 | return data; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /lib/features/todo/data/repositories/todo_repo_imp.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:todo/core/error/expetion.dart'; 3 | import 'package:todo/core/error/failur.dart'; 4 | import 'package:todo/features/todo/data/datasources/local_data_source.dart'; 5 | import 'package:todo/features/todo/data/models/todo_model.dart'; 6 | import 'package:todo/features/todo/domain/entities/todo_enti.dart'; 7 | import 'package:todo/features/todo/domain/repositories/todo_repo.dart'; 8 | 9 | class TodoRepoImp implements TodoRepo { 10 | final LocalDataSource localDataSource; 11 | 12 | TodoRepoImp({required this.localDataSource}); 13 | @override 14 | Future>> getDoneTodo() async { 15 | try { 16 | await Future.delayed(const Duration(milliseconds: 1000)); 17 | List data = await localDataSource.getDoneTodo(); 18 | return right(data); 19 | } on EmpityException { 20 | return left(EmpityFailur()); 21 | } 22 | } 23 | 24 | @override 25 | Future>> getNotDoneTodo() async { 26 | try { 27 | await Future.delayed(const Duration(milliseconds: 1000)); 28 | List data = await localDataSource.getNotDoneTodo(); 29 | return right(data); 30 | } on EmpityException { 31 | return left(EmpityFailur()); 32 | } 33 | } 34 | 35 | @override 36 | Future> updateTodo(int idTodo) async { 37 | try { 38 | await localDataSource.updateTodo(idTodo); 39 | return right(unit); 40 | } on SqlException { 41 | return left(SqlFailur()); 42 | } 43 | } 44 | 45 | @override 46 | Future> insertTodo(TodoEnti todoEnti) async { 47 | try { 48 | await localDataSource.insertTodo(TodoModel( 49 | id: todoEnti.id, 50 | iconId: todoEnti.iconId, 51 | isDone: todoEnti.isDone, 52 | title: todoEnti.title, 53 | description: todoEnti.description, 54 | time: todoEnti.time)); 55 | return right(unit); 56 | } on SqlException { 57 | return left(SqlFailur()); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /lib/features/todo/domain/entities/todo_enti.dart: -------------------------------------------------------------------------------- 1 | import 'package:equatable/equatable.dart'; 2 | 3 | class TodoEnti extends Equatable { 4 | final int? id ; 5 | final int iconId ; // for select icon from list icon by idIcon 6 | final int isDone ; // In sql if 0 is done if 1 isNot done 7 | final String title ; 8 | final String description ; 9 | final String time ; 10 | 11 | const TodoEnti({this.id, required this.iconId, required this.isDone, required this.title, required this.description, required this.time}); 12 | @override 13 | List get props => [id ,iconId , isDone , title , description , time]; 14 | 15 | } -------------------------------------------------------------------------------- /lib/features/todo/domain/repositories/todo_repo.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:todo/core/error/failur.dart'; 3 | import 'package:todo/features/todo/domain/entities/todo_enti.dart'; 4 | 5 | abstract class TodoRepo { 6 | Future>> getDoneTodo() ; 7 | Future>> getNotDoneTodo() ; 8 | Future> insertTodo(TodoEnti todoEnti) ; 9 | Future> updateTodo(int idTodo) ; 10 | } -------------------------------------------------------------------------------- /lib/features/todo/domain/usecases/get_done_todo.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:todo/core/error/failur.dart'; 3 | import 'package:todo/features/todo/domain/entities/todo_enti.dart'; 4 | import 'package:todo/features/todo/domain/repositories/todo_repo.dart'; 5 | 6 | class GetDoneTodoUsecase { 7 | final TodoRepo todoRepo ; 8 | GetDoneTodoUsecase({required this.todoRepo}); 9 | Future>> call () async { 10 | return todoRepo.getDoneTodo(); 11 | } 12 | } -------------------------------------------------------------------------------- /lib/features/todo/domain/usecases/get_not_done_todo.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:todo/core/error/failur.dart'; 3 | import 'package:todo/features/todo/domain/entities/todo_enti.dart'; 4 | import 'package:todo/features/todo/domain/repositories/todo_repo.dart'; 5 | 6 | class GetNotDoneTodoUsecase { 7 | final TodoRepo todoRepo ; 8 | GetNotDoneTodoUsecase({required this.todoRepo}); 9 | Future>> call () { 10 | return todoRepo.getNotDoneTodo() ; 11 | } 12 | } -------------------------------------------------------------------------------- /lib/features/todo/domain/usecases/insert_todo_usecase.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:todo/core/error/failur.dart'; 3 | import 'package:todo/features/todo/domain/entities/todo_enti.dart'; 4 | import 'package:todo/features/todo/domain/repositories/todo_repo.dart'; 5 | 6 | class InsertTodoUsecase { 7 | final TodoRepo todoRepo ; 8 | InsertTodoUsecase({required this.todoRepo}); 9 | Future> call (TodoEnti todoEnti) { 10 | return todoRepo.insertTodo(todoEnti) ; 11 | } 12 | } -------------------------------------------------------------------------------- /lib/features/todo/domain/usecases/update_todo_usecase.dart: -------------------------------------------------------------------------------- 1 | import 'package:dartz/dartz.dart'; 2 | import 'package:todo/core/error/failur.dart'; 3 | import 'package:todo/features/todo/domain/repositories/todo_repo.dart'; 4 | 5 | class UpdateTodoUsecase { 6 | final TodoRepo todoRepo ; 7 | UpdateTodoUsecase({required this.todoRepo}); 8 | Future> call (int idTodo) { 9 | return todoRepo.updateTodo(idTodo) ; 10 | } 11 | } -------------------------------------------------------------------------------- /lib/features/todo/presentation/bloc/bloc/todo_bloc.dart: -------------------------------------------------------------------------------- 1 | import 'package:bloc/bloc.dart'; 2 | import 'package:dartz/dartz.dart'; 3 | import 'package:equatable/equatable.dart'; 4 | import 'package:todo/core/error/failur.dart'; 5 | import 'package:todo/features/todo/domain/entities/todo_enti.dart'; 6 | import 'package:todo/features/todo/domain/usecases/update_todo_usecase.dart'; 7 | import 'package:todo/features/todo/domain/usecases/get_done_todo.dart'; 8 | import 'package:todo/features/todo/domain/usecases/get_not_done_todo.dart'; 9 | import 'package:todo/features/todo/domain/usecases/insert_todo_usecase.dart'; 10 | 11 | part 'todo_event.dart'; 12 | part 'todo_state.dart'; 13 | 14 | class TodoBloc extends Bloc { 15 | final GetDoneTodoUsecase getDoneTodoUsecase; 16 | final GetNotDoneTodoUsecase getNotDoneTodoUsecase; 17 | final InsertTodoUsecase insertTodoUsecase; 18 | final UpdateTodoUsecase updateTodoUsecase; 19 | TodoBloc( 20 | {required this.getDoneTodoUsecase, 21 | required this.getNotDoneTodoUsecase, 22 | required this.insertTodoUsecase, 23 | required this.updateTodoUsecase}) 24 | : super(TodoInitial()) { 25 | on((event, emit) {}); 26 | // 27 | on((event, emit) async { 28 | emit(LoadingTodoState()); 29 | var failurOrDone = await getDoneTodoUsecase.call(); 30 | emit(_getData(failurOrDone)); 31 | }); 32 | // 33 | on((event, emit) async { 34 | emit(LoadingTodoState()); 35 | var failurOrDone = await getNotDoneTodoUsecase.call(); 36 | emit(_getData(failurOrDone)); 37 | }); 38 | // 39 | on((event, emit) async { 40 | emit(LoadingTodoState()); 41 | var failurOrDone = await insertTodoUsecase.call(event.todoEnti); 42 | emit(_insertAndDelete(failurOrDone)); 43 | add(GetNotDoneTodoEvent()); 44 | }); 45 | // 46 | on((event, emit) async { 47 | emit(LoadingTodoState()); 48 | 49 | late Either failurOrDone; 50 | for (var i = 0; i < event.idsTodo.length; i++) { 51 | failurOrDone = await updateTodoUsecase.call(event.idsTodo[i]); 52 | } 53 | emit(_insertAndDelete(failurOrDone)); 54 | add(GetNotDoneTodoEvent()); 55 | }); 56 | } 57 | //////////// 58 | TodoState _getData(Either> either) { 59 | return either.fold((failur) { 60 | return ErrorTodoState(); 61 | }, (listData) { 62 | return LoadedTodoState(todoList: listData); 63 | }); 64 | } 65 | 66 | /////////// 67 | TodoState _insertAndDelete(Either either) { 68 | return either.fold((failur) { 69 | return ErrorTodoState(); 70 | }, (done) { 71 | return const LoadedTodoState(); 72 | }); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /lib/features/todo/presentation/bloc/bloc/todo_event.dart: -------------------------------------------------------------------------------- 1 | part of 'todo_bloc.dart'; 2 | 3 | sealed class TodoEvent extends Equatable { 4 | const TodoEvent(); 5 | 6 | @override 7 | List get props => []; 8 | } 9 | 10 | class AddTodoEvent extends TodoEvent { 11 | final TodoEnti todoEnti; 12 | const AddTodoEvent({required this.todoEnti}); 13 | @override 14 | List get props => [todoEnti]; 15 | } 16 | 17 | class GetDoneTodoEvent extends TodoEvent {} 18 | 19 | class GetNotDoneTodoEvent extends TodoEvent {} 20 | 21 | class UpdateTodoEvent extends TodoEvent { 22 | final List idsTodo; 23 | const UpdateTodoEvent({required this.idsTodo}); 24 | @override 25 | List get props => [idsTodo]; 26 | } -------------------------------------------------------------------------------- /lib/features/todo/presentation/bloc/bloc/todo_state.dart: -------------------------------------------------------------------------------- 1 | part of 'todo_bloc.dart'; 2 | 3 | sealed class TodoState extends Equatable { 4 | const TodoState(); 5 | 6 | @override 7 | List get props => []; 8 | } 9 | 10 | final class TodoInitial extends TodoState {} 11 | final class LoadingTodoState extends TodoState {} 12 | final class LoadedTodoState extends TodoState { 13 | final List? todoList ; 14 | 15 | const LoadedTodoState({this.todoList}); 16 | } 17 | final class ErrorTodoState extends TodoState {} 18 | final class BottomBarState extends TodoState { 19 | final int showNumber ; 20 | 21 | const BottomBarState({required this.showNumber}); 22 | 23 | } -------------------------------------------------------------------------------- /lib/features/todo/presentation/pages/done_todo_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:todo/core/constant/app_colors.dart'; 4 | import 'package:todo/features/todo/presentation/bloc/bloc/todo_bloc.dart'; 5 | import 'package:todo/features/todo/presentation/widgets/done_todo_page/app_bar_done_todo.dart'; 6 | import 'package:todo/features/todo/presentation/widgets/done_todo_page/done_todo_posts_widget.dart'; 7 | import 'package:todo/features/todo/presentation/widgets/todo_page/bg_widget.dart'; 8 | import 'package:todo/features/todo/presentation/widgets/public/dialog_widget.dart'; 9 | 10 | class DoneTodoPage extends StatelessWidget { 11 | const DoneTodoPage({Key? key}) : super(key: key); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return Scaffold( 16 | body: _bodyBuilder(context), 17 | ); 18 | } 19 | 20 | Widget _bodyBuilder(BuildContext context) { 21 | return BgWidget( 22 | childWidget: Stack( 23 | alignment: Alignment.bottomCenter, 24 | children: [ 25 | Container( 26 | padding: const EdgeInsets.symmetric(horizontal: 20), 27 | height: double.maxFinite, 28 | width: double.maxFinite, 29 | child: Column( 30 | children: [ 31 | const AppBarDoneTodo(), 32 | _todoListBuilder(), 33 | ], 34 | ), 35 | ), 36 | ], 37 | )); 38 | } 39 | 40 | Widget _todoListBuilder() { 41 | return BlocBuilder( 42 | builder: (context, state) { 43 | if (state is LoadingTodoState) { 44 | return Expanded( 45 | child: Center( 46 | child: CircularProgressIndicator( 47 | color: AppColors.bgGrandentTop.withOpacity(0.3), 48 | ), 49 | )); 50 | } else if (state is ErrorTodoState) { 51 | return const Text("NO DATA"); 52 | } else if (state is LoadedTodoState) { 53 | return Expanded( 54 | child: ListView.separated( 55 | physics: const BouncingScrollPhysics(), 56 | itemBuilder: (context, index) { 57 | return index != state.todoList!.length 58 | ? DoneTodoPostWidget( 59 | todoEnti: state.todoList![index], 60 | onTap: () => showDialog( 61 | context: context, 62 | builder: (context) { 63 | return DialogMoreWidget(todoEnti: state.todoList![index]); 64 | }, 65 | ), 66 | ) 67 | : const SizedBox( 68 | height: 20, 69 | ); 70 | }, 71 | separatorBuilder: (context, index) => const SizedBox( 72 | height: 20, 73 | ), 74 | itemCount: state.todoList!.isNotEmpty ? state.todoList!.length + 1 : 0), 75 | ); 76 | } 77 | return const SizedBox(); 78 | }, 79 | ); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /lib/features/todo/presentation/pages/splash_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:todo/core/constant/app_colors.dart'; 3 | import 'package:todo/core/constant/app_image.dart'; 4 | import 'package:todo/core/constant/app_route.dart'; 5 | 6 | class SplashScreen extends StatefulWidget { 7 | const SplashScreen({Key? key}) : super(key: key); 8 | 9 | @override 10 | State createState() => _SplashScreenState(); 11 | } 12 | 13 | class _SplashScreenState extends State { 14 | Future goToHome () async{ 15 | await Future.delayed(const Duration(seconds: 3) , ()=> Navigator.of(context).pushNamedAndRemoveUntil(AppRoute.todo, (route) => false)); 16 | } 17 | @override 18 | void initState() { 19 | goToHome(); 20 | super.initState(); 21 | } 22 | @override 23 | Widget build(BuildContext context) { 24 | return Container( 25 | height: double.maxFinite, 26 | width: double.maxFinite, 27 | color: AppColors.white, 28 | child: Center( 29 | child: SizedBox( 30 | height: 110, 31 | width: 110, 32 | child: Image.asset(AppImages.logo), 33 | ), 34 | ), 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/features/todo/presentation/pages/todo_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:todo/core/constant/app_colors.dart'; 4 | import 'package:todo/core/constant/app_route.dart'; 5 | import 'package:todo/features/todo/presentation/bloc/bloc/todo_bloc.dart'; 6 | import 'package:todo/features/todo/presentation/widgets/todo_page/app_bar_widget.dart'; 7 | import 'package:todo/features/todo/presentation/widgets/todo_page/bg_bottom_bar.dart'; 8 | import 'package:todo/features/todo/presentation/widgets/todo_page/bg_widget.dart'; 9 | import 'package:todo/features/todo/presentation/widgets/public/dialog_widget.dart'; 10 | import 'package:todo/features/todo/presentation/widgets/todo_page/drawer_widget.dart'; 11 | import 'package:todo/features/todo/presentation/widgets/todo_page/main_bottom_bar.dart'; 12 | import 'package:todo/features/todo/presentation/widgets/todo_page/second_bottom_bar.dart'; 13 | import 'package:todo/features/todo/presentation/widgets/todo_page/todo_post_widget.dart'; 14 | 15 | class TodoPage extends StatefulWidget { 16 | const TodoPage({super.key}); 17 | 18 | @override 19 | State createState() => _TodoPageState(); 20 | } 21 | 22 | class _TodoPageState extends State { 23 | //!For Swith by mainBottonBar and secondBottomBar 24 | int showNumber = 0; 25 | //! For get all todo posts id for Update Posts from todo to doneTodo 26 | List idPostsForUpdate = []; 27 | GlobalKey scaffoldState = GlobalKey(); 28 | @override 29 | Widget build(BuildContext context) { 30 | return Scaffold( 31 | key: scaffoldState, 32 | endDrawer: DrawerWidget( 33 | scaffoldState: scaffoldState, 34 | ), 35 | body: _bodyBuilder(), 36 | ); 37 | } 38 | 39 | Widget _bodyBuilder() { 40 | return 41 | //? BgWidget to make background For this page 42 | BgWidget( 43 | childWidget: Stack( 44 | alignment: Alignment.bottomCenter, 45 | children: [ 46 | Container( 47 | padding: const EdgeInsets.symmetric(horizontal: 20), 48 | height: double.maxFinite, 49 | width: double.maxFinite, 50 | child: Column( 51 | children: [ 52 | AppBarWidget( 53 | onTapIcon: () => Navigator.of(context).pushNamed(AppRoute.done), 54 | ), 55 | //! List Builder todo Posts 56 | _todoListBuilder(), 57 | ], 58 | ), 59 | ), 60 | //? BgWidget to make background For bottomBar For more info show desing 61 | BgBottomBar( 62 | //? for switch between MainBottomBar And secondBottomBar with animation 63 | widget: AnimatedSwitcher( 64 | duration: Durations.medium1, 65 | transitionBuilder: (child, animation) { 66 | return ScaleTransition( 67 | scale: animation, 68 | child: child, 69 | ); 70 | }, 71 | child: showNumber == 1 72 | ? SecondBottomBar( 73 | //! update Posts to DoneTodo by id Post 74 | onTapsubmet: () async { 75 | if (idPostsForUpdate.isNotEmpty) { 76 | BlocProvider.of(context).add(UpdateTodoEvent(idsTodo: idPostsForUpdate)); 77 | } 78 | }, 79 | onTapClose: () => setState(() { 80 | showNumber = 0; 81 | }), 82 | ) 83 | : MainBottomBar( 84 | onTapAdd: () => scaffoldState.currentState!.openEndDrawer(), 85 | key: const ValueKey(2), 86 | onTapDone: () => setState(() { 87 | showNumber = 1; 88 | }), 89 | ))) 90 | ], 91 | )); 92 | } 93 | 94 | Widget _todoListBuilder() { 95 | return BlocConsumer( 96 | listener: (context, state) { 97 | if (state is LoadedTodoState) { 98 | setState(() { 99 | //! On loaded Clear idPostsForUpdate To remove Old ids updated 100 | idPostsForUpdate.clear(); 101 | //! Change showNumber to 0 for return to mainBottomBar 102 | showNumber = 0; 103 | }); 104 | } 105 | }, 106 | builder: (context, state) { 107 | if (state is LoadingTodoState) { 108 | return 109 | //!on Loading 110 | Expanded( 111 | child: Center( 112 | child: CircularProgressIndicator( 113 | color: AppColors.bgGrandentTop.withOpacity(0.3), 114 | ), 115 | )); 116 | //! 117 | } else if (state is ErrorTodoState) { 118 | //! 119 | return const Text("NO DATA"); 120 | } else if (state is LoadedTodoState) { 121 | //! list Posts 122 | return Expanded( 123 | child: ListView.separated( 124 | physics: const BouncingScrollPhysics(), 125 | itemBuilder: (context, index) { 126 | return index != state.todoList!.length 127 | ? TodoPostWidget( 128 | ids: idPostsForUpdate /** for use It to check if todo post is selected or unSelected by id */, 129 | todoEnti: state.todoList![index], 130 | showNumber: showNumber /** for show checkBox on switch to secondBottomBar*/, 131 | onTapCheckOut: () { 132 | setState(() { 133 | //! Select And unSelect todo posts by id 134 | idPostsForUpdate.contains(state.todoList![index].id) 135 | ? idPostsForUpdate.remove(state.todoList![index].id) 136 | : idPostsForUpdate.add(state.todoList![index].id!); 137 | }); 138 | }, 139 | onTap: () => showDialog( 140 | context: context, 141 | builder: (context) { 142 | return DialogMoreWidget(todoEnti: state.todoList![index]); 143 | }, 144 | ), 145 | ) 146 | /** for Add space in the End list */ 147 | : const SizedBox( 148 | height: 200, 149 | ); 150 | }, 151 | separatorBuilder: (context, index) => const SizedBox( 152 | height: 20, 153 | ), 154 | itemCount: state.todoList!.isNotEmpty ? state.todoList!.length + 1 : 0 /** for Add space in the End list */), 155 | ); 156 | } 157 | return const SizedBox(); 158 | }, 159 | ); 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /lib/features/todo/presentation/widgets/done_todo_page/app_bar_done_todo.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:todo/core/constant/app_colors.dart'; 3 | import 'package:todo/core/constant/app_strings.dart'; 4 | import 'package:uicons/uicons.dart'; 5 | 6 | class AppBarDoneTodo extends StatelessWidget { 7 | const AppBarDoneTodo({Key? key}) : super(key: key); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return SizedBox( 12 | height: 50, 13 | width: double.maxFinite, 14 | child: Row( 15 | mainAxisAlignment: MainAxisAlignment.center, 16 | children: [ 17 | Expanded( 18 | child: Container( 19 | alignment: Alignment.centerLeft, 20 | child: IconButton( 21 | onPressed: () => Navigator.of(context).pop(), 22 | icon: Icon( 23 | UIcons.solidRounded.angle_left, 24 | size: 20, 25 | color: AppColors.gray, 26 | )), 27 | )), 28 | Expanded( 29 | flex: 2, 30 | child: Center( 31 | child: Text( 32 | AppStrings.dONETASKS, 33 | style: Theme.of(context).textTheme.titleLarge, 34 | ), 35 | ), 36 | ), 37 | const Expanded(child: SizedBox()) 38 | ], 39 | ), 40 | ); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/features/todo/presentation/widgets/done_todo_page/done_todo_posts_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:jiffy/jiffy.dart'; 3 | import 'package:todo/core/constant/app_colors.dart'; 4 | import 'package:todo/features/todo/data/datasources/static/colors_status_image.dart'; 5 | import 'package:todo/features/todo/domain/entities/todo_enti.dart'; 6 | import 'package:uicons/uicons.dart'; 7 | 8 | class DoneTodoPostWidget extends StatelessWidget { 9 | const DoneTodoPostWidget({super.key, this.onTap, required this.todoEnti}); 10 | final TodoEnti todoEnti; 11 | 12 | final void Function()? onTap; 13 | @override 14 | Widget build(BuildContext context) { 15 | return Container( 16 | padding: const EdgeInsets.all(3), 17 | width: double.maxFinite, 18 | height: 52, 19 | decoration: BoxDecoration( 20 | color: AppColors.white.withOpacity(0.9), 21 | borderRadius: BorderRadius.circular(6), 22 | boxShadow: [ 23 | BoxShadow(color: AppColors.black.withOpacity(0.06), blurRadius: 6, offset: const Offset(0, 1)) 24 | ]), 25 | child: Row( 26 | children: [ 27 | Column( 28 | crossAxisAlignment: CrossAxisAlignment.start, 29 | children: [ 30 | _iconStatusTodo(todoEnti.iconId), 31 | Container(margin: const EdgeInsets.only(left: 7, right: 12), child: _imageTodo(todoEnti.iconId)), 32 | ], 33 | ), 34 | _titleTodo(todoEnti.title), 35 | _time(Jiffy.parse(todoEnti.time).MMMd, Jiffy.parse(todoEnti.time).jm, context) 36 | ], 37 | )); 38 | } 39 | 40 | Widget _iconStatusTodo(int id) { 41 | return SizedBox( 42 | height: 7, 43 | width: 7, 44 | child: Icon( 45 | UIcons.solidRounded.checkbox, 46 | size: 9, 47 | color: StaticData.colorsStatusImage[id].colorStatus, 48 | ), 49 | ); 50 | } 51 | 52 | Widget _imageTodo(int id) { 53 | return SizedBox( 54 | height: 28, 55 | width: 28, 56 | child: CircleAvatar( 57 | backgroundImage: AssetImage(StaticData.colorsStatusImage[id].images), 58 | ), 59 | ); 60 | } 61 | 62 | Widget _titleTodo(String title) { 63 | return Expanded( 64 | child: InkWell( 65 | onTap: onTap, 66 | child: Text( 67 | title, 68 | style: const TextStyle( 69 | color: Color(0xff181743), fontFamily: "lato", fontSize: 14, overflow: TextOverflow.ellipsis), 70 | maxLines: 1, 71 | ), 72 | ), 73 | ); 74 | } 75 | 76 | Widget _time(String month, String hour, BuildContext context) { 77 | return SizedBox( 78 | child: Column( 79 | mainAxisAlignment: MainAxisAlignment.center, 80 | children: [ 81 | Text( 82 | month, 83 | style: Theme.of(context).textTheme.labelMedium, 84 | ), 85 | Text( 86 | hour, 87 | style: Theme.of(context).textTheme.labelSmall, 88 | ) 89 | ], 90 | ), 91 | ); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /lib/features/todo/presentation/widgets/public/dialog_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:jiffy/jiffy.dart'; 3 | import 'package:todo/core/constant/app_colors.dart'; 4 | import 'package:todo/core/constant/app_strings.dart'; 5 | import 'package:todo/features/todo/data/datasources/static/colors_status_image.dart'; 6 | import 'package:todo/features/todo/domain/entities/todo_enti.dart'; 7 | import 'package:todo/features/todo/presentation/widgets/todo_page/button_add_and_done.dart'; 8 | 9 | class DialogMoreWidget extends StatelessWidget { 10 | const DialogMoreWidget({super.key, required this.todoEnti}); 11 | final TodoEnti todoEnti; 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return Dialog( 16 | backgroundColor: const Color(0xFF000000).withOpacity(0), 17 | insetPadding: const EdgeInsets.all(0), 18 | child: SizedBox( 19 | child: Container( 20 | width: double.maxFinite, 21 | margin: const EdgeInsets.symmetric(horizontal: 20), 22 | decoration: BoxDecoration(color: AppColors.white, borderRadius: BorderRadius.circular(6)), 23 | child: Column( 24 | mainAxisSize: MainAxisSize.min, 25 | children: [PartTopOfDialog(todoEnti: todoEnti), PartDownOfDialog(todoEnti: todoEnti)], 26 | ), 27 | ), 28 | ), 29 | ); 30 | } 31 | } 32 | 33 | class PartTopOfDialog extends StatelessWidget { 34 | const PartTopOfDialog({super.key, required this.todoEnti}); 35 | final TodoEnti todoEnti; 36 | 37 | @override 38 | Widget build(BuildContext context) { 39 | return Container( 40 | padding: const EdgeInsets.all(18), 41 | height: 123, 42 | width: double.maxFinite, 43 | decoration: BoxDecoration( 44 | color: AppColors.bgGrandentTop.withOpacity(0.02), 45 | borderRadius: const BorderRadius.vertical(bottom: Radius.circular(6))), 46 | child: Column( 47 | mainAxisAlignment: MainAxisAlignment.center, 48 | children: [ 49 | _icon(), 50 | const SizedBox( 51 | height: 16, 52 | ), 53 | _title(context), 54 | const SizedBox( 55 | width: 5, 56 | ), 57 | _dateTime(context) 58 | ], 59 | ), 60 | ); 61 | } 62 | 63 | Widget _icon() { 64 | return SizedBox( 65 | height: 28, 66 | child: Image.asset(StaticData.colorsStatusImage[todoEnti.iconId].images), 67 | ); 68 | } 69 | 70 | Widget _title(BuildContext context) { 71 | return Text( 72 | todoEnti.title, 73 | style: Theme.of(context).textTheme.titleSmall, 74 | maxLines: 1, 75 | ); 76 | } 77 | 78 | Widget _dateTime(BuildContext context) { 79 | return Row( 80 | mainAxisAlignment: MainAxisAlignment.center, 81 | children: [ 82 | Text( 83 | Jiffy.parse(todoEnti.time).MMMd, 84 | style: Theme.of(context).textTheme.labelMedium, 85 | ), 86 | const SizedBox( 87 | width: 5, 88 | ), 89 | Text( 90 | Jiffy.parse(todoEnti.time).jm, 91 | style: Theme.of(context).textTheme.labelSmall!.copyWith(fontSize: 12), 92 | ) 93 | ], 94 | ); 95 | } 96 | } 97 | 98 | class PartDownOfDialog extends StatelessWidget { 99 | const PartDownOfDialog({super.key, required this.todoEnti}); 100 | final TodoEnti todoEnti; 101 | 102 | @override 103 | Widget build(BuildContext context) { 104 | return Column( 105 | children: [ 106 | const SizedBox( 107 | height: 15, 108 | ), 109 | Text( 110 | AppStrings.description, 111 | style: Theme.of(context).textTheme.labelMedium!.copyWith(fontWeight: FontWeight.w900), 112 | ), 113 | _descriptionContent(context), 114 | ButtonAddAndDone( 115 | title: AppStrings.done, 116 | onTapAdd: () => Navigator.of(context).pop(), 117 | ), 118 | const SizedBox( 119 | height: 20, 120 | ) 121 | ], 122 | ); 123 | } 124 | 125 | Widget _descriptionContent(BuildContext context) { 126 | return Container( 127 | height: 107, 128 | width: double.maxFinite, 129 | margin: const EdgeInsets.only(top: 15, left: 20, right: 20, bottom: 29), 130 | child: SingleChildScrollView( 131 | child: Text( 132 | todoEnti.description, 133 | style: Theme.of(context).textTheme.bodySmall, 134 | textAlign: TextAlign.center, 135 | ), 136 | ), 137 | ); 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /lib/features/todo/presentation/widgets/todo_page/app_bar_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:todo/core/constant/app_image.dart'; 3 | 4 | class AppBarWidget extends StatelessWidget { 5 | const AppBarWidget({super.key, this.onTapIcon}); 6 | final void Function()? onTapIcon; 7 | 8 | @override 9 | Widget build(BuildContext context) { 10 | return Container( 11 | alignment: Alignment.center, 12 | height: 50, 13 | child: Row( 14 | mainAxisAlignment: MainAxisAlignment.center, 15 | children: [ 16 | const Expanded(child: SizedBox()), 17 | Expanded( 18 | child: Container( 19 | alignment: Alignment.center, 20 | child: Text( 21 | "TODO", 22 | style: Theme.of(context).textTheme.titleLarge, 23 | ), 24 | )), 25 | Expanded( 26 | child: Align( 27 | alignment: AlignmentDirectional.centerEnd, 28 | child: InkWell(onTap: onTapIcon, child: SizedBox(height: 15, child: Image.asset(AppImages.appBarIcon))), 29 | )), 30 | ], 31 | ), 32 | ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/features/todo/presentation/widgets/todo_page/bg_bottom_bar.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class BgBottomBar extends StatelessWidget { 4 | final Widget widget ; 5 | 6 | const BgBottomBar({super.key, required this.widget}); 7 | @override 8 | Widget build(BuildContext context){ 9 | double height = MediaQuery.of(context).size.height ; 10 | return Container( 11 | padding: const EdgeInsets.only(bottom: 20), 12 | alignment: Alignment.bottomCenter, 13 | height: height / 3, 14 | width: double.maxFinite, 15 | decoration: BoxDecoration( 16 | gradient: LinearGradient(begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ 17 | const Color(0xffCAEBFE).withOpacity(0), 18 | const Color(0xffffffff), 19 | ])), 20 | child: widget , 21 | ); 22 | } 23 | } -------------------------------------------------------------------------------- /lib/features/todo/presentation/widgets/todo_page/bg_drawer.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:todo/core/constant/app_colors.dart'; 3 | import 'package:todo/core/constant/app_image.dart'; 4 | 5 | class BgDrawer extends StatelessWidget { 6 | const BgDrawer({super.key, required this.childWidget}); 7 | final Widget childWidget; 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | double height = MediaQuery.of(context).size.height; 12 | return SizedBox( 13 | height: double.maxFinite, 14 | width: double.maxFinite, 15 | child: Stack( 16 | alignment: Alignment.topCenter, 17 | children: [_bgImage(), _filter(height), childWidget], 18 | ), 19 | ); 20 | } 21 | 22 | Widget _bgImage() { 23 | return Container( 24 | height: double.maxFinite, 25 | width: double.maxFinite, 26 | decoration: BoxDecoration( 27 | gradient: LinearGradient( 28 | begin: Alignment.topCenter, 29 | end: Alignment.bottomCenter, 30 | colors: [AppColors.bgGrandentTop.withOpacity(0.03), AppColors.bgGrandentDown.withOpacity(0.03)]), 31 | image: DecorationImage(image: AssetImage(AppImages.bgDrawer), fit: BoxFit.cover)), 32 | ); 33 | } 34 | 35 | Widget _filter(double height) { 36 | return Container( 37 | height: height, 38 | width: double.maxFinite, 39 | decoration: BoxDecoration( 40 | gradient: LinearGradient(begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ 41 | const Color(0xffffffff), 42 | AppColors.filterColor.withOpacity(0.0), 43 | ])), 44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib/features/todo/presentation/widgets/todo_page/bg_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:todo/core/constant/app_colors.dart'; 3 | import 'package:todo/core/constant/app_image.dart'; 4 | 5 | class BgWidget extends StatelessWidget { 6 | const BgWidget({super.key, required this.childWidget}); 7 | final Widget childWidget ; 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | double height = MediaQuery.of(context).size.height; 12 | 13 | return SizedBox( 14 | height: double.maxFinite, 15 | width: double.maxFinite, 16 | child: Stack( 17 | alignment: Alignment.topCenter, 18 | children: [ 19 | _bgImage(), 20 | _filter(height), 21 | childWidget 22 | ], 23 | ), 24 | ); 25 | } 26 | Widget _bgImage (){ 27 | return Container( 28 | height: double.maxFinite, 29 | width: double.maxFinite, 30 | decoration: BoxDecoration( 31 | gradient: LinearGradient( 32 | begin: Alignment.topCenter, 33 | end: Alignment.bottomCenter, 34 | colors: [AppColors.bgGrandentTop.withOpacity(0.03),AppColors.bgGrandentDown.withOpacity(0.03)]), 35 | image: DecorationImage(image: AssetImage(AppImages.bgImage), fit: BoxFit.cover)), 36 | ); 37 | } 38 | Widget _filter (double height){ 39 | return Container( 40 | height: height / 4 * 3, 41 | width: double.maxFinite, 42 | decoration: BoxDecoration( 43 | gradient: LinearGradient(begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ 44 | AppColors.white, 45 | AppColors.filterColor.withOpacity(0.0), 46 | ])), 47 | ); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/features/todo/presentation/widgets/todo_page/button_add_and_done.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:todo/core/constant/app_colors.dart'; 3 | 4 | class ButtonAddAndDone extends StatelessWidget { 5 | const ButtonAddAndDone({super.key, this.onTapAdd, required this.title}); 6 | final void Function()? onTapAdd ; 7 | final String title ; 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return InkWell( 12 | onTap: onTapAdd , 13 | child: Container( 14 | height: 45, 15 | width: 132, 16 | decoration: BoxDecoration( 17 | borderRadius: BorderRadius.circular(100), 18 | boxShadow: [ 19 | BoxShadow(color: AppColors.iconAddBgGrandentTop.withOpacity(0.3), blurRadius: 6, offset: const Offset(0, 3)) 20 | ], 21 | gradient: LinearGradient( 22 | begin: Alignment.topRight, 23 | end: Alignment.bottomLeft, 24 | colors: [AppColors.iconAddBgGrandentTop, AppColors.iconAddBgGrandentDown])), 25 | child: Center( 26 | child: Text( 27 | title, 28 | style: TextStyle(color: AppColors.white, fontSize: 16), 29 | )), 30 | ), 31 | ); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/features/todo/presentation/widgets/todo_page/drawer_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_bloc/flutter_bloc.dart'; 3 | import 'package:jiffy/jiffy.dart'; 4 | import 'package:todo/core/constant/app_strings.dart'; 5 | import 'package:todo/core/functions/show_time_data_piker.dart'; 6 | import 'package:todo/features/todo/domain/entities/todo_enti.dart'; 7 | import 'package:todo/features/todo/presentation/bloc/bloc/todo_bloc.dart'; 8 | import 'package:todo/features/todo/presentation/widgets/todo_page/bg_drawer.dart'; 9 | import 'package:todo/features/todo/presentation/widgets/todo_page/drawer_widgets/description_form_field.dart'; 10 | import 'package:todo/features/todo/presentation/widgets/todo_page/button_add_and_done.dart'; 11 | import 'package:todo/features/todo/presentation/widgets/todo_page/drawer_widgets/drawer_time_and_data.dart'; 12 | import 'package:todo/features/todo/presentation/widgets/todo_page/drawer_widgets/icon_widget.dart'; 13 | import 'package:todo/features/todo/presentation/widgets/todo_page/drawer_widgets/name_form_filed.dart'; 14 | import 'package:todo/features/todo/presentation/widgets/todo_page/drawer_widgets/title_drawer_widget.dart'; 15 | 16 | class DrawerWidget extends StatefulWidget { 17 | const DrawerWidget({super.key, required this.scaffoldState}); 18 | final GlobalKey scaffoldState; 19 | 20 | @override 21 | State createState() => _DrawerWidgetState(); 22 | } 23 | 24 | class _DrawerWidgetState extends State { 25 | int iconIdSelected = 1; 26 | DateTime initialDate = DateTime.now(); 27 | DateTime initialTime = DateTime.now(); 28 | TextEditingController nameTextCo = TextEditingController(); 29 | TextEditingController descriptionTextCo = TextEditingController(); 30 | @override 31 | Widget build(BuildContext context) { 32 | return Drawer( 33 | child: BgDrawer( 34 | childWidget: Padding( 35 | padding: const EdgeInsets.only(bottom: 20, left: 20, right: 20, top: 10), 36 | child: Column( 37 | crossAxisAlignment: CrossAxisAlignment.start, 38 | children: [ 39 | //? Tittle Drawer 40 | Text( 41 | AppStrings.newTask, 42 | style: Theme.of(context).textTheme.titleLarge, 43 | ), 44 | //? List Icons For choose todo Type 45 | _space30(), 46 | TitleDrawerWidget( 47 | title: AppStrings.icon, 48 | childWidget: Row( 49 | mainAxisAlignment: MainAxisAlignment.center, 50 | children: [ 51 | ...List.generate( 52 | 5, 53 | (index) => IconWidget( 54 | index: index, 55 | iconIdSelected: iconIdSelected, 56 | onTapSelectedIcon: () => setState(() { 57 | iconIdSelected = index; 58 | }), 59 | )) 60 | ], 61 | )), 62 | //! 63 | _space18(), 64 | TitleDrawerWidget(title: AppStrings.name, childWidget: NameFormField(textEditingController: nameTextCo)), 65 | //! 66 | _space30(), 67 | 68 | TitleDrawerWidget( 69 | title: AppStrings.description, 70 | childWidget: DescriptionFormField(textEditingController: descriptionTextCo)), 71 | //! 72 | _space30(), 73 | DrawerTimeAndData( 74 | title: AppStrings.data, 75 | timeOrData: Jiffy.parse(initialDate.toString()).format(pattern: 'd - MMMM - yyyy'), 76 | onTapIcon: () => showTimeDataPiker( 77 | context: context, 78 | initialDateTime: initialDate, 79 | type: "date", 80 | onDateTimeChanged: (p0) => setState(() { 81 | initialDate = p0; 82 | }), 83 | )), 84 | //! 85 | _space30(), 86 | DrawerTimeAndData( 87 | title: AppStrings.time, 88 | timeOrData: Jiffy.parse(initialTime.toString()).jm, 89 | onTapIcon: () => showTimeDataPiker( 90 | context: context, 91 | initialDateTime: initialTime, 92 | type: "time", 93 | onDateTimeChanged: (p0) => setState(() { 94 | initialTime = p0; 95 | }), 96 | )), 97 | //! 98 | const Spacer(), 99 | ButtonAddAndDone( 100 | title: AppStrings.add, 101 | onTapAdd: () { 102 | if (nameTextCo.text.isNotEmpty || descriptionTextCo.text.isNotEmpty) { 103 | BlocProvider.of(context).add(AddTodoEvent( 104 | todoEnti: TodoEnti( 105 | id: 0, 106 | iconId: iconIdSelected, 107 | isDone: 0, 108 | title: nameTextCo.text, 109 | description: descriptionTextCo.text, 110 | time: 111 | //!for Marge Date And Time like [1997-09-23 11:18:12.946621] And use it in [TodoPostsWidget] 112 | "${Jiffy.parse(initialDate.toString()).format(pattern: 'yyyy-MM-dd')} ${Jiffy.parse(initialDate.toString()).format(pattern: 'HH:mm:ss.SSS')}"))); 113 | widget.scaffoldState.currentState!.closeEndDrawer(); 114 | } 115 | }, 116 | ) 117 | ], 118 | ), 119 | )), 120 | ); 121 | } 122 | 123 | Widget _space18() { 124 | return const SizedBox( 125 | height: 18, 126 | ); 127 | } 128 | 129 | Widget _space30() { 130 | return const SizedBox( 131 | height: 30, 132 | ); 133 | } 134 | 135 | @override 136 | void dispose() { 137 | nameTextCo.dispose(); 138 | descriptionTextCo.dispose(); 139 | super.dispose(); 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /lib/features/todo/presentation/widgets/todo_page/drawer_widgets/description_form_field.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:todo/core/constant/app_colors.dart'; 3 | 4 | class DescriptionFormField extends StatelessWidget { 5 | const DescriptionFormField({super.key, required this.textEditingController}); 6 | 7 | final TextEditingController textEditingController; 8 | @override 9 | Widget build(BuildContext context) { 10 | return Container( 11 | margin: const EdgeInsets.only(top: 8), 12 | width: double.maxFinite, 13 | child: TextFormField( 14 | maxLines: 5, 15 | controller: textEditingController, 16 | style: TextStyle(fontSize: 14, color: AppColors.bgGrandentTop), 17 | cursorHeight: 20, 18 | cursorColor: AppColors.bgGrandentTop.withOpacity(0.4), 19 | decoration: InputDecoration( 20 | filled: true, 21 | fillColor: AppColors.white.withOpacity(0.8), 22 | contentPadding: const EdgeInsets.all(7), 23 | isDense: true, 24 | hintText: 'Add description for you to do', 25 | hintStyle: const TextStyle(fontSize: 12), 26 | border: const OutlineInputBorder(), 27 | enabledBorder: OutlineInputBorder( 28 | borderRadius: BorderRadius.circular(6), 29 | borderSide: BorderSide(color: AppColors.bgGrandentTop.withOpacity(0.2))), 30 | focusedBorder: OutlineInputBorder( 31 | borderRadius: BorderRadius.circular(6), 32 | borderSide: BorderSide(color: AppColors.bgGrandentTop.withOpacity(0.2)))), 33 | ), 34 | ); 35 | } 36 | } -------------------------------------------------------------------------------- /lib/features/todo/presentation/widgets/todo_page/drawer_widgets/drawer_time_and_data.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:todo/core/constant/app_colors.dart'; 3 | import 'package:todo/features/todo/presentation/widgets/todo_page/drawer_widgets/title_drawer_widget.dart'; 4 | 5 | class DrawerTimeAndData extends StatelessWidget { 6 | const DrawerTimeAndData({super.key, required this.title, required this.timeOrData, this.onTapIcon}); 7 | 8 | final String title; 9 | final String timeOrData; 10 | final void Function()? onTapIcon; 11 | @override 12 | Widget build(BuildContext context) { 13 | return TitleDrawerWidget( 14 | title: title, 15 | // ignore: avoid_unnecessary_containers 16 | childWidget: Container( 17 | child: InkWell( 18 | splashColor: AppColors.white.withOpacity(0), 19 | onTap: onTapIcon, 20 | child: Column( 21 | children: [ 22 | Row( 23 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 24 | children: [Text(timeOrData), const Icon(Icons.arrow_drop_down)], 25 | ), 26 | Divider( 27 | thickness: 1, 28 | color: AppColors.bgGrandentTop.withOpacity(0.12), 29 | ) 30 | ], 31 | ), 32 | ), 33 | )); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/features/todo/presentation/widgets/todo_page/drawer_widgets/icon_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:todo/features/todo/data/datasources/static/colors_status_image.dart'; 3 | 4 | class IconWidget extends StatelessWidget { 5 | const IconWidget({super.key, required this.index, required this.iconIdSelected, this.onTapSelectedIcon}); 6 | final int index; 7 | final int iconIdSelected; 8 | final void Function()? onTapSelectedIcon; 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | return Container( 13 | height: 37, 14 | margin: EdgeInsets.only(right: index == StaticData.colorsStatusImage.length - 1 ? 0 : 17), 15 | child: Column( 16 | mainAxisAlignment: MainAxisAlignment.end, 17 | crossAxisAlignment: CrossAxisAlignment.start, 18 | children: [ 19 | iconIdSelected == index ? _iconStatusSelected() : const SizedBox(), 20 | Stack( 21 | alignment: Alignment.center, 22 | children: [ 23 | iconIdSelected == index ? _bgIconOnSelected() : const SizedBox(), 24 | _icon(), 25 | ], 26 | ), 27 | ], 28 | ), 29 | ); 30 | } 31 | 32 | Widget _iconStatusSelected() { 33 | return SizedBox( 34 | height: 5, 35 | width: 5, 36 | child: CircleAvatar( 37 | backgroundColor: StaticData.colorsStatusImage[index].colorStatus, 38 | ), 39 | ); 40 | } 41 | 42 | Widget _bgIconOnSelected() { 43 | return SizedBox( 44 | height: 32, 45 | width: 32, 46 | child: CircleAvatar( 47 | backgroundColor: StaticData.colorsStatusImage[index].colorStatus.withOpacity(0.12), 48 | ), 49 | ); 50 | } 51 | 52 | Widget _icon() { 53 | return SizedBox( 54 | height: 28, 55 | width: 28, 56 | child: InkWell( 57 | onTap: onTapSelectedIcon, 58 | child: CircleAvatar( 59 | backgroundImage: AssetImage(StaticData.colorsStatusImage[index].images), 60 | ), 61 | ), 62 | ); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /lib/features/todo/presentation/widgets/todo_page/drawer_widgets/name_form_filed.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:todo/core/constant/app_colors.dart'; 3 | 4 | class NameFormField extends StatelessWidget { 5 | const NameFormField({super.key, required this.textEditingController}); 6 | 7 | final TextEditingController textEditingController; 8 | @override 9 | Widget build(BuildContext context) { 10 | return SizedBox( 11 | width: double.maxFinite, 12 | child: TextFormField( 13 | controller: textEditingController, 14 | style: TextStyle(fontSize: 14, color: AppColors.bgGrandentTop), 15 | cursorHeight: 20, 16 | cursorColor: AppColors.bgGrandentTop.withOpacity(0.4), 17 | decoration: InputDecoration( 18 | contentPadding: const EdgeInsets.only(top: 3, bottom: 7), 19 | isDense: true, 20 | hintText: 'Add name for you to do', 21 | hintStyle: const TextStyle(fontSize: 12), 22 | enabledBorder: UnderlineInputBorder( 23 | borderSide: BorderSide(color: AppColors.bgGrandentDown.withOpacity(0.3), width: 1)), 24 | focusedBorder: UnderlineInputBorder( 25 | borderSide: BorderSide(color: AppColors.bgGrandentDown.withOpacity(0.5), width: 1.5))), 26 | ), 27 | ); 28 | } 29 | } -------------------------------------------------------------------------------- /lib/features/todo/presentation/widgets/todo_page/drawer_widgets/title_drawer_widget.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/material.dart'; 3 | 4 | class TitleDrawerWidget extends StatelessWidget { 5 | const TitleDrawerWidget({super.key, required this.title, required this.childWidget}); 6 | final String title; 7 | final Widget childWidget; 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return SizedBox( 12 | width: double.maxFinite, 13 | child: Column( 14 | crossAxisAlignment: CrossAxisAlignment.start, 15 | mainAxisSize: MainAxisSize.min, 16 | children: [ 17 | Text( 18 | title, 19 | style: Theme.of(context).textTheme.labelLarge, 20 | ), 21 | childWidget 22 | ], 23 | ), 24 | ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/features/todo/presentation/widgets/todo_page/icon_bottom_gradent.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:todo/core/constant/app_colors.dart'; 3 | 4 | class IconBottomGradent extends StatelessWidget { 5 | const IconBottomGradent( 6 | {super.key, required this.topGrandient, required this.bottomGrandient, required this.iconData, this.onTap}); 7 | final Color topGrandient; 8 | final Color bottomGrandient; 9 | final IconData iconData; 10 | final void Function()? onTap; 11 | @override 12 | Widget build(BuildContext context) { 13 | return InkWell( 14 | onTap: onTap, 15 | child: Container( 16 | height: 46, 17 | width: 46, 18 | decoration: BoxDecoration( 19 | shape: BoxShape.circle, 20 | boxShadow: [BoxShadow(color: topGrandient.withOpacity(0.3), blurRadius: 6, offset: const Offset(0, 3))], 21 | gradient: LinearGradient( 22 | begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [topGrandient, bottomGrandient])), 23 | child: Center( 24 | child: Icon( 25 | iconData, 26 | color: AppColors.white, 27 | ), 28 | ), 29 | ), 30 | ); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/features/todo/presentation/widgets/todo_page/main_bottom_bar.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:todo/core/constant/app_colors.dart'; 3 | import 'package:todo/core/constant/app_image.dart'; 4 | import 'package:todo/features/todo/presentation/widgets/todo_page/icon_bottom_gradent.dart'; 5 | 6 | class MainBottomBar extends StatelessWidget { 7 | const MainBottomBar({Key? key, this.onTapDone, this.onTapAdd}) : super(key: key); 8 | final void Function()? onTapDone; 9 | final void Function()? onTapAdd; 10 | @override 11 | Widget build(BuildContext context) { 12 | return SizedBox( 13 | child: Row( 14 | mainAxisAlignment: MainAxisAlignment.center, 15 | children: [ 16 | IconBottomGradent( 17 | onTap: onTapDone, 18 | topGrandient: AppColors.iconDoneBgGrandentTop, 19 | bottomGrandient: AppColors.iconDoneBgGrandentDown, 20 | iconData: Icons.done), 21 | const SizedBox( 22 | width: 46, 23 | ), 24 | _centerIcon(), 25 | const SizedBox( 26 | width: 46, 27 | ), 28 | IconBottomGradent( 29 | onTap: onTapAdd, 30 | topGrandient: AppColors.iconAddBgGrandentTop, 31 | bottomGrandient: AppColors.iconAddBgGrandentDown, 32 | iconData: Icons.add) 33 | ], 34 | ), 35 | ); 36 | } 37 | 38 | Widget _centerIcon() { 39 | return Container( 40 | height: 56, 41 | width: 56, 42 | decoration: BoxDecoration( 43 | color: AppColors.white, 44 | boxShadow: [BoxShadow(color: AppColors.other.withOpacity(0.2), blurRadius: 6, offset: const Offset(0, 4))], 45 | shape: BoxShape.circle, 46 | ), 47 | child: Center( 48 | child: SizedBox( 49 | height: 28, 50 | width: 28, 51 | child: Image.asset(AppImages.main), 52 | ), 53 | ), 54 | ); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /lib/features/todo/presentation/widgets/todo_page/second_bottom_bar.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:todo/core/constant/app_colors.dart'; 3 | import 'package:todo/features/todo/presentation/widgets/todo_page/icon_bottom_gradent.dart'; 4 | 5 | class SecondBottomBar extends StatelessWidget { 6 | const SecondBottomBar({super.key, this.onTapClose, this.onTapsubmet}); 7 | final void Function()? onTapClose ; 8 | final void Function()? onTapsubmet ; 9 | 10 | @override 11 | Widget build(BuildContext context) { 12 | return Container( 13 | key: const ValueKey(1), 14 | margin: const EdgeInsets.only(bottom: 10), 15 | child: Row( 16 | mainAxisAlignment: MainAxisAlignment.center, 17 | children: [ 18 | IconBottomGradent( 19 | onTap: onTapClose, 20 | topGrandient: AppColors.bgGrandentTop, 21 | bottomGrandient: AppColors.iconCancelBgGrandentDown, 22 | iconData: Icons.close_rounded), 23 | const SizedBox( 24 | width: 46, 25 | ), 26 | IconBottomGradent( 27 | onTap:onTapsubmet , 28 | topGrandient: AppColors.iconDoneBgGrandentTop, 29 | bottomGrandient: AppColors.iconDoneBgGrandentDown, 30 | iconData: Icons.done_all_rounded), 31 | ], 32 | ), 33 | ); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/features/todo/presentation/widgets/todo_page/todo_post_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:jiffy/jiffy.dart'; 3 | import 'package:todo/core/constant/app_colors.dart'; 4 | import 'package:todo/features/todo/data/datasources/static/colors_status_image.dart'; 5 | import 'package:todo/features/todo/domain/entities/todo_enti.dart'; 6 | import 'package:todo/features/todo/presentation/widgets/todo_page/todo_posts_checkout.dart'; 7 | 8 | class TodoPostWidget extends StatelessWidget { 9 | const TodoPostWidget( 10 | {super.key, this.onTap, required this.showNumber, this.onTapCheckOut, required this.todoEnti, required this.ids}); 11 | final TodoEnti todoEnti; 12 | final int showNumber; 13 | final void Function()? onTap; 14 | final void Function()? onTapCheckOut; 15 | final List ids; 16 | @override 17 | Widget build(BuildContext context) { 18 | return Container( 19 | padding: const EdgeInsets.all(3), 20 | width: double.maxFinite, 21 | height: 52, 22 | decoration: BoxDecoration( 23 | color: AppColors.white.withOpacity(0.9), 24 | borderRadius: BorderRadius.circular(6), 25 | boxShadow: [ 26 | BoxShadow(color: AppColors.black.withOpacity(0.06), blurRadius: 6, offset: const Offset(0, 1)) 27 | ]), 28 | child: Row( 29 | children: [ 30 | Column( 31 | crossAxisAlignment: CrossAxisAlignment.start, 32 | children: [ 33 | _iconStatusTodo(todoEnti.iconId), 34 | Container(margin: const EdgeInsets.only(left: 7, right: 12), child: _imageTodo(todoEnti.iconId)), 35 | ], 36 | ), 37 | _titleTodo(todoEnti.title , context), 38 | AnimatedCrossFade( 39 | firstChild: Container( 40 | margin: const EdgeInsets.only(right: 7, left: 12), 41 | child: _time(Jiffy.parse(todoEnti.time).MMMd, Jiffy.parse(todoEnti.time).jm, context)), 42 | secondChild: TodoPostsCheckout( 43 | onTap: onTapCheckOut, 44 | visibleIconCheck: ids.contains(todoEnti.id), 45 | ), 46 | crossFadeState: showNumber == 0 ? CrossFadeState.showFirst : CrossFadeState.showSecond, 47 | duration: Durations.medium1) 48 | 49 | ], 50 | )); 51 | } 52 | 53 | Widget _iconStatusTodo(int id) { 54 | return SizedBox( 55 | height: 7, 56 | width: 7, 57 | child: CircleAvatar( 58 | backgroundColor: StaticData.colorsStatusImage[id].colorStatus, 59 | ), 60 | ); 61 | } 62 | 63 | Widget _imageTodo(int id) { 64 | return SizedBox( 65 | height: 28, 66 | width: 28, 67 | child: CircleAvatar( 68 | backgroundImage: AssetImage(StaticData.colorsStatusImage[id].images), 69 | ), 70 | ); 71 | } 72 | 73 | Widget _titleTodo(String title , BuildContext context) { 74 | return Expanded( 75 | child: InkWell( 76 | onTap: onTap, 77 | child: Text( 78 | title, 79 | style: Theme.of(context).textTheme.bodyMedium, 80 | maxLines: 1, 81 | ), 82 | ), 83 | ); 84 | } 85 | 86 | Widget _time(String month, String hour, BuildContext context) { 87 | return SizedBox( 88 | child: Column( 89 | mainAxisAlignment: MainAxisAlignment.center, 90 | children: [ 91 | Text( 92 | month, 93 | style: Theme.of(context).textTheme.labelMedium, 94 | ), 95 | Text( 96 | hour, 97 | style: Theme.of(context).textTheme.labelSmall, 98 | ) 99 | ], 100 | ), 101 | ); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /lib/features/todo/presentation/widgets/todo_page/todo_posts_checkout.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:todo/core/constant/app_colors.dart'; 3 | import 'package:uicons/uicons.dart'; 4 | 5 | class TodoPostsCheckout extends StatelessWidget { 6 | const TodoPostsCheckout({ 7 | super.key, 8 | required this.visibleIconCheck, 9 | this.onTap, 10 | }); 11 | final bool visibleIconCheck; 12 | final void Function()? onTap; 13 | @override 14 | Widget build(BuildContext context) { 15 | return InkWell( 16 | onTap: onTap, 17 | child: _bg(SizedBox( 18 | child: Container( 19 | height: 27, 20 | width: 27, 21 | decoration: BoxDecoration( 22 | color: AppColors.white, 23 | borderRadius: BorderRadius.circular(6), 24 | border: Border.all(color: AppColors.bgGrandentTop.withOpacity(0.2)), 25 | boxShadow: [ 26 | BoxShadow( 27 | color: AppColors.iconDoneBgGrandentTop.withOpacity(0.1), blurRadius: 4, offset: const Offset(0, 2)), 28 | ]), 29 | child: _checkIcon(), 30 | ), 31 | )), 32 | ); 33 | } 34 | 35 | Widget _bg(Widget widget) { 36 | return Container( 37 | width: 74, 38 | height: double.maxFinite, 39 | alignment: AlignmentDirectional.centerEnd, 40 | padding: const EdgeInsets.symmetric(horizontal: 12), 41 | decoration: BoxDecoration( 42 | borderRadius: BorderRadius.circular(6), 43 | gradient: LinearGradient(colors: [ 44 | AppColors.white.withOpacity(0), 45 | AppColors.white, 46 | ])), 47 | child: widget, 48 | ); 49 | } 50 | 51 | Widget _checkIcon() { 52 | return Visibility( 53 | visible: visibleIconCheck, 54 | child: Center( 55 | child: SizedBox( 56 | child: ShaderMask( 57 | blendMode: BlendMode.srcATop, 58 | shaderCallback: (bounds) { 59 | return LinearGradient( 60 | begin: Alignment.topRight, 61 | end: Alignment.bottomLeft, 62 | colors: [AppColors.iconDoneBgGrandentTop, AppColors.iconDoneBgGrandentDown]).createShader(bounds); 63 | }, 64 | child: Icon( 65 | UIcons.boldStraight.check, 66 | size: 17, 67 | ), 68 | ), 69 | ), 70 | ), 71 | ); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/services.dart'; 3 | import 'package:flutter_bloc/flutter_bloc.dart'; 4 | import 'package:todo/core/constant/app_route.dart'; 5 | import 'package:todo/core/my_bloc_observer.dart'; 6 | import 'package:todo/features/todo/presentation/bloc/bloc/todo_bloc.dart'; 7 | import 'package:todo/features/todo/presentation/pages/done_todo_page.dart'; 8 | import 'package:todo/features/todo/presentation/pages/splash_screen.dart'; 9 | import 'package:todo/features/todo/presentation/pages/todo_page.dart'; 10 | import 'package:todo/core/services/my_services.dart' as id; 11 | import 'package:todo/theme/my_theme.dart'; 12 | 13 | void main() { 14 | runApp(const MyApp()); 15 | id.init(); 16 | Bloc.observer = MyBlocObserver(); 17 | } 18 | 19 | class MyApp extends StatelessWidget { 20 | const MyApp({super.key}); 21 | 22 | // This widget is the root of your application. 23 | @override 24 | Widget build(BuildContext context) { 25 | SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [SystemUiOverlay.bottom]); 26 | return MaterialApp( 27 | debugShowCheckedModeBanner: false, 28 | initialRoute: "/", 29 | routes: { 30 | "/": (context) => const SplashScreen(), 31 | AppRoute.todo: (context) => BlocProvider( 32 | create: (context) => id.ls.get()..add(GetNotDoneTodoEvent()), 33 | child: const TodoPage(), 34 | ), 35 | AppRoute.done: (context) => BlocProvider( 36 | create: (context) => id.ls.get()..add(GetDoneTodoEvent()), 37 | child: const DoneTodoPage(), 38 | ) 39 | }, 40 | theme: myTheme(), 41 | ); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /lib/theme/my_theme.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:todo/core/constant/app_colors.dart'; 3 | 4 | ThemeData myTheme() { 5 | return ThemeData( 6 | fontFamily: 'lato', 7 | textTheme: TextTheme( 8 | titleLarge: TextStyle(fontSize: 20, color: AppColors.bgGrandentTop, fontFamily: "baloo"), 9 | titleSmall: TextStyle(fontSize: 16, color: AppColors.bgGrandentTop, fontWeight: FontWeight.bold), 10 | labelLarge: 11 | TextStyle(fontSize: 12, color: AppColors.bgGrandentTop.withOpacity(0.2), fontWeight: FontWeight.bold), 12 | labelMedium: 13 | TextStyle(fontWeight: FontWeight.bold, fontSize: 12, color: AppColors.bgGrandentTop.withOpacity(0.8)), 14 | // ignore: prefer_const_constructors 15 | bodySmall: TextStyle(fontSize: 12, color: const Color(0xff95989A)), 16 | bodyMedium: TextStyle( 17 | color: AppColors.bgGrandentTop, fontFamily: "lato", fontSize: 14, overflow: TextOverflow.ellipsis), 18 | labelSmall: TextStyle(fontSize: 10, color: AppColors.bgGrandentTop.withOpacity(0.6)))); 19 | } 20 | -------------------------------------------------------------------------------- /linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.10) 3 | project(runner LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "todo") 8 | # The unique GTK application identifier for this application. See: 9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID 10 | set(APPLICATION_ID "com.example.todo") 11 | 12 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 13 | # versions of CMake. 14 | cmake_policy(SET CMP0063 NEW) 15 | 16 | # Load bundled libraries from the lib/ directory relative to the binary. 17 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 18 | 19 | # Root filesystem for cross-building. 20 | if(FLUTTER_TARGET_PLATFORM_SYSROOT) 21 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) 22 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) 23 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 24 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 27 | endif() 28 | 29 | # Define build configuration options. 30 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 31 | set(CMAKE_BUILD_TYPE "Debug" CACHE 32 | STRING "Flutter build mode" FORCE) 33 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 34 | "Debug" "Profile" "Release") 35 | endif() 36 | 37 | # Compilation settings that should be applied to most targets. 38 | # 39 | # Be cautious about adding new options here, as plugins use this function by 40 | # default. In most cases, you should add new options to specific targets instead 41 | # of modifying this function. 42 | function(APPLY_STANDARD_SETTINGS TARGET) 43 | target_compile_features(${TARGET} PUBLIC cxx_std_14) 44 | target_compile_options(${TARGET} PRIVATE -Wall -Werror) 45 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") 46 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") 47 | endfunction() 48 | 49 | # Flutter library and tool build rules. 50 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 51 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 52 | 53 | # System-level dependencies. 54 | find_package(PkgConfig REQUIRED) 55 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 56 | 57 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 58 | 59 | # Define the application target. To change its name, change BINARY_NAME above, 60 | # not the value here, or `flutter run` will no longer work. 61 | # 62 | # Any new source files that you add to the application should be added here. 63 | add_executable(${BINARY_NAME} 64 | "main.cc" 65 | "my_application.cc" 66 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 67 | ) 68 | 69 | # Apply the standard set of build settings. This can be removed for applications 70 | # that need different build settings. 71 | apply_standard_settings(${BINARY_NAME}) 72 | 73 | # Add dependency libraries. Add any application-specific dependencies here. 74 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 75 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 76 | 77 | # Run the Flutter tool portions of the build. This must not be removed. 78 | add_dependencies(${BINARY_NAME} flutter_assemble) 79 | 80 | # Only the install-generated bundle's copy of the executable will launch 81 | # correctly, since the resources must in the right relative locations. To avoid 82 | # people trying to run the unbundled copy, put it in a subdirectory instead of 83 | # the default top-level location. 84 | set_target_properties(${BINARY_NAME} 85 | PROPERTIES 86 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 87 | ) 88 | 89 | 90 | # Generated plugin build rules, which manage building the plugins and adding 91 | # them to the application. 92 | include(flutter/generated_plugins.cmake) 93 | 94 | 95 | # === Installation === 96 | # By default, "installing" just makes a relocatable bundle in the build 97 | # directory. 98 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 99 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 100 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 101 | endif() 102 | 103 | # Start with a clean build bundle directory every time. 104 | install(CODE " 105 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 106 | " COMPONENT Runtime) 107 | 108 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 109 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 110 | 111 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 112 | COMPONENT Runtime) 113 | 114 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 115 | COMPONENT Runtime) 116 | 117 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 118 | COMPONENT Runtime) 119 | 120 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) 121 | install(FILES "${bundled_library}" 122 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 123 | COMPONENT Runtime) 124 | endforeach(bundled_library) 125 | 126 | # Copy the native assets provided by the build.dart from all packages. 127 | set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") 128 | install(DIRECTORY "${NATIVE_ASSETS_DIR}" 129 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 130 | COMPONENT Runtime) 131 | 132 | # Fully re-copy the assets directory on each build to avoid having stale files 133 | # from a previous install. 134 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 135 | install(CODE " 136 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 137 | " COMPONENT Runtime) 138 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 139 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 140 | 141 | # Install the AOT library on non-Debug builds only. 142 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 143 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 144 | COMPONENT Runtime) 145 | endif() 146 | -------------------------------------------------------------------------------- /linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.10) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | 12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 13 | # which isn't available in 3.10. 14 | function(list_prepend LIST_NAME PREFIX) 15 | set(NEW_LIST "") 16 | foreach(element ${${LIST_NAME}}) 17 | list(APPEND NEW_LIST "${PREFIX}${element}") 18 | endforeach(element) 19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 20 | endfunction() 21 | 22 | # === Flutter Library === 23 | # System-level dependencies. 24 | find_package(PkgConfig REQUIRED) 25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 28 | 29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 30 | 31 | # Published to parent scope for install step. 32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 36 | 37 | list(APPEND FLUTTER_LIBRARY_HEADERS 38 | "fl_basic_message_channel.h" 39 | "fl_binary_codec.h" 40 | "fl_binary_messenger.h" 41 | "fl_dart_project.h" 42 | "fl_engine.h" 43 | "fl_json_message_codec.h" 44 | "fl_json_method_codec.h" 45 | "fl_message_codec.h" 46 | "fl_method_call.h" 47 | "fl_method_channel.h" 48 | "fl_method_codec.h" 49 | "fl_method_response.h" 50 | "fl_plugin_registrar.h" 51 | "fl_plugin_registry.h" 52 | "fl_standard_message_codec.h" 53 | "fl_standard_method_codec.h" 54 | "fl_string_codec.h" 55 | "fl_value.h" 56 | "fl_view.h" 57 | "flutter_linux.h" 58 | ) 59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 60 | add_library(flutter INTERFACE) 61 | target_include_directories(flutter INTERFACE 62 | "${EPHEMERAL_DIR}" 63 | ) 64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 65 | target_link_libraries(flutter INTERFACE 66 | PkgConfig::GTK 67 | PkgConfig::GLIB 68 | PkgConfig::GIO 69 | ) 70 | add_dependencies(flutter flutter_assemble) 71 | 72 | # === Flutter tool backend === 73 | # _phony_ is a non-existent file to force this command to run every time, 74 | # since currently there's no way to get a full input/output list from the 75 | # flutter tool. 76 | add_custom_command( 77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 79 | COMMAND ${CMAKE_COMMAND} -E env 80 | ${FLUTTER_TOOL_ENVIRONMENT} 81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 83 | VERBATIM 84 | ) 85 | add_custom_target(flutter_assemble DEPENDS 86 | "${FLUTTER_LIBRARY}" 87 | ${FLUTTER_LIBRARY_HEADERS} 88 | ) 89 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void fl_register_plugins(FlPluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /linux/my_application.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | #include 4 | #ifdef GDK_WINDOWING_X11 5 | #include 6 | #endif 7 | 8 | #include "flutter/generated_plugin_registrant.h" 9 | 10 | struct _MyApplication { 11 | GtkApplication parent_instance; 12 | char** dart_entrypoint_arguments; 13 | }; 14 | 15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) 16 | 17 | // Implements GApplication::activate. 18 | static void my_application_activate(GApplication* application) { 19 | MyApplication* self = MY_APPLICATION(application); 20 | GtkWindow* window = 21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); 22 | 23 | // Use a header bar when running in GNOME as this is the common style used 24 | // by applications and is the setup most users will be using (e.g. Ubuntu 25 | // desktop). 26 | // If running on X and not using GNOME then just use a traditional title bar 27 | // in case the window manager does more exotic layout, e.g. tiling. 28 | // If running on Wayland assume the header bar will work (may need changing 29 | // if future cases occur). 30 | gboolean use_header_bar = TRUE; 31 | #ifdef GDK_WINDOWING_X11 32 | GdkScreen* screen = gtk_window_get_screen(window); 33 | if (GDK_IS_X11_SCREEN(screen)) { 34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); 35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) { 36 | use_header_bar = FALSE; 37 | } 38 | } 39 | #endif 40 | if (use_header_bar) { 41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); 42 | gtk_widget_show(GTK_WIDGET(header_bar)); 43 | gtk_header_bar_set_title(header_bar, "todo"); 44 | gtk_header_bar_set_show_close_button(header_bar, TRUE); 45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); 46 | } else { 47 | gtk_window_set_title(window, "todo"); 48 | } 49 | 50 | gtk_window_set_default_size(window, 1280, 720); 51 | gtk_widget_show(GTK_WIDGET(window)); 52 | 53 | g_autoptr(FlDartProject) project = fl_dart_project_new(); 54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); 55 | 56 | FlView* view = fl_view_new(project); 57 | gtk_widget_show(GTK_WIDGET(view)); 58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); 59 | 60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view)); 61 | 62 | gtk_widget_grab_focus(GTK_WIDGET(view)); 63 | } 64 | 65 | // Implements GApplication::local_command_line. 66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { 67 | MyApplication* self = MY_APPLICATION(application); 68 | // Strip out the first argument as it is the binary name. 69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); 70 | 71 | g_autoptr(GError) error = nullptr; 72 | if (!g_application_register(application, nullptr, &error)) { 73 | g_warning("Failed to register: %s", error->message); 74 | *exit_status = 1; 75 | return TRUE; 76 | } 77 | 78 | g_application_activate(application); 79 | *exit_status = 0; 80 | 81 | return TRUE; 82 | } 83 | 84 | // Implements GObject::dispose. 85 | static void my_application_dispose(GObject* object) { 86 | MyApplication* self = MY_APPLICATION(object); 87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 89 | } 90 | 91 | static void my_application_class_init(MyApplicationClass* klass) { 92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 95 | } 96 | 97 | static void my_application_init(MyApplication* self) {} 98 | 99 | MyApplication* my_application_new() { 100 | return MY_APPLICATION(g_object_new(my_application_get_type(), 101 | "application-id", APPLICATION_ID, 102 | "flags", G_APPLICATION_NON_UNIQUE, 103 | nullptr)); 104 | } 105 | -------------------------------------------------------------------------------- /linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import sqflite 9 | 10 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 11 | SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) 12 | } 13 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 43 | 49 | 50 | 51 | 52 | 53 | 63 | 65 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = todo 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.todo 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2024 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import FlutterMacOS 2 | import Cocoa 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /new.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debt Now App - Appcast 5 | 6 | Version 1.3.0 7 | إصلاح صفحة استخراج النص من الصور. 8 | Sun, 30 Dec 2018 12:00:00 +0000 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: todo 2 | description: "A new Flutter project." 3 | # The following line prevents the package from being accidentally published to 4 | # pub.dev using `flutter pub publish`. This is preferred for private packages. 5 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 6 | 7 | # The following defines the version and build number for your application. 8 | # A version number is three numbers separated by dots, like 1.2.43 9 | # followed by an optional build number separated by a +. 10 | # Both the version and the builder number may be overridden in flutter 11 | # build by specifying --build-name and --build-number, respectively. 12 | # In Android, build-name is used as versionName while build-number used as versionCode. 13 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 14 | # In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. 15 | # Read more about iOS versioning at 16 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 17 | # In Windows, build-name is used as the major, minor, and patch parts 18 | # of the product and file versions while build-number is used as the build suffix. 19 | version: 1.0.0+1 20 | 21 | environment: 22 | sdk: '>=3.2.3 <4.0.0' 23 | 24 | # Dependencies specify other packages that your package needs in order to work. 25 | # To automatically upgrade your package dependencies to the latest versions 26 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 27 | # dependencies can be manually updated by changing the version numbers below to 28 | # the latest version available on pub.dev. To see which dependencies have newer 29 | # versions available, run `flutter pub outdated`. 30 | dependencies: 31 | flutter: 32 | sdk: flutter 33 | 34 | 35 | # The following adds the Cupertino Icons font to your application. 36 | # Use with the CupertinoIcons class for iOS style icons. 37 | cupertino_icons: ^1.0.2 38 | flutter_bloc: ^8.1.5 39 | equatable: ^2.0.5 40 | dartz: ^0.10.1 41 | sqflite: ^2.3.2 42 | path: ^1.8.3 43 | bloc: ^8.1.4 44 | page_transition: ^2.1.0 45 | get_it: ^7.6.7 46 | jiffy: ^6.3.0 47 | gradient_icon: ^2.0.9 48 | uicons: ^1.0.1 49 | 50 | dev_dependencies: 51 | flutter_test: 52 | sdk: flutter 53 | 54 | 55 | # The "flutter_lints" package below contains a set of recommended lints to 56 | # encourage good coding practices. The lint set provided by the package is 57 | # activated in the `analysis_options.yaml` file located at the root of your 58 | # package. See that file for information about deactivating specific lint 59 | # rules and activating additional ones. 60 | flutter_lints: ^2.0.0 61 | flutter_launcher_icons: ^0.13.1 62 | 63 | flutter_launcher_icons: 64 | android: "launcher_icon" 65 | ios: true 66 | image_path: "assets/images/logo.png" 67 | min_sdk_android: 21 # android min sdk min:16, default 21 68 | 69 | # For information on the generic Dart part of this file, see the 70 | # following page: https://dart.dev/tools/pub/pubspec 71 | 72 | # The following section is specific to Flutter packages. 73 | flutter: 74 | 75 | # The following line ensures that the Material Icons font is 76 | # included with your application, so that you can use the icons in 77 | # the material Icons class. 78 | uses-material-design: true 79 | 80 | # To add assets to your application, add an assets section, like this: 81 | assets: 82 | - assets/images/ 83 | # - images/a_dot_ham.jpeg 84 | 85 | # An image asset can refer to one or more resolution-specific "variants", see 86 | # https://flutter.dev/assets-and-images/#resolution-aware 87 | 88 | # For details regarding adding assets from package dependencies, see 89 | # https://flutter.dev/assets-and-images/#from-packages 90 | 91 | # To add custom fonts to your application, add a fonts section here, 92 | # in this "flutter" section. Each entry in this list should have a 93 | # "family" key with the font family name, and a "fonts" key with a 94 | # list giving the asset and other descriptors for the font. For 95 | # example: 96 | fonts: 97 | - family: lato 98 | fonts: 99 | - asset: assets/fonts/Lato-Regular.ttf 100 | - asset: assets/fonts/Lato-Black.ttf 101 | weight: 700 102 | - family: baloo 103 | fonts: 104 | - asset: assets/fonts/Baloo-Regular.ttf 105 | # - asset: fonts/TrajanPro_Bold.ttf 106 | # weight: 700 107 | # 108 | # For details regarding fonts from package dependencies, 109 | # see https://flutter.dev/custom-fonts/#from-packages 110 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/web/favicon.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/web/icons/Icon-512.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | todo 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "todo", 3 | "short_name": "todo", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.14) 3 | project(todo LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "todo") 8 | 9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 10 | # versions of CMake. 11 | cmake_policy(VERSION 3.14...3.25) 12 | 13 | # Define build configuration option. 14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 15 | if(IS_MULTICONFIG) 16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 17 | CACHE STRING "" FORCE) 18 | else() 19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 20 | set(CMAKE_BUILD_TYPE "Debug" CACHE 21 | STRING "Flutter build mode" FORCE) 22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 23 | "Debug" "Profile" "Release") 24 | endif() 25 | endif() 26 | # Define settings for the Profile build mode. 27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 31 | 32 | # Use Unicode for all projects. 33 | add_definitions(-DUNICODE -D_UNICODE) 34 | 35 | # Compilation settings that should be applied to most targets. 36 | # 37 | # Be cautious about adding new options here, as plugins use this function by 38 | # default. In most cases, you should add new options to specific targets instead 39 | # of modifying this function. 40 | function(APPLY_STANDARD_SETTINGS TARGET) 41 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 43 | target_compile_options(${TARGET} PRIVATE /EHsc) 44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 46 | endfunction() 47 | 48 | # Flutter library and tool build rules. 49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 50 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 51 | 52 | # Application build; see runner/CMakeLists.txt. 53 | add_subdirectory("runner") 54 | 55 | 56 | # Generated plugin build rules, which manage building the plugins and adding 57 | # them to the application. 58 | include(flutter/generated_plugins.cmake) 59 | 60 | 61 | # === Installation === 62 | # Support files are copied into place next to the executable, so that it can 63 | # run in place. This is done instead of making a separate bundle (as on Linux) 64 | # so that building and running from within Visual Studio will work. 65 | set(BUILD_BUNDLE_DIR "$") 66 | # Make the "install" step default, as it's required to run. 67 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 68 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 69 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 70 | endif() 71 | 72 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 73 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 74 | 75 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 76 | COMPONENT Runtime) 77 | 78 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 79 | COMPONENT Runtime) 80 | 81 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 82 | COMPONENT Runtime) 83 | 84 | if(PLUGIN_BUNDLED_LIBRARIES) 85 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 86 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 87 | COMPONENT Runtime) 88 | endif() 89 | 90 | # Copy the native assets provided by the build.dart from all packages. 91 | set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") 92 | install(DIRECTORY "${NATIVE_ASSETS_DIR}" 93 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 94 | COMPONENT Runtime) 95 | 96 | # Fully re-copy the assets directory on each build to avoid having stale files 97 | # from a previous install. 98 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 99 | install(CODE " 100 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 101 | " COMPONENT Runtime) 102 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 103 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 104 | 105 | # Install the AOT library on non-Debug builds only. 106 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 107 | CONFIGURATIONS Profile;Release 108 | COMPONENT Runtime) 109 | -------------------------------------------------------------------------------- /windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.14) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 12 | 13 | # Set fallback configurations for older versions of the flutter tool. 14 | if (NOT DEFINED FLUTTER_TARGET_PLATFORM) 15 | set(FLUTTER_TARGET_PLATFORM "windows-x64") 16 | endif() 17 | 18 | # === Flutter Library === 19 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 20 | 21 | # Published to parent scope for install step. 22 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 23 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 24 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 25 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 26 | 27 | list(APPEND FLUTTER_LIBRARY_HEADERS 28 | "flutter_export.h" 29 | "flutter_windows.h" 30 | "flutter_messenger.h" 31 | "flutter_plugin_registrar.h" 32 | "flutter_texture_registrar.h" 33 | ) 34 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 35 | add_library(flutter INTERFACE) 36 | target_include_directories(flutter INTERFACE 37 | "${EPHEMERAL_DIR}" 38 | ) 39 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 40 | add_dependencies(flutter flutter_assemble) 41 | 42 | # === Wrapper === 43 | list(APPEND CPP_WRAPPER_SOURCES_CORE 44 | "core_implementations.cc" 45 | "standard_codec.cc" 46 | ) 47 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 48 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 49 | "plugin_registrar.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 52 | list(APPEND CPP_WRAPPER_SOURCES_APP 53 | "flutter_engine.cc" 54 | "flutter_view_controller.cc" 55 | ) 56 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 57 | 58 | # Wrapper sources needed for a plugin. 59 | add_library(flutter_wrapper_plugin STATIC 60 | ${CPP_WRAPPER_SOURCES_CORE} 61 | ${CPP_WRAPPER_SOURCES_PLUGIN} 62 | ) 63 | apply_standard_settings(flutter_wrapper_plugin) 64 | set_target_properties(flutter_wrapper_plugin PROPERTIES 65 | POSITION_INDEPENDENT_CODE ON) 66 | set_target_properties(flutter_wrapper_plugin PROPERTIES 67 | CXX_VISIBILITY_PRESET hidden) 68 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 69 | target_include_directories(flutter_wrapper_plugin PUBLIC 70 | "${WRAPPER_ROOT}/include" 71 | ) 72 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 73 | 74 | # Wrapper sources needed for the runner. 75 | add_library(flutter_wrapper_app STATIC 76 | ${CPP_WRAPPER_SOURCES_CORE} 77 | ${CPP_WRAPPER_SOURCES_APP} 78 | ) 79 | apply_standard_settings(flutter_wrapper_app) 80 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 81 | target_include_directories(flutter_wrapper_app PUBLIC 82 | "${WRAPPER_ROOT}/include" 83 | ) 84 | add_dependencies(flutter_wrapper_app flutter_assemble) 85 | 86 | # === Flutter tool backend === 87 | # _phony_ is a non-existent file to force this command to run every time, 88 | # since currently there's no way to get a full input/output list from the 89 | # flutter tool. 90 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 91 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 92 | add_custom_command( 93 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 94 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 95 | ${CPP_WRAPPER_SOURCES_APP} 96 | ${PHONY_OUTPUT} 97 | COMMAND ${CMAKE_COMMAND} -E env 98 | ${FLUTTER_TOOL_ENVIRONMENT} 99 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 100 | ${FLUTTER_TARGET_PLATFORM} $ 101 | VERBATIM 102 | ) 103 | add_custom_target(flutter_assemble DEPENDS 104 | "${FLUTTER_LIBRARY}" 105 | ${FLUTTER_LIBRARY_HEADERS} 106 | ${CPP_WRAPPER_SOURCES_CORE} 107 | ${CPP_WRAPPER_SOURCES_PLUGIN} 108 | ${CPP_WRAPPER_SOURCES_APP} 109 | ) 110 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void RegisterPlugins(flutter::PluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Add preprocessor definitions for the build version. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") 25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") 26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") 27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") 28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") 29 | 30 | # Disable Windows macros that collide with C++ standard library functions. 31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 32 | 33 | # Add dependency libraries and include directories. Add any application-specific 34 | # dependencies here. 35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 36 | target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") 37 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 38 | 39 | # Run the Flutter tool portions of the build. This must not be removed. 40 | add_dependencies(${BINARY_NAME} flutter_assemble) 41 | -------------------------------------------------------------------------------- /windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) 64 | #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0,0 67 | #endif 68 | 69 | #if defined(FLUTTER_VERSION) 70 | #define VERSION_AS_STRING FLUTTER_VERSION 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "com.example" "\0" 93 | VALUE "FileDescription", "todo" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "todo" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2024 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "todo.exe" "\0" 98 | VALUE "ProductName", "todo" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | 30 | flutter_controller_->engine()->SetNextFrameCallback([&]() { 31 | this->Show(); 32 | }); 33 | 34 | // Flutter can complete the first frame before the "show window" callback is 35 | // registered. The following call ensures a frame is pending to ensure the 36 | // window is shown. It is a no-op if the first frame hasn't completed yet. 37 | flutter_controller_->ForceRedraw(); 38 | 39 | return true; 40 | } 41 | 42 | void FlutterWindow::OnDestroy() { 43 | if (flutter_controller_) { 44 | flutter_controller_ = nullptr; 45 | } 46 | 47 | Win32Window::OnDestroy(); 48 | } 49 | 50 | LRESULT 51 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 52 | WPARAM const wparam, 53 | LPARAM const lparam) noexcept { 54 | // Give Flutter, including plugins, an opportunity to handle window messages. 55 | if (flutter_controller_) { 56 | std::optional result = 57 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 58 | lparam); 59 | if (result) { 60 | return *result; 61 | } 62 | } 63 | 64 | switch (message) { 65 | case WM_FONTCHANGE: 66 | flutter_controller_->engine()->ReloadSystemFonts(); 67 | break; 68 | } 69 | 70 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 71 | } 72 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.Create(L"todo", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/najm-flutter/Todo-flutter/09c0b19213ac34188355c56acf386eaf17f8b567/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr) 51 | -1; // remove the trailing null character 52 | int input_length = (int)wcslen(utf16_string); 53 | std::string utf8_string; 54 | if (target_length <= 0 || target_length > utf8_string.max_size()) { 55 | return utf8_string; 56 | } 57 | utf8_string.resize(target_length); 58 | int converted_length = ::WideCharToMultiByte( 59 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 60 | input_length, utf8_string.data(), target_length, nullptr, nullptr); 61 | if (converted_length == 0) { 62 | return std::string(); 63 | } 64 | return utf8_string; 65 | } 66 | -------------------------------------------------------------------------------- /windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /windows/runner/win32_window.cpp: -------------------------------------------------------------------------------- 1 | #include "win32_window.h" 2 | 3 | #include 4 | #include 5 | 6 | #include "resource.h" 7 | 8 | namespace { 9 | 10 | /// Window attribute that enables dark mode window decorations. 11 | /// 12 | /// Redefined in case the developer's machine has a Windows SDK older than 13 | /// version 10.0.22000.0. 14 | /// See: https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute 15 | #ifndef DWMWA_USE_IMMERSIVE_DARK_MODE 16 | #define DWMWA_USE_IMMERSIVE_DARK_MODE 20 17 | #endif 18 | 19 | constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; 20 | 21 | /// Registry key for app theme preference. 22 | /// 23 | /// A value of 0 indicates apps should use dark mode. A non-zero or missing 24 | /// value indicates apps should use light mode. 25 | constexpr const wchar_t kGetPreferredBrightnessRegKey[] = 26 | L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"; 27 | constexpr const wchar_t kGetPreferredBrightnessRegValue[] = L"AppsUseLightTheme"; 28 | 29 | // The number of Win32Window objects that currently exist. 30 | static int g_active_window_count = 0; 31 | 32 | using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); 33 | 34 | // Scale helper to convert logical scaler values to physical using passed in 35 | // scale factor 36 | int Scale(int source, double scale_factor) { 37 | return static_cast(source * scale_factor); 38 | } 39 | 40 | // Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. 41 | // This API is only needed for PerMonitor V1 awareness mode. 42 | void EnableFullDpiSupportIfAvailable(HWND hwnd) { 43 | HMODULE user32_module = LoadLibraryA("User32.dll"); 44 | if (!user32_module) { 45 | return; 46 | } 47 | auto enable_non_client_dpi_scaling = 48 | reinterpret_cast( 49 | GetProcAddress(user32_module, "EnableNonClientDpiScaling")); 50 | if (enable_non_client_dpi_scaling != nullptr) { 51 | enable_non_client_dpi_scaling(hwnd); 52 | } 53 | FreeLibrary(user32_module); 54 | } 55 | 56 | } // namespace 57 | 58 | // Manages the Win32Window's window class registration. 59 | class WindowClassRegistrar { 60 | public: 61 | ~WindowClassRegistrar() = default; 62 | 63 | // Returns the singleton registrar instance. 64 | static WindowClassRegistrar* GetInstance() { 65 | if (!instance_) { 66 | instance_ = new WindowClassRegistrar(); 67 | } 68 | return instance_; 69 | } 70 | 71 | // Returns the name of the window class, registering the class if it hasn't 72 | // previously been registered. 73 | const wchar_t* GetWindowClass(); 74 | 75 | // Unregisters the window class. Should only be called if there are no 76 | // instances of the window. 77 | void UnregisterWindowClass(); 78 | 79 | private: 80 | WindowClassRegistrar() = default; 81 | 82 | static WindowClassRegistrar* instance_; 83 | 84 | bool class_registered_ = false; 85 | }; 86 | 87 | WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; 88 | 89 | const wchar_t* WindowClassRegistrar::GetWindowClass() { 90 | if (!class_registered_) { 91 | WNDCLASS window_class{}; 92 | window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); 93 | window_class.lpszClassName = kWindowClassName; 94 | window_class.style = CS_HREDRAW | CS_VREDRAW; 95 | window_class.cbClsExtra = 0; 96 | window_class.cbWndExtra = 0; 97 | window_class.hInstance = GetModuleHandle(nullptr); 98 | window_class.hIcon = 99 | LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); 100 | window_class.hbrBackground = 0; 101 | window_class.lpszMenuName = nullptr; 102 | window_class.lpfnWndProc = Win32Window::WndProc; 103 | RegisterClass(&window_class); 104 | class_registered_ = true; 105 | } 106 | return kWindowClassName; 107 | } 108 | 109 | void WindowClassRegistrar::UnregisterWindowClass() { 110 | UnregisterClass(kWindowClassName, nullptr); 111 | class_registered_ = false; 112 | } 113 | 114 | Win32Window::Win32Window() { 115 | ++g_active_window_count; 116 | } 117 | 118 | Win32Window::~Win32Window() { 119 | --g_active_window_count; 120 | Destroy(); 121 | } 122 | 123 | bool Win32Window::Create(const std::wstring& title, 124 | const Point& origin, 125 | const Size& size) { 126 | Destroy(); 127 | 128 | const wchar_t* window_class = 129 | WindowClassRegistrar::GetInstance()->GetWindowClass(); 130 | 131 | const POINT target_point = {static_cast(origin.x), 132 | static_cast(origin.y)}; 133 | HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); 134 | UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); 135 | double scale_factor = dpi / 96.0; 136 | 137 | HWND window = CreateWindow( 138 | window_class, title.c_str(), WS_OVERLAPPEDWINDOW, 139 | Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), 140 | Scale(size.width, scale_factor), Scale(size.height, scale_factor), 141 | nullptr, nullptr, GetModuleHandle(nullptr), this); 142 | 143 | if (!window) { 144 | return false; 145 | } 146 | 147 | UpdateTheme(window); 148 | 149 | return OnCreate(); 150 | } 151 | 152 | bool Win32Window::Show() { 153 | return ShowWindow(window_handle_, SW_SHOWNORMAL); 154 | } 155 | 156 | // static 157 | LRESULT CALLBACK Win32Window::WndProc(HWND const window, 158 | UINT const message, 159 | WPARAM const wparam, 160 | LPARAM const lparam) noexcept { 161 | if (message == WM_NCCREATE) { 162 | auto window_struct = reinterpret_cast(lparam); 163 | SetWindowLongPtr(window, GWLP_USERDATA, 164 | reinterpret_cast(window_struct->lpCreateParams)); 165 | 166 | auto that = static_cast(window_struct->lpCreateParams); 167 | EnableFullDpiSupportIfAvailable(window); 168 | that->window_handle_ = window; 169 | } else if (Win32Window* that = GetThisFromHandle(window)) { 170 | return that->MessageHandler(window, message, wparam, lparam); 171 | } 172 | 173 | return DefWindowProc(window, message, wparam, lparam); 174 | } 175 | 176 | LRESULT 177 | Win32Window::MessageHandler(HWND hwnd, 178 | UINT const message, 179 | WPARAM const wparam, 180 | LPARAM const lparam) noexcept { 181 | switch (message) { 182 | case WM_DESTROY: 183 | window_handle_ = nullptr; 184 | Destroy(); 185 | if (quit_on_close_) { 186 | PostQuitMessage(0); 187 | } 188 | return 0; 189 | 190 | case WM_DPICHANGED: { 191 | auto newRectSize = reinterpret_cast(lparam); 192 | LONG newWidth = newRectSize->right - newRectSize->left; 193 | LONG newHeight = newRectSize->bottom - newRectSize->top; 194 | 195 | SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, 196 | newHeight, SWP_NOZORDER | SWP_NOACTIVATE); 197 | 198 | return 0; 199 | } 200 | case WM_SIZE: { 201 | RECT rect = GetClientArea(); 202 | if (child_content_ != nullptr) { 203 | // Size and position the child window. 204 | MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, 205 | rect.bottom - rect.top, TRUE); 206 | } 207 | return 0; 208 | } 209 | 210 | case WM_ACTIVATE: 211 | if (child_content_ != nullptr) { 212 | SetFocus(child_content_); 213 | } 214 | return 0; 215 | 216 | case WM_DWMCOLORIZATIONCOLORCHANGED: 217 | UpdateTheme(hwnd); 218 | return 0; 219 | } 220 | 221 | return DefWindowProc(window_handle_, message, wparam, lparam); 222 | } 223 | 224 | void Win32Window::Destroy() { 225 | OnDestroy(); 226 | 227 | if (window_handle_) { 228 | DestroyWindow(window_handle_); 229 | window_handle_ = nullptr; 230 | } 231 | if (g_active_window_count == 0) { 232 | WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); 233 | } 234 | } 235 | 236 | Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { 237 | return reinterpret_cast( 238 | GetWindowLongPtr(window, GWLP_USERDATA)); 239 | } 240 | 241 | void Win32Window::SetChildContent(HWND content) { 242 | child_content_ = content; 243 | SetParent(content, window_handle_); 244 | RECT frame = GetClientArea(); 245 | 246 | MoveWindow(content, frame.left, frame.top, frame.right - frame.left, 247 | frame.bottom - frame.top, true); 248 | 249 | SetFocus(child_content_); 250 | } 251 | 252 | RECT Win32Window::GetClientArea() { 253 | RECT frame; 254 | GetClientRect(window_handle_, &frame); 255 | return frame; 256 | } 257 | 258 | HWND Win32Window::GetHandle() { 259 | return window_handle_; 260 | } 261 | 262 | void Win32Window::SetQuitOnClose(bool quit_on_close) { 263 | quit_on_close_ = quit_on_close; 264 | } 265 | 266 | bool Win32Window::OnCreate() { 267 | // No-op; provided for subclasses. 268 | return true; 269 | } 270 | 271 | void Win32Window::OnDestroy() { 272 | // No-op; provided for subclasses. 273 | } 274 | 275 | void Win32Window::UpdateTheme(HWND const window) { 276 | DWORD light_mode; 277 | DWORD light_mode_size = sizeof(light_mode); 278 | LSTATUS result = RegGetValue(HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey, 279 | kGetPreferredBrightnessRegValue, 280 | RRF_RT_REG_DWORD, nullptr, &light_mode, 281 | &light_mode_size); 282 | 283 | if (result == ERROR_SUCCESS) { 284 | BOOL enable_dark_mode = light_mode == 0; 285 | DwmSetWindowAttribute(window, DWMWA_USE_IMMERSIVE_DARK_MODE, 286 | &enable_dark_mode, sizeof(enable_dark_mode)); 287 | } 288 | } 289 | -------------------------------------------------------------------------------- /windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates a win32 window with |title| that is positioned and sized using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size this function will scale the inputted width and height as 35 | // as appropriate for the default monitor. The window is invisible until 36 | // |Show| is called. Returns true if the window was created successfully. 37 | bool Create(const std::wstring& title, const Point& origin, const Size& size); 38 | 39 | // Show the current window. Returns true if the window was successfully shown. 40 | bool Show(); 41 | 42 | // Release OS resources associated with window. 43 | void Destroy(); 44 | 45 | // Inserts |content| into the window tree. 46 | void SetChildContent(HWND content); 47 | 48 | // Returns the backing Window handle to enable clients to set icon and other 49 | // window properties. Returns nullptr if the window has been destroyed. 50 | HWND GetHandle(); 51 | 52 | // If true, closing this window will quit the application. 53 | void SetQuitOnClose(bool quit_on_close); 54 | 55 | // Return a RECT representing the bounds of the current client area. 56 | RECT GetClientArea(); 57 | 58 | protected: 59 | // Processes and route salient window messages for mouse handling, 60 | // size change and DPI. Delegates handling of these to member overloads that 61 | // inheriting classes can handle. 62 | virtual LRESULT MessageHandler(HWND window, 63 | UINT const message, 64 | WPARAM const wparam, 65 | LPARAM const lparam) noexcept; 66 | 67 | // Called when CreateAndShow is called, allowing subclass window-related 68 | // setup. Subclasses should return false if setup fails. 69 | virtual bool OnCreate(); 70 | 71 | // Called when Destroy is called. 72 | virtual void OnDestroy(); 73 | 74 | private: 75 | friend class WindowClassRegistrar; 76 | 77 | // OS callback called by message pump. Handles the WM_NCCREATE message which 78 | // is passed when the non-client area is being created and enables automatic 79 | // non-client DPI scaling so that the non-client area automatically 80 | // responds to changes in DPI. All other messages are handled by 81 | // MessageHandler. 82 | static LRESULT CALLBACK WndProc(HWND const window, 83 | UINT const message, 84 | WPARAM const wparam, 85 | LPARAM const lparam) noexcept; 86 | 87 | // Retrieves a class instance pointer for |window| 88 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 89 | 90 | // Update the window frame's theme to match the system theme. 91 | static void UpdateTheme(HWND const window); 92 | 93 | bool quit_on_close_ = false; 94 | 95 | // window handle for top level window. 96 | HWND window_handle_ = nullptr; 97 | 98 | // window handle for hosted content. 99 | HWND child_content_ = nullptr; 100 | }; 101 | 102 | #endif // RUNNER_WIN32_WINDOW_H_ 103 | --------------------------------------------------------------------------------