commit 50931d839d638384fecebe1d0258d5df9455110c Author: Oracle Public Cloud User Date: Wed Mar 4 15:53:58 2026 +0000 Initial scaffold: FocusFlow ADHD Task Manager Flutter app BLoC/Cubit state management, ADHD-friendly theme (calming teal, no red), GetIt DI, GoRouter navigation. Screens: task dashboard, focus mode, task create/detail, streaks, time perception, settings, onboarding, auth. Custom widgets: TaskCard, RewardPopup, StreakRing, GentleNudgeCard. Co-Authored-By: Claude Opus 4.6 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..79c113f --- /dev/null +++ b/.gitignore @@ -0,0 +1,45 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.build/ +.buildlog/ +.history +.svn/ +.swiftpm/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/.metadata b/.metadata new file mode 100644 index 0000000..e7b8e12 --- /dev/null +++ b/.metadata @@ -0,0 +1,36 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "c23637390482d4cf9598c3ce3f2be31aa7332daf" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf + base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf + - platform: android + create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf + base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf + - platform: ios + create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf + base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf + - platform: web + create_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf + base_revision: c23637390482d4cf9598c3ce3f2be31aa7332daf + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/README.md b/README.md new file mode 100644 index 0000000..35232f9 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# focusflow_app + +A new Flutter project. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) + +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 0000000..0d29021 --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/android/.gitignore b/android/.gitignore new file mode 100644 index 0000000..be3943c --- /dev/null +++ b/android/.gitignore @@ -0,0 +1,14 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java +.cxx/ + +# Remember to never publicly share your keystore. +# See https://flutter.dev/to/reference-keystore +key.properties +**/*.keystore +**/*.jks diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts new file mode 100644 index 0000000..a533d00 --- /dev/null +++ b/android/app/build.gradle.kts @@ -0,0 +1,44 @@ +plugins { + id("com.android.application") + id("kotlin-android") + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "com.focusflow.focusflow_app" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_11.toString() + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId = "com.focusflow.focusflow_app" + // You can update the following values to match your application needs. + // For more information, see: https://flutter.dev/to/review-gradle-config. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig = signingConfigs.getByName("debug") + } + } +} + +flutter { + source = "../.." +} diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..8ed5d53 --- /dev/null +++ b/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/kotlin/com/focusflow/focusflow_app/MainActivity.kt b/android/app/src/main/kotlin/com/focusflow/focusflow_app/MainActivity.kt new file mode 100644 index 0000000..1a02ed1 --- /dev/null +++ b/android/app/src/main/kotlin/com/focusflow/focusflow_app/MainActivity.kt @@ -0,0 +1,5 @@ +package com.focusflow.focusflow_app + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity : FlutterActivity() diff --git a/android/app/src/main/res/drawable-v21/launch_background.xml b/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main/res/drawable/launch_background.xml b/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000..304732f --- /dev/null +++ b/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..db77bb4 Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..17987b7 Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..09d4391 Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..d5f1c8d Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..4d6372e Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/values-night/styles.xml b/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..06952be --- /dev/null +++ b/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..cb1ef88 --- /dev/null +++ b/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/android/build.gradle.kts b/android/build.gradle.kts new file mode 100644 index 0000000..89176ef --- /dev/null +++ b/android/build.gradle.kts @@ -0,0 +1,21 @@ +allprojects { + repositories { + google() + mavenCentral() + } +} + +val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/android/gradle.properties b/android/gradle.properties new file mode 100644 index 0000000..f018a61 --- /dev/null +++ b/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError +android.useAndroidX=true +android.enableJetifier=true diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..afa1e8e --- /dev/null +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip diff --git a/android/settings.gradle.kts b/android/settings.gradle.kts new file mode 100644 index 0000000..a439442 --- /dev/null +++ b/android/settings.gradle.kts @@ -0,0 +1,25 @@ +pluginManagement { + val flutterSdkPath = run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.7.0" apply false + id("org.jetbrains.kotlin.android") version "1.8.22" apply false +} + +include(":app") diff --git a/assets/animations/.gitkeep b/assets/animations/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/assets/images/.gitkeep b/assets/images/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/ios/.gitignore b/ios/.gitignore new file mode 100644 index 0000000..7a7f987 --- /dev/null +++ b/ios/.gitignore @@ -0,0 +1,34 @@ +**/dgph +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/ephemeral/ +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/ios/Flutter/AppFrameworkInfo.plist b/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 0000000..7c56964 --- /dev/null +++ b/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 12.0 + + diff --git a/ios/Flutter/Debug.xcconfig b/ios/Flutter/Debug.xcconfig new file mode 100644 index 0000000..592ceee --- /dev/null +++ b/ios/Flutter/Debug.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/ios/Flutter/Release.xcconfig b/ios/Flutter/Release.xcconfig new file mode 100644 index 0000000..592ceee --- /dev/null +++ b/ios/Flutter/Release.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..5923655 --- /dev/null +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,616 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 97C146E61CF9000F007C117D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 97C146ED1CF9000F007C117D; + remoteInfo = Runner; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C8082294A63A400263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C807B294A618700263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + 331C8082294A63A400263BE5 /* RunnerTests */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + 331C8081294A63A400263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C8080294A63A400263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 331C807D294A63A400263BE5 /* Sources */, + 331C807F294A63A400263BE5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 331C8086294A63A400263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = YES; + LastUpgradeCheck = 1510; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C8080294A63A400263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 97C146ED1CF9000F007C117D; + }; + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + 331C8080294A63A400263BE5 /* RunnerTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C807F294A63A400263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C807D294A63A400263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C8086294A63A400263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 97C146ED1CF9000F007C117D /* Runner */; + targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.focusflow.focusflowApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 331C8088294A63A400263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.focusflow.focusflowApp.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Debug; + }; + 331C8089294A63A400263BE5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.focusflow.focusflowApp.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Release; + }; + 331C808A294A63A400263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.focusflow.focusflowApp.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.focusflow.focusflowApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.focusflow.focusflowApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C8088294A63A400263BE5 /* Debug */, + 331C8089294A63A400263BE5 /* Release */, + 331C808A294A63A400263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000..15cada4 --- /dev/null +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Runner.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..1d526a1 --- /dev/null +++ b/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift new file mode 100644 index 0000000..6266644 --- /dev/null +++ b/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import Flutter +import UIKit + +@main +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d36b1fa --- /dev/null +++ b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "Icon-App-1024x1024@1x.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 0000000..dc9ada4 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 0000000..7353c41 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 0000000..797d452 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 0000000..6ed2d93 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 0000000..4cd7b00 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 0000000..fe73094 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 0000000..321773c Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 0000000..797d452 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 0000000..502f463 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 0000000..0ec3034 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 0000000..0ec3034 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 0000000..e9f5fea Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 0000000..84ac32a Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 0000000..8953cba Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 0000000..0467bf1 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 0000000..0bedcf2 --- /dev/null +++ b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 0000000..89c2725 --- /dev/null +++ b/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +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. \ No newline at end of file diff --git a/ios/Runner/Base.lproj/LaunchScreen.storyboard b/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..f2e259c --- /dev/null +++ b/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Runner/Base.lproj/Main.storyboard b/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 0000000..f3c2851 --- /dev/null +++ b/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist new file mode 100644 index 0000000..4eea8b3 --- /dev/null +++ b/ios/Runner/Info.plist @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Focusflow App + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + focusflow_app + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + CADisableMinimumFrameDurationOnPhone + + UIApplicationSupportsIndirectInputEvents + + + diff --git a/ios/Runner/Runner-Bridging-Header.h b/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 0000000..308a2a5 --- /dev/null +++ b/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/ios/RunnerTests/RunnerTests.swift b/ios/RunnerTests/RunnerTests.swift new file mode 100644 index 0000000..86a7c3b --- /dev/null +++ b/ios/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import Flutter +import UIKit +import XCTest + +class RunnerTests: XCTestCase { + + func testExample() { + // If you add code to the Runner application, consider adding tests here. + // See https://developer.apple.com/documentation/xctest for more information about using XCTest. + } + +} diff --git a/lib/app.dart b/lib/app.dart new file mode 100644 index 0000000..30b10e8 --- /dev/null +++ b/lib/app.dart @@ -0,0 +1,31 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; + +import 'core/theme/app_theme.dart'; +import 'features/auth/presentation/bloc/auth_bloc.dart'; +import 'routing/app_router.dart'; + +/// Root widget for the FocusFlow app. +/// +/// Provides BLoCs at the top of the tree so they are available to every +/// route, then delegates to GoRouter for navigation. +class FocusFlowApp extends StatelessWidget { + const FocusFlowApp({super.key}); + + @override + Widget build(BuildContext context) { + return MultiBlocProvider( + providers: [ + BlocProvider(create: (_) => AuthBloc()..add(AuthCheckRequested())), + ], + child: MaterialApp.router( + title: 'FocusFlow', + debugShowCheckedModeBanner: false, + theme: AppTheme.light, + darkTheme: AppTheme.dark, + themeMode: ThemeMode.system, + routerConfig: AppRouter.router, + ), + ); + } +} diff --git a/lib/core/error/failures.dart b/lib/core/error/failures.dart new file mode 100644 index 0000000..6a1aaeb --- /dev/null +++ b/lib/core/error/failures.dart @@ -0,0 +1,45 @@ +import 'package:equatable/equatable.dart'; + +/// Base failure type for the application. +/// +/// Uses a sealed class hierarchy so `switch` expressions are exhaustive. +sealed class Failure extends Equatable { + final String message; + const Failure(this.message); + + @override + List get props => [message]; +} + +/// Returned when the backend API responds with a non-2xx status. +class ServerFailure extends Failure { + final int? statusCode; + const ServerFailure(super.message, {this.statusCode}); + + @override + List get props => [message, statusCode]; +} + +/// Returned when the device has no network connectivity. +class NetworkFailure extends Failure { + const NetworkFailure([super.message = 'No internet connection. Your changes are saved locally.']); +} + +/// Returned when reading / writing the local cache fails. +class CacheFailure extends Failure { + const CacheFailure([super.message = 'Could not access local storage.']); +} + +/// Returned for authentication problems (expired token, bad credentials, etc.). +class AuthFailure extends Failure { + const AuthFailure([super.message = 'Authentication failed. Please sign in again.']); +} + +/// Returned when user input does not pass validation. +class ValidationFailure extends Failure { + final Map fieldErrors; + const ValidationFailure(super.message, {this.fieldErrors = const {}}); + + @override + List get props => [message, fieldErrors]; +} diff --git a/lib/core/network/api_client.dart b/lib/core/network/api_client.dart new file mode 100644 index 0000000..2de102a --- /dev/null +++ b/lib/core/network/api_client.dart @@ -0,0 +1,153 @@ +import 'package:dio/dio.dart'; +import 'package:focusflow_shared/focusflow_shared.dart'; +import 'interceptors/auth_interceptor.dart'; + +/// Central Dio wrapper for all API communication. +/// +/// Registered as a lazy singleton in GetIt so every feature shares +/// the same HTTP client (and therefore the same auth interceptor, +/// retry logic, and error normalisation). +class ApiClient { + late final Dio _dio; + + ApiClient() { + _dio = Dio( + BaseOptions( + // TODO: read from env / config + baseUrl: 'https://api.focusflow.app', + connectTimeout: const Duration(seconds: 15), + receiveTimeout: const Duration(seconds: 15), + headers: { + 'Content-Type': 'application/json', + 'Accept': 'application/json', + }, + ), + ); + + _dio.interceptors.addAll([ + AuthInterceptor(), + LogInterceptor(requestBody: true, responseBody: true), + ]); + } + + // ── Convenience HTTP verbs ─────────────────────────────────────── + + Future> get( + String path, { + Map? queryParameters, + Options? options, + }) => + _dio.get(path, queryParameters: queryParameters, options: options); + + Future> post( + String path, { + Object? data, + Options? options, + }) => + _dio.post(path, data: data, options: options); + + Future> put( + String path, { + Object? data, + Options? options, + }) => + _dio.put(path, data: data, options: options); + + Future> patch( + String path, { + Object? data, + Options? options, + }) => + _dio.patch(path, data: data, options: options); + + Future> delete( + String path, { + Object? data, + Options? options, + }) => + _dio.delete(path, data: data, options: options); + + // ── Auth helpers ───────────────────────────────────────────────── + + Future>> login(String email, String password) async { + final response = await post>( + ApiConstants.authLogin, + data: {'email': email, 'password': password}, + ); + return ApiResponse.fromJson( + response.data!, + (json) => json as Map, + ); + } + + Future>> register( + String displayName, + String email, + String password, + ) async { + final response = await post>( + ApiConstants.authRegister, + data: { + 'displayName': displayName, + 'email': email, + 'password': password, + }, + ); + return ApiResponse.fromJson( + response.data!, + (json) => json as Map, + ); + } + + Future logout() => post(ApiConstants.authLogout); + + // ── Task helpers ───────────────────────────────────────────────── + + Future>> fetchTasks({ + int page = 1, + int limit = 20, + }) => + get>( + ApiConstants.tasks, + queryParameters: {'page': page, 'limit': limit}, + ); + + Future>> fetchNextTask() => + get>(ApiConstants.nextTask); + + Future>> completeTask(String id) => + post>(ApiConstants.completeTask(id)); + + Future>> skipTask(String id) => + post>(ApiConstants.skipTask(id)); + + Future>> createTask(Map data) => + post>(ApiConstants.tasks, data: data); + + Future>> deleteTask(String id) => + delete>(ApiConstants.task(id)); + + // ── Streak helpers ─────────────────────────────────────────────── + + Future>> fetchStreaks() => + get>(ApiConstants.streaks); + + Future>> completeStreak(String id) => + post>(ApiConstants.streak(id)); + + Future>> forgiveStreak(String id) => + post>(ApiConstants.forgiveStreak(id)); + + // ── Reward helpers ─────────────────────────────────────────────── + + Future>> generateReward(String taskId) => + post>( + ApiConstants.generateReward, + data: {'taskId': taskId}, + ); + + // ── Time helpers ───────────────────────────────────────────────── + + Future>> fetchTimeAccuracy() => + get>(ApiConstants.timeAccuracy); +} diff --git a/lib/core/network/interceptors/auth_interceptor.dart b/lib/core/network/interceptors/auth_interceptor.dart new file mode 100644 index 0000000..49a1cc4 --- /dev/null +++ b/lib/core/network/interceptors/auth_interceptor.dart @@ -0,0 +1,89 @@ +import 'package:dio/dio.dart'; +import 'package:flutter_secure_storage/flutter_secure_storage.dart'; +import 'package:focusflow_shared/focusflow_shared.dart'; + +/// Dio interceptor that attaches a JWT Bearer token to every request +/// and transparently refreshes the token on 401 responses. +class AuthInterceptor extends Interceptor { + static const _storage = FlutterSecureStorage(); + static const _accessTokenKey = 'ff_access_token'; + static const _refreshTokenKey = 'ff_refresh_token'; + + // ── Attach token on every request ──────────────────────────────── + @override + void onRequest(RequestOptions options, RequestInterceptorHandler handler) async { + final token = await _storage.read(key: _accessTokenKey); + if (token != null) { + options.headers['Authorization'] = 'Bearer $token'; + } + handler.next(options); + } + + // ── Handle 401 — attempt token refresh ─────────────────────────── + @override + void onError(DioException err, ErrorInterceptorHandler handler) async { + if (err.response?.statusCode == 401) { + final refreshed = await _tryRefresh(); + if (refreshed) { + // Retry the original request with the new token. + final token = await _storage.read(key: _accessTokenKey); + final opts = err.requestOptions; + opts.headers['Authorization'] = 'Bearer $token'; + + try { + final response = await Dio().fetch(opts); + return handler.resolve(response); + } on DioException catch (e) { + return handler.next(e); + } + } + } + handler.next(err); + } + + // ── Token refresh ──────────────────────────────────────────────── + Future _tryRefresh() async { + final refreshToken = await _storage.read(key: _refreshTokenKey); + if (refreshToken == null) return false; + + try { + final dio = Dio(); + final response = await dio.post>( + // Use the same base url; in production this is configured once. + 'https://api.focusflow.app${ApiConstants.authRefresh}', + data: {'refreshToken': refreshToken}, + ); + + final data = response.data; + if (data != null && data['status'] == 'success') { + final tokens = data['data'] as Map; + await _storage.write(key: _accessTokenKey, value: tokens['accessToken'] as String); + await _storage.write(key: _refreshTokenKey, value: tokens['refreshToken'] as String); + return true; + } + } catch (_) { + // Refresh failed — caller will propagate the original 401. + } + return false; + } + + // ── Static helpers for login / logout ──────────────────────────── + + static Future saveTokens({ + required String accessToken, + required String refreshToken, + }) async { + await _storage.write(key: _accessTokenKey, value: accessToken); + await _storage.write(key: _refreshTokenKey, value: refreshToken); + } + + static Future clearTokens() async { + await _storage.delete(key: _accessTokenKey); + await _storage.delete(key: _refreshTokenKey); + } + + static Future hasToken() async { + final token = await _storage.read(key: _accessTokenKey); + return token != null; + } +} diff --git a/lib/core/theme/app_colors.dart b/lib/core/theme/app_colors.dart new file mode 100644 index 0000000..21e448f --- /dev/null +++ b/lib/core/theme/app_colors.dart @@ -0,0 +1,72 @@ +import 'package:flutter/material.dart'; + +/// ADHD-friendly color palette. +/// +/// Designed around calming, non-aggressive tones that reduce +/// visual anxiety and avoid triggering shame or urgency. +class AppColors { + AppColors._(); + + // ── Primary palette ────────────────────────────────────────────── + /// Calming teal — the anchor of the app. + static const Color primary = Color(0xFF26A69A); + static const Color primaryLight = Color(0xFF80CBC4); + static const Color primaryDark = Color(0xFF00897B); + + // ── Secondary — warmth & rewards ───────────────────────────────── + /// Warm amber for positive reinforcement, rewards, celebrations. + static const Color secondary = Color(0xFFFFB74D); + static const Color secondaryLight = Color(0xFFFFE0B2); + static const Color secondaryDark = Color(0xFFF9A825); + + // ── Tertiary — streaks & progress ──────────────────────────────── + /// Soft purple for streak visuals and progress indicators. + static const Color tertiary = Color(0xFFAB47BC); + static const Color tertiaryLight = Color(0xFFCE93D8); + static const Color tertiaryDark = Color(0xFF8E24AA); + + // ── Backgrounds ────────────────────────────────────────────────── + static const Color backgroundLight = Color(0xFFFAFAFA); + static const Color backgroundDark = Color(0xFF121212); + + // ── Surfaces ───────────────────────────────────────────────────── + static const Color surfaceLight = Color(0xFFFFFFFF); + static const Color surfaceDark = Color(0xFF1E1E1E); + static const Color surfaceVariantLight = Color(0xFFF5F5F5); + static const Color surfaceVariantDark = Color(0xFF2C2C2C); + + // ── Semantic — intentionally forgiving ─────────────────────────── + /// Tasks completed — celebrate! + static const Color completed = Color(0xFF66BB6A); + + /// Tasks skipped — neutral gray, no shame. + static const Color skipped = Color(0xFFBDBDBD); + + /// Tasks missed — light gray, forgiveness over punishment. + static const Color missed = Color(0xFFE0E0E0); + + /// Error — muted coral, not aggressive red. + static const Color error = Color(0xFFE57373); + static const Color errorLight = Color(0xFFFFCDD2); + + // ── Reward gold ────────────────────────────────────────────────── + static const Color rewardGold = Color(0xFFFFD54F); + static const Color rewardGoldDark = Color(0xFFFFC107); + + // ── Energy levels ──────────────────────────────────────────────── + static const Color energyLow = Color(0xFF81C784); + static const Color energyMedium = Color(0xFFFFD54F); + static const Color energyHigh = Color(0xFFFF8A65); + + // ── Text ───────────────────────────────────────────────────────── + static const Color textPrimaryLight = Color(0xFF212121); + static const Color textSecondaryLight = Color(0xFF616161); + static const Color textPrimaryDark = Color(0xFFFAFAFA); + static const Color textSecondaryDark = Color(0xFFBDBDBD); + + // ── Misc ───────────────────────────────────────────────────────── + static const Color dividerLight = Color(0xFFE0E0E0); + static const Color dividerDark = Color(0xFF424242); + static const Color shimmerBase = Color(0xFFE0E0E0); + static const Color shimmerHighlight = Color(0xFFF5F5F5); +} diff --git a/lib/core/theme/app_theme.dart b/lib/core/theme/app_theme.dart new file mode 100644 index 0000000..8a25d50 --- /dev/null +++ b/lib/core/theme/app_theme.dart @@ -0,0 +1,354 @@ +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'app_colors.dart'; + +/// ADHD-friendly Material 3 theme. +/// +/// Design principles: +/// - Calming primary colors (teal / soft blue) — NO aggressive reds. +/// - High-contrast text for readability. +/// - Large touch targets (minimum 48 dp). +/// - Rounded corners everywhere (16 dp radius). +/// - Gentle animations, no jarring transitions. +/// - Nunito for headers (friendly, rounded), Inter for body. +/// - Subtle, soft card shadows. +class AppTheme { + AppTheme._(); + + static const double _borderRadius = 16.0; + static final _roundedShape = RoundedRectangleBorder( + borderRadius: BorderRadius.circular(_borderRadius), + ); + + // ── Typography ─────────────────────────────────────────────────── + static TextTheme _buildTextTheme(TextTheme base, Color primary, Color secondary) { + final headlineFont = GoogleFonts.nunitoTextTheme(base); + final bodyFont = GoogleFonts.interTextTheme(base); + + return bodyFont.copyWith( + displayLarge: headlineFont.displayLarge?.copyWith(color: primary, fontWeight: FontWeight.w700), + displayMedium: headlineFont.displayMedium?.copyWith(color: primary, fontWeight: FontWeight.w700), + displaySmall: headlineFont.displaySmall?.copyWith(color: primary, fontWeight: FontWeight.w700), + headlineLarge: headlineFont.headlineLarge?.copyWith(color: primary, fontWeight: FontWeight.w700), + headlineMedium: headlineFont.headlineMedium?.copyWith(color: primary, fontWeight: FontWeight.w600), + headlineSmall: headlineFont.headlineSmall?.copyWith(color: primary, fontWeight: FontWeight.w600), + titleLarge: headlineFont.titleLarge?.copyWith(color: primary, fontWeight: FontWeight.w600), + titleMedium: headlineFont.titleMedium?.copyWith(color: primary, fontWeight: FontWeight.w600), + titleSmall: headlineFont.titleSmall?.copyWith(color: primary, fontWeight: FontWeight.w500), + bodyLarge: bodyFont.bodyLarge?.copyWith(color: primary, fontSize: 16), + bodyMedium: bodyFont.bodyMedium?.copyWith(color: secondary, fontSize: 14), + bodySmall: bodyFont.bodySmall?.copyWith(color: secondary, fontSize: 12), + labelLarge: bodyFont.labelLarge?.copyWith(color: primary, fontWeight: FontWeight.w600, fontSize: 16), + labelMedium: bodyFont.labelMedium?.copyWith(color: secondary), + labelSmall: bodyFont.labelSmall?.copyWith(color: secondary), + ); + } + + // ── Light theme ────────────────────────────────────────────────── + static ThemeData get light { + final colorScheme = ColorScheme.light( + primary: AppColors.primary, + onPrimary: Colors.white, + primaryContainer: AppColors.primaryLight, + onPrimaryContainer: AppColors.primaryDark, + secondary: AppColors.secondary, + onSecondary: Colors.white, + secondaryContainer: AppColors.secondaryLight, + onSecondaryContainer: AppColors.secondaryDark, + tertiary: AppColors.tertiary, + onTertiary: Colors.white, + tertiaryContainer: AppColors.tertiaryLight, + onTertiaryContainer: AppColors.tertiaryDark, + surface: AppColors.surfaceLight, + onSurface: AppColors.textPrimaryLight, + surfaceContainerHighest: AppColors.surfaceVariantLight, + onSurfaceVariant: AppColors.textSecondaryLight, + error: AppColors.error, + onError: Colors.white, + ); + + final textTheme = _buildTextTheme( + ThemeData.light().textTheme, + AppColors.textPrimaryLight, + AppColors.textSecondaryLight, + ); + + return ThemeData( + useMaterial3: true, + colorScheme: colorScheme, + scaffoldBackgroundColor: AppColors.backgroundLight, + textTheme: textTheme, + + // AppBar + appBarTheme: AppBarTheme( + elevation: 0, + scrolledUnderElevation: 1, + backgroundColor: AppColors.backgroundLight, + foregroundColor: AppColors.textPrimaryLight, + titleTextStyle: textTheme.titleLarge, + ), + + // Cards — subtle, soft shadows + cardTheme: CardThemeData( + elevation: 2, + shadowColor: Colors.black.withAlpha(25), + shape: _roundedShape, + margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 6), + ), + + // Elevated buttons — large touch targets + elevatedButtonTheme: ElevatedButtonThemeData( + style: ElevatedButton.styleFrom( + minimumSize: const Size(double.infinity, 52), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(_borderRadius)), + textStyle: textTheme.labelLarge, + elevation: 2, + shadowColor: Colors.black.withAlpha(25), + ), + ), + + // Filled buttons + filledButtonTheme: FilledButtonThemeData( + style: FilledButton.styleFrom( + minimumSize: const Size(double.infinity, 52), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(_borderRadius)), + textStyle: textTheme.labelLarge, + ), + ), + + // Outlined buttons + outlinedButtonTheme: OutlinedButtonThemeData( + style: OutlinedButton.styleFrom( + minimumSize: const Size(double.infinity, 52), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(_borderRadius)), + textStyle: textTheme.labelLarge, + ), + ), + + // Text buttons + textButtonTheme: TextButtonThemeData( + style: TextButton.styleFrom( + minimumSize: const Size(48, 48), + textStyle: textTheme.labelLarge, + ), + ), + + // Input decoration + inputDecorationTheme: InputDecorationTheme( + filled: true, + fillColor: AppColors.surfaceVariantLight, + contentPadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 18), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(_borderRadius), + borderSide: BorderSide.none, + ), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(_borderRadius), + borderSide: BorderSide.none, + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(_borderRadius), + borderSide: const BorderSide(color: AppColors.primary, width: 2), + ), + errorBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(_borderRadius), + borderSide: const BorderSide(color: AppColors.error, width: 1), + ), + labelStyle: textTheme.bodyMedium, + hintStyle: textTheme.bodyMedium?.copyWith(color: AppColors.textSecondaryLight.withAlpha(150)), + ), + + // FABs + floatingActionButtonTheme: FloatingActionButtonThemeData( + backgroundColor: AppColors.primary, + foregroundColor: Colors.white, + elevation: 4, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)), + ), + + // Chips + chipTheme: ChipThemeData( + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), + ), + + // Bottom nav + bottomNavigationBarTheme: BottomNavigationBarThemeData( + elevation: 8, + selectedItemColor: AppColors.primary, + unselectedItemColor: AppColors.textSecondaryLight, + type: BottomNavigationBarType.fixed, + backgroundColor: AppColors.surfaceLight, + ), + + // Snackbar + snackBarTheme: SnackBarThemeData( + behavior: SnackBarBehavior.floating, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + ), + + // Divider + dividerTheme: const DividerThemeData( + color: AppColors.dividerLight, + thickness: 1, + space: 1, + ), + + // Page transitions — gentle + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: FadeUpwardsPageTransitionsBuilder(), + TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), + }, + ), + ); + } + + // ── Dark theme — true dark with muted accents ──────────────────── + static ThemeData get dark { + final colorScheme = ColorScheme.dark( + primary: AppColors.primaryLight, + onPrimary: AppColors.primaryDark, + primaryContainer: AppColors.primaryDark, + onPrimaryContainer: AppColors.primaryLight, + secondary: AppColors.secondary, + onSecondary: Colors.black, + secondaryContainer: AppColors.secondaryDark, + onSecondaryContainer: AppColors.secondaryLight, + tertiary: AppColors.tertiaryLight, + onTertiary: Colors.black, + tertiaryContainer: AppColors.tertiaryDark, + onTertiaryContainer: AppColors.tertiaryLight, + surface: AppColors.surfaceDark, + onSurface: AppColors.textPrimaryDark, + surfaceContainerHighest: AppColors.surfaceVariantDark, + onSurfaceVariant: AppColors.textSecondaryDark, + error: AppColors.errorLight, + onError: Colors.black, + ); + + final textTheme = _buildTextTheme( + ThemeData.dark().textTheme, + AppColors.textPrimaryDark, + AppColors.textSecondaryDark, + ); + + return ThemeData( + useMaterial3: true, + colorScheme: colorScheme, + scaffoldBackgroundColor: AppColors.backgroundDark, + textTheme: textTheme, + + appBarTheme: AppBarTheme( + elevation: 0, + scrolledUnderElevation: 1, + backgroundColor: AppColors.backgroundDark, + foregroundColor: AppColors.textPrimaryDark, + titleTextStyle: textTheme.titleLarge, + ), + + cardTheme: CardThemeData( + elevation: 2, + shadowColor: Colors.black.withAlpha(60), + shape: _roundedShape, + color: AppColors.surfaceDark, + margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 6), + ), + + elevatedButtonTheme: ElevatedButtonThemeData( + style: ElevatedButton.styleFrom( + minimumSize: const Size(double.infinity, 52), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(_borderRadius)), + textStyle: textTheme.labelLarge, + elevation: 2, + shadowColor: Colors.black.withAlpha(60), + ), + ), + + filledButtonTheme: FilledButtonThemeData( + style: FilledButton.styleFrom( + minimumSize: const Size(double.infinity, 52), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(_borderRadius)), + textStyle: textTheme.labelLarge, + ), + ), + + outlinedButtonTheme: OutlinedButtonThemeData( + style: OutlinedButton.styleFrom( + minimumSize: const Size(double.infinity, 52), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(_borderRadius)), + textStyle: textTheme.labelLarge, + ), + ), + + textButtonTheme: TextButtonThemeData( + style: TextButton.styleFrom( + minimumSize: const Size(48, 48), + textStyle: textTheme.labelLarge, + ), + ), + + inputDecorationTheme: InputDecorationTheme( + filled: true, + fillColor: AppColors.surfaceVariantDark, + contentPadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 18), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(_borderRadius), + borderSide: BorderSide.none, + ), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(_borderRadius), + borderSide: BorderSide.none, + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(_borderRadius), + borderSide: const BorderSide(color: AppColors.primaryLight, width: 2), + ), + errorBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(_borderRadius), + borderSide: const BorderSide(color: AppColors.errorLight, width: 1), + ), + labelStyle: textTheme.bodyMedium, + hintStyle: textTheme.bodyMedium?.copyWith(color: AppColors.textSecondaryDark.withAlpha(150)), + ), + + floatingActionButtonTheme: FloatingActionButtonThemeData( + backgroundColor: AppColors.primaryLight, + foregroundColor: AppColors.primaryDark, + elevation: 4, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)), + ), + + chipTheme: ChipThemeData( + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), + ), + + bottomNavigationBarTheme: BottomNavigationBarThemeData( + elevation: 8, + selectedItemColor: AppColors.primaryLight, + unselectedItemColor: AppColors.textSecondaryDark, + type: BottomNavigationBarType.fixed, + backgroundColor: AppColors.surfaceDark, + ), + + snackBarTheme: SnackBarThemeData( + behavior: SnackBarBehavior.floating, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + ), + + dividerTheme: const DividerThemeData( + color: AppColors.dividerDark, + thickness: 1, + space: 1, + ), + + pageTransitionsTheme: const PageTransitionsTheme( + builders: { + TargetPlatform.android: FadeUpwardsPageTransitionsBuilder(), + TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), + }, + ), + ); + } +} diff --git a/lib/core/widgets/gentle_nudge_card.dart b/lib/core/widgets/gentle_nudge_card.dart new file mode 100644 index 0000000..af7f86d --- /dev/null +++ b/lib/core/widgets/gentle_nudge_card.dart @@ -0,0 +1,96 @@ +import 'package:flutter/material.dart'; + +import '../theme/app_colors.dart'; + +/// Re-engagement card shown when the user returns after an absence. +/// +/// Design rules: +/// - Warm, welcoming message — "Welcome back! Your tasks missed you." +/// - Show previous streak info gently. +/// - "Let's start small" CTA. +/// - NO guilt, NO "you missed X days" in red. +class GentleNudgeCard extends StatelessWidget { + final int? previousStreak; + final VoidCallback? onStartSmall; + final VoidCallback? onDismiss; + + const GentleNudgeCard({ + super.key, + this.previousStreak, + this.onStartSmall, + this.onDismiss, + }); + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + + return Card( + margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)), + color: AppColors.primaryLight.withAlpha(40), + elevation: 0, + child: Padding( + padding: const EdgeInsets.all(20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // ── Header row ───────────────────────────────────────── + Row( + children: [ + const Icon(Icons.waving_hand_rounded, + size: 28, color: AppColors.secondary), + const SizedBox(width: 10), + Expanded( + child: Text( + 'Welcome back!', + style: theme.textTheme.titleLarge?.copyWith( + fontWeight: FontWeight.w700, + ), + ), + ), + if (onDismiss != null) + IconButton( + icon: const Icon(Icons.close_rounded, size: 20), + onPressed: onDismiss, + style: IconButton.styleFrom( + minimumSize: const Size(36, 36), + ), + ), + ], + ), + const SizedBox(height: 10), + + // ── Body ─────────────────────────────────────────────── + Text( + 'Your tasks missed you. No pressure — let\'s ease back in.', + style: theme.textTheme.bodyLarge, + ), + + if (previousStreak != null && previousStreak! > 0) ...[ + const SizedBox(height: 8), + Text( + 'You had a $previousStreak-day streak going. ' + 'That\'s still impressive — let\'s build on it.', + style: theme.textTheme.bodyMedium, + ), + ], + + const SizedBox(height: 16), + + // ── CTA ──────────────────────────────────────────────── + FilledButton.icon( + onPressed: onStartSmall, + icon: const Icon(Icons.play_arrow_rounded), + label: const Text('Let\'s start small'), + style: FilledButton.styleFrom( + backgroundColor: AppColors.primary, + minimumSize: const Size(double.infinity, 52), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/core/widgets/reward_popup.dart b/lib/core/widgets/reward_popup.dart new file mode 100644 index 0000000..ffeff23 --- /dev/null +++ b/lib/core/widgets/reward_popup.dart @@ -0,0 +1,131 @@ +import 'package:flutter/material.dart'; +import 'package:focusflow_shared/focusflow_shared.dart'; + +import '../theme/app_colors.dart'; + +/// Reward celebration overlay. +/// +/// Shows after a task is completed: +/// - Placeholder area for a Lottie animation. +/// - Points / magnitude display. +/// - Encouraging message. +/// - "Nice!" dismiss button. +/// - Surprise rewards get extra fanfare (larger, longer animation). +class RewardPopup extends StatelessWidget { + final Reward reward; + final VoidCallback onDismiss; + + const RewardPopup({ + super.key, + required this.reward, + required this.onDismiss, + }); + + /// Messages shown at random — always positive. + static const _messages = [ + 'You did it!', + 'Awesome work!', + 'One more down!', + 'Keep that momentum!', + 'Look at you go!', + 'Your brain thanks you!', + 'Small wins add up!', + 'That felt good, right?', + ]; + + String get _message { + if (reward.description != null && reward.description!.isNotEmpty) { + return reward.description!; + } + // Deterministic pick based on reward id hashCode so the same reward + // always shows the same message during a session. + return _messages[reward.id.hashCode.abs() % _messages.length]; + } + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + final isSurprise = reward.isSurprise; + final size = isSurprise ? 140.0 : 100.0; + + return Center( + child: Material( + color: Colors.transparent, + child: Container( + margin: const EdgeInsets.symmetric(horizontal: 32), + padding: const EdgeInsets.all(28), + decoration: BoxDecoration( + color: theme.colorScheme.surface, + borderRadius: BorderRadius.circular(24), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(40), + blurRadius: 24, + offset: const Offset(0, 8), + ), + ], + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + // ── Animation placeholder ──────────────────────────── + Container( + width: size, + height: size, + decoration: BoxDecoration( + color: AppColors.rewardGold.withAlpha(40), + shape: BoxShape.circle, + ), + child: Icon( + isSurprise ? Icons.auto_awesome : Icons.celebration_rounded, + size: size * 0.5, + color: AppColors.rewardGold, + ), + ), + const SizedBox(height: 20), + + // ── Title ──────────────────────────────────────────── + if (reward.title != null) + Text( + reward.title!, + style: theme.textTheme.headlineSmall?.copyWith( + fontWeight: FontWeight.w700, + ), + textAlign: TextAlign.center, + ), + if (reward.title != null) const SizedBox(height: 8), + + // ── Points ─────────────────────────────────────────── + Text( + '+${reward.magnitude} pts', + style: theme.textTheme.titleLarge?.copyWith( + color: AppColors.rewardGoldDark, + fontWeight: FontWeight.w800, + ), + ), + const SizedBox(height: 12), + + // ── Message ────────────────────────────────────────── + Text( + _message, + style: theme.textTheme.bodyLarge, + textAlign: TextAlign.center, + ), + const SizedBox(height: 24), + + // ── Dismiss ────────────────────────────────────────── + FilledButton( + onPressed: onDismiss, + style: FilledButton.styleFrom( + backgroundColor: AppColors.primary, + minimumSize: const Size(160, 52), + ), + child: const Text('Nice!'), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/core/widgets/streak_ring.dart b/lib/core/widgets/streak_ring.dart new file mode 100644 index 0000000..9c6f606 --- /dev/null +++ b/lib/core/widgets/streak_ring.dart @@ -0,0 +1,179 @@ +import 'dart:math' as math; +import 'package:flutter/material.dart'; + +import '../theme/app_colors.dart'; + +/// Circular streak progress indicator. +/// +/// - Ring fills based on current count vs a goal. +/// - Grace days shown as dashed segments. +/// - Frozen indicator (snowflake icon). +/// - Center shows current count. +/// - Warm teal/green when active, gray when in grace period. +class StreakRing extends StatelessWidget { + /// Current streak count. + final int currentCount; + + /// Number of grace days remaining (max grace days minus used). + final int graceDaysRemaining; + + /// Total grace days allowed. + final int totalGraceDays; + + /// Whether the streak is currently frozen. + final bool isFrozen; + + /// Size of the widget (width & height). + final double size; + + /// Optional label beneath the count. + final String? label; + + const StreakRing({ + super.key, + required this.currentCount, + this.graceDaysRemaining = 0, + this.totalGraceDays = 2, + this.isFrozen = false, + this.size = 100, + this.label, + }); + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + + return SizedBox( + width: size, + height: size, + child: CustomPaint( + painter: _StreakRingPainter( + progress: _progress, + graceProgress: _graceProgress, + isFrozen: isFrozen, + activeColor: AppColors.primary, + graceColor: AppColors.skipped, + frozenColor: AppColors.primaryLight, + backgroundColor: theme.dividerColor.withAlpha(50), + ), + child: Center( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + if (isFrozen) + Icon(Icons.ac_unit_rounded, + size: size * 0.22, color: AppColors.primaryLight) + else + Text( + '$currentCount', + style: theme.textTheme.headlineSmall?.copyWith( + fontWeight: FontWeight.w800, + fontSize: size * 0.26, + ), + ), + if (label != null) + Text( + label!, + style: theme.textTheme.bodySmall?.copyWith(fontSize: size * 0.1), + textAlign: TextAlign.center, + ), + ], + ), + ), + ), + ); + } + + /// Normalised 0-1 progress for the main ring. + /// We cap visual progress at 1.0 but the count can exceed 30. + double get _progress => (currentCount / 30).clamp(0.0, 1.0); + + /// Grace segment progress (shown as dashed portion after the main ring). + double get _graceProgress { + if (totalGraceDays == 0) return 0; + return ((totalGraceDays - graceDaysRemaining) / totalGraceDays).clamp(0.0, 1.0); + } +} + +class _StreakRingPainter extends CustomPainter { + final double progress; + final double graceProgress; + final bool isFrozen; + final Color activeColor; + final Color graceColor; + final Color frozenColor; + final Color backgroundColor; + + _StreakRingPainter({ + required this.progress, + required this.graceProgress, + required this.isFrozen, + required this.activeColor, + required this.graceColor, + required this.frozenColor, + required this.backgroundColor, + }); + + @override + void paint(Canvas canvas, Size size) { + final center = Offset(size.width / 2, size.height / 2); + final radius = (size.shortestSide / 2) - 6; + const strokeWidth = 8.0; + const startAngle = -math.pi / 2; + + // Background ring + canvas.drawCircle( + center, + radius, + Paint() + ..color = backgroundColor + ..style = PaintingStyle.stroke + ..strokeWidth = strokeWidth + ..strokeCap = StrokeCap.round, + ); + + // Main progress arc + final sweepAngle = 2 * math.pi * progress; + if (progress > 0) { + canvas.drawArc( + Rect.fromCircle(center: center, radius: radius), + startAngle, + sweepAngle, + false, + Paint() + ..color = isFrozen ? frozenColor : activeColor + ..style = PaintingStyle.stroke + ..strokeWidth = strokeWidth + ..strokeCap = StrokeCap.round, + ); + } + + // Grace dashed segments (small arcs after the progress) + if (graceProgress > 0 && !isFrozen) { + const graceArcLength = math.pi / 8; // each dash length + final graceStart = startAngle + sweepAngle + 0.05; + final dashCount = (graceProgress * 3).ceil().clamp(0, 3); + + for (int i = 0; i < dashCount; i++) { + final dashStart = graceStart + i * (graceArcLength + 0.06); + canvas.drawArc( + Rect.fromCircle(center: center, radius: radius), + dashStart, + graceArcLength, + false, + Paint() + ..color = graceColor + ..style = PaintingStyle.stroke + ..strokeWidth = strokeWidth * 0.6 + ..strokeCap = StrokeCap.round, + ); + } + } + } + + @override + bool shouldRepaint(covariant _StreakRingPainter oldDelegate) => + progress != oldDelegate.progress || + graceProgress != oldDelegate.graceProgress || + isFrozen != oldDelegate.isFrozen; +} diff --git a/lib/core/widgets/task_card.dart b/lib/core/widgets/task_card.dart new file mode 100644 index 0000000..5ab5b36 --- /dev/null +++ b/lib/core/widgets/task_card.dart @@ -0,0 +1,215 @@ +import 'package:flutter/material.dart'; +import 'package:focusflow_shared/focusflow_shared.dart'; + +import '../theme/app_colors.dart'; + +/// ADHD-friendly task card. +/// +/// Design principles: +/// - Large title text for scannability. +/// - Energy level indicator (colored dot). +/// - Estimated time badge. +/// - Tags as small chips. +/// - Gentle color coding — NO overwhelming information density. +/// - Tap to open, long-press for quick actions. +class TaskCard extends StatelessWidget { + final Task task; + final VoidCallback? onTap; + final VoidCallback? onComplete; + final VoidCallback? onSkip; + + const TaskCard({ + super.key, + required this.task, + this.onTap, + this.onComplete, + this.onSkip, + }); + + Color _energyColor() { + switch (task.energyLevel) { + case 'low': + return AppColors.energyLow; + case 'high': + return AppColors.energyHigh; + default: + return AppColors.energyMedium; + } + } + + String _energyLabel() { + switch (task.energyLevel) { + case 'low': + return 'Low'; + case 'high': + return 'High'; + default: + return 'Med'; + } + } + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + + return Card( + child: InkWell( + borderRadius: BorderRadius.circular(16), + onTap: onTap, + onLongPress: () => _showQuickActions(context), + child: Padding( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // ── Top row: title + energy dot ───────────────────── + Row( + children: [ + // Energy dot + Container( + width: 12, + height: 12, + decoration: BoxDecoration( + color: _energyColor(), + shape: BoxShape.circle, + ), + ), + const SizedBox(width: 10), + + // Title + Expanded( + child: Text( + task.title, + style: theme.textTheme.titleMedium?.copyWith( + fontSize: 18, + fontWeight: FontWeight.w600, + ), + maxLines: 2, + overflow: TextOverflow.ellipsis, + ), + ), + ], + ), + + if (task.description != null && task.description!.isNotEmpty) ...[ + const SizedBox(height: 6), + Text( + task.description!, + style: theme.textTheme.bodyMedium, + maxLines: 2, + overflow: TextOverflow.ellipsis, + ), + ], + + const SizedBox(height: 12), + + // ── Bottom row: badges & tags ────────────────────── + Wrap( + spacing: 8, + runSpacing: 6, + children: [ + // Energy badge + _Badge( + icon: Icons.bolt_rounded, + label: _energyLabel(), + color: _energyColor(), + ), + + // Estimated time + if (task.estimatedMinutes != null) + _Badge( + icon: Icons.timer_outlined, + label: '${task.estimatedMinutes} min', + color: AppColors.primary, + ), + + // Category + if (task.category != null) + _Badge( + icon: Icons.label_outline, + label: task.category!, + color: AppColors.tertiary, + ), + + // Tags + ...task.tags.take(3).map((tag) => Chip( + label: Text(tag, style: const TextStyle(fontSize: 11)), + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + visualDensity: VisualDensity.compact, + padding: EdgeInsets.zero, + )), + ], + ), + ], + ), + ), + ), + ); + } + + void _showQuickActions(BuildContext context) { + showModalBottomSheet( + context: context, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.vertical(top: Radius.circular(20)), + ), + builder: (ctx) => SafeArea( + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 16), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + ListTile( + leading: const Icon(Icons.check_circle_outline, color: AppColors.completed), + title: const Text('Mark as done'), + onTap: () { + Navigator.pop(ctx); + onComplete?.call(); + }, + ), + ListTile( + leading: const Icon(Icons.skip_next_outlined, color: AppColors.skipped), + title: const Text('Skip for now'), + onTap: () { + Navigator.pop(ctx); + onSkip?.call(); + }, + ), + ], + ), + ), + ), + ); + } +} + +/// Small coloured badge used inside [TaskCard]. +class _Badge extends StatelessWidget { + final IconData icon; + final String label; + final Color color; + + const _Badge({required this.icon, required this.label, required this.color}); + + @override + Widget build(BuildContext context) { + return Container( + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), + decoration: BoxDecoration( + color: color.withAlpha(30), + borderRadius: BorderRadius.circular(12), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(icon, size: 14, color: color), + const SizedBox(width: 4), + Text( + label, + style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: color), + ), + ], + ), + ); + } +} diff --git a/lib/core/widgets/time_visualizer.dart b/lib/core/widgets/time_visualizer.dart new file mode 100644 index 0000000..ca2f6f9 --- /dev/null +++ b/lib/core/widgets/time_visualizer.dart @@ -0,0 +1,125 @@ +import 'package:flutter/material.dart'; + +import '../theme/app_colors.dart'; + +/// Visual time block widget showing estimated vs actual duration. +/// +/// - Horizontal bar: green (under estimate) -> yellow (near) -> soft orange (over). +/// - NO red — going over is shown gently, not punitively. +class TimeVisualizer extends StatelessWidget { + /// Estimated duration in minutes. + final int estimatedMinutes; + + /// Actual duration in minutes (null if not yet completed). + final int? actualMinutes; + + /// Optional height for the bars. + final double barHeight; + + const TimeVisualizer({ + super.key, + required this.estimatedMinutes, + this.actualMinutes, + this.barHeight = 12, + }); + + /// Returns a color based on actual / estimated ratio. + /// <= 0.8 -> green (under) + /// 0.8-1.1 -> teal (on time) + /// 1.1-1.5 -> yellow (slightly over) + /// > 1.5 -> soft orange (over, but gentle) + Color _barColor(double ratio) { + if (ratio <= 0.8) return AppColors.completed; + if (ratio <= 1.1) return AppColors.primary; + if (ratio <= 1.5) return AppColors.energyMedium; + return AppColors.energyHigh; // soft orange, NOT red + } + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + final actual = actualMinutes; + final hasActual = actual != null && actual > 0; + + // If no actual yet, show just the estimate bar. + final ratio = hasActual ? actual / estimatedMinutes : 0.0; + final estimateWidth = 1.0; // always full width = estimate + final actualWidth = hasActual ? ratio.clamp(0.0, 2.0) / 2.0 : 0.0; + + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + // Labels + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + 'Estimated: $estimatedMinutes min', + style: theme.textTheme.bodySmall, + ), + if (hasActual) + Text( + 'Actual: $actual min', + style: theme.textTheme.bodySmall?.copyWith( + fontWeight: FontWeight.w600, + color: _barColor(ratio), + ), + ), + ], + ), + const SizedBox(height: 6), + + // ── Estimate bar (background / reference) ────────────────── + ClipRRect( + borderRadius: BorderRadius.circular(barHeight / 2), + child: Stack( + children: [ + // Full estimate background + Container( + height: barHeight, + width: double.infinity, + decoration: BoxDecoration( + color: AppColors.primary.withAlpha(30), + borderRadius: BorderRadius.circular(barHeight / 2), + ), + ), + + // Actual fill + if (hasActual) + FractionallySizedBox( + widthFactor: actualWidth.clamp(0.0, estimateWidth), + child: Container( + height: barHeight, + decoration: BoxDecoration( + color: _barColor(ratio), + borderRadius: BorderRadius.circular(barHeight / 2), + ), + ), + ), + ], + ), + ), + + // ── Gentle insight ───────────────────────────────────────── + if (hasActual) ...[ + const SizedBox(height: 4), + Text( + _insightText(ratio), + style: theme.textTheme.bodySmall?.copyWith( + color: _barColor(ratio), + fontWeight: FontWeight.w500, + ), + ), + ], + ], + ); + } + + String _insightText(double ratio) { + if (ratio <= 0.8) return 'Finished early — nice!'; + if (ratio <= 1.1) return 'Right on target.'; + if (ratio <= 1.5) return 'A little over — totally fine.'; + return 'Took longer than expected. That happens!'; + } +} diff --git a/lib/features/auth/presentation/bloc/auth_bloc.dart b/lib/features/auth/presentation/bloc/auth_bloc.dart new file mode 100644 index 0000000..c7b7fc2 --- /dev/null +++ b/lib/features/auth/presentation/bloc/auth_bloc.dart @@ -0,0 +1,151 @@ +import 'package:equatable/equatable.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:focusflow_shared/focusflow_shared.dart'; + +import '../../../../core/network/api_client.dart'; +import '../../../../core/network/interceptors/auth_interceptor.dart'; +import '../../../../main.dart'; + +// ── Events ───────────────────────────────────────────────────────── + +sealed class AuthEvent extends Equatable { + const AuthEvent(); + @override + List get props => []; +} + +class AuthLoginRequested extends AuthEvent { + final String email; + final String password; + const AuthLoginRequested({required this.email, required this.password}); + @override + List get props => [email, password]; +} + +class AuthSignupRequested extends AuthEvent { + final String displayName; + final String email; + final String password; + const AuthSignupRequested({ + required this.displayName, + required this.email, + required this.password, + }); + @override + List get props => [displayName, email, password]; +} + +class AuthLogoutRequested extends AuthEvent { + const AuthLogoutRequested(); +} + +class AuthCheckRequested extends AuthEvent {} + +// ── States ───────────────────────────────────────────────────────── + +sealed class AuthState extends Equatable { + const AuthState(); + @override + List get props => []; +} + +class AuthInitial extends AuthState {} + +class AuthLoading extends AuthState {} + +class AuthAuthenticated extends AuthState { + final User user; + const AuthAuthenticated(this.user); + @override + List get props => [user]; +} + +class AuthUnauthenticated extends AuthState {} + +class AuthError extends AuthState { + final String message; + const AuthError(this.message); + @override + List get props => [message]; +} + +// ── BLoC ─────────────────────────────────────────────────────────── + +class AuthBloc extends Bloc { + final ApiClient _api = getIt(); + + AuthBloc() : super(AuthInitial()) { + on(_onCheck); + on(_onLogin); + on(_onSignup); + on(_onLogout); + } + + Future _onCheck(AuthCheckRequested event, Emitter emit) async { + final hasToken = await AuthInterceptor.hasToken(); + if (hasToken) { + // In a production app we would validate the token and fetch the user profile. + // For now we emit a placeholder user. + emit(AuthAuthenticated( + User( + id: 'local', + email: '', + displayName: 'Friend', + createdAt: DateTime.now(), + ), + )); + } else { + emit(AuthUnauthenticated()); + } + } + + Future _onLogin(AuthLoginRequested event, Emitter emit) async { + emit(AuthLoading()); + try { + final response = await _api.login(event.email, event.password); + if (response.status == 'success' && response.data != null) { + final data = response.data!; + await AuthInterceptor.saveTokens( + accessToken: data['accessToken'] as String, + refreshToken: data['refreshToken'] as String, + ); + final user = User.fromJson(data['user'] as Map); + emit(AuthAuthenticated(user)); + } else { + emit(AuthError(response.error?.message ?? 'Login failed')); + } + } catch (e) { + emit(AuthError('Something went wrong. Please try again.')); + } + } + + Future _onSignup(AuthSignupRequested event, Emitter emit) async { + emit(AuthLoading()); + try { + final response = await _api.register(event.displayName, event.email, event.password); + if (response.status == 'success' && response.data != null) { + final data = response.data!; + await AuthInterceptor.saveTokens( + accessToken: data['accessToken'] as String, + refreshToken: data['refreshToken'] as String, + ); + final user = User.fromJson(data['user'] as Map); + emit(AuthAuthenticated(user)); + } else { + emit(AuthError(response.error?.message ?? 'Sign up failed')); + } + } catch (e) { + emit(AuthError('Something went wrong. Please try again.')); + } + } + + Future _onLogout(AuthLogoutRequested event, Emitter emit) async { + try { + await _api.logout(); + } catch (_) { + // Best-effort server logout — clear local tokens regardless. + } + await AuthInterceptor.clearTokens(); + emit(AuthUnauthenticated()); + } +} diff --git a/lib/features/auth/presentation/screens/login_screen.dart b/lib/features/auth/presentation/screens/login_screen.dart new file mode 100644 index 0000000..ebc66bf --- /dev/null +++ b/lib/features/auth/presentation/screens/login_screen.dart @@ -0,0 +1,153 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:go_router/go_router.dart'; + +import '../../../../core/theme/app_colors.dart'; +import '../bloc/auth_bloc.dart'; + +/// Clean, ADHD-friendly login screen. +/// +/// Minimal fields, large touch targets, clear labels, calming tone. +class LoginScreen extends StatefulWidget { + const LoginScreen({super.key}); + + @override + State createState() => _LoginScreenState(); +} + +class _LoginScreenState extends State { + final _formKey = GlobalKey(); + final _emailController = TextEditingController(); + final _passwordController = TextEditingController(); + bool _obscurePassword = true; + + @override + void dispose() { + _emailController.dispose(); + _passwordController.dispose(); + super.dispose(); + } + + void _submit() { + if (_formKey.currentState?.validate() ?? false) { + context.read().add(AuthLoginRequested( + email: _emailController.text.trim(), + password: _passwordController.text, + )); + } + } + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + + return Scaffold( + body: BlocListener( + listener: (context, state) { + if (state is AuthAuthenticated) { + context.go('/'); + } else if (state is AuthError) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text(state.message)), + ); + } + }, + child: SafeArea( + child: Center( + child: SingleChildScrollView( + padding: const EdgeInsets.symmetric(horizontal: 28, vertical: 24), + child: Form( + key: _formKey, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + // ── Logo / Title ───────────────────────────────── + Icon(Icons.self_improvement_rounded, + size: 64, color: AppColors.primary), + const SizedBox(height: 12), + Text('FocusFlow', style: theme.textTheme.headlineLarge), + const SizedBox(height: 8), + Text( + 'Welcome back. Let\'s get things done — gently.', + style: theme.textTheme.bodyMedium, + textAlign: TextAlign.center, + ), + const SizedBox(height: 40), + + // ── Email ──────────────────────────────────────── + TextFormField( + controller: _emailController, + keyboardType: TextInputType.emailAddress, + textInputAction: TextInputAction.next, + decoration: const InputDecoration( + labelText: 'Email', + prefixIcon: Icon(Icons.email_outlined), + ), + validator: (v) { + if (v == null || v.trim().isEmpty) return 'Email is required'; + if (!v.contains('@')) return 'Enter a valid email'; + return null; + }, + ), + const SizedBox(height: 16), + + // ── Password ───────────────────────────────────── + TextFormField( + controller: _passwordController, + obscureText: _obscurePassword, + textInputAction: TextInputAction.done, + onFieldSubmitted: (_) => _submit(), + decoration: InputDecoration( + labelText: 'Password', + prefixIcon: const Icon(Icons.lock_outline), + suffixIcon: IconButton( + icon: Icon(_obscurePassword + ? Icons.visibility_off_outlined + : Icons.visibility_outlined), + onPressed: () => + setState(() => _obscurePassword = !_obscurePassword), + ), + ), + validator: (v) { + if (v == null || v.isEmpty) return 'Password is required'; + return null; + }, + ), + const SizedBox(height: 28), + + // ── Sign in button ─────────────────────────────── + BlocBuilder( + builder: (context, state) { + final loading = state is AuthLoading; + return FilledButton( + onPressed: loading ? null : _submit, + child: loading + ? const SizedBox( + height: 22, + width: 22, + child: CircularProgressIndicator( + strokeWidth: 2, + color: Colors.white, + ), + ) + : const Text('Sign In'), + ); + }, + ), + const SizedBox(height: 16), + + // ── Create account link ────────────────────────── + TextButton( + onPressed: () => context.go('/signup'), + child: const Text('Don\'t have an account? Create one'), + ), + ], + ), + ), + ), + ), + ), + ), + ); + } +} diff --git a/lib/features/auth/presentation/screens/signup_screen.dart b/lib/features/auth/presentation/screens/signup_screen.dart new file mode 100644 index 0000000..0e2dec9 --- /dev/null +++ b/lib/features/auth/presentation/screens/signup_screen.dart @@ -0,0 +1,169 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:go_router/go_router.dart'; + +import '../../../../core/theme/app_colors.dart'; +import '../bloc/auth_bloc.dart'; + +/// Sign-up screen — minimal fields to reduce friction. +class SignupScreen extends StatefulWidget { + const SignupScreen({super.key}); + + @override + State createState() => _SignupScreenState(); +} + +class _SignupScreenState extends State { + final _formKey = GlobalKey(); + final _nameController = TextEditingController(); + final _emailController = TextEditingController(); + final _passwordController = TextEditingController(); + bool _obscurePassword = true; + + @override + void dispose() { + _nameController.dispose(); + _emailController.dispose(); + _passwordController.dispose(); + super.dispose(); + } + + void _submit() { + if (_formKey.currentState?.validate() ?? false) { + context.read().add(AuthSignupRequested( + displayName: _nameController.text.trim(), + email: _emailController.text.trim(), + password: _passwordController.text, + )); + } + } + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + + return Scaffold( + body: BlocListener( + listener: (context, state) { + if (state is AuthAuthenticated) { + context.go('/onboarding'); + } else if (state is AuthError) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text(state.message)), + ); + } + }, + child: SafeArea( + child: Center( + child: SingleChildScrollView( + padding: const EdgeInsets.symmetric(horizontal: 28, vertical: 24), + child: Form( + key: _formKey, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(Icons.emoji_nature_rounded, + size: 64, color: AppColors.primary), + const SizedBox(height: 12), + Text('Join FocusFlow', style: theme.textTheme.headlineLarge), + const SizedBox(height: 8), + Text( + 'Built for brains like yours. No judgement, just support.', + style: theme.textTheme.bodyMedium, + textAlign: TextAlign.center, + ), + const SizedBox(height: 40), + + // ── Display name ───────────────────────────────── + TextFormField( + controller: _nameController, + textInputAction: TextInputAction.next, + decoration: const InputDecoration( + labelText: 'What should we call you?', + prefixIcon: Icon(Icons.person_outline), + ), + validator: (v) { + if (v == null || v.trim().isEmpty) return 'A name helps us personalise things'; + return null; + }, + ), + const SizedBox(height: 16), + + // ── Email ──────────────────────────────────────── + TextFormField( + controller: _emailController, + keyboardType: TextInputType.emailAddress, + textInputAction: TextInputAction.next, + decoration: const InputDecoration( + labelText: 'Email', + prefixIcon: Icon(Icons.email_outlined), + ), + validator: (v) { + if (v == null || v.trim().isEmpty) return 'Email is required'; + if (!v.contains('@')) return 'Enter a valid email'; + return null; + }, + ), + const SizedBox(height: 16), + + // ── Password ───────────────────────────────────── + TextFormField( + controller: _passwordController, + obscureText: _obscurePassword, + textInputAction: TextInputAction.done, + onFieldSubmitted: (_) => _submit(), + decoration: InputDecoration( + labelText: 'Password', + prefixIcon: const Icon(Icons.lock_outline), + suffixIcon: IconButton( + icon: Icon(_obscurePassword + ? Icons.visibility_off_outlined + : Icons.visibility_outlined), + onPressed: () => + setState(() => _obscurePassword = !_obscurePassword), + ), + ), + validator: (v) { + if (v == null || v.length < 8) { + return 'At least 8 characters'; + } + return null; + }, + ), + const SizedBox(height: 28), + + // ── Create account button ──────────────────────── + BlocBuilder( + builder: (context, state) { + final loading = state is AuthLoading; + return FilledButton( + onPressed: loading ? null : _submit, + child: loading + ? const SizedBox( + height: 22, + width: 22, + child: CircularProgressIndicator( + strokeWidth: 2, + color: Colors.white, + ), + ) + : const Text('Create Account'), + ); + }, + ), + const SizedBox(height: 16), + + TextButton( + onPressed: () => context.go('/login'), + child: const Text('Already have an account? Sign in'), + ), + ], + ), + ), + ), + ), + ), + ), + ); + } +} diff --git a/lib/features/body_doubling/presentation/screens/rooms_screen.dart b/lib/features/body_doubling/presentation/screens/rooms_screen.dart new file mode 100644 index 0000000..74d77b7 --- /dev/null +++ b/lib/features/body_doubling/presentation/screens/rooms_screen.dart @@ -0,0 +1,72 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; + +import '../../../../core/theme/app_colors.dart'; + +/// Placeholder screen for the body doubling / virtual coworking rooms feature. +class RoomsScreen extends StatelessWidget { + const RoomsScreen({super.key}); + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + + return Scaffold( + appBar: AppBar( + leading: IconButton( + icon: const Icon(Icons.arrow_back_rounded), + onPressed: () => context.go('/'), + ), + title: const Text('Body Doubling'), + ), + body: Center( + child: Padding( + padding: const EdgeInsets.all(32), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(Icons.groups_rounded, size: 80, color: AppColors.tertiary.withAlpha(180)), + const SizedBox(height: 24), + Text( + 'Body Doubling', + style: theme.textTheme.headlineMedium?.copyWith( + fontWeight: FontWeight.w700, + ), + textAlign: TextAlign.center, + ), + const SizedBox(height: 8), + Text( + 'Coming Soon', + style: theme.textTheme.titleLarge?.copyWith( + color: AppColors.tertiary, + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 20), + Text( + 'Body doubling is a technique where having another person nearby ' + 'helps you stay focused. Soon you\'ll be able to join virtual ' + 'coworking rooms, work alongside others in real-time, and pick ' + 'ambient sounds like a caf\u00e9 or rain.', + style: theme.textTheme.bodyLarge, + textAlign: TextAlign.center, + ), + const SizedBox(height: 28), + OutlinedButton.icon( + onPressed: () { + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar( + content: Text('We\'ll notify you when body doubling rooms launch!'), + ), + ); + }, + icon: const Icon(Icons.notifications_active_outlined), + label: const Text('Notify me'), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/features/rewards/presentation/cubit/reward_cubit.dart b/lib/features/rewards/presentation/cubit/reward_cubit.dart new file mode 100644 index 0000000..01b8140 --- /dev/null +++ b/lib/features/rewards/presentation/cubit/reward_cubit.dart @@ -0,0 +1,48 @@ +import 'package:equatable/equatable.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:focusflow_shared/focusflow_shared.dart'; + +// ── States ───────────────────────────────────────────────────────── + +sealed class RewardState extends Equatable { + const RewardState(); + @override + List get props => []; +} + +class RewardIdle extends RewardState {} + +class RewardShowing extends RewardState { + final Reward reward; + const RewardShowing(this.reward); + @override + List get props => [reward]; +} + +class RewardDismissed extends RewardState {} + +// ── Cubit ────────────────────────────────────────────────────────── + +/// Manages the reward overlay display lifecycle. +/// +/// Flow: +/// 1. After a task is completed, call [showReward]. +/// 2. The UI renders [RewardPopup] when state is [RewardShowing]. +/// 3. User taps dismiss -> call [dismiss]. +class RewardCubit extends Cubit { + RewardCubit() : super(RewardIdle()); + + /// Show a reward to the user. + void showReward(Reward reward) { + emit(RewardShowing(reward)); + } + + /// Dismiss the current reward and return to idle. + void dismiss() { + emit(RewardDismissed()); + // Brief delay then return to idle so the cubit is ready for the next reward. + Future.delayed(const Duration(milliseconds: 300), () { + if (!isClosed) emit(RewardIdle()); + }); + } +} diff --git a/lib/features/settings/presentation/screens/settings_screen.dart b/lib/features/settings/presentation/screens/settings_screen.dart new file mode 100644 index 0000000..2b82592 --- /dev/null +++ b/lib/features/settings/presentation/screens/settings_screen.dart @@ -0,0 +1,196 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:go_router/go_router.dart'; + +import '../../../../core/theme/app_colors.dart'; +import '../../../../features/auth/presentation/bloc/auth_bloc.dart'; + +/// Settings screen. +/// +/// - Notification preferences. +/// - Daily task load slider (1-10). +/// - Focus session length. +/// - Reward style (playful / minimal / data). +/// - Forgiveness toggle. +/// - Theme (light / dark / system). +/// - Account management. +class SettingsScreen extends StatefulWidget { + const SettingsScreen({super.key}); + + @override + State createState() => _SettingsScreenState(); +} + +class _SettingsScreenState extends State { + // ── Local preference state ─────────────────────────────────────── + bool _notificationsEnabled = true; + double _taskLoad = 5; + double _focusMinutes = 25; + String _rewardStyle = 'playful'; + bool _forgivenessEnabled = true; + ThemeMode _themeMode = ThemeMode.system; + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + + return Scaffold( + appBar: AppBar( + leading: IconButton( + icon: const Icon(Icons.arrow_back_rounded), + onPressed: () => context.go('/'), + ), + title: const Text('Settings'), + ), + body: ListView( + padding: const EdgeInsets.symmetric(vertical: 8), + children: [ + // ── Notifications ──────────────────────────────────────── + _SectionTitle('Notifications'), + SwitchListTile( + title: const Text('Enable notifications'), + subtitle: const Text('Gentle reminders, never nagging'), + value: _notificationsEnabled, + onChanged: (v) => setState(() => _notificationsEnabled = v), + ), + const Divider(), + + // ── Daily task load ────────────────────────────────────── + _SectionTitle('Daily Task Load'), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Row( + children: [ + Expanded( + child: Slider( + value: _taskLoad, + min: 1, + max: 10, + divisions: 9, + label: _taskLoad.round().toString(), + onChanged: (v) => setState(() => _taskLoad = v), + ), + ), + Text( + '${_taskLoad.round()} tasks', + style: theme.textTheme.bodyLarge?.copyWith(fontWeight: FontWeight.w600), + ), + ], + ), + ), + const Divider(), + + // ── Focus session length ───────────────────────────────── + _SectionTitle('Focus Session Length'), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Row( + children: [ + Expanded( + child: Slider( + value: _focusMinutes, + min: 5, + max: 60, + divisions: 11, + label: '${_focusMinutes.round()} min', + onChanged: (v) => setState(() => _focusMinutes = v), + ), + ), + Text( + '${_focusMinutes.round()} min', + style: theme.textTheme.bodyLarge?.copyWith(fontWeight: FontWeight.w600), + ), + ], + ), + ), + const Divider(), + + // ── Reward style ───────────────────────────────────────── + _SectionTitle('Reward Style'), + RadioListTile( + title: const Text('Playful (animations & messages)'), + value: 'playful', + groupValue: _rewardStyle, + onChanged: (v) => setState(() => _rewardStyle = v!), + ), + RadioListTile( + title: const Text('Minimal (subtle feedback)'), + value: 'minimal', + groupValue: _rewardStyle, + onChanged: (v) => setState(() => _rewardStyle = v!), + ), + RadioListTile( + title: const Text('Data-driven (stats & charts)'), + value: 'data', + groupValue: _rewardStyle, + onChanged: (v) => setState(() => _rewardStyle = v!), + ), + const Divider(), + + // ── Forgiveness toggle ─────────────────────────────────── + _SectionTitle('Forgiveness'), + SwitchListTile( + title: const Text('Enable grace days'), + subtitle: const Text('Missed a day? Grace days protect your streaks.'), + value: _forgivenessEnabled, + onChanged: (v) => setState(() => _forgivenessEnabled = v), + ), + const Divider(), + + // ── Theme ──────────────────────────────────────────────── + _SectionTitle('Theme'), + RadioListTile( + title: const Text('System default'), + value: ThemeMode.system, + groupValue: _themeMode, + onChanged: (v) => setState(() => _themeMode = v!), + ), + RadioListTile( + title: const Text('Light'), + value: ThemeMode.light, + groupValue: _themeMode, + onChanged: (v) => setState(() => _themeMode = v!), + ), + RadioListTile( + title: const Text('Dark'), + value: ThemeMode.dark, + groupValue: _themeMode, + onChanged: (v) => setState(() => _themeMode = v!), + ), + const Divider(), + + // ── Account ────────────────────────────────────────────── + _SectionTitle('Account'), + ListTile( + leading: const Icon(Icons.logout_rounded, color: AppColors.error), + title: const Text('Sign out'), + onTap: () { + context.read().add(const AuthLogoutRequested()); + context.go('/login'); + }, + ), + const SizedBox(height: 40), + ], + ), + ); + } +} + +class _SectionTitle extends StatelessWidget { + final String title; + const _SectionTitle(this.title); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.fromLTRB(16, 16, 16, 4), + child: Text( + title, + style: Theme.of(context).textTheme.titleSmall?.copyWith( + color: AppColors.primary, + fontWeight: FontWeight.w700, + ), + ), + ); + } +} diff --git a/lib/features/streaks/presentation/bloc/streak_bloc.dart b/lib/features/streaks/presentation/bloc/streak_bloc.dart new file mode 100644 index 0000000..9b52680 --- /dev/null +++ b/lib/features/streaks/presentation/bloc/streak_bloc.dart @@ -0,0 +1,120 @@ +import 'package:equatable/equatable.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:focusflow_shared/focusflow_shared.dart'; + +import '../../../../core/network/api_client.dart'; +import '../../../../main.dart'; + +// ── Events ───────────────────────────────────────────────────────── + +sealed class StreakEvent extends Equatable { + const StreakEvent(); + @override + List get props => []; +} + +class StreaksLoaded extends StreakEvent { + const StreaksLoaded(); +} + +class StreakCompleted extends StreakEvent { + final String id; + const StreakCompleted(this.id); + @override + List get props => [id]; +} + +class StreakForgiven extends StreakEvent { + final String id; + const StreakForgiven(this.id); + @override + List get props => [id]; +} + +class StreakFrozen extends StreakEvent { + final String id; + final DateTime until; + const StreakFrozen(this.id, this.until); + @override + List get props => [id, until]; +} + +// ── States ───────────────────────────────────────────────────────── + +sealed class StreakState extends Equatable { + const StreakState(); + @override + List get props => []; +} + +class StreakInitial extends StreakState {} + +class StreakLoading extends StreakState {} + +class StreakLoaded extends StreakState { + final List streaks; + const StreakLoaded(this.streaks); + @override + List get props => [streaks]; +} + +class StreakError extends StreakState { + final String message; + const StreakError(this.message); + @override + List get props => [message]; +} + +// ── BLoC ─────────────────────────────────────────────────────────── + +class StreakBloc extends Bloc { + final ApiClient _api = getIt(); + + StreakBloc() : super(StreakInitial()) { + on(_onLoaded); + on(_onCompleted); + on(_onForgiven); + on(_onFrozen); + } + + Future _onLoaded(StreaksLoaded event, Emitter emit) async { + emit(StreakLoading()); + try { + final response = await _api.fetchStreaks(); + final data = response.data; + if (data != null && data['status'] == 'success') { + final items = (data['data'] as List) + .map((e) => Streak.fromJson(e as Map)) + .toList(); + emit(StreakLoaded(items)); + } else { + emit(const StreakError('Could not load streaks.')); + } + } catch (_) { + emit(const StreakError('Something went wrong loading streaks.')); + } + } + + Future _onCompleted(StreakCompleted event, Emitter emit) async { + try { + await _api.completeStreak(event.id); + add(const StreaksLoaded()); + } catch (_) { + emit(const StreakError('Could not complete streak entry.')); + } + } + + Future _onForgiven(StreakForgiven event, Emitter emit) async { + try { + await _api.forgiveStreak(event.id); + add(const StreaksLoaded()); + } catch (_) { + emit(const StreakError('Could not forgive streak.')); + } + } + + Future _onFrozen(StreakFrozen event, Emitter emit) async { + // TODO: API call to freeze streak until `event.until`. + add(const StreaksLoaded()); + } +} diff --git a/lib/features/streaks/presentation/screens/streaks_screen.dart b/lib/features/streaks/presentation/screens/streaks_screen.dart new file mode 100644 index 0000000..2db1560 --- /dev/null +++ b/lib/features/streaks/presentation/screens/streaks_screen.dart @@ -0,0 +1,229 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:focusflow_shared/focusflow_shared.dart'; +import 'package:go_router/go_router.dart'; + +import '../../../../core/theme/app_colors.dart'; +import '../../../../core/widgets/streak_ring.dart'; +import '../bloc/streak_bloc.dart'; + +/// Streak overview screen. +/// +/// - Active streaks as cards with [StreakRing] widget. +/// - "Frozen" indicator for paused streaks. +/// - Tap to see history. +/// - "New Streak" FAB. +/// - Grace day info shown positively. +class StreaksScreen extends StatefulWidget { + const StreaksScreen({super.key}); + + @override + State createState() => _StreaksScreenState(); +} + +class _StreaksScreenState extends State { + late final StreakBloc _bloc; + + @override + void initState() { + super.initState(); + _bloc = StreakBloc()..add(const StreaksLoaded()); + } + + @override + void dispose() { + _bloc.close(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + + return BlocProvider.value( + value: _bloc, + child: Scaffold( + appBar: AppBar( + leading: IconButton( + icon: const Icon(Icons.arrow_back_rounded), + onPressed: () => context.go('/'), + ), + title: const Text('Your Streaks'), + ), + body: BlocBuilder( + builder: (context, state) { + if (state is StreakLoading) { + return const Center(child: CircularProgressIndicator()); + } + + if (state is StreakError) { + return Center( + child: Padding( + padding: const EdgeInsets.all(32), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + const Icon(Icons.cloud_off_rounded, size: 48, color: AppColors.skipped), + const SizedBox(height: 12), + Text(state.message, style: theme.textTheme.bodyLarge, textAlign: TextAlign.center), + const SizedBox(height: 16), + FilledButton( + onPressed: () => _bloc.add(const StreaksLoaded()), + child: const Text('Retry'), + ), + ], + ), + ), + ); + } + + if (state is StreakLoaded) { + if (state.streaks.isEmpty) { + return Center( + child: Padding( + padding: const EdgeInsets.all(32), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + const Icon(Icons.local_fire_department_rounded, + size: 56, color: AppColors.tertiary), + const SizedBox(height: 12), + Text('No streaks yet', + style: theme.textTheme.titleMedium), + const SizedBox(height: 4), + Text( + 'Start a streak to build consistency — with grace days built in.', + style: theme.textTheme.bodyMedium, + textAlign: TextAlign.center, + ), + ], + ), + ), + ); + } + + return ListView.builder( + padding: const EdgeInsets.only(top: 8, bottom: 100), + itemCount: state.streaks.length, + itemBuilder: (context, index) { + final streak = state.streaks[index]; + return _StreakCard( + streak: streak, + onComplete: () => _bloc.add(StreakCompleted(streak.id)), + ); + }, + ); + } + + return const SizedBox.shrink(); + }, + ), + floatingActionButton: FloatingActionButton.extended( + onPressed: () { + // TODO: navigate to create streak screen. + }, + icon: const Icon(Icons.add_rounded), + label: const Text('New Streak'), + ), + ), + ); + } +} + +class _StreakCard extends StatelessWidget { + final Streak streak; + final VoidCallback onComplete; + + const _StreakCard({required this.streak, required this.onComplete}); + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + final isFrozen = streak.frozenUntil != null && + streak.frozenUntil!.isAfter(DateTime.now()); + final graceDaysRemaining = streak.graceDays - streak.graceUsed; + + return Card( + child: InkWell( + borderRadius: BorderRadius.circular(16), + onTap: () { + // TODO: navigate to streak history. + }, + child: Padding( + padding: const EdgeInsets.all(16), + child: Row( + children: [ + StreakRing( + currentCount: streak.currentCount, + graceDaysRemaining: graceDaysRemaining, + totalGraceDays: streak.graceDays, + isFrozen: isFrozen, + size: 72, + ), + const SizedBox(width: 16), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: Text( + streak.name, + style: theme.textTheme.titleMedium?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + ), + if (isFrozen) + Container( + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), + decoration: BoxDecoration( + color: AppColors.primaryLight.withAlpha(40), + borderRadius: BorderRadius.circular(12), + ), + child: const Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(Icons.ac_unit_rounded, size: 14, color: AppColors.primaryLight), + SizedBox(width: 4), + Text('Frozen', + style: TextStyle(fontSize: 12, color: AppColors.primaryLight)), + ], + ), + ), + ], + ), + const SizedBox(height: 4), + Text( + 'Current: ${streak.currentCount} days | Best: ${streak.longestCount}', + style: theme.textTheme.bodySmall, + ), + if (graceDaysRemaining > 0 && !isFrozen) + Padding( + padding: const EdgeInsets.only(top: 4), + child: Text( + '$graceDaysRemaining grace days remaining', + style: theme.textTheme.bodySmall?.copyWith( + color: AppColors.primary, + fontWeight: FontWeight.w500, + ), + ), + ), + ], + ), + ), + if (!isFrozen) + IconButton( + icon: const Icon(Icons.check_circle_outline_rounded, + color: AppColors.completed), + onPressed: onComplete, + tooltip: 'Complete today', + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/features/tasks/presentation/bloc/next_task_cubit.dart b/lib/features/tasks/presentation/bloc/next_task_cubit.dart new file mode 100644 index 0000000..1ff5912 --- /dev/null +++ b/lib/features/tasks/presentation/bloc/next_task_cubit.dart @@ -0,0 +1,84 @@ +import 'package:equatable/equatable.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:focusflow_shared/focusflow_shared.dart'; + +import '../../../../core/network/api_client.dart'; +import '../../../../main.dart'; + +// ── States ───────────────────────────────────────────────────────── + +sealed class NextTaskState extends Equatable { + const NextTaskState(); + @override + List get props => []; +} + +class NextTaskLoading extends NextTaskState {} + +class NextTaskLoaded extends NextTaskState { + final Task task; + const NextTaskLoaded(this.task); + @override + List get props => [task]; +} + +class NextTaskEmpty extends NextTaskState {} + +class NextTaskError extends NextTaskState { + final String message; + const NextTaskError(this.message); + @override + List get props => [message]; +} + +// ── Cubit ────────────────────────────────────────────────────────── + +/// Simple cubit for focus mode: "just do the next thing." +/// +/// Loads the single highest-priority task from the API. +class NextTaskCubit extends Cubit { + final ApiClient _api = getIt(); + + NextTaskCubit() : super(NextTaskLoading()); + + /// Fetch the next recommended task. + Future loadNext() async { + emit(NextTaskLoading()); + try { + final response = await _api.fetchNextTask(); + final data = response.data; + if (data != null && data['status'] == 'success' && data['data'] != null) { + final task = Task.fromJson(data['data'] as Map); + emit(NextTaskLoaded(task)); + } else { + emit(NextTaskEmpty()); + } + } catch (_) { + emit(const NextTaskError('Could not load your next task.')); + } + } + + /// Mark the current task as done, then load the next one. + Future complete() async { + final current = state; + if (current is! NextTaskLoaded) return; + try { + await _api.completeTask(current.task.id); + } catch (_) { + // Best-effort — still load next. + } + await loadNext(); + } + + /// Skip the current task, then load the next one. + Future skip() async { + final current = state; + if (current is! NextTaskLoaded) return; + try { + await _api.skipTask(current.task.id); + } catch (_) { + // Best-effort. + } + await loadNext(); + } +} diff --git a/lib/features/tasks/presentation/bloc/task_list_bloc.dart b/lib/features/tasks/presentation/bloc/task_list_bloc.dart new file mode 100644 index 0000000..1644c78 --- /dev/null +++ b/lib/features/tasks/presentation/bloc/task_list_bloc.dart @@ -0,0 +1,141 @@ +import 'package:equatable/equatable.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:focusflow_shared/focusflow_shared.dart'; + +import '../../../../core/network/api_client.dart'; +import '../../../../main.dart'; + +// ── Events ───────────────────────────────────────────────────────── + +sealed class TaskListEvent extends Equatable { + const TaskListEvent(); + @override + List get props => []; +} + +class TasksLoaded extends TaskListEvent { + const TasksLoaded(); +} + +class TaskCompleted extends TaskListEvent { + final String id; + const TaskCompleted(this.id); + @override + List get props => [id]; +} + +class TaskSkipped extends TaskListEvent { + final String id; + const TaskSkipped(this.id); + @override + List get props => [id]; +} + +class TaskCreated extends TaskListEvent { + final Task task; + const TaskCreated(this.task); + @override + List get props => [task]; +} + +class TaskDeleted extends TaskListEvent { + final String id; + const TaskDeleted(this.id); + @override + List get props => [id]; +} + +// ── States ───────────────────────────────────────────────────────── + +sealed class TaskListState extends Equatable { + const TaskListState(); + @override + List get props => []; +} + +class TaskListInitial extends TaskListState {} + +class TaskListLoading extends TaskListState {} + +class TaskListLoaded extends TaskListState { + final List tasks; + const TaskListLoaded(this.tasks); + @override + List get props => [tasks]; +} + +class TaskListError extends TaskListState { + final String message; + const TaskListError(this.message); + @override + List get props => [message]; +} + +// ── BLoC ─────────────────────────────────────────────────────────── + +class TaskListBloc extends Bloc { + final ApiClient _api = getIt(); + + TaskListBloc() : super(TaskListInitial()) { + on(_onLoaded); + on(_onCompleted); + on(_onSkipped); + on(_onCreated); + on(_onDeleted); + } + + Future _onLoaded(TasksLoaded event, Emitter emit) async { + emit(TaskListLoading()); + try { + final response = await _api.fetchTasks(); + final data = response.data; + if (data != null && data['status'] == 'success') { + final items = (data['data'] as List) + .map((e) => Task.fromJson(e as Map)) + .toList(); + emit(TaskListLoaded(items)); + } else { + emit(const TaskListError('Could not load tasks.')); + } + } catch (_) { + emit(const TaskListError('Something went wrong loading tasks.')); + } + } + + Future _onCompleted(TaskCompleted event, Emitter emit) async { + try { + await _api.completeTask(event.id); + // Re-fetch after completion so the list is up to date. + add(const TasksLoaded()); + } catch (_) { + emit(const TaskListError('Could not complete task.')); + } + } + + Future _onSkipped(TaskSkipped event, Emitter emit) async { + try { + await _api.skipTask(event.id); + add(const TasksLoaded()); + } catch (_) { + emit(const TaskListError('Could not skip task.')); + } + } + + Future _onCreated(TaskCreated event, Emitter emit) async { + try { + await _api.createTask(event.task.toJson()); + add(const TasksLoaded()); + } catch (_) { + emit(const TaskListError('Could not create task.')); + } + } + + Future _onDeleted(TaskDeleted event, Emitter emit) async { + try { + await _api.deleteTask(event.id); + add(const TasksLoaded()); + } catch (_) { + emit(const TaskListError('Could not delete task.')); + } + } +} diff --git a/lib/features/tasks/presentation/screens/create_task_screen.dart b/lib/features/tasks/presentation/screens/create_task_screen.dart new file mode 100644 index 0000000..88bbf79 --- /dev/null +++ b/lib/features/tasks/presentation/screens/create_task_screen.dart @@ -0,0 +1,120 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; + +import '../widgets/energy_selector.dart'; + +/// Quick task creation screen — minimal friction. +/// +/// Fields: +/// - Title (required). +/// - Energy level (default medium). +/// - Estimated minutes. +/// - Tags. +class CreateTaskScreen extends StatefulWidget { + const CreateTaskScreen({super.key}); + + @override + State createState() => _CreateTaskScreenState(); +} + +class _CreateTaskScreenState extends State { + final _formKey = GlobalKey(); + final _titleController = TextEditingController(); + final _minutesController = TextEditingController(text: '15'); + final _tagsController = TextEditingController(); + String _energyLevel = 'medium'; + + @override + void dispose() { + _titleController.dispose(); + _minutesController.dispose(); + _tagsController.dispose(); + super.dispose(); + } + + void _create() { + if (_formKey.currentState?.validate() ?? false) { + // TODO: dispatch TaskCreated via BLoC. + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text('Task created!')), + ); + context.pop(); + } + } + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + + return Scaffold( + appBar: AppBar(title: const Text('New Task')), + body: SingleChildScrollView( + padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16), + child: Form( + key: _formKey, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'What do you need to do?', + style: theme.textTheme.titleLarge, + ), + const SizedBox(height: 16), + + // ── Title ────────────────────────────────────────── + TextFormField( + controller: _titleController, + autofocus: true, + textInputAction: TextInputAction.next, + decoration: const InputDecoration( + labelText: 'Task title', + hintText: 'e.g. Reply to email', + ), + validator: (v) => + (v == null || v.trim().isEmpty) ? 'What is it?' : null, + ), + const SizedBox(height: 24), + + // ── Energy level ─────────────────────────────────── + Text('How much energy will this take?', + style: theme.textTheme.titleSmall), + const SizedBox(height: 8), + EnergySelector( + value: _energyLevel, + onChanged: (v) => setState(() => _energyLevel = v), + ), + const SizedBox(height: 24), + + // ── Estimated minutes ────────────────────────────── + TextFormField( + controller: _minutesController, + keyboardType: TextInputType.number, + decoration: const InputDecoration( + labelText: 'Estimated minutes', + suffixText: 'min', + ), + ), + const SizedBox(height: 24), + + // ── Tags ─────────────────────────────────────────── + TextFormField( + controller: _tagsController, + decoration: const InputDecoration( + labelText: 'Tags (optional, comma separated)', + prefixIcon: Icon(Icons.label_outline), + ), + ), + const SizedBox(height: 32), + + // ── Create button ────────────────────────────────── + FilledButton( + onPressed: _create, + child: const Text('Create Task'), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/features/tasks/presentation/screens/focus_mode_screen.dart b/lib/features/tasks/presentation/screens/focus_mode_screen.dart new file mode 100644 index 0000000..483d405 --- /dev/null +++ b/lib/features/tasks/presentation/screens/focus_mode_screen.dart @@ -0,0 +1,391 @@ +import 'dart:async'; +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:go_router/go_router.dart'; +import 'package:focusflow_shared/focusflow_shared.dart'; + +import '../../../../core/theme/app_colors.dart'; +import '../../../../core/widgets/reward_popup.dart'; +import '../bloc/next_task_cubit.dart'; + +/// THE core ADHD feature — "Just do the next thing." +/// +/// - Single task displayed, nothing else. +/// - Large title text centered. +/// - Energy level indicator. +/// - Estimated time. +/// - Big "Done!" button (green, satisfying). +/// - "Skip" button (smaller, gray, no guilt). +/// - "I need a break" option. +/// - Timer showing elapsed time (gentle, not anxiety-inducing). +/// - On completion: reward popup appears. +/// - After reward: auto-loads next task or shows "All done!" celebration. +class FocusModeScreen extends StatefulWidget { + const FocusModeScreen({super.key}); + + @override + State createState() => _FocusModeScreenState(); +} + +class _FocusModeScreenState extends State { + late final NextTaskCubit _cubit; + final Stopwatch _stopwatch = Stopwatch(); + Timer? _timer; + bool _showReward = false; + int _elapsedSeconds = 0; + + @override + void initState() { + super.initState(); + _cubit = NextTaskCubit()..loadNext(); + _startTimer(); + } + + void _startTimer() { + _stopwatch.start(); + _timer = Timer.periodic(const Duration(seconds: 1), (_) { + if (mounted) { + setState(() => _elapsedSeconds = _stopwatch.elapsed.inSeconds); + } + }); + } + + void _resetTimer() { + _stopwatch.reset(); + setState(() => _elapsedSeconds = 0); + } + + @override + void dispose() { + _timer?.cancel(); + _stopwatch.stop(); + _cubit.close(); + super.dispose(); + } + + String _formatElapsed() { + final minutes = _elapsedSeconds ~/ 60; + final seconds = _elapsedSeconds % 60; + return '${minutes}m ${seconds.toString().padLeft(2, '0')}s so far'; + } + + Color _energyColor(String level) { + switch (level) { + case 'low': + return AppColors.energyLow; + case 'high': + return AppColors.energyHigh; + default: + return AppColors.energyMedium; + } + } + + String _energyEmoji(String level) { + switch (level) { + case 'low': + return 'Low energy'; + case 'high': + return 'High energy'; + default: + return 'Medium energy'; + } + } + + Future _onComplete() async { + _stopwatch.stop(); + setState(() => _showReward = true); + } + + void _dismissReward() { + setState(() => _showReward = false); + _resetTimer(); + _stopwatch.start(); + _cubit.complete(); + } + + void _onSkip() { + _resetTimer(); + _cubit.skip(); + } + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + + return BlocProvider.value( + value: _cubit, + child: Scaffold( + backgroundColor: theme.scaffoldBackgroundColor, + appBar: AppBar( + leading: IconButton( + icon: const Icon(Icons.close_rounded), + onPressed: () => context.go('/'), + tooltip: 'Exit focus mode', + ), + title: const Text('Focus Mode'), + centerTitle: true, + ), + body: Stack( + children: [ + BlocBuilder( + builder: (context, state) { + if (state is NextTaskLoading) { + return const Center(child: CircularProgressIndicator()); + } + + if (state is NextTaskError) { + return Center( + child: Padding( + padding: const EdgeInsets.all(32), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + const Icon(Icons.cloud_off_rounded, + size: 56, color: AppColors.skipped), + const SizedBox(height: 12), + Text(state.message, + style: theme.textTheme.bodyLarge, + textAlign: TextAlign.center), + const SizedBox(height: 16), + FilledButton( + onPressed: () => _cubit.loadNext(), + child: const Text('Try again'), + ), + ], + ), + ), + ); + } + + if (state is NextTaskEmpty) { + return _AllDoneView(onGoBack: () => context.go('/')); + } + + if (state is NextTaskLoaded) { + return _TaskFocusView( + task: state.task, + elapsed: _formatElapsed(), + energyColor: _energyColor(state.task.energyLevel), + energyLabel: _energyEmoji(state.task.energyLevel), + onComplete: _onComplete, + onSkip: _onSkip, + onBreak: () { + _stopwatch.stop(); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: const Text( + 'Take your time. Tap anywhere when you\'re ready.'), + action: SnackBarAction( + label: 'Resume', + onPressed: () => _stopwatch.start(), + ), + ), + ); + }, + ); + } + + return const SizedBox.shrink(); + }, + ), + + // ── Reward overlay ─────────────────────────────────── + if (_showReward) + Container( + color: Colors.black.withAlpha(120), + child: RewardPopup( + reward: Reward( + id: 'local-${DateTime.now().millisecondsSinceEpoch}', + userId: '', + rewardType: 'points', + magnitude: 10, + title: 'Task complete!', + createdAt: DateTime.now(), + ), + onDismiss: _dismissReward, + ), + ), + ], + ), + ), + ); + } +} + +// ── Single-task focus view ───────────────────────────────────────── + +class _TaskFocusView extends StatelessWidget { + final Task task; + final String elapsed; + final Color energyColor; + final String energyLabel; + final VoidCallback onComplete; + final VoidCallback onSkip; + final VoidCallback onBreak; + + const _TaskFocusView({ + required this.task, + required this.elapsed, + required this.energyColor, + required this.energyLabel, + required this.onComplete, + required this.onSkip, + required this.onBreak, + }); + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + + return SafeArea( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 28), + child: Column( + children: [ + const Spacer(flex: 2), + + // ── Energy indicator ───────────────────────────────── + Container( + padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 6), + decoration: BoxDecoration( + color: energyColor.withAlpha(30), + borderRadius: BorderRadius.circular(20), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(Icons.bolt_rounded, size: 18, color: energyColor), + const SizedBox(width: 4), + Text(energyLabel, + style: TextStyle( + color: energyColor, fontWeight: FontWeight.w600)), + ], + ), + ), + const SizedBox(height: 24), + + // ── Task title ─────────────────────────────────────── + Text( + task.title, + style: theme.textTheme.headlineMedium?.copyWith( + fontWeight: FontWeight.w700, + ), + textAlign: TextAlign.center, + ), + const SizedBox(height: 12), + + // ── Estimated time ─────────────────────────────────── + if (task.estimatedMinutes != null) + Text( + '~${task.estimatedMinutes} min estimated', + style: theme.textTheme.bodyLarge?.copyWith( + color: AppColors.primary, + ), + ), + const SizedBox(height: 20), + + // ── Elapsed time (gentle) ──────────────────────────── + Text( + elapsed, + style: theme.textTheme.bodyMedium?.copyWith( + fontWeight: FontWeight.w500, + color: AppColors.primary, + ), + ), + + const Spacer(flex: 3), + + // ── Done button ────────────────────────────────────── + SizedBox( + width: double.infinity, + height: 64, + child: FilledButton( + onPressed: onComplete, + style: FilledButton.styleFrom( + backgroundColor: AppColors.completed, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20), + ), + textStyle: theme.textTheme.titleLarge?.copyWith( + fontWeight: FontWeight.w700, + color: Colors.white, + ), + ), + child: const Text('Done!', style: TextStyle(fontSize: 22, color: Colors.white)), + ), + ), + const SizedBox(height: 12), + + // ── Skip button (smaller, gray, no guilt) ──────────── + SizedBox( + width: double.infinity, + height: 52, + child: OutlinedButton( + onPressed: onSkip, + style: OutlinedButton.styleFrom( + foregroundColor: AppColors.skipped, + side: const BorderSide(color: AppColors.skipped), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16), + ), + ), + child: const Text('Skip for now'), + ), + ), + const SizedBox(height: 8), + + // ── Break button ───────────────────────────────────── + TextButton.icon( + onPressed: onBreak, + icon: const Icon(Icons.self_improvement_rounded, size: 20), + label: const Text('I need a break'), + ), + + const Spacer(), + ], + ), + ), + ); + } +} + +// ── All done celebration ─────────────────────────────────────────── + +class _AllDoneView extends StatelessWidget { + final VoidCallback onGoBack; + const _AllDoneView({required this.onGoBack}); + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + + return Center( + child: Padding( + padding: const EdgeInsets.all(32), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(Icons.celebration_rounded, size: 80, color: AppColors.rewardGold), + const SizedBox(height: 20), + Text( + 'All done for today!', + style: theme.textTheme.headlineMedium?.copyWith(fontWeight: FontWeight.w700), + textAlign: TextAlign.center, + ), + const SizedBox(height: 8), + Text( + 'You showed up and that matters. Enjoy your free time!', + style: theme.textTheme.bodyLarge, + textAlign: TextAlign.center, + ), + const SizedBox(height: 28), + FilledButton( + onPressed: onGoBack, + child: const Text('Back to dashboard'), + ), + ], + ), + ), + ); + } +} diff --git a/lib/features/tasks/presentation/screens/onboarding_screen.dart b/lib/features/tasks/presentation/screens/onboarding_screen.dart new file mode 100644 index 0000000..ca0b145 --- /dev/null +++ b/lib/features/tasks/presentation/screens/onboarding_screen.dart @@ -0,0 +1,362 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; + +import '../../../../core/theme/app_colors.dart'; +import '../widgets/energy_selector.dart'; + +/// ADHD-specific onboarding flow (4 steps). +/// +/// 1. Welcome — "Built for brains like yours." +/// 2. How it works — focus mode, rewards, forgiveness. +/// 3. Preferences — daily task load, energy preference, focus session length. +/// 4. Ready — "Let's do this! No pressure." +class OnboardingScreen extends StatefulWidget { + const OnboardingScreen({super.key}); + + @override + State createState() => _OnboardingScreenState(); +} + +class _OnboardingScreenState extends State { + final PageController _pageController = PageController(); + int _currentPage = 0; + + // ── Preference values ──────────────────────────────────────────── + double _taskLoad = 5; + String _energyPreference = 'medium'; + double _focusMinutes = 25; + + void _next() { + if (_currentPage < 3) { + _pageController.nextPage( + duration: const Duration(milliseconds: 350), + curve: Curves.easeInOut, + ); + } else { + // Onboarding complete — go home. + context.go('/'); + } + } + + @override + void dispose() { + _pageController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + + return Scaffold( + body: SafeArea( + child: Column( + children: [ + // ── Page indicator ──────────────────────────────────── + Padding( + padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 28), + child: Row( + children: List.generate(4, (i) { + final active = i <= _currentPage; + return Expanded( + child: Container( + height: 4, + margin: const EdgeInsets.symmetric(horizontal: 3), + decoration: BoxDecoration( + color: active ? AppColors.primary : AppColors.skipped.withAlpha(80), + borderRadius: BorderRadius.circular(2), + ), + ), + ); + }), + ), + ), + + // ── Pages ──────────────────────────────────────────── + Expanded( + child: PageView( + controller: _pageController, + onPageChanged: (i) => setState(() => _currentPage = i), + physics: const NeverScrollableScrollPhysics(), + children: [ + _WelcomePage(theme: theme), + _HowItWorksPage(theme: theme), + _PreferencesPage( + theme: theme, + taskLoad: _taskLoad, + onTaskLoadChanged: (v) => setState(() => _taskLoad = v), + energyPreference: _energyPreference, + onEnergyChanged: (v) => setState(() => _energyPreference = v), + focusMinutes: _focusMinutes, + onFocusChanged: (v) => setState(() => _focusMinutes = v), + ), + _ReadyPage(theme: theme), + ], + ), + ), + + // ── Bottom button ──────────────────────────────────── + Padding( + padding: const EdgeInsets.fromLTRB(28, 8, 28, 24), + child: FilledButton( + onPressed: _next, + child: Text(_currentPage == 3 ? 'Let\'s go!' : 'Continue'), + ), + ), + ], + ), + ), + ); + } +} + +// ── Step 1: Welcome ──────────────────────────────────────────────── + +class _WelcomePage extends StatelessWidget { + final ThemeData theme; + const _WelcomePage({required this.theme}); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 28), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Icon(Icons.self_improvement_rounded, size: 80, color: AppColors.primary), + const SizedBox(height: 24), + Text( + 'Built for brains like yours', + style: theme.textTheme.headlineMedium?.copyWith(fontWeight: FontWeight.w700), + textAlign: TextAlign.center, + ), + const SizedBox(height: 16), + Text( + 'FocusFlow is designed with ADHD in mind. ' + 'No overwhelming lists, no guilt — just gentle support ' + 'to help you get things done, one task at a time.', + style: theme.textTheme.bodyLarge, + textAlign: TextAlign.center, + ), + ], + ), + ); + } +} + +// ── Step 2: How it works ─────────────────────────────────────────── + +class _HowItWorksPage extends StatelessWidget { + final ThemeData theme; + const _HowItWorksPage({required this.theme}); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 28), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'How it works', + style: theme.textTheme.headlineMedium?.copyWith(fontWeight: FontWeight.w700), + textAlign: TextAlign.center, + ), + const SizedBox(height: 28), + _FeatureRow( + icon: Icons.center_focus_strong_rounded, + color: AppColors.primary, + title: 'Focus Mode', + subtitle: 'One task at a time. No distractions.', + ), + const SizedBox(height: 20), + _FeatureRow( + icon: Icons.celebration_rounded, + color: AppColors.secondary, + title: 'Rewards', + subtitle: 'Earn points & celebrations for completing tasks.', + ), + const SizedBox(height: 20), + _FeatureRow( + icon: Icons.favorite_rounded, + color: AppColors.tertiary, + title: 'Forgiveness', + subtitle: 'Missed a day? Grace days have your back. No guilt.', + ), + ], + ), + ); + } +} + +class _FeatureRow extends StatelessWidget { + final IconData icon; + final Color color; + final String title; + final String subtitle; + + const _FeatureRow({ + required this.icon, + required this.color, + required this.title, + required this.subtitle, + }); + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + return Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: const EdgeInsets.all(10), + decoration: BoxDecoration( + color: color.withAlpha(30), + borderRadius: BorderRadius.circular(12), + ), + child: Icon(icon, color: color, size: 28), + ), + const SizedBox(width: 14), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(title, style: theme.textTheme.titleMedium?.copyWith(fontWeight: FontWeight.w600)), + const SizedBox(height: 2), + Text(subtitle, style: theme.textTheme.bodyMedium), + ], + ), + ), + ], + ); + } +} + +// ── Step 3: Preferences ──────────────────────────────────────────── + +class _PreferencesPage extends StatelessWidget { + final ThemeData theme; + final double taskLoad; + final ValueChanged onTaskLoadChanged; + final String energyPreference; + final ValueChanged onEnergyChanged; + final double focusMinutes; + final ValueChanged onFocusChanged; + + const _PreferencesPage({ + required this.theme, + required this.taskLoad, + required this.onTaskLoadChanged, + required this.energyPreference, + required this.onEnergyChanged, + required this.focusMinutes, + required this.onFocusChanged, + }); + + @override + Widget build(BuildContext context) { + return SingleChildScrollView( + padding: const EdgeInsets.symmetric(horizontal: 28), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const SizedBox(height: 20), + Text( + 'Set your preferences', + style: theme.textTheme.headlineMedium?.copyWith(fontWeight: FontWeight.w700), + ), + const SizedBox(height: 8), + Text( + 'You can always change these later.', + style: theme.textTheme.bodyMedium, + ), + const SizedBox(height: 28), + + // Daily task load + Text('How many tasks per day feel right?', style: theme.textTheme.titleSmall), + const SizedBox(height: 4), + Row( + children: [ + Expanded( + child: Slider( + value: taskLoad, + min: 1, + max: 10, + divisions: 9, + label: taskLoad.round().toString(), + onChanged: onTaskLoadChanged, + ), + ), + Text( + '${taskLoad.round()}', + style: theme.textTheme.titleLarge?.copyWith(fontWeight: FontWeight.w700), + ), + ], + ), + const SizedBox(height: 24), + + // Energy preference + Text('What\'s your usual energy level?', style: theme.textTheme.titleSmall), + const SizedBox(height: 8), + EnergySelector(value: energyPreference, onChanged: onEnergyChanged), + const SizedBox(height: 24), + + // Focus session length + Text('Focus session length', style: theme.textTheme.titleSmall), + const SizedBox(height: 4), + Row( + children: [ + Expanded( + child: Slider( + value: focusMinutes, + min: 5, + max: 60, + divisions: 11, + label: '${focusMinutes.round()} min', + onChanged: onFocusChanged, + ), + ), + Text( + '${focusMinutes.round()} min', + style: theme.textTheme.titleMedium?.copyWith(fontWeight: FontWeight.w600), + ), + ], + ), + ], + ), + ); + } +} + +// ── Step 4: Ready ────────────────────────────────────────────────── + +class _ReadyPage extends StatelessWidget { + final ThemeData theme; + const _ReadyPage({required this.theme}); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 28), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Icon(Icons.rocket_launch_rounded, size: 80, color: AppColors.primary), + const SizedBox(height: 24), + Text( + 'You\'re all set!', + style: theme.textTheme.headlineMedium?.copyWith(fontWeight: FontWeight.w700), + textAlign: TextAlign.center, + ), + const SizedBox(height: 16), + Text( + 'Let\'s do this. No pressure — start with one task ' + 'and see how it feels. You\'ve got this.', + style: theme.textTheme.bodyLarge, + textAlign: TextAlign.center, + ), + ], + ), + ); + } +} diff --git a/lib/features/tasks/presentation/screens/task_dashboard_screen.dart b/lib/features/tasks/presentation/screens/task_dashboard_screen.dart new file mode 100644 index 0000000..ebad572 --- /dev/null +++ b/lib/features/tasks/presentation/screens/task_dashboard_screen.dart @@ -0,0 +1,303 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:go_router/go_router.dart'; +import '../../../../core/theme/app_colors.dart'; +import '../../../../core/widgets/gentle_nudge_card.dart'; +import '../../../../core/widgets/streak_ring.dart'; +import '../../../../core/widgets/task_card.dart'; +import '../../../../features/auth/presentation/bloc/auth_bloc.dart'; +import '../bloc/task_list_bloc.dart'; + +/// Home screen — the task dashboard. +/// +/// Layout: +/// - AppBar greeting. +/// - Focus Mode prominent card at the top. +/// - Today's tasks list (limited to preferredTaskLoad). +/// - Streak summary cards (horizontal scroll). +/// - Bottom nav: Tasks, Streaks, Time, Settings. +class TaskDashboardScreen extends StatefulWidget { + const TaskDashboardScreen({super.key}); + + @override + State createState() => _TaskDashboardScreenState(); +} + +class _TaskDashboardScreenState extends State { + late final TaskListBloc _taskListBloc; + int _currentNavIndex = 0; + + @override + void initState() { + super.initState(); + _taskListBloc = TaskListBloc()..add(const TasksLoaded()); + } + + @override + void dispose() { + _taskListBloc.close(); + super.dispose(); + } + + String _greeting(AuthState authState) { + final name = authState is AuthAuthenticated ? authState.user.displayName : 'Friend'; + return 'Hey $name! What shall we tackle?'; + } + + void _onNavTap(int index) { + switch (index) { + case 0: + break; // already here + case 1: + context.go('/streaks'); + case 2: + context.go('/time'); + case 3: + context.go('/settings'); + } + setState(() => _currentNavIndex = index); + } + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + + return BlocProvider.value( + value: _taskListBloc, + child: Scaffold( + // ── AppBar ─────────────────────────────────────────────── + appBar: AppBar( + title: BlocBuilder( + builder: (context, state) => Text( + _greeting(state), + style: theme.textTheme.titleMedium, + ), + ), + actions: [ + IconButton( + icon: const Icon(Icons.notifications_none_rounded), + onPressed: () {}, + tooltip: 'Notifications', + ), + ], + ), + + // ── Body ───────────────────────────────────────────────── + body: RefreshIndicator( + onRefresh: () async => _taskListBloc.add(const TasksLoaded()), + child: ListView( + padding: const EdgeInsets.only(bottom: 100), + children: [ + // Focus Mode card + _FocusModeCard(onTap: () => context.go('/focus')), + + // Gentle nudge (shown conditionally) + GentleNudgeCard( + previousStreak: 7, + onStartSmall: () => context.go('/focus'), + onDismiss: () {}, + ), + + // ── Streak rings (horizontal scroll) ─────────────── + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: Text('Your Streaks', style: theme.textTheme.titleMedium), + ), + SizedBox( + height: 120, + child: ListView( + scrollDirection: Axis.horizontal, + padding: const EdgeInsets.symmetric(horizontal: 12), + children: const [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 6), + child: StreakRing( + currentCount: 12, + graceDaysRemaining: 2, + totalGraceDays: 2, + label: 'Daily tasks', + ), + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 6), + child: StreakRing( + currentCount: 5, + graceDaysRemaining: 1, + totalGraceDays: 2, + label: 'Exercise', + ), + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 6), + child: StreakRing( + currentCount: 0, + isFrozen: true, + label: 'Frozen', + ), + ), + ], + ), + ), + + // ── Today's tasks ────────────────────────────────── + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + child: Text('Today\'s Tasks', style: theme.textTheme.titleMedium), + ), + + BlocBuilder( + builder: (context, state) { + if (state is TaskListLoading) { + return const Center( + child: Padding( + padding: EdgeInsets.all(32), + child: CircularProgressIndicator(), + ), + ); + } + + if (state is TaskListError) { + return _EmptyState( + icon: Icons.cloud_off_rounded, + title: 'Could not load tasks', + subtitle: state.message, + ); + } + + if (state is TaskListLoaded) { + final tasks = state.tasks; + if (tasks.isEmpty) { + return const _EmptyState( + icon: Icons.check_circle_outline_rounded, + title: 'All clear!', + subtitle: 'No tasks for today. Enjoy the calm.', + ); + } + + return Column( + children: tasks + .take(5) + .map((t) => TaskCard( + task: t, + onTap: () => context.go('/task/${t.id}'), + onComplete: () => + _taskListBloc.add(TaskCompleted(t.id)), + onSkip: () => + _taskListBloc.add(TaskSkipped(t.id)), + )) + .toList(), + ); + } + + return const SizedBox.shrink(); + }, + ), + ], + ), + ), + + // ── FAB: create task ───────────────────────────────────── + floatingActionButton: FloatingActionButton.extended( + onPressed: () => context.go('/task-create'), + icon: const Icon(Icons.add_rounded), + label: const Text('New Task'), + ), + + // ── Bottom nav ─────────────────────────────────────────── + bottomNavigationBar: BottomNavigationBar( + currentIndex: _currentNavIndex, + onTap: _onNavTap, + items: const [ + BottomNavigationBarItem(icon: Icon(Icons.task_alt_rounded), label: 'Tasks'), + BottomNavigationBarItem(icon: Icon(Icons.local_fire_department_rounded), label: 'Streaks'), + BottomNavigationBarItem(icon: Icon(Icons.timer_outlined), label: 'Time'), + BottomNavigationBarItem(icon: Icon(Icons.settings_rounded), label: 'Settings'), + ], + ), + ), + ); + } +} + +// ── Focus Mode Card ──────────────────────────────────────────────── + +class _FocusModeCard extends StatelessWidget { + final VoidCallback onTap; + const _FocusModeCard({required this.onTap}); + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + + return Card( + margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), + color: AppColors.primary, + child: InkWell( + borderRadius: BorderRadius.circular(16), + onTap: onTap, + child: Padding( + padding: const EdgeInsets.all(20), + child: Row( + children: [ + const Icon(Icons.self_improvement_rounded, size: 40, color: Colors.white), + const SizedBox(width: 16), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Focus Mode', + style: theme.textTheme.titleLarge?.copyWith( + color: Colors.white, + fontWeight: FontWeight.w700, + ), + ), + const SizedBox(height: 4), + Text( + 'Just do the next thing. One at a time.', + style: theme.textTheme.bodyMedium?.copyWith( + color: Colors.white.withAlpha(200), + ), + ), + ], + ), + ), + const Icon(Icons.arrow_forward_rounded, color: Colors.white), + ], + ), + ), + ), + ); + } +} + +// ── Empty state ──────────────────────────────────────────────────── + +class _EmptyState extends StatelessWidget { + final IconData icon; + final String title; + final String subtitle; + + const _EmptyState({ + required this.icon, + required this.title, + required this.subtitle, + }); + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + return Padding( + padding: const EdgeInsets.all(32), + child: Column( + children: [ + Icon(icon, size: 56, color: AppColors.skipped), + const SizedBox(height: 12), + Text(title, style: theme.textTheme.titleMedium), + const SizedBox(height: 4), + Text(subtitle, style: theme.textTheme.bodyMedium, textAlign: TextAlign.center), + ], + ), + ); + } +} diff --git a/lib/features/tasks/presentation/screens/task_detail_screen.dart b/lib/features/tasks/presentation/screens/task_detail_screen.dart new file mode 100644 index 0000000..413b7c3 --- /dev/null +++ b/lib/features/tasks/presentation/screens/task_detail_screen.dart @@ -0,0 +1,220 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import 'package:focusflow_shared/focusflow_shared.dart'; + +import '../../../../core/theme/app_colors.dart'; +import '../../../../core/widgets/time_visualizer.dart'; +import '../widgets/energy_selector.dart'; + +/// Task detail / edit screen. +/// +/// Shows title, description, energy level selector, time estimate, +/// tags, category. Provides save and delete actions. +class TaskDetailScreen extends StatefulWidget { + final String taskId; + + const TaskDetailScreen({super.key, required this.taskId}); + + @override + State createState() => _TaskDetailScreenState(); +} + +class _TaskDetailScreenState extends State { + final _formKey = GlobalKey(); + final _titleController = TextEditingController(); + final _descriptionController = TextEditingController(); + final _minutesController = TextEditingController(); + final _tagsController = TextEditingController(); + final _categoryController = TextEditingController(); + String _energyLevel = 'medium'; + + // Placeholder task — in production, load from BLoC. + Task? _task; + bool _loading = true; + + @override + void initState() { + super.initState(); + _loadTask(); + } + + Future _loadTask() async { + // Simulated placeholder — in production the BLoC fetches from the API. + await Future.delayed(const Duration(milliseconds: 300)); + final task = Task( + id: widget.taskId, + userId: 'local', + title: 'Sample Task', + description: 'Tap to edit this task.', + energyLevel: 'medium', + estimatedMinutes: 25, + actualMinutes: 20, + tags: const ['work', 'focus'], + category: 'work', + createdAt: DateTime.now(), + ); + + if (!mounted) return; + setState(() { + _task = task; + _loading = false; + _titleController.text = task.title; + _descriptionController.text = task.description ?? ''; + _minutesController.text = task.estimatedMinutes?.toString() ?? ''; + _tagsController.text = task.tags.join(', '); + _categoryController.text = task.category ?? ''; + _energyLevel = task.energyLevel; + }); + } + + @override + void dispose() { + _titleController.dispose(); + _descriptionController.dispose(); + _minutesController.dispose(); + _tagsController.dispose(); + _categoryController.dispose(); + super.dispose(); + } + + void _save() { + if (_formKey.currentState?.validate() ?? false) { + // TODO: dispatch update via BLoC. + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text('Task saved.')), + ); + context.pop(); + } + } + + void _delete() { + showDialog( + context: context, + builder: (ctx) => AlertDialog( + title: const Text('Delete task?'), + content: const Text('This cannot be undone.'), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)), + actions: [ + TextButton(onPressed: () => Navigator.pop(ctx), child: const Text('Cancel')), + TextButton( + onPressed: () { + Navigator.pop(ctx); + // TODO: dispatch delete via BLoC. + context.pop(); + }, + child: const Text('Delete', style: TextStyle(color: AppColors.error)), + ), + ], + ), + ); + } + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + + if (_loading) { + return Scaffold( + appBar: AppBar(title: const Text('Task')), + body: const Center(child: CircularProgressIndicator()), + ); + } + + return Scaffold( + appBar: AppBar( + title: const Text('Task Detail'), + actions: [ + IconButton( + icon: const Icon(Icons.delete_outline_rounded, color: AppColors.error), + onPressed: _delete, + tooltip: 'Delete', + ), + ], + ), + body: SingleChildScrollView( + padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16), + child: Form( + key: _formKey, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // ── Title ────────────────────────────────────────── + TextFormField( + controller: _titleController, + decoration: const InputDecoration(labelText: 'Title'), + style: theme.textTheme.titleLarge, + validator: (v) => + (v == null || v.trim().isEmpty) ? 'Give it a name' : null, + ), + const SizedBox(height: 16), + + // ── Description ──────────────────────────────────── + TextFormField( + controller: _descriptionController, + decoration: const InputDecoration(labelText: 'Description (optional)'), + maxLines: 3, + ), + const SizedBox(height: 20), + + // ── Energy level ─────────────────────────────────── + Text('Energy level', style: theme.textTheme.titleSmall), + const SizedBox(height: 8), + EnergySelector( + value: _energyLevel, + onChanged: (v) => setState(() => _energyLevel = v), + ), + const SizedBox(height: 20), + + // ── Time estimate ────────────────────────────────── + TextFormField( + controller: _minutesController, + keyboardType: TextInputType.number, + decoration: const InputDecoration( + labelText: 'Estimated minutes', + suffixText: 'min', + ), + ), + const SizedBox(height: 20), + + // ── Time visualizer (if there is actual data) ────── + if (_task != null && + _task!.estimatedMinutes != null && + _task!.actualMinutes != null) + TimeVisualizer( + estimatedMinutes: _task!.estimatedMinutes!, + actualMinutes: _task!.actualMinutes, + ), + const SizedBox(height: 20), + + // ── Tags ─────────────────────────────────────────── + TextFormField( + controller: _tagsController, + decoration: const InputDecoration( + labelText: 'Tags (comma separated)', + prefixIcon: Icon(Icons.label_outline), + ), + ), + const SizedBox(height: 16), + + // ── Category ─────────────────────────────────────── + TextFormField( + controller: _categoryController, + decoration: const InputDecoration( + labelText: 'Category', + prefixIcon: Icon(Icons.category_outlined), + ), + ), + const SizedBox(height: 32), + + // ── Save button ──────────────────────────────────── + FilledButton( + onPressed: _save, + child: const Text('Save'), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/features/tasks/presentation/widgets/energy_selector.dart b/lib/features/tasks/presentation/widgets/energy_selector.dart new file mode 100644 index 0000000..9159004 --- /dev/null +++ b/lib/features/tasks/presentation/widgets/energy_selector.dart @@ -0,0 +1,81 @@ +import 'package:flutter/material.dart'; + +import '../../../../core/theme/app_colors.dart'; + +/// Three-option energy selector with icons. +/// +/// Horizontal toggle: Low | Medium | High +class EnergySelector extends StatelessWidget { + final String value; // 'low', 'medium', 'high' + final ValueChanged onChanged; + + const EnergySelector({ + super.key, + required this.value, + required this.onChanged, + }); + + static const _options = [ + _EnergyOption(key: 'low', label: 'Low', icon: Icons.spa_outlined, color: AppColors.energyLow), + _EnergyOption(key: 'medium', label: 'Medium', icon: Icons.bolt_outlined, color: AppColors.energyMedium), + _EnergyOption(key: 'high', label: 'High', icon: Icons.local_fire_department_outlined, color: AppColors.energyHigh), + ]; + + @override + Widget build(BuildContext context) { + return Row( + children: _options.map((opt) { + final selected = value == opt.key; + return Expanded( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 4), + child: GestureDetector( + onTap: () => onChanged(opt.key), + child: AnimatedContainer( + duration: const Duration(milliseconds: 200), + curve: Curves.easeInOut, + padding: const EdgeInsets.symmetric(vertical: 14), + decoration: BoxDecoration( + color: selected ? opt.color.withAlpha(40) : Colors.transparent, + borderRadius: BorderRadius.circular(14), + border: Border.all( + color: selected ? opt.color : Colors.grey.withAlpha(60), + width: selected ? 2 : 1, + ), + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(opt.icon, color: selected ? opt.color : Colors.grey, size: 26), + const SizedBox(height: 4), + Text( + opt.label, + style: TextStyle( + fontSize: 13, + fontWeight: selected ? FontWeight.w700 : FontWeight.w500, + color: selected ? opt.color : Colors.grey, + ), + ), + ], + ), + ), + ), + ), + ); + }).toList(), + ); + } +} + +class _EnergyOption { + final String key; + final String label; + final IconData icon; + final Color color; + const _EnergyOption({ + required this.key, + required this.label, + required this.icon, + required this.color, + }); +} diff --git a/lib/features/time_perception/presentation/screens/time_dashboard_screen.dart b/lib/features/time_perception/presentation/screens/time_dashboard_screen.dart new file mode 100644 index 0000000..ec30b05 --- /dev/null +++ b/lib/features/time_perception/presentation/screens/time_dashboard_screen.dart @@ -0,0 +1,229 @@ +import 'package:flutter/material.dart'; +import 'package:fl_chart/fl_chart.dart'; +import 'package:go_router/go_router.dart'; + +import '../../../../core/theme/app_colors.dart'; +import '../../../../core/widgets/time_visualizer.dart'; + +/// Time perception tools dashboard. +/// +/// - Accuracy trend chart (fl_chart) showing estimate vs actual over time. +/// - "You tend to underestimate by X%" insight. +/// - Recent time entries list. +/// - Tips for improving time awareness. +class TimeDashboardScreen extends StatelessWidget { + const TimeDashboardScreen({super.key}); + + // ── Dummy data for the chart ───────────────────────────────────── + static const _estimatedData = [15.0, 20.0, 10.0, 30.0, 25.0, 15.0, 20.0]; + static const _actualData = [22.0, 18.0, 14.0, 40.0, 28.0, 20.0, 19.0]; + static const _labels = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']; + + double get _averageBias { + double total = 0; + for (int i = 0; i < _estimatedData.length; i++) { + total += (_actualData[i] - _estimatedData[i]) / _estimatedData[i]; + } + return (total / _estimatedData.length) * 100; + } + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + final bias = _averageBias; + final biasText = bias > 0 + ? 'You tend to underestimate by ${bias.abs().toStringAsFixed(0)}%' + : 'You tend to overestimate by ${bias.abs().toStringAsFixed(0)}%'; + + return Scaffold( + appBar: AppBar( + leading: IconButton( + icon: const Icon(Icons.arrow_back_rounded), + onPressed: () => context.go('/'), + ), + title: const Text('Time Perception'), + ), + body: ListView( + padding: const EdgeInsets.all(16), + children: [ + // ── Insight card ───────────────────────────────────────── + Card( + color: AppColors.primaryLight.withAlpha(30), + elevation: 0, + child: Padding( + padding: const EdgeInsets.all(16), + child: Row( + children: [ + const Icon(Icons.insights_rounded, size: 32, color: AppColors.primary), + const SizedBox(width: 12), + Expanded( + child: Text(biasText, style: theme.textTheme.bodyLarge?.copyWith( + fontWeight: FontWeight.w600, + )), + ), + ], + ), + ), + ), + const SizedBox(height: 20), + + // ── Trend chart ────────────────────────────────────────── + Text('Estimated vs Actual (this week)', style: theme.textTheme.titleMedium), + const SizedBox(height: 12), + SizedBox( + height: 220, + child: LineChart( + LineChartData( + gridData: const FlGridData(show: false), + titlesData: FlTitlesData( + leftTitles: AxisTitles( + sideTitles: SideTitles( + showTitles: true, + reservedSize: 32, + getTitlesWidget: (value, meta) => Text( + '${value.toInt()}m', + style: theme.textTheme.bodySmall, + ), + ), + ), + bottomTitles: AxisTitles( + sideTitles: SideTitles( + showTitles: true, + getTitlesWidget: (value, meta) { + final idx = value.toInt(); + if (idx < 0 || idx >= _labels.length) return const SizedBox.shrink(); + return Text(_labels[idx], style: theme.textTheme.bodySmall); + }, + ), + ), + topTitles: const AxisTitles(sideTitles: SideTitles(showTitles: false)), + rightTitles: const AxisTitles(sideTitles: SideTitles(showTitles: false)), + ), + borderData: FlBorderData(show: false), + lineBarsData: [ + // Estimated + LineChartBarData( + spots: List.generate( + _estimatedData.length, + (i) => FlSpot(i.toDouble(), _estimatedData[i]), + ), + isCurved: true, + color: AppColors.primary, + barWidth: 3, + dotData: const FlDotData(show: true), + belowBarData: BarAreaData( + show: true, + color: AppColors.primary.withAlpha(20), + ), + ), + // Actual + LineChartBarData( + spots: List.generate( + _actualData.length, + (i) => FlSpot(i.toDouble(), _actualData[i]), + ), + isCurved: true, + color: AppColors.secondary, + barWidth: 3, + dotData: const FlDotData(show: true), + dashArray: [6, 4], + ), + ], + minY: 0, + ), + ), + ), + const SizedBox(height: 8), + + // ── Legend ──────────────────────────────────────────────── + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + _LegendDot(color: AppColors.primary, label: 'Estimated'), + const SizedBox(width: 20), + _LegendDot(color: AppColors.secondary, label: 'Actual'), + ], + ), + const SizedBox(height: 24), + + // ── Recent entries ─────────────────────────────────────── + Text('Recent', style: theme.textTheme.titleMedium), + const SizedBox(height: 8), + ...List.generate( + _estimatedData.length, + (i) => Padding( + padding: const EdgeInsets.only(bottom: 12), + child: TimeVisualizer( + estimatedMinutes: _estimatedData[i].toInt(), + actualMinutes: _actualData[i].toInt(), + ), + ), + ), + + const SizedBox(height: 24), + + // ── Tips ───────────────────────────────────────────────── + Text('Tips for improving time awareness', style: theme.textTheme.titleMedium), + const SizedBox(height: 8), + const _TipCard( + icon: Icons.timer_outlined, + text: 'Before starting, say your estimate out loud — it makes you more committed.', + ), + const _TipCard( + icon: Icons.visibility_rounded, + text: 'Use a visible clock or timer while working to build a sense of passing time.', + ), + const _TipCard( + icon: Icons.edit_note_rounded, + text: 'After each task, note how long it really took. Patterns will emerge!', + ), + ], + ), + ); + } +} + +class _LegendDot extends StatelessWidget { + final Color color; + final String label; + const _LegendDot({required this.color, required this.label}); + + @override + Widget build(BuildContext context) { + return Row( + mainAxisSize: MainAxisSize.min, + children: [ + Container(width: 10, height: 10, decoration: BoxDecoration(color: color, shape: BoxShape.circle)), + const SizedBox(width: 6), + Text(label, style: Theme.of(context).textTheme.bodySmall), + ], + ); + } +} + +class _TipCard extends StatelessWidget { + final IconData icon; + final String text; + const _TipCard({required this.icon, required this.text}); + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + return Card( + elevation: 0, + color: AppColors.surfaceVariantLight, + margin: const EdgeInsets.only(bottom: 8), + child: Padding( + padding: const EdgeInsets.all(14), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Icon(icon, size: 22, color: AppColors.primary), + const SizedBox(width: 10), + Expanded(child: Text(text, style: theme.textTheme.bodyMedium)), + ], + ), + ), + ); + } +} diff --git a/lib/features/time_perception/presentation/widgets/gentle_timer.dart b/lib/features/time_perception/presentation/widgets/gentle_timer.dart new file mode 100644 index 0000000..b9fcff7 --- /dev/null +++ b/lib/features/time_perception/presentation/widgets/gentle_timer.dart @@ -0,0 +1,159 @@ +import 'dart:math' as math; +import 'package:flutter/material.dart'; + +import '../../../../core/theme/app_colors.dart'; + +/// Non-anxiety-inducing timer widget. +/// +/// Design rules: +/// - Circular progress (NOT countdown — progress forward). +/// - Soft pulsing animation. +/// - Color stays calm (teal/blue). +/// - No alarming sounds or red colors. +/// - Shows "X min so far" not "X min remaining." +class GentleTimer extends StatefulWidget { + /// Total elapsed seconds. + final int elapsedSeconds; + + /// Optional estimated total in seconds (used only for the progress ring). + final int? estimatedTotalSeconds; + + /// Widget size (width & height). + final double size; + + const GentleTimer({ + super.key, + required this.elapsedSeconds, + this.estimatedTotalSeconds, + this.size = 180, + }); + + @override + State createState() => _GentleTimerState(); +} + +class _GentleTimerState extends State + with SingleTickerProviderStateMixin { + late final AnimationController _pulseController; + late final Animation _pulse; + + @override + void initState() { + super.initState(); + _pulseController = AnimationController( + vsync: this, + duration: const Duration(seconds: 2), + )..repeat(reverse: true); + _pulse = Tween(begin: 0.96, end: 1.0).animate( + CurvedAnimation(parent: _pulseController, curve: Curves.easeInOut), + ); + } + + @override + void dispose() { + _pulseController.dispose(); + super.dispose(); + } + + String _formatElapsed() { + final m = widget.elapsedSeconds ~/ 60; + final s = widget.elapsedSeconds % 60; + if (m == 0) return '${s}s so far'; + return '${m}m ${s.toString().padLeft(2, '0')}s so far'; + } + + double get _progress { + final total = widget.estimatedTotalSeconds; + if (total == null || total == 0) { + // No estimate — use a slow modular fill so the ring still moves. + return (widget.elapsedSeconds % 300) / 300; + } + return (widget.elapsedSeconds / total).clamp(0.0, 1.0); + } + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + + return AnimatedBuilder( + animation: _pulse, + builder: (context, child) { + return Transform.scale( + scale: _pulse.value, + child: child, + ); + }, + child: SizedBox( + width: widget.size, + height: widget.size, + child: CustomPaint( + painter: _GentleTimerPainter( + progress: _progress, + color: AppColors.primary, + backgroundColor: AppColors.primary.withAlpha(25), + ), + child: Center( + child: Text( + _formatElapsed(), + style: theme.textTheme.titleMedium?.copyWith( + fontWeight: FontWeight.w600, + color: AppColors.primary, + ), + textAlign: TextAlign.center, + ), + ), + ), + ), + ); + } +} + +class _GentleTimerPainter extends CustomPainter { + final double progress; + final Color color; + final Color backgroundColor; + + _GentleTimerPainter({ + required this.progress, + required this.color, + required this.backgroundColor, + }); + + @override + void paint(Canvas canvas, Size size) { + final center = Offset(size.width / 2, size.height / 2); + final radius = (size.shortestSide / 2) - 10; + const strokeWidth = 10.0; + const startAngle = -math.pi / 2; + + // Background circle + canvas.drawCircle( + center, + radius, + Paint() + ..color = backgroundColor + ..style = PaintingStyle.stroke + ..strokeWidth = strokeWidth + ..strokeCap = StrokeCap.round, + ); + + // Progress arc + if (progress > 0) { + canvas.drawArc( + Rect.fromCircle(center: center, radius: radius), + startAngle, + 2 * math.pi * progress, + false, + Paint() + ..color = color + ..style = PaintingStyle.stroke + ..strokeWidth = strokeWidth + ..strokeCap = StrokeCap.round, + ); + } + } + + @override + bool shouldRepaint(covariant _GentleTimerPainter oldDelegate) => + progress != oldDelegate.progress; +} diff --git a/lib/main.dart b/lib/main.dart new file mode 100644 index 0000000..2518a7e --- /dev/null +++ b/lib/main.dart @@ -0,0 +1,16 @@ +import 'package:flutter/material.dart'; +import 'package:get_it/get_it.dart'; +import 'app.dart'; +import 'core/network/api_client.dart'; + +final getIt = GetIt.instance; + +void main() { + WidgetsFlutterBinding.ensureInitialized(); + _setupDI(); + runApp(const FocusFlowApp()); +} + +void _setupDI() { + getIt.registerLazySingleton(() => ApiClient()); +} diff --git a/lib/routing/app_router.dart b/lib/routing/app_router.dart new file mode 100644 index 0000000..59e5e47 --- /dev/null +++ b/lib/routing/app_router.dart @@ -0,0 +1,123 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; + +import '../core/network/interceptors/auth_interceptor.dart'; +import '../features/auth/presentation/screens/login_screen.dart'; +import '../features/auth/presentation/screens/signup_screen.dart'; +import '../features/body_doubling/presentation/screens/rooms_screen.dart'; +import '../features/settings/presentation/screens/settings_screen.dart'; +import '../features/streaks/presentation/screens/streaks_screen.dart'; +import '../features/tasks/presentation/screens/create_task_screen.dart'; +import '../features/tasks/presentation/screens/focus_mode_screen.dart'; +import '../features/tasks/presentation/screens/onboarding_screen.dart'; +import '../features/tasks/presentation/screens/task_dashboard_screen.dart'; +import '../features/tasks/presentation/screens/task_detail_screen.dart'; +import '../features/time_perception/presentation/screens/time_dashboard_screen.dart'; + +/// Application router using GoRouter. +/// +/// Auth redirect: unauthenticated users are sent to /login except +/// when they are already on /login, /signup, or /onboarding. +class AppRouter { + AppRouter._(); + + static final _rootNavigatorKey = GlobalKey(); + + static final GoRouter router = GoRouter( + navigatorKey: _rootNavigatorKey, + initialLocation: '/', + redirect: _authRedirect, + routes: [ + // ── Home / Task Dashboard ──────────────────────────────────── + GoRoute( + path: '/', + name: 'home', + builder: (context, state) => const TaskDashboardScreen(), + ), + + // ── Focus mode — "just do the next thing" ─────────────────── + GoRoute( + path: '/focus', + name: 'focus', + builder: (context, state) => const FocusModeScreen(), + ), + + // ── Auth ───────────────────────────────────────────────────── + GoRoute( + path: '/login', + name: 'login', + builder: (context, state) => const LoginScreen(), + ), + GoRoute( + path: '/signup', + name: 'signup', + builder: (context, state) => const SignupScreen(), + ), + + // ── Task detail ────────────────────────────────────────────── + GoRoute( + path: '/task/:id', + name: 'taskDetail', + builder: (context, state) => TaskDetailScreen( + taskId: state.pathParameters['id']!, + ), + ), + + // ── Create task ────────────────────────────────────────────── + GoRoute( + path: '/task-create', + name: 'createTask', + builder: (context, state) => const CreateTaskScreen(), + ), + + // ── Streaks ────────────────────────────────────────────────── + GoRoute( + path: '/streaks', + name: 'streaks', + builder: (context, state) => const StreaksScreen(), + ), + + // ── Time perception ────────────────────────────────────────── + GoRoute( + path: '/time', + name: 'time', + builder: (context, state) => const TimeDashboardScreen(), + ), + + // ── Body doubling rooms ────────────────────────────────────── + GoRoute( + path: '/rooms', + name: 'rooms', + builder: (context, state) => const RoomsScreen(), + ), + + // ── Settings ───────────────────────────────────────────────── + GoRoute( + path: '/settings', + name: 'settings', + builder: (context, state) => const SettingsScreen(), + ), + + // ── Onboarding ─────────────────────────────────────────────── + GoRoute( + path: '/onboarding', + name: 'onboarding', + builder: (context, state) => const OnboardingScreen(), + ), + ], + ); + + /// Redirect unauthenticated users to /login. + static Future _authRedirect( + BuildContext context, + GoRouterState state, + ) async { + final publicPaths = {'/login', '/signup', '/onboarding'}; + if (publicPaths.contains(state.matchedLocation)) return null; + + final loggedIn = await AuthInterceptor.hasToken(); + if (!loggedIn) return '/login'; + + return null; // no redirect needed + } +} diff --git a/pubspec.lock b/pubspec.lock new file mode 100644 index 0000000..befdfd0 --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,1289 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: da0d9209ca76bde579f2da330aeb9df62b6319c834fa7baae052021b0462401f + url: "https://pub.dev" + source: hosted + version: "85.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "974859dc0ff5f37bc4313244b3218c791810d03ab3470a579580279ba971a48d" + url: "https://pub.dev" + source: hosted + version: "7.7.1" + archive: + dependency: transitive + description: + name: archive + sha256: a96e8b390886ee8abb49b7bd3ac8df6f451c621619f52a26e815fdcf568959ff + url: "https://pub.dev" + source: hosted + version: "4.0.9" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + async: + dependency: transitive + description: + name: async + sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 + url: "https://pub.dev" + source: hosted + version: "2.12.0" + bloc: + dependency: "direct main" + description: + name: bloc + sha256: a48653a82055a900b88cd35f92429f068c5a8057ae9b136d197b3d56c57efb81 + url: "https://pub.dev" + source: hosted + version: "9.2.0" + bloc_test: + dependency: "direct dev" + description: + name: bloc_test + sha256: "1dd549e58be35148bc22a9135962106aa29334bc1e3f285994946a1057b29d7b" + url: "https://pub.dev" + source: hosted + version: "10.0.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + build: + dependency: transitive + description: + name: build + sha256: "51dc711996cbf609b90cbe5b335bbce83143875a9d58e4b5c6d3c4f684d3dda7" + url: "https://pub.dev" + source: hosted + version: "2.5.4" + build_config: + dependency: transitive + description: + name: build_config + sha256: "4ae2de3e1e67ea270081eaee972e1bd8f027d459f249e0f1186730784c2e7e33" + url: "https://pub.dev" + source: hosted + version: "1.1.2" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: bf05f6e12cfea92d3c09308d7bcdab1906cd8a179b023269eed00c071004b957 + url: "https://pub.dev" + source: hosted + version: "4.1.1" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + sha256: ee4257b3f20c0c90e72ed2b57ad637f694ccba48839a821e87db762548c22a62 + url: "https://pub.dev" + source: hosted + version: "2.5.4" + build_runner: + dependency: "direct dev" + description: + name: build_runner + sha256: "382a4d649addbfb7ba71a3631df0ec6a45d5ab9b098638144faf27f02778eb53" + url: "https://pub.dev" + source: hosted + version: "2.5.4" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + sha256: "85fbbb1036d576d966332a3f5ce83f2ce66a40bea1a94ad2d5fc29a19a0d3792" + url: "https://pub.dev" + source: hosted + version: "9.1.2" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.dev" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + sha256: "6ae8a6435a8c6520c7077b107e77f1fb4ba7009633259a4d49a8afd8e7efc5e9" + url: "https://pub.dev" + source: hosted + version: "8.12.4" + cached_network_image: + dependency: "direct main" + description: + name: cached_network_image + sha256: "7c1183e361e5c8b0a0f21a28401eecdbde252441106a9816400dd4c2b2424916" + url: "https://pub.dev" + source: hosted + version: "3.4.1" + cached_network_image_platform_interface: + dependency: transitive + description: + name: cached_network_image_platform_interface + sha256: "35814b016e37fbdc91f7ae18c8caf49ba5c88501813f73ce8a07027a395e2829" + url: "https://pub.dev" + source: hosted + version: "4.1.1" + cached_network_image_web: + dependency: transitive + description: + name: cached_network_image_web + sha256: "980842f4e8e2535b8dbd3d5ca0b1f0ba66bf61d14cc3a17a9b4788a3685ba062" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + characters: + dependency: transitive + description: + name: characters + sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + charcode: + dependency: transitive + description: + name: charcode + sha256: fb0f1107cac15a5ea6ef0a6ef71a807b9e4267c713bb93e00e92d737cc8dbd8a + url: "https://pub.dev" + source: hosted + version: "1.4.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff + url: "https://pub.dev" + source: hosted + version: "2.0.3" + cli_config: + dependency: transitive + description: + name: cli_config + sha256: ac20a183a07002b700f0c25e61b7ee46b23c309d76ab7b7640a028f18e4d99ec + url: "https://pub.dev" + source: hosted + version: "0.2.0" + cli_util: + dependency: transitive + description: + name: cli_util + sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c + url: "https://pub.dev" + source: hosted + version: "0.4.2" + clock: + dependency: transitive + description: + name: clock + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b + url: "https://pub.dev" + source: hosted + version: "1.1.2" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: "6a6cab2ba4680d6423f34a9b972a4c9a94ebe1b62ecec4e1a1f2cba91fd1319d" + url: "https://pub.dev" + source: hosted + version: "4.11.1" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + connectivity_plus: + dependency: "direct main" + description: + name: connectivity_plus + sha256: b5e72753cf63becce2c61fd04dfe0f1c430cc5278b53a1342dc5ad839eab29ec + url: "https://pub.dev" + source: hosted + version: "6.1.5" + connectivity_plus_platform_interface: + dependency: transitive + description: + name: connectivity_plus_platform_interface + sha256: "42657c1715d48b167930d5f34d00222ac100475f73d10162ddf43e714932f204" + url: "https://pub.dev" + source: hosted + version: "2.0.1" + convert: + dependency: transitive + description: + name: convert + sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + coverage: + dependency: transitive + description: + name: coverage + sha256: "5da775aa218eaf2151c721b16c01c7676fbfdd99cebba2bf64e8b807a28ff94d" + url: "https://pub.dev" + source: hosted + version: "1.15.0" + cross_file: + dependency: transitive + description: + name: cross_file + sha256: "942a4791cd385a68ccb3b32c71c427aba508a1bb949b86dff2adbe4049f16239" + url: "https://pub.dev" + source: hosted + version: "0.3.5" + crypto: + dependency: transitive + description: + name: crypto + sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf + url: "https://pub.dev" + source: hosted + version: "3.0.7" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: "8a0e5fba27e8ee025d2ffb4ee820b4e6e2cf5e4246a6b1a477eb66866947e0bb" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + dbus: + dependency: transitive + description: + name: dbus + sha256: d0c98dcd4f5169878b6cf8f6e0a52403a9dff371a3e2f019697accbf6f44a270 + url: "https://pub.dev" + source: hosted + version: "0.7.12" + diff_match_patch: + dependency: transitive + description: + name: diff_match_patch + sha256: "2efc9e6e8f449d0abe15be240e2c2a3bcd977c8d126cfd70598aee60af35c0a4" + url: "https://pub.dev" + source: hosted + version: "0.4.1" + dio: + dependency: "direct main" + description: + name: dio + sha256: aff32c08f92787a557dd5c0145ac91536481831a01b4648136373cddb0e64f8c + url: "https://pub.dev" + source: hosted + version: "5.9.2" + dio_web_adapter: + dependency: transitive + description: + name: dio_web_adapter + sha256: "2f9e64323a7c3c7ef69567d5c800424a11f8337b8b228bad02524c9fb3c1f340" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + drift: + dependency: "direct main" + description: + name: drift + sha256: "540cf382a3bfa99b76e51514db5b0ebcd81ce3679b7c1c9cb9478ff3735e47a1" + url: "https://pub.dev" + source: hosted + version: "2.28.2" + drift_dev: + dependency: "direct dev" + description: + name: drift_dev + sha256: "68c138e884527d2bd61df2ade276c3a144df84d1adeb0ab8f3196b5afe021bd4" + url: "https://pub.dev" + source: hosted + version: "2.28.0" + equatable: + dependency: "direct main" + description: + name: equatable + sha256: "3e0141505477fd8ad55d6eb4e7776d3fe8430be8e497ccb1521370c3f21a3e2b" + url: "https://pub.dev" + source: hosted + version: "2.0.8" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc" + url: "https://pub.dev" + source: hosted + version: "1.3.2" + ffi: + dependency: transitive + description: + name: ffi + sha256: "6d7fd89431262d8f3125e81b50d3847a091d846eafcd4fdb88dd06f36d705a45" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" + fl_chart: + dependency: "direct main" + description: + name: fl_chart + sha256: "5276944c6ffc975ae796569a826c38a62d2abcf264e26b88fa6f482e107f4237" + url: "https://pub.dev" + source: hosted + version: "0.70.2" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_bloc: + dependency: "direct main" + description: + name: flutter_bloc + sha256: cf51747952201a455a1c840f8171d273be009b932c75093020f9af64f2123e38 + url: "https://pub.dev" + source: hosted + version: "9.1.1" + flutter_cache_manager: + dependency: transitive + description: + name: flutter_cache_manager + sha256: "400b6592f16a4409a7f2bb929a9a7e38c72cceb8ffb99ee57bbf2cb2cecf8386" + url: "https://pub.dev" + source: hosted + version: "3.4.1" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" + url: "https://pub.dev" + source: hosted + version: "5.0.0" + flutter_local_notifications: + dependency: "direct main" + description: + name: flutter_local_notifications + sha256: ef41ae901e7529e52934feba19ed82827b11baa67336829564aeab3129460610 + url: "https://pub.dev" + source: hosted + version: "18.0.1" + flutter_local_notifications_linux: + dependency: transitive + description: + name: flutter_local_notifications_linux + sha256: "8f685642876742c941b29c32030f6f4f6dacd0e4eaecb3efbb187d6a3812ca01" + url: "https://pub.dev" + source: hosted + version: "5.0.0" + flutter_local_notifications_platform_interface: + dependency: transitive + description: + name: flutter_local_notifications_platform_interface + sha256: "6c5b83c86bf819cdb177a9247a3722067dd8cc6313827ce7c77a4b238a26fd52" + url: "https://pub.dev" + source: hosted + version: "8.0.0" + flutter_secure_storage: + dependency: "direct main" + description: + name: flutter_secure_storage + sha256: "9cad52d75ebc511adfae3d447d5d13da15a55a92c9410e50f67335b6d21d16ea" + url: "https://pub.dev" + source: hosted + version: "9.2.4" + flutter_secure_storage_linux: + dependency: transitive + description: + name: flutter_secure_storage_linux + sha256: be76c1d24a97d0b98f8b54bce6b481a380a6590df992d0098f868ad54dc8f688 + url: "https://pub.dev" + source: hosted + version: "1.2.3" + flutter_secure_storage_macos: + dependency: transitive + description: + name: flutter_secure_storage_macos + sha256: "6c0a2795a2d1de26ae202a0d78527d163f4acbb11cde4c75c670f3a0fc064247" + url: "https://pub.dev" + source: hosted + version: "3.1.3" + flutter_secure_storage_platform_interface: + dependency: transitive + description: + name: flutter_secure_storage_platform_interface + sha256: cf91ad32ce5adef6fba4d736a542baca9daf3beac4db2d04be350b87f69ac4a8 + url: "https://pub.dev" + source: hosted + version: "1.1.2" + flutter_secure_storage_web: + dependency: transitive + description: + name: flutter_secure_storage_web + sha256: f4ebff989b4f07b2656fb16b47852c0aab9fed9b4ec1c70103368337bc1886a9 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + flutter_secure_storage_windows: + dependency: transitive + description: + name: flutter_secure_storage_windows + sha256: b20b07cb5ed4ed74fc567b78a72936203f587eba460af1df11281c9326cd3709 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + focusflow_shared: + dependency: "direct main" + description: + path: "../focusflow_shared" + relative: true + source: path + version: "0.1.0" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 + url: "https://pub.dev" + source: hosted + version: "4.0.0" + get_it: + dependency: "direct main" + description: + name: get_it + sha256: ae78de7c3f2304b8d81f2bb6e320833e5e81de942188542328f074978cc0efa9 + url: "https://pub.dev" + source: hosted + version: "8.3.0" + glob: + dependency: transitive + description: + name: glob + sha256: c3f1ee72c96f8f78935e18aa8cecced9ab132419e8625dc187e1c2408efc20de + url: "https://pub.dev" + source: hosted + version: "2.1.3" + go_router: + dependency: "direct main" + description: + name: go_router + sha256: f02fd7d2a4dc512fec615529824fdd217fecb3a3d3de68360293a551f21634b3 + url: "https://pub.dev" + source: hosted + version: "14.8.1" + google_fonts: + dependency: "direct main" + description: + name: google_fonts + sha256: "517b20870220c48752eafa0ba1a797a092fb22df0d89535fd9991e86ee2cdd9c" + url: "https://pub.dev" + source: hosted + version: "6.3.2" + graphs: + dependency: transitive + description: + name: graphs + sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + http: + dependency: transitive + description: + name: http + sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412" + url: "https://pub.dev" + source: hosted + version: "1.6.0" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: aa6199f908078bb1c5efb8d8638d4ae191aac11b311132c3ef48ce352fb52ef8 + url: "https://pub.dev" + source: hosted + version: "3.2.2" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + intl: + dependency: "direct main" + description: + name: intl + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf + url: "https://pub.dev" + source: hosted + version: "0.19.0" + io: + dependency: transitive + description: + name: io + sha256: dfd5a80599cf0165756e3181807ed3e77daf6dd4137caaad72d0b7931597650b + url: "https://pub.dev" + source: hosted + version: "1.0.5" + js: + dependency: transitive + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" + json_annotation: + dependency: "direct main" + description: + name: json_annotation + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + url: "https://pub.dev" + source: hosted + version: "4.9.0" + json_serializable: + dependency: "direct dev" + description: + name: json_serializable + sha256: c50ef5fc083d5b5e12eef489503ba3bf5ccc899e487d691584699b4bdefeea8c + url: "https://pub.dev" + source: hosted + version: "6.9.5" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec + url: "https://pub.dev" + source: hosted + version: "10.0.8" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 + url: "https://pub.dev" + source: hosted + version: "3.0.9" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + lints: + dependency: transitive + description: + name: lints + sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7 + url: "https://pub.dev" + source: hosted + version: "5.1.1" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + lottie: + dependency: "direct main" + description: + name: lottie + sha256: c5fa04a80a620066c15cf19cc44773e19e9b38e989ff23ea32e5903ef1015950 + url: "https://pub.dev" + source: hosted + version: "3.3.1" + matcher: + dependency: transitive + description: + name: matcher + sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + url: "https://pub.dev" + source: hosted + version: "0.12.17" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" + source: hosted + version: "0.11.1" + meta: + dependency: transitive + description: + name: meta + sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c + url: "https://pub.dev" + source: hosted + version: "1.16.0" + mime: + dependency: transitive + description: + name: mime + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + mocktail: + dependency: "direct dev" + description: + name: mocktail + sha256: "890df3f9688106f25755f26b1c60589a92b3ab91a22b8b224947ad041bf172d8" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + nested: + dependency: transitive + description: + name: nested + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + nm: + dependency: transitive + description: + name: nm + sha256: "2c9aae4127bdc8993206464fcc063611e0e36e72018696cd9631023a31b24254" + url: "https://pub.dev" + source: hosted + version: "0.5.0" + node_preamble: + dependency: transitive + description: + name: node_preamble + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + octo_image: + dependency: transitive + description: + name: octo_image + sha256: "34faa6639a78c7e3cbe79be6f9f96535867e879748ade7d17c9b1ae7536293bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + package_config: + dependency: transitive + description: + name: package_config + sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc + url: "https://pub.dev" + source: hosted + version: "2.2.0" + package_info_plus: + dependency: transitive + description: + name: package_info_plus + sha256: f69da0d3189a4b4ceaeb1a3defb0f329b3b352517f52bed4290f83d4f06bc08d + url: "https://pub.dev" + source: hosted + version: "9.0.0" + package_info_plus_platform_interface: + dependency: transitive + description: + name: package_info_plus_platform_interface + sha256: "202a487f08836a592a6bd4f901ac69b3a8f146af552bbd14407b6b41e1c3f086" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + path_provider: + dependency: transitive + description: + name: path_provider + sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd" + url: "https://pub.dev" + source: hosted + version: "2.1.5" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "3b4c1fc3aa55ddc9cd4aa6759984330d5c8e66aa7702a6223c61540dc6380c37" + url: "https://pub.dev" + source: hosted + version: "2.2.19" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "16eef174aacb07e09c351502740fa6254c165757638eba1e9116b0a781201bbd" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: "07c8f0b1913bcde1ff0d26e57ace2f3012ccbf2b204e070290dad3bb22797646" + url: "https://pub.dev" + source: hosted + version: "6.1.0" + platform: + dependency: transitive + description: + name: platform + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + url: "https://pub.dev" + source: hosted + version: "3.1.6" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + pool: + dependency: transitive + description: + name: pool + sha256: "978783255c543aa3586a1b3c21f6e9d720eb315376a915872c61ef8b5c20177d" + url: "https://pub.dev" + source: hosted + version: "1.5.2" + posix: + dependency: transitive + description: + name: posix + sha256: "185ef7606574f789b40f289c233efa52e96dead518aed988e040a10737febb07" + url: "https://pub.dev" + source: hosted + version: "6.5.0" + provider: + dependency: transitive + description: + name: provider + sha256: "4e82183fa20e5ca25703ead7e05de9e4cceed1fbd1eadc1ac3cb6f565a09f272" + url: "https://pub.dev" + source: hosted + version: "6.1.5+1" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: "0560ba233314abbed0a48a2956f7f022cce7c3e1e73df540277da7544cad4082" + url: "https://pub.dev" + source: hosted + version: "1.5.0" + recase: + dependency: transitive + description: + name: recase + sha256: e4eb4ec2dcdee52dcf99cb4ceabaffc631d7424ee55e56f280bc039737f89213 + url: "https://pub.dev" + source: hosted + version: "4.1.0" + rxdart: + dependency: transitive + description: + name: rxdart + sha256: "5c3004a4a8dbb94bd4bf5412a4def4acdaa12e12f269737a5751369e12d1a962" + url: "https://pub.dev" + source: hosted + version: "0.28.0" + share_plus: + dependency: "direct main" + description: + name: share_plus + sha256: fce43200aa03ea87b91ce4c3ac79f0cecd52e2a7a56c7a4185023c271fbfa6da + url: "https://pub.dev" + source: hosted + version: "10.1.4" + share_plus_platform_interface: + dependency: transitive + description: + name: share_plus_platform_interface + sha256: cc012a23fc2d479854e6c80150696c4a5f5bb62cb89af4de1c505cf78d0a5d0b + url: "https://pub.dev" + source: hosted + version: "5.0.2" + shelf: + dependency: transitive + description: + name: shelf + sha256: e7dd780a7ffb623c57850b33f43309312fc863fb6aa3d276a754bb299839ef12 + url: "https://pub.dev" + source: hosted + version: "1.4.2" + shelf_packages_handler: + dependency: transitive + description: + name: shelf_packages_handler + sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + shelf_static: + dependency: transitive + description: + name: shelf_static + sha256: c87c3875f91262785dade62d135760c2c69cb217ac759485334c5857ad89f6e3 + url: "https://pub.dev" + source: hosted + version: "1.1.3" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: "3632775c8e90d6c9712f883e633716432a27758216dfb61bd86a8321c0580925" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + shimmer: + dependency: "direct main" + description: + name: shimmer + sha256: "5f88c883a22e9f9f299e5ba0e4f7e6054857224976a5d9f839d4ebdc94a14ac9" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_gen: + dependency: transitive + description: + name: source_gen + sha256: "35c8150ece9e8c8d263337a265153c3329667640850b9304861faea59fc98f6b" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + source_helper: + dependency: transitive + description: + name: source_helper + sha256: a447acb083d3a5ef17f983dd36201aeea33fedadb3228fa831f2f0c92f0f3aca + url: "https://pub.dev" + source: hosted + version: "1.3.7" + source_map_stack_trace: + dependency: transitive + description: + name: source_map_stack_trace + sha256: c0713a43e323c3302c2abe2a1cc89aa057a387101ebd280371d6a6c9fa68516b + url: "https://pub.dev" + source: hosted + version: "2.1.2" + source_maps: + dependency: transitive + description: + name: source_maps + sha256: "190222579a448b03896e0ca6eca5998fa810fda630c1d65e2f78b3f638f54812" + url: "https://pub.dev" + source: hosted + version: "0.10.13" + source_span: + dependency: transitive + description: + name: source_span + sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" + url: "https://pub.dev" + source: hosted + version: "1.10.1" + sqflite: + dependency: transitive + description: + name: sqflite + sha256: e2297b1da52f127bc7a3da11439985d9b536f75070f3325e62ada69a5c585d03 + url: "https://pub.dev" + source: hosted + version: "2.4.2" + sqflite_android: + dependency: transitive + description: + name: sqflite_android + sha256: "2b3070c5fa881839f8b402ee4a39c1b4d561704d4ebbbcfb808a119bc2a1701b" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + sqflite_common: + dependency: transitive + description: + name: sqflite_common + sha256: "84731e8bfd8303a3389903e01fb2141b6e59b5973cacbb0929021df08dddbe8b" + url: "https://pub.dev" + source: hosted + version: "2.5.5" + sqflite_darwin: + dependency: transitive + description: + name: sqflite_darwin + sha256: "279832e5cde3fe99e8571879498c9211f3ca6391b0d818df4e17d9fff5c6ccb3" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + sqflite_platform_interface: + dependency: transitive + description: + name: sqflite_platform_interface + sha256: "8dd4515c7bdcae0a785b0062859336de775e8c65db81ae33dd5445f35be61920" + url: "https://pub.dev" + source: hosted + version: "2.4.0" + sqlite3: + dependency: transitive + description: + name: sqlite3 + sha256: "3145bd74dcdb4fd6f5c6dda4d4e4490a8087d7f286a14dee5d37087290f0f8a2" + url: "https://pub.dev" + source: hosted + version: "2.9.4" + sqlite3_flutter_libs: + dependency: "direct main" + description: + name: sqlite3_flutter_libs + sha256: "1e800ebe7f85a80a66adacaa6febe4d5f4d8b75f244e9838a27cb2ffc7aec08d" + url: "https://pub.dev" + source: hosted + version: "0.5.41" + sqlparser: + dependency: transitive + description: + name: sqlparser + sha256: "57090342af1ce32bb499aa641f4ecdd2d6231b9403cea537ac059e803cc20d67" + url: "https://pub.dev" + source: hosted + version: "0.41.2" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" + url: "https://pub.dev" + source: hosted + version: "1.12.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: ad47125e588cfd37a9a7f86c7d6356dde8dfe89d071d293f80ca9e9273a33871 + url: "https://pub.dev" + source: hosted + version: "2.1.1" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + synchronized: + dependency: transitive + description: + name: synchronized + sha256: "0669c70faae6270521ee4f05bffd2919892d42d1276e6c495be80174b6bc0ef6" + url: "https://pub.dev" + source: hosted + version: "3.3.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test: + dependency: transitive + description: + name: test + sha256: "301b213cd241ca982e9ba50266bd3f5bd1ea33f1455554c5abb85d1be0e2d87e" + url: "https://pub.dev" + source: hosted + version: "1.25.15" + test_api: + dependency: transitive + description: + name: test_api + sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd + url: "https://pub.dev" + source: hosted + version: "0.7.4" + test_core: + dependency: transitive + description: + name: test_core + sha256: "84d17c3486c8dfdbe5e12a50c8ae176d15e2a771b96909a9442b40173649ccaa" + url: "https://pub.dev" + source: hosted + version: "0.6.8" + timezone: + dependency: transitive + description: + name: timezone + sha256: dd14a3b83cfd7cb19e7888f1cbc20f258b8d71b54c06f79ac585f14093a287d1 + url: "https://pub.dev" + source: hosted + version: "0.10.1" + timing: + dependency: transitive + description: + name: timing + sha256: "62ee18aca144e4a9f29d212f5a4c6a053be252b895ab14b5821996cff4ed90fe" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + sha256: "4bd2b7b4dc4d4d0b94e5babfffbca8eac1a126c7f3d6ecbc1a11013faa3abba2" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + sha256: "3284b6d2ac454cf34f114e1d3319866fdd1e19cdc329999057e44ffe936cfa77" + url: "https://pub.dev" + source: hosted + version: "3.1.4" + uuid: + dependency: transitive + description: + name: uuid + sha256: "1fef9e8e11e2991bb773070d4656b7bd5d850967a2456cfc83cf47925ba79489" + url: "https://pub.dev" + source: hosted + version: "4.5.3" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14" + url: "https://pub.dev" + source: hosted + version: "14.3.1" + wakelock_plus: + dependency: "direct main" + description: + name: wakelock_plus + sha256: "9296d40c9adbedaba95d1e704f4e0b434be446e2792948d0e4aa977048104228" + url: "https://pub.dev" + source: hosted + version: "1.4.0" + wakelock_plus_platform_interface: + dependency: transitive + description: + name: wakelock_plus_platform_interface + sha256: "036deb14cd62f558ca3b73006d52ce049fabcdcb2eddfe0bf0fe4e8a943b5cf2" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + watcher: + dependency: transitive + description: + name: watcher + sha256: "1398c9f081a753f9226febe8900fce8f7d0a67163334e1c94a2438339d79d635" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + web_socket: + dependency: transitive + description: + name: web_socket + sha256: "34d64019aa8e36bf9842ac014bb5d2f5586ca73df5e4d9bf5c936975cae6982c" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + web_socket_channel: + dependency: "direct main" + description: + name: web_socket_channel + sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8 + url: "https://pub.dev" + source: hosted + version: "3.0.3" + webkit_inspection_protocol: + dependency: transitive + description: + name: webkit_inspection_protocol + sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + win32: + dependency: transitive + description: + name: win32 + sha256: "329edf97fdd893e0f1e3b9e88d6a0e627128cc17cc316a8d67fda8f1451178ba" + url: "https://pub.dev" + source: hosted + version: "5.13.0" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + xml: + dependency: transitive + description: + name: xml + sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 + url: "https://pub.dev" + source: hosted + version: "6.5.0" + yaml: + dependency: transitive + description: + name: yaml + sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce + url: "https://pub.dev" + source: hosted + version: "3.1.3" +sdks: + dart: ">=3.7.0 <4.0.0" + flutter: ">=3.29.0" diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 0000000..f5ff0bc --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,50 @@ +name: focusflow_app +description: FocusFlow - ADHD Task & Life Management +publish_to: 'none' +version: 1.0.0+1 + +environment: + sdk: ^3.7.0 + +dependencies: + flutter: + sdk: flutter + flutter_bloc: ^9.0.0 + bloc: ^9.0.0 + equatable: ^2.0.7 + get_it: ^8.0.0 + dio: ^5.7.0 + go_router: ^14.6.0 + flutter_secure_storage: ^9.2.0 + drift: ^2.22.0 + sqlite3_flutter_libs: ^0.5.0 + connectivity_plus: ^6.1.0 + flutter_local_notifications: ^18.0.0 + lottie: ^3.0.0 + fl_chart: ^0.70.0 + google_fonts: ^6.2.0 + json_annotation: ^4.9.0 + intl: ^0.19.0 + wakelock_plus: ^1.2.0 + share_plus: ^10.1.0 + web_socket_channel: ^3.0.0 + cached_network_image: ^3.4.0 + shimmer: ^3.0.0 + focusflow_shared: + path: ../focusflow_shared + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^5.0.0 + bloc_test: ^10.0.0 + build_runner: ^2.4.0 + json_serializable: ^6.8.0 + drift_dev: ^2.22.0 + mocktail: ^1.0.0 + +flutter: + uses-material-design: true + assets: + - assets/animations/ + - assets/images/ diff --git a/test/widget_test.dart b/test/widget_test.dart new file mode 100644 index 0000000..11c7e33 --- /dev/null +++ b/test/widget_test.dart @@ -0,0 +1,9 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:focusflow_app/app.dart'; + +void main() { + testWidgets('App renders without crashing', (WidgetTester tester) async { + await tester.pumpWidget(const FocusFlowApp()); + expect(find.byType(FocusFlowApp), findsOneWidget); + }); +} diff --git a/web/favicon.png b/web/favicon.png new file mode 100644 index 0000000..8aaa46a Binary files /dev/null and b/web/favicon.png differ diff --git a/web/icons/Icon-192.png b/web/icons/Icon-192.png new file mode 100644 index 0000000..b749bfe Binary files /dev/null and b/web/icons/Icon-192.png differ diff --git a/web/icons/Icon-512.png b/web/icons/Icon-512.png new file mode 100644 index 0000000..88cfd48 Binary files /dev/null and b/web/icons/Icon-512.png differ diff --git a/web/icons/Icon-maskable-192.png b/web/icons/Icon-maskable-192.png new file mode 100644 index 0000000..eb9b4d7 Binary files /dev/null and b/web/icons/Icon-maskable-192.png differ diff --git a/web/icons/Icon-maskable-512.png b/web/icons/Icon-maskable-512.png new file mode 100644 index 0000000..d69c566 Binary files /dev/null and b/web/icons/Icon-maskable-512.png differ diff --git a/web/index.html b/web/index.html new file mode 100644 index 0000000..f28b62e --- /dev/null +++ b/web/index.html @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + focusflow_app + + + + + + diff --git a/web/manifest.json b/web/manifest.json new file mode 100644 index 0000000..87c9d16 --- /dev/null +++ b/web/manifest.json @@ -0,0 +1,35 @@ +{ + "name": "focusflow_app", + "short_name": "focusflow_app", + "start_url": ".", + "display": "standalone", + "background_color": "#0175C2", + "theme_color": "#0175C2", + "description": "A new Flutter project.", + "orientation": "portrait-primary", + "prefer_related_applications": false, + "icons": [ + { + "src": "icons/Icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "icons/Icon-512.png", + "sizes": "512x512", + "type": "image/png" + }, + { + "src": "icons/Icon-maskable-192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "icons/Icon-maskable-512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + } + ] +}