commit b41cf6cc584c471325ac98210d8f4e3001322b6f Author: Rishad7594 Date: Sat Jan 31 15:23:18 2026 +0530 Initial commit: Eventify frontend diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aca81ee --- /dev/null +++ b/.gitignore @@ -0,0 +1,47 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.build/ +.buildlog/ +.history +.svn/ +.swiftpm/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +*.zip + +.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-dependencies +.pub-cache/ +.pub/ +/build/ +/coverage/ + +# 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..c85d80a --- /dev/null +++ b/.metadata @@ -0,0 +1,45 @@ +# 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: "20f82749394e68bcfbbeee96bad384abaae09c13" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 20f82749394e68bcfbbeee96bad384abaae09c13 + base_revision: 20f82749394e68bcfbbeee96bad384abaae09c13 + - platform: android + create_revision: 20f82749394e68bcfbbeee96bad384abaae09c13 + base_revision: 20f82749394e68bcfbbeee96bad384abaae09c13 + - platform: ios + create_revision: 20f82749394e68bcfbbeee96bad384abaae09c13 + base_revision: 20f82749394e68bcfbbeee96bad384abaae09c13 + - platform: linux + create_revision: 20f82749394e68bcfbbeee96bad384abaae09c13 + base_revision: 20f82749394e68bcfbbeee96bad384abaae09c13 + - platform: macos + create_revision: 20f82749394e68bcfbbeee96bad384abaae09c13 + base_revision: 20f82749394e68bcfbbeee96bad384abaae09c13 + - platform: web + create_revision: 20f82749394e68bcfbbeee96bad384abaae09c13 + base_revision: 20f82749394e68bcfbbeee96bad384abaae09c13 + - platform: windows + create_revision: 20f82749394e68bcfbbeee96bad384abaae09c13 + base_revision: 20f82749394e68bcfbbeee96bad384abaae09c13 + + # 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..06bd344 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# figma_events + +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..e23a2f2 --- /dev/null +++ b/android/app/build.gradle.kts @@ -0,0 +1,63 @@ +plugins { + id("com.android.application") + id("kotlin-android") + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "com.sicherhaven.eventify" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_11.toString() + } + + defaultConfig { + applicationId = "com.sicherhaven.eventify" + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = 11 + versionName = "1.2(p)" + } + + // ---------- SIGNING CONFIG ---------- + signingConfigs { + create("release") { + // path relative to android/app/ + storeFile = file("upload-keystore-new.jks") + + // Read from gradle.properties or environment variables. + @Suppress("UNCHECKED_CAST") + val storePwd = (project.findProperty("KEYSTORE_PASSWORD") ?: System.getenv("KEYSTORE_PASSWORD")) as String? + val alias = (project.findProperty("KEY_ALIAS") ?: System.getenv("KEY_ALIAS")) as String? + val keyPwd = (project.findProperty("KEY_PASSWORD") ?: System.getenv("KEY_PASSWORD")) as String? + + // If any are null/empty the build will fail; keep empty strings to avoid null issues, + // but ensure you provided values in gradle.properties or env. + storePassword = storePwd ?: "" + keyAlias = alias ?: "" + keyPassword = keyPwd ?: "" + } + } + + buildTypes { + release { + // Use the release signing config created above + signingConfig = signingConfigs.getByName("release") + + isMinifyEnabled = false + isShrinkResources = false + // proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") + } + } +} + +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..ff0b212 --- /dev/null +++ b/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/kotlin/com/sicherhaven/eventify/MainActivity.kt b/android/app/src/main/kotlin/com/sicherhaven/eventify/MainActivity.kt new file mode 100644 index 0000000..b78a002 --- /dev/null +++ b/android/app/src/main/kotlin/com/sicherhaven/eventify/MainActivity.kt @@ -0,0 +1,5 @@ +package com.sicherhaven.eventify + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity : FlutterActivity() diff --git a/android/app/src/main/res/drawable-hdpi/android12splash.png b/android/app/src/main/res/drawable-hdpi/android12splash.png new file mode 100644 index 0000000..0fa2a8f Binary files /dev/null and b/android/app/src/main/res/drawable-hdpi/android12splash.png differ diff --git a/android/app/src/main/res/drawable-hdpi/splash.png b/android/app/src/main/res/drawable-hdpi/splash.png new file mode 100644 index 0000000..0fa2a8f Binary files /dev/null and b/android/app/src/main/res/drawable-hdpi/splash.png differ diff --git a/android/app/src/main/res/drawable-mdpi/android12splash.png b/android/app/src/main/res/drawable-mdpi/android12splash.png new file mode 100644 index 0000000..7952084 Binary files /dev/null and b/android/app/src/main/res/drawable-mdpi/android12splash.png differ diff --git a/android/app/src/main/res/drawable-mdpi/splash.png b/android/app/src/main/res/drawable-mdpi/splash.png new file mode 100644 index 0000000..7952084 Binary files /dev/null and b/android/app/src/main/res/drawable-mdpi/splash.png differ diff --git a/android/app/src/main/res/drawable-night-hdpi/android12splash.png b/android/app/src/main/res/drawable-night-hdpi/android12splash.png new file mode 100644 index 0000000..0fa2a8f Binary files /dev/null and b/android/app/src/main/res/drawable-night-hdpi/android12splash.png differ diff --git a/android/app/src/main/res/drawable-night-mdpi/android12splash.png b/android/app/src/main/res/drawable-night-mdpi/android12splash.png new file mode 100644 index 0000000..7952084 Binary files /dev/null and b/android/app/src/main/res/drawable-night-mdpi/android12splash.png differ diff --git a/android/app/src/main/res/drawable-night-xhdpi/android12splash.png b/android/app/src/main/res/drawable-night-xhdpi/android12splash.png new file mode 100644 index 0000000..29fc508 Binary files /dev/null and b/android/app/src/main/res/drawable-night-xhdpi/android12splash.png differ diff --git a/android/app/src/main/res/drawable-night-xxhdpi/android12splash.png b/android/app/src/main/res/drawable-night-xxhdpi/android12splash.png new file mode 100644 index 0000000..8a08b00 Binary files /dev/null and b/android/app/src/main/res/drawable-night-xxhdpi/android12splash.png differ diff --git a/android/app/src/main/res/drawable-night-xxxhdpi/android12splash.png b/android/app/src/main/res/drawable-night-xxxhdpi/android12splash.png new file mode 100644 index 0000000..3289821 Binary files /dev/null and b/android/app/src/main/res/drawable-night-xxxhdpi/android12splash.png differ diff --git a/android/app/src/main/res/drawable-v21/background.png b/android/app/src/main/res/drawable-v21/background.png new file mode 100644 index 0000000..8e21404 Binary files /dev/null and b/android/app/src/main/res/drawable-v21/background.png differ 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..3cc4948 --- /dev/null +++ b/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/android/app/src/main/res/drawable-xhdpi/android12splash.png b/android/app/src/main/res/drawable-xhdpi/android12splash.png new file mode 100644 index 0000000..29fc508 Binary files /dev/null and b/android/app/src/main/res/drawable-xhdpi/android12splash.png differ diff --git a/android/app/src/main/res/drawable-xhdpi/splash.png b/android/app/src/main/res/drawable-xhdpi/splash.png new file mode 100644 index 0000000..29fc508 Binary files /dev/null and b/android/app/src/main/res/drawable-xhdpi/splash.png differ diff --git a/android/app/src/main/res/drawable-xxhdpi/android12splash.png b/android/app/src/main/res/drawable-xxhdpi/android12splash.png new file mode 100644 index 0000000..8a08b00 Binary files /dev/null and b/android/app/src/main/res/drawable-xxhdpi/android12splash.png differ diff --git a/android/app/src/main/res/drawable-xxhdpi/splash.png b/android/app/src/main/res/drawable-xxhdpi/splash.png new file mode 100644 index 0000000..8a08b00 Binary files /dev/null and b/android/app/src/main/res/drawable-xxhdpi/splash.png differ diff --git a/android/app/src/main/res/drawable-xxxhdpi/android12splash.png b/android/app/src/main/res/drawable-xxxhdpi/android12splash.png new file mode 100644 index 0000000..3289821 Binary files /dev/null and b/android/app/src/main/res/drawable-xxxhdpi/android12splash.png differ diff --git a/android/app/src/main/res/drawable-xxxhdpi/splash.png b/android/app/src/main/res/drawable-xxxhdpi/splash.png new file mode 100644 index 0000000..3289821 Binary files /dev/null and b/android/app/src/main/res/drawable-xxxhdpi/splash.png differ diff --git a/android/app/src/main/res/drawable/background.png b/android/app/src/main/res/drawable/background.png new file mode 100644 index 0000000..8e21404 Binary files /dev/null and b/android/app/src/main/res/drawable/background.png differ 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..3cc4948 --- /dev/null +++ b/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,9 @@ + + + + + + + + + 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..63ecd28 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..1dfb552 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..d60bb8d 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..94522fe 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..5ba6bf9 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-v31/styles.xml b/android/app/src/main/res/values-night-v31/styles.xml new file mode 100644 index 0000000..2df1a97 --- /dev/null +++ b/android/app/src/main/res/values-night-v31/styles.xml @@ -0,0 +1,21 @@ + + + + + + + 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..dbc9ea9 --- /dev/null +++ b/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,22 @@ + + + + + + + diff --git a/android/app/src/main/res/values-v31/styles.xml b/android/app/src/main/res/values-v31/styles.xml new file mode 100644 index 0000000..dbdf6f9 --- /dev/null +++ b/android/app/src/main/res/values-v31/styles.xml @@ -0,0 +1,21 @@ + + + + + + + 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..0d1fa8f --- /dev/null +++ b/android/app/src/main/res/values/styles.xml @@ -0,0 +1,22 @@ + + + + + + + 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..dbee657 --- /dev/null +++ b/android/build.gradle.kts @@ -0,0 +1,24 @@ +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..ef05596 --- /dev/null +++ b/android/gradle.properties @@ -0,0 +1,14 @@ +# Gradle JVM memory & misc +org.gradle.jvmargs=-Xmx2g -Dfile.encoding=UTF-8 -XX:MaxMetaspaceSize=512m -XX:ReservedCodeCacheSize=256m -XX:+HeapDumpOnOutOfMemoryError + +# Avoid extra parallel Gradle work on very low-RAM machines +org.gradle.daemon=false +org.gradle.parallel=false + +# AndroidX (keep if your project needs it) +android.useAndroidX=true +android.enableJetifier=true + +KEYSTORE_PASSWORD=android +KEY_ALIAS=upload +KEY_PASSWORD=android diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..ac3b479 --- /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.12-all.zip diff --git a/android/settings.gradle.kts b/android/settings.gradle.kts new file mode 100644 index 0000000..fb605bc --- /dev/null +++ b/android/settings.gradle.kts @@ -0,0 +1,26 @@ +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.9.1" apply false + id("org.jetbrains.kotlin.android") version "2.1.0" apply false +} + +include(":app") diff --git a/assets/icon/app_icon.png b/assets/icon/app_icon.png new file mode 100644 index 0000000..6dc2966 Binary files /dev/null and b/assets/icon/app_icon.png differ diff --git a/assets/images/gradient_dark_blue.png b/assets/images/gradient_dark_blue.png new file mode 100644 index 0000000..a11c96e Binary files /dev/null and b/assets/images/gradient_dark_blue.png differ diff --git a/assets/images/splash_icon.png b/assets/images/splash_icon.png new file mode 100644 index 0000000..9016c7c Binary files /dev/null and b/assets/images/splash_icon.png differ 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..1dc6cf7 --- /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 + 13.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..ce7eb1e --- /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 = 13.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.example.figmaEvents; + 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.example.figmaEvents.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.example.figmaEvents.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.example.figmaEvents.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 = AppIcon; + 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 = 13.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 = AppIcon; + 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 = 13.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.example.figmaEvents; + 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.example.figmaEvents; + 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..e3773d4 --- /dev/null +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..a22ad54 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..fa09d5e 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..0b659f4 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..c898b09 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..1d1365a 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..8f6bc7d 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..1f6b578 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..0b659f4 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..0977859 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..d1c77eb 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-50x50@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png new file mode 100644 index 0000000..4988a3f Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png new file mode 100644 index 0000000..b1a4f64 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png new file mode 100644 index 0000000..61be77c Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png new file mode 100644 index 0000000..e7b0c3f Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.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..d1c77eb 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..b8d300c 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-72x72@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png new file mode 100644 index 0000000..63ecd28 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png new file mode 100644 index 0000000..94522fe Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.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..0ad6406 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..93fc504 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..ec8c910 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/LaunchBackground.imageset/Contents.json b/ios/Runner/Assets.xcassets/LaunchBackground.imageset/Contents.json new file mode 100644 index 0000000..9f447e1 --- /dev/null +++ b/ios/Runner/Assets.xcassets/LaunchBackground.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "filename" : "background.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/ios/Runner/Assets.xcassets/LaunchBackground.imageset/background.png b/ios/Runner/Assets.xcassets/LaunchBackground.imageset/background.png new file mode 100644 index 0000000..8e21404 Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchBackground.imageset/background.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..00cabce --- /dev/null +++ b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "LaunchImage.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "LaunchImage@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "LaunchImage@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} 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..7952084 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..29fc508 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..8a08b00 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..7aa6dfb --- /dev/null +++ b/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..3af8016 --- /dev/null +++ b/ios/Runner/Info.plist @@ -0,0 +1,51 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Figma Events + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + figma_events + 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 + + UIStatusBarHidden + + + 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/core/api/api_client.dart b/lib/core/api/api_client.dart new file mode 100644 index 0000000..afe4acf --- /dev/null +++ b/lib/core/api/api_client.dart @@ -0,0 +1,183 @@ +// lib/core/api/api_client.dart +import 'dart:convert'; +import 'package:flutter/foundation.dart'; +import 'package:http/http.dart' as http; +import '../storage/token_storage.dart'; + +class ApiClient { + static const Duration _timeout = Duration(seconds: 30); + + /// POST request + /// + /// - `url` should be a fully qualified endpoint (ApiEndpoints.*) + /// - `body` is the JSON object to send (Map) + /// - when `requiresAuth == true` token & username are added to the request body + Future> post( + String url, { + Map? body, + bool requiresAuth = true, + }) async { + final headers = { + 'Content-Type': 'application/json', + }; + + final Map finalBody = await _buildAuthBody(body, requiresAuth); + + late http.Response response; + try { + response = await http + .post( + Uri.parse(url), + headers: headers, + body: jsonEncode(finalBody), + ) + .timeout(_timeout); + } catch (e) { + if (kDebugMode) debugPrint('ApiClient.post network error: $e'); + throw Exception('Network error: $e'); + } + + return _handleResponse(url, response, finalBody); + } + + /// GET request + /// + /// - If requiresAuth==true, token & username will be attached as query parameters. + /// - `params` will be appended as query parameters. + Future> get( + String url, { + Map? params, + bool requiresAuth = true, + }) async { + // build final query params including auth if needed + final Map finalParams = {}; + + if (requiresAuth) { + final token = await TokenStorage.getToken(); + final username = await TokenStorage.getUsername(); + if (token == null || username == null) { + throw Exception('Authentication required'); + } + finalParams['token'] = token; + finalParams['username'] = username; + } + + if (params != null) finalParams.addAll(params); + + final uri = Uri.parse(url).replace(queryParameters: finalParams.map((k, v) => MapEntry(k, v?.toString()))); + + late http.Response response; + try { + response = await http.get(uri).timeout(_timeout); + } catch (e) { + if (kDebugMode) debugPrint('ApiClient.get network error: $e'); + throw Exception('Network error: $e'); + } + + return _handleResponse(url, response, finalParams); + } + + /// Build request body and attach token + username if required + Future> _buildAuthBody(Map? body, bool requiresAuth) async { + final Map finalBody = {}; + + if (requiresAuth) { + final token = await TokenStorage.getToken(); + final username = await TokenStorage.getUsername(); + + if (token == null || username == null) { + throw Exception('Authentication required'); + } + + finalBody['token'] = token; + finalBody['username'] = username; + } + + if (body != null) finalBody.addAll(body); + + return finalBody; + } + + /// Centralized response handling and error parsing + Map _handleResponse(String url, http.Response response, Map requestBody) { + dynamic decoded; + try { + decoded = jsonDecode(response.body); + } catch (e) { + decoded = response.body; + } + + if (kDebugMode) { + debugPrint('API -> $url'); + debugPrint('Status: ${response.statusCode}'); + debugPrint('Request body: ${jsonEncode(requestBody)}'); + debugPrint('Response body: ${response.body}'); + } + + if (response.statusCode >= 200 && response.statusCode < 300) { + if (decoded is Map) return decoded; + return {'data': decoded}; + } + + // Build human-friendly message from common server patterns + String errorMessage = 'Request failed (status ${response.statusCode})'; + + if (decoded is Map) { + // 1) If there's an explicit top-level 'message' (string), prefer it + if (decoded.containsKey('message') && decoded['message'] is String) { + errorMessage = decoded['message'] as String; + } + // 2) If 'errors' exists and is a map, collect inner messages + else if (decoded.containsKey('errors')) { + final errs = decoded['errors']; + final messages = []; + if (errs is String) { + messages.add(errs); + } else if (errs is List) { + for (final e in errs) messages.add(e.toString()); + } else if (errs is Map) { + // collect first-level messages (prefer the text, not the key) + errs.forEach((k, v) { + if (v is List && v.isNotEmpty) { + messages.add(v.first.toString()); + } else if (v is String) { + messages.add(v); + } else { + messages.add(v.toString()); + } + }); + } else { + messages.add(errs.toString()); + } + if (messages.isNotEmpty) { + errorMessage = messages.join(' | '); + } + } + // 3) If '__all__' present (DRF default), show it + else if (decoded.containsKey('__all__')) { + final all = decoded['__all__']; + if (all is List) { + errorMessage = all.join(' | '); + } else { + errorMessage = all.toString(); + } + } + // 4) fallback - join map values' messages (prefer strings inside lists) + else { + final messages = []; + decoded.forEach((k, v) { + if (v is List && v.isNotEmpty) { + messages.add(v.first.toString()); + } else { + messages.add(v.toString()); + } + }); + errorMessage = messages.isNotEmpty ? messages.join(' | ') : decoded.toString(); + } + } else if (decoded is String) { + errorMessage = decoded; + } + + throw Exception(errorMessage); + } +} diff --git a/lib/core/api/api_endpoints.dart b/lib/core/api/api_endpoints.dart new file mode 100644 index 0000000..7ce37e8 --- /dev/null +++ b/lib/core/api/api_endpoints.dart @@ -0,0 +1,26 @@ +// lib/core/api/api_endpoints.dart +class ApiEndpoints { + // Change this to your desired backend base URL (local or UAT) + // For local Django dev use: "http://127.0.0.1:8000/api" + // For UAT: "https://uat.eventifyplus.com/api" + static const String baseUrl = "https://uat.eventifyplus.com/api"; + + // Auth + static const String register = "$baseUrl/user/register/"; + static const String login = "$baseUrl/user/login/"; + static const String logout = "$baseUrl/user/logout/"; + static const String status = "$baseUrl/user/status/"; + + // Events + static const String eventTypes = "$baseUrl/events/type-list/"; // list of event types + static const String eventsByPincode = "$baseUrl/events/pincode-events/"; // pincode-events + static const String eventDetails = "$baseUrl/events/event-details/"; // event-details + static const String eventImages = "$baseUrl/events/event-images/"; // event-images + static const String eventsByCategory = "$baseUrl/events/events-by-category/"; + static const String eventsByMonth = "$baseUrl/events/events-by-month-year/"; + + // Bookings + // static const String bookEvent = "$baseUrl/events/book-event/"; + // static const String userSuccessBookings = "$baseUrl/events/event/user-success-bookings/"; + // static const String userCancelledBookings = "$baseUrl/events/event/user-cancelled-bookings/"; +} diff --git a/lib/core/app_decoration.dart b/lib/core/app_decoration.dart new file mode 100644 index 0000000..bbd2531 --- /dev/null +++ b/lib/core/app_decoration.dart @@ -0,0 +1,21 @@ +import 'package:flutter/material.dart'; + +class AppDecoration { + static const BoxDecoration blueGradient = BoxDecoration( + image: DecorationImage( + image: AssetImage('assets/images/gradient_dark_blue.png'), + fit: BoxFit.cover, + ), + ); + + /// Returns a BoxDecoration with the gradient image and specific border radius + static BoxDecoration blueGradientRounded(double radius) { + return BoxDecoration( + image: const DecorationImage( + image: AssetImage('assets/images/gradient_dark_blue.png'), + fit: BoxFit.cover, + ), + borderRadius: BorderRadius.circular(radius), + ); + } +} diff --git a/lib/core/constants.dart b/lib/core/constants.dart new file mode 100644 index 0000000..9955151 --- /dev/null +++ b/lib/core/constants.dart @@ -0,0 +1,25 @@ +import 'package:flutter/material.dart'; + +class AppConstants { + // Layout + static const double desktopBreakpoint = 820; + static const double tabletBreakpoint = 600; + + // Padding & Radius + static const double defaultPadding = 16; + static const double cardRadius = 14; + + // Animation Durations + static const Duration fastAnimation = Duration(milliseconds: 200); + static const Duration normalAnimation = Duration(milliseconds: 350); + static const Duration slowAnimation = Duration(milliseconds: 600); + + // Colors + static const Color primaryColor = Color(0xFF2563EB); // Blue-600 + static const Color backgroundColor = Color(0xFFF9FAFB); + static const Color textPrimary = Color(0xFF111827); + static const Color textSecondary = Color(0xFF6B7280); + + // API + static const int apiTimeoutSeconds = 30; +} diff --git a/lib/core/storage/token_storage.dart b/lib/core/storage/token_storage.dart new file mode 100644 index 0000000..4eeb8af --- /dev/null +++ b/lib/core/storage/token_storage.dart @@ -0,0 +1,62 @@ +// lib/core/storage/token_storage.dart + +import 'package:shared_preferences/shared_preferences.dart'; + +class TokenStorage { + static const _tokenKey = "auth_token"; + static const _authUsernameKey = "auth_username"; // new key used for backend identity + static const _oldUsernameKey = "username"; // old key (may have been used for UI or auth) + static const _displayNameKey = "display_name"; // UI display name + + /// Save token and backend username. + /// Will save `auth_username` always. It will only overwrite the old `username` key + /// if that key is missing or already looks like an email (avoid overwriting user display names). + static Future saveToken(String token, String username) async { + final prefs = await SharedPreferences.getInstance(); + await prefs.setString(_tokenKey, token); + await prefs.setString(_authUsernameKey, username); + + final oldVal = prefs.getString(_oldUsernameKey); + // If old key not present OR old value looks like an email (so it's probably the backend username), + // keep it in sync. Do not overwrite if it's a display name. + if (oldVal == null || oldVal.contains('@')) { + await prefs.setString(_oldUsernameKey, username); + } + } + + static Future getToken() async { + final prefs = await SharedPreferences.getInstance(); + return prefs.getString(_tokenKey); + } + + /// Return backend username (auth identity). + /// Tries new key first, falls back to old key for compatibility. + static Future getUsername() async { + final prefs = await SharedPreferences.getInstance(); + final auth = prefs.getString(_authUsernameKey); + if (auth != null && auth.isNotEmpty) return auth; + // fallback (older apps used 'username' key) + final old = prefs.getString(_oldUsernameKey); + return old; + } + + /// Helper to read display name (UI) + static Future getDisplayName() async { + final prefs = await SharedPreferences.getInstance(); + return prefs.getString(_displayNameKey); + } + + /// Save display name for UI (do NOT use this key for backend authentication) + static Future saveDisplayName(String displayName) async { + final prefs = await SharedPreferences.getInstance(); + await prefs.setString(_displayNameKey, displayName); + } + + static Future clear() async { + final prefs = await SharedPreferences.getInstance(); + // Intentionally clear only auth-related keys (keeps user display name if you want) + await prefs.remove(_tokenKey); + await prefs.remove(_authUsernameKey); + // do NOT remove _oldUsernameKey or _displayNameKey automatically to avoid losing UI settings + } +} diff --git a/lib/core/theme_manager.dart b/lib/core/theme_manager.dart new file mode 100644 index 0000000..7993940 --- /dev/null +++ b/lib/core/theme_manager.dart @@ -0,0 +1,32 @@ +// lib/core/theme_manager.dart +import 'package:flutter/material.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +class ThemeManager { + ThemeManager._(); + + static const String _prefKey = 'is_dark_mode'; + static final ValueNotifier themeMode = ValueNotifier(ThemeMode.light); + + /// Call during app startup to load saved preference. + static Future init() async { + final prefs = await SharedPreferences.getInstance(); + final isDark = prefs.getBool(_prefKey) ?? false; + themeMode.value = isDark ? ThemeMode.dark : ThemeMode.light; + } + + /// Set theme and persist + static Future setThemeMode(ThemeMode mode) async { + themeMode.value = mode; + final prefs = await SharedPreferences.getInstance(); + await prefs.setBool(_prefKey, mode == ThemeMode.dark); + } + + static bool get isDark => themeMode.value == ThemeMode.dark; + + /// Toggle helper + static Future toggle() async { + final newMode = themeMode.value == ThemeMode.dark ? ThemeMode.light : ThemeMode.dark; + await setThemeMode(newMode); + } +} diff --git a/lib/features/auth/models/user_model.dart b/lib/features/auth/models/user_model.dart new file mode 100644 index 0000000..25d0f5a --- /dev/null +++ b/lib/features/auth/models/user_model.dart @@ -0,0 +1,36 @@ +class UserModel { + final String username; + final String email; + final String role; + final String token; + final String? phoneNumber; + + UserModel({ + required this.username, + required this.email, + required this.role, + required this.token, + this.phoneNumber, + }); + + /// Defensive factory: uses defaults when keys are missing + factory UserModel.fromJson(Map json) { + return UserModel( + username: (json['username'] ?? json['email'] ?? '').toString(), + email: (json['email'] ?? '').toString(), + role: (json['role'] ?? 'user').toString(), + token: (json['token'] ?? '').toString(), + phoneNumber: json['phone_number'] != null ? json['phone_number'].toString() : null, + ); + } + + Map toJson() { + return { + 'username': username, + 'email': email, + 'role': role, + 'token': token, + if (phoneNumber != null) 'phone_number': phoneNumber, + }; + } +} diff --git a/lib/features/auth/providers/auth_provider.dart b/lib/features/auth/providers/auth_provider.dart new file mode 100644 index 0000000..2da3e82 --- /dev/null +++ b/lib/features/auth/providers/auth_provider.dart @@ -0,0 +1,67 @@ +import 'package:flutter/material.dart'; +import '../models/user_model.dart'; +import '../services/auth_service.dart'; + +class AuthProvider extends ChangeNotifier { + final AuthService _authService = AuthService(); + + UserModel? _user; + bool _loading = false; + + UserModel? get user => _user; + bool get loading => _loading; + + /// Login with username/email and password. + Future login(String username, String password) async { + _loading = true; + notifyListeners(); + + try { + final user = await _authService.login(username, password); + _user = user; + } finally { + _loading = false; + notifyListeners(); + } + } + + /// Register wrapper that is compatible with both old and new callers. + /// + /// Preferred: provide [email], [phoneNumber], [password]. + /// Older callers that pass [username] will still work — username is ignored + /// for the backend call (we use email/phone/password as per API spec). + Future register({ + String? username, // kept for backward compatibility; not sent to backend + String? email, + required String password, + String? phoneNumber, + }) async { + _loading = true; + notifyListeners(); + + try { + // Prefer explicit email param; if not provided try to use username (some screens passed email as username) + final resolvedEmail = (email != null && email.isNotEmpty) ? email : (username ?? ''); + + // Ensure we always pass a string phoneNumber to the AuthService (it expects a non-null value) + final resolvedPhone = phoneNumber ?? ''; + + final user = await _authService.register( + email: resolvedEmail, + phoneNumber: resolvedPhone, + password: password, + ); + + _user = user; + } finally { + _loading = false; + notifyListeners(); + } + } + + Future logout() async { + await _authService.logout(); + _user = null; + notifyListeners(); + } +} diff --git a/lib/features/auth/services/auth_service.dart b/lib/features/auth/services/auth_service.dart new file mode 100644 index 0000000..b06c464 --- /dev/null +++ b/lib/features/auth/services/auth_service.dart @@ -0,0 +1,141 @@ +// lib/features/auth/services/auth_service.dart +import 'package:flutter/foundation.dart' show kDebugMode, debugPrint; +import 'package:shared_preferences/shared_preferences.dart'; +import '../../../core/api/api_client.dart'; +import '../../../core/api/api_endpoints.dart'; +import '../../../core/storage/token_storage.dart'; +import '../models/user_model.dart'; + +class AuthService { + final ApiClient _api = ApiClient(); + + /// LOGIN → returns UserModel + Future login(String username, String password) async { + try { + final res = await _api.post( + ApiEndpoints.login, + body: { + "username": username, + "password": password, + }, + requiresAuth: false, + ); + + final token = res['token']; + if (token == null) { + throw Exception('Token missing from response'); + } + + final serverUsername = (res['username'] is String && (res['username'] as String).isNotEmpty) ? res['username'] as String : null; + final serverEmail = (res['email'] is String && (res['email'] as String).isNotEmpty) ? res['email'] as String : null; + // savedEmail is the canonical identifier for this account + final savedEmail = serverEmail ?? username; + // candidate display name (server username or email fallback) + final displayCandidate = serverUsername ?? savedEmail; + + // save token (TokenStorage stays responsible for token) + await TokenStorage.saveToken(token.toString(), savedEmail); + + // persist per-account fields in SharedPreferences + final prefs = await SharedPreferences.getInstance(); + // mark current logged-in account + await prefs.setString('current_email', savedEmail); + // always keep a canonical 'email' pointing to current user's email for old callers + await prefs.setString('email', savedEmail); + // save per-account display name (do not overwrite an explicit per-account display name if already set) + final perKey = 'display_name_$savedEmail'; + final existingPer = prefs.getString(perKey); + if (existingPer == null || existingPer.trim().isEmpty) { + await prefs.setString(perKey, displayCandidate); + } + // save server-provided email (if any) separately too + if (serverEmail != null) await prefs.setString('server_email', serverEmail); + + // Save phone if provided (optional) + if (res['phone_number'] != null) await prefs.setString('phone_number', res['phone_number'].toString()); + + return UserModel.fromJson(res); + } catch (e) { + if (kDebugMode) debugPrint('AuthService.login error: $e'); + rethrow; + } + } + + /// REGISTER → returns UserModel + Future register({ + required String email, + required String phoneNumber, + required String password, + }) async { + try { + final res = await _api.post( + ApiEndpoints.register, + body: { + "email": email, + "phone_number": phoneNumber, + "password": password, + }, + requiresAuth: false, + ); + + final token = res['token']; + if (token == null) { + throw Exception('Token missing from response'); + } + + final serverUsername = (res['username'] is String && (res['username'] as String).isNotEmpty) ? res['username'] as String : null; + final serverEmail = (res['email'] is String && (res['email'] as String).isNotEmpty) ? res['email'] as String : null; + final savedEmail = serverEmail ?? email; + final savedUsername = serverUsername ?? savedEmail; + final savedRole = (res['role'] ?? 'user').toString(); + final savedPhone = (res['phone_number'] ?? phoneNumber)?.toString(); + + // Save token + canonical user id for token storage + await TokenStorage.saveToken(token.toString(), savedEmail); + + // Persist per-account keys + final prefs = await SharedPreferences.getInstance(); + await prefs.setString('current_email', savedEmail); + await prefs.setString('email', savedEmail); + + // Set display_name_ if not present yet + final perKey = 'display_name_$savedEmail'; + final existing = prefs.getString(perKey); + if (existing == null || existing.trim().isEmpty) { + await prefs.setString(perKey, savedUsername); + } + + // Optionally save phone/email in prefs + await prefs.setString('server_email', savedEmail); + if (savedPhone != null) await prefs.setString('phone_number', savedPhone); + + // Return a simple UserModel (defensive) + return UserModel( + username: savedUsername, + email: savedEmail, + role: savedRole, + token: token.toString(), + phoneNumber: savedPhone, + ); + } catch (e) { + if (kDebugMode) debugPrint('AuthService.register error: $e'); + rethrow; + } + } + + /// Logout – clear auth token and current_email (keep per-account display_name entries so they persist) + Future logout() async { + try { + final prefs = await SharedPreferences.getInstance(); + // clear token storage (should delete token + auth headers) + await TokenStorage.clear(); + // remove current_email marker so no previous account remains current + await prefs.remove('current_email'); + // Also remove canonical 'email' pointing to current user + await prefs.remove('email'); + // Do not delete display_name_ entries — they are per-account and should remain on device. + } catch (e) { + if (kDebugMode) debugPrint('AuthService.logout warning: $e'); + } + } +} diff --git a/lib/features/events/models/event_models.dart b/lib/features/events/models/event_models.dart new file mode 100644 index 0000000..11de701 --- /dev/null +++ b/lib/features/events/models/event_models.dart @@ -0,0 +1,104 @@ +// lib/features/events/models/event_models.dart +class EventTypeModel { + final int id; + final String name; + final String? iconUrl; + + EventTypeModel({required this.id, required this.name, this.iconUrl}); + + factory EventTypeModel.fromJson(Map j) { + return EventTypeModel( + id: j['id'] as int, + name: (j['event_type'] ?? j['name'] ?? '') as String, + iconUrl: (j['event_type_icon'] ?? j['icon_url']) as String?, + ); + } +} + +class EventImageModel { + final bool isPrimary; + final String image; + + EventImageModel({required this.isPrimary, required this.image}); + + factory EventImageModel.fromJson(Map j) { + return EventImageModel( + isPrimary: j['is_primary'] == true, + image: (j['image'] ?? '') as String, + ); + } +} + +class EventModel { + final int id; + final String name; + final String? title; + final String? description; + final String startDate; // YYYY-MM-DD + final String endDate; + final String? startTime; + final String? endTime; + final String? pincode; + final String? place; + final bool isBookable; + final int? eventTypeId; + final String? thumbImg; + final List images; + + // NEW fields mapped from backend + final String? importantInformation; + final String? venueName; + final String? eventStatus; + final String? cancelledReason; + + EventModel({ + required this.id, + required this.name, + this.title, + this.description, + required this.startDate, + required this.endDate, + this.startTime, + this.endTime, + this.pincode, + this.place, + this.isBookable = true, + this.eventTypeId, + this.thumbImg, + this.images = const [], + this.importantInformation, + this.venueName, + this.eventStatus, + this.cancelledReason, + }); + + factory EventModel.fromJson(Map j) { + final imgs = []; + if (j['images'] is List) { + for (final im in j['images']) { + if (im is Map) imgs.add(EventImageModel.fromJson(im)); + } + } + + return EventModel( + id: j['id'] is int ? j['id'] as int : int.parse(j['id'].toString()), + name: (j['name'] ?? '') as String, + title: j['title'] as String?, + description: j['description'] as String?, + startDate: (j['start_date'] ?? '') as String, + endDate: (j['end_date'] ?? '') as String, + startTime: j['start_time'] as String?, + endTime: j['end_time'] as String?, + pincode: j['pincode'] as String?, + place: (j['place'] ?? j['venue_name']) as String?, + isBookable: j['is_bookable'] == null ? true : (j['is_bookable'] == true || j['is_bookable'].toString().toLowerCase() == 'true'), + eventTypeId: j['event_type'] is int ? j['event_type'] as int : (j['event_type'] != null ? int.tryParse(j['event_type'].toString()) : null), + thumbImg: j['thumb_img'] as String?, + images: imgs, + importantInformation: j['important_information'] as String?, + venueName: j['venue_name'] as String?, + eventStatus: j['event_status'] as String?, + cancelledReason: j['cancelled_reason'] as String?, + ); + } +} diff --git a/lib/features/events/services/events_service.dart b/lib/features/events/services/events_service.dart new file mode 100644 index 0000000..bc886c2 --- /dev/null +++ b/lib/features/events/services/events_service.dart @@ -0,0 +1,70 @@ +// lib/features/events/services/events_service.dart +import 'package:intl/intl.dart'; +import '../../../core/api/api_client.dart'; +import '../../../core/api/api_endpoints.dart'; +import '../models/event_models.dart'; + +class EventsService { + final ApiClient _api = ApiClient(); + + /// Get event types (POST to /events/type-list/) + Future> getEventTypes() async { + final res = await _api.post(ApiEndpoints.eventTypes); + final list = []; + final data = res['event_types'] ?? res['event_types'] ?? res; + if (data is List) { + for (final e in data) { + if (e is Map) list.add(EventTypeModel.fromJson(e)); + } + } else if (res['event_types'] is List) { + for (final e in res['event_types']) { + list.add(EventTypeModel.fromJson(Map.from(e))); + } + } + return list; + } + + /// Get events filtered by pincode (POST to /events/pincode-events/) + /// Use pincode='all' to fetch all events. + Future> getEventsByPincode(String pincode) async { + final res = await _api.post(ApiEndpoints.eventsByPincode, body: {'pincode': pincode}); + final list = []; + final events = res['events'] ?? res['data'] ?? []; + if (events is List) { + for (final e in events) { + if (e is Map) list.add(EventModel.fromJson(Map.from(e))); + } + } + return list; + } + + /// Event details + Future getEventDetails(int eventId) async { + final res = await _api.post(ApiEndpoints.eventDetails, body: {'event_id': eventId}); + return EventModel.fromJson(Map.from(res)); + } + + /// Events by month and year for calendar (POST to /events/events-by-month-year/) + /// Accepts month string and year int. + /// Returns Map with 'dates' (list of YYYY-MM-DD) and 'date_events' (list with counts). + Future> getEventsByMonthYear(String month, int year) async { + final res = await _api.post(ApiEndpoints.eventsByMonth, body: {'month': month, 'year': year}); + // expected keys: dates, total_number_of_events, date_events + return res; + } + + /// Convenience: get events for a specific date (YYYY-MM-DD) + Future> getEventsForDate(String date) async { + // Simplest approach: hit pincode-events with filter or hit events-by-month-year and then + // query event-details for events of that date. Assuming backend doesn't provide direct endpoint, + // we'll call eventsByPincode('all') and filter locally by date — acceptable for demo/small datasets. + final all = await getEventsByPincode('all'); + return all.where((e) { + try { + return e.startDate == date || e.endDate == date || (DateTime.parse(e.startDate).isBefore(DateTime.parse(date)) && DateTime.parse(e.endDate).isAfter(DateTime.parse(date))); + } catch (_) { + return false; + } + }).toList(); + } +} diff --git a/lib/main.dart b/lib/main.dart new file mode 100644 index 0000000..f088609 --- /dev/null +++ b/lib/main.dart @@ -0,0 +1,149 @@ +// lib/main.dart + +import 'package:flutter/material.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +import 'screens/home_screen.dart'; +import 'screens/home_desktop_screen.dart'; +import 'screens/login_screen.dart'; +import 'screens/desktop_login_screen.dart'; +import 'screens/responsive_layout.dart'; // keep this path if your file is under lib/screens/ +import 'core/theme_manager.dart'; + +void main() async { + WidgetsFlutterBinding.ensureInitialized(); + await ThemeManager.init(); // load saved theme preference + runApp(const MyApp()); +} + +class MyApp extends StatelessWidget { + const MyApp({Key? key}) : super(key: key); + + // Breakpoint used across app: >= => desktop/tablet UI, < => mobile UI + static const double desktopBreakpoint = 820; + + // Optional: reuse your branded blue swatch if you prefer; simplified here. + static const MaterialColor primarySwatch = MaterialColor( + 0xFF0B63D6, + { + 50: Color(0xFFEAF4FF), + 100: Color(0xFFD6EBFF), + 200: Color(0xFFADD6FF), + 300: Color(0xFF85C1FF), + 400: Color(0xFF4FA6FF), + 500: Color(0xFF0B63D6), + 600: Color(0xFF0959C0), + 700: Color(0xFF074EA6), + 800: Color(0xFF05358D), + 900: Color(0xFF04256E), + }, + ); + + ThemeData _lightTheme() { + return ThemeData( + brightness: Brightness.light, + primarySwatch: primarySwatch, + scaffoldBackgroundColor: const Color(0xFFF7F5FB), + appBarTheme: const AppBarTheme( + backgroundColor: Colors.white, + foregroundColor: Colors.black87, + elevation: 0, + ), + elevatedButtonTheme: ElevatedButtonThemeData( + style: ElevatedButton.styleFrom( + backgroundColor: const Color(0xFF0B63D6), + foregroundColor: Colors.white, + ), + ), + cardColor: Colors.white, + useMaterial3: false, + ); + } + + ThemeData _darkTheme() { + // Basic dark theme based on your sample — tweak colors as desired + return ThemeData( + brightness: Brightness.dark, + primarySwatch: primarySwatch, + scaffoldBackgroundColor: const Color(0xFF0B1220), + appBarTheme: const AppBarTheme( + backgroundColor: Color(0xFF0B1220), + foregroundColor: Colors.white, + elevation: 0, + ), + elevatedButtonTheme: ElevatedButtonThemeData( + style: ElevatedButton.styleFrom(backgroundColor: const Color(0xFF0B63D6)), + ), + cardColor: const Color(0xFF0E1620), + textTheme: ThemeData.dark().textTheme, + useMaterial3: false, + ); + } + + @override + Widget build(BuildContext context) { + return ValueListenableBuilder( + valueListenable: ThemeManager.themeMode, + builder: (context, mode, _) { + return MaterialApp( + title: 'Event App', + debugShowCheckedModeBanner: false, + theme: _lightTheme(), + darkTheme: _darkTheme(), + themeMode: mode, + home: const StartupScreen(), + ); + }, + ); + } +} + +class StartupScreen extends StatefulWidget { + const StartupScreen({Key? key}) : super(key: key); + + @override + State createState() => _StartupScreenState(); +} + +class _StartupScreenState extends State { + bool? _loggedIn; + + @override + void initState() { + super.initState(); + _loadLoginState(); + } + + Future _loadLoginState() async { + final prefs = await SharedPreferences.getInstance(); + final hasEmail = prefs.getString('email') != null && prefs.getString('email')!.isNotEmpty; + setState(() => _loggedIn = hasEmail); + } + + @override + Widget build(BuildContext context) { + // While we check local storage show a loader + if (_loggedIn == null) { + return const Scaffold( + body: Center(child: CircularProgressIndicator()), + ); + } + + // Use LayoutBuilder so we can inspect the actual window width and choose the proper login/home variant. + return LayoutBuilder(builder: (context, constraints) { + final width = constraints.maxWidth; + final isDesktop = width >= MyApp.desktopBreakpoint; + + // If the user is already logged in, show responsive home (mobile or desktop) + if (_loggedIn == true) { + return ResponsiveLayout( + mobile: HomeScreen(), + desktop: const HomeDesktopScreen(), + ); + } + + // Not logged in → show login appropriate for the window size + return isDesktop ? const DesktopLoginScreen() : const LoginScreen(); + }); + } +} diff --git a/lib/screens/booking_screen.dart b/lib/screens/booking_screen.dart new file mode 100644 index 0000000..ff4a1fc --- /dev/null +++ b/lib/screens/booking_screen.dart @@ -0,0 +1,382 @@ +// lib/screens/booking_screen.dart +import 'package:flutter/material.dart'; + +class BookingScreen extends StatefulWidget { + // Keep onBook in the constructor if you want to use it later, but we won't call it here. + final VoidCallback? onBook; + final String image; + + const BookingScreen({ + Key? key, + this.onBook, + this.image = 'assets/images/event1.jpg', + }) : super(key: key); + + @override + State createState() => _BookingScreenState(); +} + +class _BookingScreenState extends State { + // small gallery placeholder + final List gallery = [ + 'assets/images/event1.jpg', + 'assets/images/event2.jpg', + 'assets/images/event3.jpeg', + 'assets/images/event1.jpg', + ]; + + // long about text + final String aboutText = ''' +Some voices don't just sing, they awaken something deep within. Sid Sriram is one of those rare artists who doesn't just perform music... he becomes it. + +This concert isn't just about a setlist or a stage, it's a journey. A moment suspended in time. A powerful collective experience where every note pulls at memory, every silence says what words never could, and every crescendo feels like it was meant just for you. + +From the moment the lights go down, you're no longer in the real world — you're in his world: a place shaped by melody and intimacy, where familiar songs are reborn and new ones carve out space in your memory. Expect an award-calibre voice that melts into orchestration, fragile acoustic passages that make the room hold its breath, and thunderous climaxes that lift everyone to their feet. + +Whether you're a longtime fan or hearing him live for the first time, this evening promises to linger long after the last chord fades — a night of shared emotion, artistry, and music that stays with you. +'''; + + bool _booked = false; + + void _performLocalBooking() { + // mark locally booked (do NOT call widget.onBook()) + if (!_booked) { + setState(() => _booked = true); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text('Tickets booked (demo)')), + ); + } + } + + void _openLearnMoreSheet() { + showModalBottomSheet( + context: context, + isScrollControlled: true, + backgroundColor: Colors.transparent, + builder: (ctx) { + return DraggableScrollableSheet( + expand: false, + initialChildSize: 0.78, + minChildSize: 0.35, + maxChildSize: 0.95, + builder: (context, scrollController) { + return Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.vertical(top: Radius.circular(24.0)), + boxShadow: [BoxShadow(color: Colors.black26, blurRadius: 8)], + ), + child: SingleChildScrollView( + controller: scrollController, + child: Padding( + padding: const EdgeInsets.fromLTRB(20, 18, 20, 24), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // drag handle + Center( + child: Container( + width: 48, + height: 6, + decoration: BoxDecoration( + color: Colors.grey[300], + borderRadius: BorderRadius.circular(6), + ), + ), + ), + SizedBox(height: 16), + + Text( + "The Homecoming Tour | Sid Sriram Live in Concert", + style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), + ), + SizedBox(height: 12), + + Row( + children: [ + Icon(Icons.calendar_today, size: 16, color: Colors.blue), + SizedBox(width: 8), + Text("22 Jan - 24 Jan, 2025", style: TextStyle(color: Colors.black54)), + SizedBox(width: 14), + Icon(Icons.access_time, size: 16, color: Colors.blue), + SizedBox(width: 8), + Text("04:00 PM - 11:00 PM", style: TextStyle(color: Colors.black54)), + ], + ), + SizedBox(height: 14), + + Container( + height: 120, + decoration: BoxDecoration( + color: Colors.grey[200], + borderRadius: BorderRadius.circular(12), + ), + child: Center(child: Text('Map placeholder — Cultural Hall', style: TextStyle(color: Colors.black45))), + ), + SizedBox(height: 18), + + Text('About the Event', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold)), + SizedBox(height: 8), + Text(aboutText, style: TextStyle(color: Colors.black54, height: 1.45)), + SizedBox(height: 18), + + Text('Gallery', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold)), + SizedBox(height: 12), + SizedBox( + height: 78, + child: ListView.separated( + scrollDirection: Axis.horizontal, + itemCount: gallery.length, + separatorBuilder: (_, __) => SizedBox(width: 12), + itemBuilder: (context, idx) { + final path = gallery[idx]; + return ClipRRect( + borderRadius: BorderRadius.circular(12), + child: Container( + width: 78, + height: 78, + color: Colors.grey[200], + child: Image.asset( + path, + fit: BoxFit.cover, + errorBuilder: (ctx, err, st) => Center(child: Icon(Icons.image, color: Colors.grey)), + ), + ), + ); + }, + ), + ), + + SizedBox(height: 22), + + // If already booked, show booked UI inside the sheet too (optional) + if (_booked) ...[ + _bookedRow(), + SizedBox(height: 12), + ] else ...[ + // Book button inside sheet — now does in-place booking (no navigation) + SizedBox( + width: double.infinity, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + padding: EdgeInsets.symmetric(vertical: 16), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + backgroundColor: Color(0xFF0B63D6), + foregroundColor: Colors.white, + ), + onPressed: () { + // mark booked and close the sheet (no removal from home) + _performLocalBooking(); + Navigator.of(context).pop(); + }, + child: Text('Book Your Spot', style: TextStyle(fontSize: 16, color: Colors.white)), + ), + ), + ], + + SizedBox(height: 12), + ], + ), + ), + ), + ); + }, + ); + }, + ); + } + + // row shown after booking: left green pill + three action icons on right + Widget _bookedRow() { + final Color primary = Color(0xFF0B63D6); + return Row( + children: [ + // Tickets Booked pill (left) + Container( + padding: EdgeInsets.symmetric(horizontal: 18, vertical: 12), + decoration: BoxDecoration( + color: Color(0xFFDFF5DF), // light green background + borderRadius: BorderRadius.circular(12), + ), + child: Text('Tickets Booked', style: TextStyle(color: Color(0xFF2E7D32), fontWeight: FontWeight.bold)), + ), + + Spacer(), + + // action icons (scanner / chat / call) + _iconSquare(primary, Icons.qr_code_scanner, onTap: () { + ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Scanner tapped (demo)'))); + }), + SizedBox(width: 12), + _iconSquare(primary, Icons.chat, onTap: () { + ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Chat tapped (demo)'))); + }), + SizedBox(width: 12), + _iconSquare(primary, Icons.call, onTap: () { + ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Call tapped (demo)'))); + }), + ], + ); + } + + Widget _iconSquare(Color bg, IconData icon, {required VoidCallback onTap}) { + return InkWell( + onTap: onTap, + borderRadius: BorderRadius.circular(12), + child: Container( + width: 52, + height: 52, + decoration: BoxDecoration( + color: bg, + borderRadius: BorderRadius.circular(12), + boxShadow: [BoxShadow(color: Colors.black12, blurRadius: 6, offset: Offset(0, 4))], + ), + child: Icon(icon, color: Colors.white, size: 24), + ), + ); + } + + void _confirmBookingFromMain() { + // book in-place (no navigation and no removal from home) + _performLocalBooking(); + } + + @override + Widget build(BuildContext context) { + // full-bleed image behind status bar + return Scaffold( + extendBodyBehindAppBar: true, + backgroundColor: Colors.black, + body: Stack( + children: [ + // full background image + Positioned.fill( + child: Image.asset( + widget.image, + fit: BoxFit.cover, + errorBuilder: (ctx, err, st) => Container(color: Colors.grey[900]), + ), + ), + + // subtle gradient to make bottom white text readable + Positioned.fill( + child: Container( + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [Colors.transparent, Colors.black87], + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + stops: [0.45, 1.0], + ), + ), + ), + ), + + // top safe area controls + SafeArea( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + _smallRoundedButton(icon: Icons.arrow_back, onTap: () => Navigator.pop(context)), + _smallRoundedButton(icon: Icons.favorite_border, onTap: () {}), + ], + ), + ), + ), + + // bottom anchored overlay: title, details, either book button or booked row, learn more + Align( + alignment: Alignment.bottomCenter, + child: SafeArea( + bottom: true, + child: Padding( + padding: const EdgeInsets.fromLTRB(20, 12, 20, 16), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + // Title & details + Container( + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'The Homecoming Tour | Sid Sriram Live in Concert', + style: TextStyle(color: Colors.white, fontSize: 22, fontWeight: FontWeight.bold), + ), + SizedBox(height: 10), + Row( + children: [ + Icon(Icons.calendar_today, size: 16, color: Colors.white70), + SizedBox(width: 8), + Text('22 Jan - 24 Jan', style: TextStyle(color: Colors.white70)), + SizedBox(width: 12), + Icon(Icons.location_on, size: 16, color: Colors.white70), + SizedBox(width: 8), + Expanded(child: Text('Cultural Hall, Brookefield', style: TextStyle(color: Colors.white70))), + ], + ), + ], + ), + ), + + SizedBox(height: 16), + + // If booked: show green pill + icons in-place. + // Otherwise show the large Book button. + if (_booked) ...[ + _bookedRow(), + SizedBox(height: 12), + ] else ...[ + SizedBox( + width: double.infinity, + child: ElevatedButton( + onPressed: _confirmBookingFromMain, + style: ElevatedButton.styleFrom( + padding: EdgeInsets.symmetric(vertical: 16), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + backgroundColor: Color(0xFF0B63D6), + foregroundColor: Colors.white, + ), + child: Text('Book Your Spot', style: TextStyle(fontSize: 16, color: Colors.white)), + ), + ), + SizedBox(height: 12), + ], + + // Learn more handle (tappable) + GestureDetector( + onTap: _openLearnMoreSheet, + child: Column( + children: [ + Text('Learn More', style: TextStyle(color: Colors.white70)), + SizedBox(height: 6), + Icon(Icons.keyboard_double_arrow_up, color: Colors.white70), + ], + ), + ), + ], + ), + ), + ), + ), + ], + ), + ); + } + + Widget _smallRoundedButton({required IconData icon, required VoidCallback onTap}) { + return InkWell( + onTap: onTap, + borderRadius: BorderRadius.circular(12), + child: Container( + width: 44, + height: 44, + decoration: BoxDecoration(color: Colors.white24, borderRadius: BorderRadius.circular(12)), + child: Icon(icon, color: Colors.white), + ), + ); + } +} diff --git a/lib/screens/calendar_screen.dart b/lib/screens/calendar_screen.dart new file mode 100644 index 0000000..5b47059 --- /dev/null +++ b/lib/screens/calendar_screen.dart @@ -0,0 +1,732 @@ +// lib/screens/calendar_screen.dart +import 'dart:math' as math; +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import '../features/events/services/events_service.dart'; +import '../features/events/models/event_models.dart'; +import 'learn_more_screen.dart'; +import '../core/app_decoration.dart'; + +class CalendarScreen extends StatefulWidget { + const CalendarScreen({Key? key}) : super(key: key); + + @override + State createState() => _CalendarScreenState(); +} + +class _CalendarScreenState extends State { + DateTime visibleMonth = DateTime.now(); + DateTime selectedDate = DateTime.now(); + + final EventsService _service = EventsService(); + + bool _loadingMonth = true; + bool _loadingDay = false; + + final Set _markedDates = {}; + final Map _dateCounts = {}; + final Map> _dateThumbnails = {}; + + List _eventsOfDay = []; + + // Scroll controller for the calendar grid + final ScrollController _calendarGridController = ScrollController(); + + static const List monthNames = [ + '', + 'January', + 'February', + 'March', + 'April', + 'May', + 'June', + 'July', + 'August', + 'September', + 'October', + 'November', + 'December' + ]; + + @override + void initState() { + super.initState(); + _loadMonth(visibleMonth); + selectedDate = DateTime.now(); + WidgetsBinding.instance.addPostFrameCallback((_) => _onSelectDate(_ymKey(selectedDate))); + } + + @override + void dispose() { + _calendarGridController.dispose(); + super.dispose(); + } + + Future _loadMonth(DateTime dt) async { + setState(() { + _loadingMonth = true; + _markedDates.clear(); + _dateCounts.clear(); + _dateThumbnails.clear(); + _eventsOfDay = []; + }); + + final monthName = DateFormat.MMMM().format(dt); + final year = dt.year; + + try { + final res = await _service.getEventsByMonthYear(monthName, year); + final datesRaw = res['dates']; + if (datesRaw is List) { + for (final d in datesRaw) { + if (d is String) _markedDates.add(d); + } + } + final dateEvents = res['date_events']; + if (dateEvents is List) { + for (final item in dateEvents) { + if (item is Map) { + final k = item['date_of_event']?.toString(); + final cnt = item['events_of_date']; + if (k != null) { + _dateCounts[k] = (cnt is int) ? cnt : int.tryParse(cnt?.toString() ?? '0') ?? 0; + } + } + } + } + + if (_markedDates.isNotEmpty) { + await _fetchThumbnailsForDates(_markedDates.toList()); + } + } catch (e) { + if (mounted) ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(e.toString()))); + } finally { + if (mounted) setState(() => _loadingMonth = false); + } + } + + Future _fetchThumbnailsForDates(List dates) async { + for (final date in dates) { + try { + final events = await _service.getEventsForDate(date); + final thumbs = []; + for (final e in events) { + String? url; + if (e.thumbImg != null && e.thumbImg!.trim().isNotEmpty) { + url = e.thumbImg!.trim(); + } else if (e.images.isNotEmpty && e.images.first.image.trim().isNotEmpty) { + url = e.images.first.image.trim(); + } + if (url != null && url.isNotEmpty) thumbs.add(url); + if (thumbs.length >= 3) break; + } + if (thumbs.isNotEmpty) { + if (mounted) { + setState(() => _dateThumbnails[date] = thumbs); + } else { + _dateThumbnails[date] = thumbs; + } + } + } catch (_) { + // ignore per-date errors + } + } + } + + Future _onSelectDate(String yyyyMMdd) async { + setState(() { + _loadingDay = true; + _eventsOfDay = []; + final parts = yyyyMMdd.split('-'); + if (parts.length == 3) { + final y = int.tryParse(parts[0]) ?? DateTime.now().year; + final m = int.tryParse(parts[1]) ?? DateTime.now().month; + final d = int.tryParse(parts[2]) ?? DateTime.now().day; + selectedDate = DateTime(y, m, d); + } + }); + + try { + final events = await _service.getEventsForDate(yyyyMMdd); + if (mounted) setState(() => _eventsOfDay = events); + } catch (e) { + if (mounted) ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(e.toString()))); + } finally { + if (mounted) setState(() => _loadingDay = false); + } + } + + void _prevMonth() { + setState(() => visibleMonth = DateTime(visibleMonth.year, visibleMonth.month - 1, 1)); + _loadMonth(visibleMonth); + } + + void _nextMonth() { + setState(() => visibleMonth = DateTime(visibleMonth.year, visibleMonth.month + 1, 1)); + _loadMonth(visibleMonth); + } + + int _daysInMonth(DateTime d) { + final next = (d.month == 12) ? DateTime(d.year + 1, 1, 1) : DateTime(d.year, d.month + 1, 1); + return next.subtract(const Duration(days: 1)).day; + } + + int _firstWeekdayOfMonth(DateTime d) { + final first = DateTime(d.year, d.month, 1); + return first.weekday; // 1=Mon ... 7=Sun + } + + String _ymKey(DateTime d) => + '${d.year.toString().padLeft(4, "0")}-${d.month.toString().padLeft(2, "0")}-${d.day.toString().padLeft(2, "0")}'; + + // show a premium modal sheet with years 2020..2050 in a 3-column grid, scrollable & draggable + Future _showYearPicker(BuildContext context) async { + final startYear = 2020; + final endYear = 2050; + final years = List.generate(endYear - startYear + 1, (i) => startYear + i); + + await showModalBottomSheet( + context: context, + isScrollControlled: true, + backgroundColor: Colors.transparent, + builder: (ctx) { + final theme = Theme.of(ctx); + return DraggableScrollableSheet( + initialChildSize: 0.55, + minChildSize: 0.32, + maxChildSize: 0.95, + expand: false, + builder: (context, scrollController) { + return Container( + margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 18), + padding: const EdgeInsets.all(12), + decoration: BoxDecoration( + color: theme.cardColor, + borderRadius: BorderRadius.circular(16), + boxShadow: [BoxShadow(color: Colors.black26, blurRadius: 20, offset: Offset(0, 8))], + ), + child: Column( + children: [ + // header + Padding( + padding: const EdgeInsets.symmetric(horizontal: 6.0, vertical: 8.0), + child: Row( + children: [ + const SizedBox(width: 4), + Expanded(child: Text('Select Year', style: theme.textTheme.titleMedium?.copyWith(fontWeight: FontWeight.w700))), + IconButton( + icon: Icon(Icons.close, color: theme.hintColor), + onPressed: () => Navigator.of(ctx).pop(), + ) + ], + ), + ), + const SizedBox(height: 8), + // grid (scrollable using the passed scrollController) + Expanded( + child: GridView.builder( + controller: scrollController, + padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 8), + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, // 3 columns -> premium style + mainAxisSpacing: 12, + crossAxisSpacing: 12, + childAspectRatio: 2.4, + ), + itemCount: years.length, + itemBuilder: (context, index) { + final y = years[index]; + final isSelected = visibleMonth.year == y; + return InkWell( + onTap: () { + setState(() { + visibleMonth = DateTime(y, visibleMonth.month, 1); + }); + _loadMonth(visibleMonth); + Navigator.of(ctx).pop(); + }, + borderRadius: BorderRadius.circular(10), + child: Container( + alignment: Alignment.center, + decoration: BoxDecoration( + color: isSelected ? theme.colorScheme.primary.withOpacity(0.12) : null, + borderRadius: BorderRadius.circular(10), + border: isSelected ? Border.all(color: theme.colorScheme.primary, width: 1.6) : Border.all(color: Colors.transparent), + boxShadow: isSelected ? [BoxShadow(color: theme.colorScheme.primary.withOpacity(0.06), blurRadius: 10, offset: Offset(0, 4))] : null, + ), + child: Text( + '$y', + style: theme.textTheme.bodyLarge?.copyWith( + fontWeight: isSelected ? FontWeight.w700 : FontWeight.w600, + color: isSelected ? theme.colorScheme.primary : theme.textTheme.bodyLarge?.color, + fontSize: 16, + ), + ), + ), + ); + }, + ), + ), + ], + ), + ); + }, + ); + }, + ); + } + + Widget _buildMonthYearHeader(BuildContext context, Color primaryColor) { + final theme = Theme.of(context); + return Row( + children: [ + IconButton(icon: Icon(Icons.chevron_left, color: primaryColor), onPressed: _prevMonth, splashRadius: 20), + Expanded( + child: Center( + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + // plain month label (no dropdown) + Text( + monthNames[visibleMonth.month], + style: const TextStyle(fontWeight: FontWeight.w600), + ), + const SizedBox(width: 10), + // year "dropdown" replaced with premium modal trigger + InkWell( + onTap: () => _showYearPicker(context), + borderRadius: BorderRadius.circular(6), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4), + child: Row( + children: [ + Text( + '${visibleMonth.year}', + style: const TextStyle(fontWeight: FontWeight.w600), + ), + const SizedBox(width: 6), + Icon(Icons.arrow_drop_down, size: 22, color: theme.textTheme.bodyLarge?.color), + ], + ), + ), + ), + ], + ), + ), + ), + IconButton(icon: Icon(Icons.chevron_right, color: primaryColor), onPressed: _nextMonth, splashRadius: 20), + ], + ); + } + + /// Calendar card that shows full rows (including overflow prev/next month dates). + Widget _calendarCard(BuildContext context) { + final theme = Theme.of(context); + final primaryColor = theme.colorScheme.primary; + final weekdayShorts = ['M', 'T', 'W', 'T', 'F', 'S', 'S']; + + // compute rows to guarantee rows * 7 cells + final daysInMonth = _daysInMonth(visibleMonth); + final firstWeekday = _firstWeekdayOfMonth(visibleMonth); + final leadingEmpty = firstWeekday - 1; + final totalCells = leadingEmpty + daysInMonth; + final rows = (totalCells / 7).ceil(); + final totalItems = rows * 7; + + // first date shown (may be prev month's date) + final firstCellDate = DateTime(visibleMonth.year, visibleMonth.month, 1).subtract(Duration(days: leadingEmpty)); + + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 20.0), + child: Card( + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)), + elevation: 8, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 14.0, vertical: 12.0), + child: Column( + mainAxisSize: MainAxisSize.min, // tightly wrap grid + children: [ + // month/year header + SizedBox(height: 48, child: _buildMonthYearHeader(context, primaryColor)), + const SizedBox(height: 6), + // weekday labels row + SizedBox( + height: 22, + child: Row( + children: List.generate(7, (i) { + final isWeekend = (i == 5 || i == 6); + return Expanded( + child: Center( + child: Text( + weekdayShorts[i], + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w700, + color: isWeekend ? Colors.redAccent.withOpacity(0.9) : (Theme.of(context).brightness == Brightness.dark ? Colors.white70 : Colors.black54), + ), + ), + ), + ); + }), + ), + ), + const SizedBox(height: 8), + + // GRID: shrinkWrap true ensures all rows are rendered + GridView.builder( + shrinkWrap: true, + controller: _calendarGridController, + physics: const NeverScrollableScrollPhysics(), + padding: EdgeInsets.zero, + itemCount: totalItems, + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 7, + mainAxisSpacing: 8, + crossAxisSpacing: 8, + childAspectRatio: 1, + ), + itemBuilder: (context, index) { + final cellDate = firstCellDate.add(Duration(days: index)); + final inCurrentMonth = cellDate.month == visibleMonth.month && cellDate.year == visibleMonth.year; + final dayIndex = cellDate.day; + final key = _ymKey(cellDate); + final hasEvents = _markedDates.contains(key); + final thumbnails = _dateThumbnails[key] ?? []; + final isSelected = selectedDate.year == cellDate.year && selectedDate.month == cellDate.month && selectedDate.day == cellDate.day; + + final dayTextColor = inCurrentMonth + ? (Theme.of(context).brightness == Brightness.dark ? Colors.white : Colors.black87) + : (Theme.of(context).brightness == Brightness.dark ? Colors.white38 : Colors.grey.shade400); + + return GestureDetector( + onTap: () { + if (!inCurrentMonth) { + setState(() => visibleMonth = DateTime(cellDate.year, cellDate.month, 1)); + _loadMonth(visibleMonth); + } + _onSelectDate(key); + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + // rounded date cell + Container( + width: 36, + height: 36, + decoration: BoxDecoration( + color: isSelected ? primaryColor.withOpacity(0.14) : Colors.transparent, + borderRadius: BorderRadius.circular(8), + ), + alignment: Alignment.center, + child: Text( + '$dayIndex', + style: TextStyle( + fontWeight: isSelected ? FontWeight.w700 : FontWeight.w600, + color: isSelected ? primaryColor : dayTextColor, + fontSize: 14, + ), + ), + ), + const SizedBox(height: 6), + // small event indicators (thumbnail overlap or dot) + if (hasEvents && thumbnails.isNotEmpty) + SizedBox( + height: 14, + child: Row( + mainAxisSize: MainAxisSize.min, + children: thumbnails.take(2).toList().asMap().entries.map((entry) { + final i = entry.key; + final url = entry.value; + return Transform.translate( + offset: Offset(i * -6.0, 0), + child: Container( + margin: const EdgeInsets.only(left: 4), + width: 14, + height: 14, + decoration: BoxDecoration(shape: BoxShape.circle, border: Border.all(color: Theme.of(context).cardColor, width: 1.0)), + child: ClipOval(child: Image.network(url, fit: BoxFit.cover, errorBuilder: (_, __, ___) => Container(color: Theme.of(context).dividerColor))), + ), + ); + }).toList(), + ), + ) + else if (hasEvents) + Container(width: 18, height: 6, decoration: BoxDecoration(color: primaryColor, borderRadius: BorderRadius.circular(6))) + else + const SizedBox.shrink(), + ], + ), + ); + }, + ), + ], + ), + ), + ), + ); + } + + // Selected-date summary (now guaranteed outside and below the calendar card) + Widget _selectedDateSummary(BuildContext context) { + final theme = Theme.of(context); + final shortWeekday = DateFormat('EEEE').format(selectedDate); + final shortDate = DateFormat('d MMMM, yyyy').format(selectedDate); + final dayNumber = selectedDate.day; + final monthLabel = DateFormat('MMM').format(selectedDate).toUpperCase(); + final eventsCount = _eventsOfDay.length; + final primaryColor = theme.colorScheme.primary; + + return Padding( + padding: const EdgeInsets.fromLTRB(20, 12, 20, 8), + child: Card( + elevation: 6, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 10.0, vertical: 8.0), + child: Row( + children: [ + Container( + width: 56, + height: 56, + decoration: BoxDecoration(color: primaryColor.withOpacity(0.12), borderRadius: BorderRadius.circular(10)), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text('$dayNumber', style: theme.textTheme.headlineSmall?.copyWith(color: primaryColor, fontWeight: FontWeight.bold, fontSize: 18)), + const SizedBox(height: 2), + Text(monthLabel, style: theme.textTheme.bodySmall?.copyWith(color: theme.hintColor, fontSize: 11, fontWeight: FontWeight.w700)), + ], + ), + ), + const SizedBox(width: 10), + Expanded( + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Text(shortWeekday, style: theme.textTheme.titleMedium?.copyWith(fontWeight: FontWeight.w600, fontSize: 14)), + const SizedBox(height: 2), + Text(shortDate, style: theme.textTheme.bodySmall?.copyWith(color: theme.hintColor, fontSize: 12)), + ]), + ), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text('$eventsCount', style: theme.textTheme.headlineSmall?.copyWith(fontWeight: FontWeight.bold, color: primaryColor, fontSize: 16)), + const SizedBox(height: 2), + Text(eventsCount == 1 ? 'Event' : 'Events', style: theme.textTheme.bodySmall?.copyWith(color: theme.hintColor, fontSize: 12)), + ], + ), + ], + ), + ), + ), + ); + } + + // Mobile event card (kept unchanged) + Widget _eventCardMobile(EventModel e) { + final theme = Theme.of(context); + final imgUrl = (e.thumbImg != null && e.thumbImg!.isNotEmpty) ? e.thumbImg! : (e.images.isNotEmpty ? e.images.first.image : null); + final dateLabel = (e.startDate != null && e.endDate != null && e.startDate == e.endDate) + ? '${e.startDate}' + : (e.startDate != null && e.endDate != null ? '${e.startDate} - ${e.endDate}' : (e.startDate ?? '')); + + return GestureDetector( + onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => LearnMoreScreen(eventId: e.id))), + child: Card( + elevation: 6, + margin: const EdgeInsets.fromLTRB(20, 10, 20, 10), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + ClipRRect( + borderRadius: const BorderRadius.vertical(top: Radius.circular(14)), + child: imgUrl != null ? Image.network(imgUrl, height: 150, width: double.infinity, fit: BoxFit.cover, errorBuilder: (_, __, ___) => Container(height: 150, color: theme.dividerColor)) : Container(height: 150, color: theme.dividerColor, child: Icon(Icons.event, size: 44, color: theme.hintColor)), + ), + Padding( + padding: const EdgeInsets.fromLTRB(12, 12, 12, 14), + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Text(e.title ?? e.name ?? '', style: theme.textTheme.titleMedium?.copyWith(fontWeight: FontWeight.bold), maxLines: 2, overflow: TextOverflow.ellipsis), + const SizedBox(height: 10), + Row(children: [ + Container(width: 26, height: 26, decoration: BoxDecoration(color: theme.colorScheme.primary.withOpacity(0.12), borderRadius: BorderRadius.circular(6)), child: Icon(Icons.calendar_today, size: 14, color: theme.colorScheme.primary)), + const SizedBox(width: 8), + Expanded(child: Text(dateLabel, style: theme.textTheme.bodySmall?.copyWith(color: theme.hintColor))), + ]), + const SizedBox(height: 8), + Row(children: [ + Container(width: 26, height: 26, decoration: BoxDecoration(color: theme.colorScheme.primary.withOpacity(0.12), borderRadius: BorderRadius.circular(6)), child: Icon(Icons.location_on, size: 14, color: theme.colorScheme.primary)), + const SizedBox(width: 8), + Expanded(child: Text(e.place ?? '', style: theme.textTheme.bodySmall?.copyWith(color: theme.hintColor))), + ]), + ]), + ), + ], + ), + ), + ); + } + + @override + Widget build(BuildContext context) { + final width = MediaQuery.of(context).size.width; + final isMobile = width < 700; + final theme = Theme.of(context); + + // For non-mobile, keep original split layout + if (!isMobile) { + return Scaffold( + backgroundColor: theme.scaffoldBackgroundColor, + body: SafeArea( + child: Row( + children: [ + Expanded(flex: 3, child: Padding(padding: const EdgeInsets.all(24.0), child: _calendarCard(context))), + Expanded(flex: 1, child: _detailsPanel()), + ], + ), + ), + ); + } + + // MOBILE layout + // Stack: extended gradient panel (below appbar) that visually extends behind the calendar. + return Scaffold( + backgroundColor: theme.scaffoldBackgroundColor, + body: Stack( + children: [ + // Extended blue gradient panel behind calendar (matches reference) + Positioned( + top: 0, + left: 0, + right: 0, + child: Container( + height: 260, // controls how much gradient shows behind calendar + decoration: AppDecoration.blueGradient.copyWith( + borderRadius: const BorderRadius.only(bottomLeft: Radius.circular(30), bottomRight: Radius.circular(30)), + boxShadow: [const BoxShadow(color: Colors.black12, blurRadius: 12, offset: Offset(0, 6))], + ), + // leave child empty — title and bell are placed above + child: const SizedBox.shrink(), + ), + ), + + // TOP APP BAR (title centered + notification at top-right) - unchanged placement + Positioned( + top: 0, + left: 0, + right: 0, + child: SafeArea( + bottom: false, + child: SizedBox( + height: 56, // app bar height + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 20), + child: Stack( + alignment: Alignment.center, + children: [ + // centered title + Text( + "Event's Calendar", + style: Theme.of(context).textTheme.titleMedium?.copyWith( + color: Colors.white, + fontSize: 18, + fontWeight: FontWeight.w600, + ), + ), + + // notification icon at absolute top-right + Positioned( + right: 0, + child: InkWell( + onTap: () => ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Notifications (demo)'))), + child: Container( + width: 40, + height: 40, + decoration: BoxDecoration( + color: Colors.white24, + borderRadius: BorderRadius.circular(10), + ), + child: const Icon(Icons.notifications_none, color: Colors.white), + ), + ), + ), + ], + ), + ), + ), + ), + ), + + // CONTENT: calendar card overlapped on gradient, then summary and list + Column( + children: [ + const SizedBox(height: 110), // leave space for appbar + some gradient top + _calendarCard(context), // calendar card sits visually on top of the gradient + _selectedDateSummary(context), + Expanded( + child: _loadingDay + ? Center(child: CircularProgressIndicator(color: theme.colorScheme.primary)) + : _eventsOfDay.isEmpty + ? Center( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(Icons.event_available, size: 48, color: theme.hintColor), + const SizedBox(height: 10), + Text('No events scheduled for this date', style: theme.textTheme.bodyMedium?.copyWith(color: theme.hintColor)), + ], + ), + ) + : ListView.builder( + padding: const EdgeInsets.only(top: 6, bottom: 32), + itemCount: _eventsOfDay.length, + itemBuilder: (context, idx) => _eventCardMobile(_eventsOfDay[idx]), + ), + ), + ], + ), + ], + ), + ); + } + + Widget _detailsPanel() { + final theme = Theme.of(context); + final shortDate = DateFormat('EEE, d MMM').format(selectedDate); + final eventsCount = _eventsOfDay.length; + + Widget _buildHeaderCompact() { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 12.0), + child: Row( + children: [ + Container( + width: 48, + height: 48, + decoration: AppDecoration.blueGradientRounded(10), + child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [Text('${selectedDate.day}', style: const TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.bold)), const SizedBox(height: 2), Text(monthNames[selectedDate.month].substring(0, 3), style: const TextStyle(color: Colors.white70, fontSize: 10))]), + ), + const SizedBox(width: 12), + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [Text(shortDate, style: Theme.of(context).textTheme.bodyLarge?.copyWith(fontWeight: FontWeight.w600)), const SizedBox(height: 4), Text('$eventsCount ${eventsCount == 1 ? "Event" : "Events"}', style: Theme.of(context).textTheme.bodySmall?.copyWith(color: Theme.of(context).hintColor))]), + const Spacer(), + IconButton(onPressed: () {}, icon: Icon(Icons.more_horiz, color: Theme.of(context).iconTheme.color)), + ], + ), + ); + } + + return Container( + color: Theme.of(context).scaffoldBackgroundColor, + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + _buildHeaderCompact(), + Divider(height: 1, color: theme.dividerColor), + Expanded( + child: _loadingDay + ? Center(child: CircularProgressIndicator(color: theme.colorScheme.primary)) + : _eventsOfDay.isEmpty + ? const SizedBox.shrink() + : ListView.builder(padding: const EdgeInsets.only(top: 6, bottom: 24), itemCount: _eventsOfDay.length, itemBuilder: (context, idx) => _eventCardMobile(_eventsOfDay[idx])), + ) + ]), + ); + } +} diff --git a/lib/screens/contribute_screen.dart b/lib/screens/contribute_screen.dart new file mode 100644 index 0000000..8f632b1 --- /dev/null +++ b/lib/screens/contribute_screen.dart @@ -0,0 +1,556 @@ +// lib/screens/contribute_screen.dart +import 'dart:io'; +import '../core/app_decoration.dart'; + +import 'package:flutter/foundation.dart' show kIsWeb; +import 'package:flutter/material.dart'; +import 'package:image_picker/image_picker.dart'; + +class ContributeScreen extends StatefulWidget { + const ContributeScreen({Key? key}) : super(key: key); + + @override + State createState() => _ContributeScreenState(); +} + +class _ContributeScreenState extends State with SingleTickerProviderStateMixin { + // Primary accent used for buttons / active tab (kept as a single constant) + static const Color _primary = Color(0xFF0B63D6); + + // single corner radius to use everywhere + static const double _cornerRadius = 18.0; + + // Form controllers + final TextEditingController _titleCtl = TextEditingController(); + final TextEditingController _locationCtl = TextEditingController(); + final TextEditingController _organizerCtl = TextEditingController(); + final TextEditingController _descriptionCtl = TextEditingController(); + DateTime? _selectedDate; + String _selectedCategory = 'Music'; + + // Image pickers + final ImagePicker _picker = ImagePicker(); + XFile? _coverImageFile; + XFile? _thumbImageFile; + + bool _submitting = false; + + // Tab state: 0 = Contribute, 1 = Leaderboard, 2 = Achievements + int _activeTab = 0; + + // Example progress value (0..1) + double _progress = 0.45; + + // A few category options + final List _categories = ['Music', 'Food', 'Arts', 'Sports', 'Tech', 'Community']; + + @override + void dispose() { + _titleCtl.dispose(); + _locationCtl.dispose(); + _organizerCtl.dispose(); + _descriptionCtl.dispose(); + super.dispose(); + } + + Future _pickCoverImage() async { + try { + final XFile? picked = await _picker.pickImage(source: ImageSource.gallery, imageQuality: 85); + if (picked != null) setState(() => _coverImageFile = picked); + } catch (e) { + if (mounted) ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Failed to pick image: $e'))); + } + } + + Future _pickThumbnailImage() async { + try { + final XFile? picked = await _picker.pickImage(source: ImageSource.gallery, imageQuality: 85); + if (picked != null) setState(() => _thumbImageFile = picked); + } catch (e) { + if (mounted) ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Failed to pick image: $e'))); + } + } + + Future _pickDate() async { + final now = DateTime.now(); + final picked = await showDatePicker( + context: context, + initialDate: _selectedDate ?? now, + firstDate: DateTime(now.year - 2), + lastDate: DateTime(now.year + 3), + builder: (context, child) { + return Theme( + data: Theme.of(context).copyWith(colorScheme: ColorScheme.light(primary: _primary)), + child: child!, + ); + }, + ); + if (picked != null) setState(() => _selectedDate = picked); + } + + Future _submit() async { + if (_titleCtl.text.trim().isEmpty) { + ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Please enter an event title'))); + return; + } + + setState(() => _submitting = true); + // simulate work + await Future.delayed(const Duration(milliseconds: 800)); + + setState(() => _submitting = false); + if (mounted) { + ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Submitted for verification (demo)'))); + _clearForm(); + } + } + + void _clearForm() { + _titleCtl.clear(); + _locationCtl.clear(); + _organizerCtl.clear(); + _descriptionCtl.clear(); + _selectedDate = null; + _selectedCategory = _categories.first; + _coverImageFile = null; + _thumbImageFile = null; + setState(() {}); + } + + // ---------- UI Builders ---------- + + Widget _buildHeader(BuildContext context) { + final theme = Theme.of(context); + // header uses AppDecoration.blueGradient for background (project-specific) + return Container( + width: double.infinity, + padding: const EdgeInsets.fromLTRB(20, 32, 20, 24), + decoration: AppDecoration.blueGradient.copyWith( + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(_cornerRadius), + bottomRight: Radius.circular(_cornerRadius), + ), + // subtle shadow only + boxShadow: [ + BoxShadow(color: Colors.black.withOpacity(0.06), blurRadius: 8, offset: const Offset(0, 4)), + ], + ), + child: SafeArea( + bottom: false, + child: Column( + children: [ + // increased spacing to create a breathable layout + const SizedBox(height: 6), + + // Title & subtitle (centered) — smaller title weight, clearer hierarchy + Text( + 'Contributor Dashboard', + textAlign: TextAlign.center, + style: theme.textTheme.titleLarge?.copyWith( + color: Colors.white, + fontWeight: FontWeight.w700, + fontSize: 20, + ), + ), + const SizedBox(height: 12), // more space between title & subtitle + Text( + 'Track your impact, earn rewards, and climb the ranks!', + textAlign: TextAlign.center, + style: theme.textTheme.bodyMedium?.copyWith(color: Colors.white.withOpacity(0.92), fontSize: 13, height: 1.35), + ), + + const SizedBox(height: 20), // more space before tabs + + // Pill-style segmented tabs (animated active) — slimmer / minimal + _buildSegmentedTabs(context), + + const SizedBox(height: 18), // comfortable spacing before contributor card + + // Contributor level card — lighter, soft border, thinner progress + Container( + width: double.infinity, + padding: const EdgeInsets.all(14), + margin: const EdgeInsets.symmetric(horizontal: 4), + decoration: BoxDecoration( + color: Colors.white.withOpacity(0.08), // slightly lighter than before + borderRadius: BorderRadius.circular(_cornerRadius - 2), + border: Border.all(color: Colors.white.withOpacity(0.09)), // soft border + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Contributor Level', + style: theme.textTheme.titleSmall?.copyWith(color: Colors.white, fontWeight: FontWeight.w700)), + const SizedBox(height: 8), + Text('Start earning rewards by contributing!', style: theme.textTheme.bodySmall?.copyWith(color: Colors.white70)), + const SizedBox(height: 12), + Row( + children: [ + Expanded( + // animated progress using TweenAnimationBuilder + child: TweenAnimationBuilder( + tween: Tween(begin: 0.0, end: _progress), + duration: const Duration(milliseconds: 700), + builder: (context, value, _) => ClipRRect( + borderRadius: BorderRadius.circular(6), + child: LinearProgressIndicator( + value: value, + minHeight: 6, // thinner progress bar + valueColor: const AlwaysStoppedAnimation(Colors.white), + backgroundColor: Colors.white24, + ), + ), + ), + ), + const SizedBox(width: 12), + Container( + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6), + decoration: BoxDecoration( + color: Colors.white.withOpacity(0.12), + borderRadius: BorderRadius.circular(12), + ), + child: Text('Explorer', style: theme.textTheme.bodySmall?.copyWith(color: Colors.white, fontWeight: FontWeight.w600)), + ), + ], + ), + const SizedBox(height: 8), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text('30 pts', style: theme.textTheme.bodyMedium?.copyWith(color: Colors.white, fontWeight: FontWeight.w600)), + Text('Next: Enthusiast (50 pts)', style: theme.textTheme.bodyMedium?.copyWith(color: Colors.white70)), + ], + ), + ], + ), + ), + ], + ), + ), + ); + } + + Widget _buildSegmentedTabs(BuildContext context) { + final tabs = ['Contribute', 'Leaderboard', 'Achievements']; + + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10), + child: Container( + padding: const EdgeInsets.all(8), + decoration: BoxDecoration( + color: Colors.white.withOpacity(0.06), + borderRadius: BorderRadius.circular(_cornerRadius + 6), + border: Border.all(color: Colors.white.withOpacity(0.10)), + boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.04), blurRadius: 8, offset: const Offset(0, 6))], + ), + child: Row( + children: List.generate(tabs.length, (i) { + final active = i == _activeTab; + return Expanded( + child: GestureDetector( + onTap: () => setState(() => _activeTab = i), + child: AnimatedContainer( + duration: const Duration(milliseconds: 220), + padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 10), + margin: EdgeInsets.only(right: i == tabs.length - 1 ? 0 : 8), + decoration: BoxDecoration( + color: active ? Colors.white : Colors.transparent, + borderRadius: BorderRadius.circular(_cornerRadius - 4), + boxShadow: active ? [BoxShadow(color: Colors.black.withOpacity(0.06), blurRadius: 8, offset: const Offset(0, 4))] : null, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + // show a small icon only for active tab + if (active) ...[ + Icon(Icons.edit, size: 14, color: _primary), + const SizedBox(width: 8), + ], + // FittedBox ensures the whole word is visible (scales down if necessary) + Flexible( + child: FittedBox( + fit: BoxFit.scaleDown, + alignment: Alignment.center, + child: Text( + tabs[i], + textAlign: TextAlign.center, + style: TextStyle( + color: active ? _primary : Colors.white.withOpacity(0.95), + fontWeight: active ? FontWeight.w800 : FontWeight.w600, + fontSize: 16, // preferred size; FittedBox will shrink if needed + ), + ), + ), + ), + ], + ), + ), + ), + ); + }), + ), + ), + ); + } + + + + + Widget _buildForm(BuildContext ctx) { + final theme = Theme.of(ctx); + return Container( + width: double.infinity, + margin: const EdgeInsets.only(top: 18), + padding: const EdgeInsets.fromLTRB(18, 20, 18, 28), + decoration: BoxDecoration( + color: theme.scaffoldBackgroundColor, + borderRadius: BorderRadius.circular(_cornerRadius), + boxShadow: [BoxShadow(color: Colors.black.withOpacity(0.03), blurRadius: 12, offset: const Offset(0, 6))], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // sheet title + Center( + child: Column( + children: [ + Text('Contribute an Event', style: theme.textTheme.headlineSmall?.copyWith(fontWeight: FontWeight.bold)), + const SizedBox(height: 8), + Text('Share local events. Earn points for every verified submission!', + textAlign: TextAlign.center, style: theme.textTheme.bodyMedium?.copyWith(color: theme.hintColor)), + ], + ), + ), + + const SizedBox(height: 18), + + // small helper button + Center( + child: OutlinedButton( + onPressed: () { + ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Want to edit an existing event? (demo)'))); + }, + style: OutlinedButton.styleFrom( + side: BorderSide(color: Colors.grey.shade300), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(_cornerRadius - 6)), + padding: const EdgeInsets.symmetric(horizontal: 18, vertical: 12), + ), + child: const Text('Want to edit an existing event?'), + ), + ), + + const SizedBox(height: 18), + + // Event Title + Text('Event Title', style: theme.textTheme.labelLarge), + const SizedBox(height: 8), + _roundedTextField(controller: _titleCtl, hint: 'e.g. Local Food Festival'), + + const SizedBox(height: 14), + + // Category + Text('Category', style: theme.textTheme.labelLarge), + const SizedBox(height: 8), + Container( + padding: const EdgeInsets.symmetric(horizontal: 12), + decoration: BoxDecoration(color: theme.cardColor, borderRadius: BorderRadius.circular(_cornerRadius - 8)), + child: DropdownButtonHideUnderline( + child: DropdownButton( + value: _selectedCategory, + isExpanded: true, + items: _categories.map((c) => DropdownMenuItem(value: c, child: Text(c))).toList(), + onChanged: (v) => setState(() => _selectedCategory = v ?? _selectedCategory), + icon: const Icon(Icons.keyboard_arrow_down), + ), + ), + ), + + const SizedBox(height: 14), + + // Date + Text('Date', style: theme.textTheme.labelLarge), + const SizedBox(height: 8), + GestureDetector( + onTap: _pickDate, + child: Container( + height: 48, + padding: const EdgeInsets.symmetric(horizontal: 12), + alignment: Alignment.centerLeft, + decoration: BoxDecoration(color: theme.cardColor, borderRadius: BorderRadius.circular(_cornerRadius - 8)), + child: Text(_selectedDate == null ? 'Select date' : '${_selectedDate!.day}/${_selectedDate!.month}/${_selectedDate!.year}', style: theme.textTheme.bodyMedium), + ), + ), + + const SizedBox(height: 14), + + // Location + Text('Location', style: theme.textTheme.labelLarge), + const SizedBox(height: 8), + _roundedTextField(controller: _locationCtl, hint: 'e.g. City Park, Calicut'), + + const SizedBox(height: 14), + + // Organizer + Text('Organizer Name', style: theme.textTheme.labelLarge), + const SizedBox(height: 8), + _roundedTextField(controller: _organizerCtl, hint: 'Individual or Organization Name'), + + const SizedBox(height: 14), + + // Description + Text('Description', style: theme.textTheme.labelLarge), + const SizedBox(height: 8), + TextField( + controller: _descriptionCtl, + minLines: 4, + maxLines: 6, + decoration: InputDecoration( + hintText: 'Tell us more about the event...', + filled: true, + fillColor: theme.cardColor, + border: OutlineInputBorder(borderRadius: BorderRadius.circular(_cornerRadius - 8), borderSide: BorderSide.none), + contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 12), + ), + ), + + const SizedBox(height: 18), + + // Event Images header + Text('Event Images', style: theme.textTheme.titleMedium?.copyWith(fontWeight: FontWeight.w600)), + const SizedBox(height: 12), + + // Cover image + Text('Cover Image', style: theme.textTheme.bodySmall), + const SizedBox(height: 8), + GestureDetector( + onTap: _pickCoverImage, + child: _imagePickerPlaceholder(file: _coverImageFile, label: 'Cover Image'), + ), + + const SizedBox(height: 12), + + // Thumbnail image + Text('Thumbnail', style: theme.textTheme.bodySmall), + const SizedBox(height: 8), + GestureDetector( + onTap: _pickThumbnailImage, + child: _imagePickerPlaceholder(file: _thumbImageFile, label: 'Thumbnail'), + ), + + const SizedBox(height: 22), + + // Submit button + SizedBox( + width: double.infinity, + height: 52, + child: ElevatedButton( + onPressed: _submitting ? null : _submit, + style: ElevatedButton.styleFrom( + backgroundColor: _primary, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(_cornerRadius - 6)), + ), + child: _submitting + ? const SizedBox(width: 22, height: 22, child: CircularProgressIndicator(color: Colors.white, strokeWidth: 2.2)) + : const Text('Submit for Verification', style: TextStyle(fontWeight: FontWeight.w600)), + ), + ), + ], + ), + ); + } + + Widget _roundedTextField({required TextEditingController controller, required String hint}) { + final theme = Theme.of(context); + return TextField( + controller: controller, + decoration: InputDecoration( + hintText: hint, + filled: true, + fillColor: theme.cardColor, + border: OutlineInputBorder(borderRadius: BorderRadius.circular(_cornerRadius - 8), borderSide: BorderSide.none), + contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14), + ), + ); + } + + Widget _imagePickerPlaceholder({XFile? file, required String label}) { + final theme = Theme.of(context); + if (file == null) { + return Container( + width: double.infinity, + height: 120, + decoration: BoxDecoration(color: theme.cardColor, borderRadius: BorderRadius.circular(_cornerRadius - 8)), + child: Center( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(Icons.image, size: 28, color: theme.hintColor), + const SizedBox(height: 8), + Text(label, style: theme.textTheme.bodySmall?.copyWith(color: theme.hintColor)), + ], + ), + ), + ); + } + + // show picked image (file or network depending on platform) + if (kIsWeb || file.path.startsWith('http')) { + return ClipRRect( + borderRadius: BorderRadius.circular(_cornerRadius - 8), + child: Image.network(file.path, width: double.infinity, height: 120, fit: BoxFit.cover, errorBuilder: (_, __, ___) { + return Container( + width: double.infinity, + height: 120, + decoration: BoxDecoration(color: theme.cardColor, borderRadius: BorderRadius.circular(_cornerRadius - 8)), + child: Center(child: Text(label, style: theme.textTheme.bodySmall?.copyWith(color: theme.hintColor))), + ); + }), + ); + } else { + final f = File(file.path); + if (!f.existsSync()) { + return Container( + width: double.infinity, + height: 120, + decoration: BoxDecoration(color: theme.cardColor, borderRadius: BorderRadius.circular(_cornerRadius - 8)), + child: Center(child: Text(label, style: theme.textTheme.bodySmall?.copyWith(color: theme.hintColor))), + ); + } + return ClipRRect( + borderRadius: BorderRadius.circular(_cornerRadius - 8), + child: Image.file(f, width: double.infinity, height: 120, fit: BoxFit.cover, errorBuilder: (_, __, ___) { + return Container( + width: double.infinity, + height: 120, + decoration: BoxDecoration(color: theme.cardColor, borderRadius: BorderRadius.circular(_cornerRadius - 8)), + child: Center(child: Text(label, style: theme.textTheme.bodySmall?.copyWith(color: theme.hintColor))), + ); + }), + ); + } + } + + @override + Widget build(BuildContext context) { + // The whole screen is scrollable — header is part of the normal scroll (not floating). + return Scaffold( + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + body: SafeArea( + bottom: false, + child: SingleChildScrollView( + physics: const BouncingScrollPhysics(), + child: Column( + children: [ + _buildHeader(context), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 12), + child: _buildForm(context), + ), + const SizedBox(height: 36), + ], + ), + ), + ), + ); + } +} diff --git a/lib/screens/desktop_login_screen.dart b/lib/screens/desktop_login_screen.dart new file mode 100644 index 0000000..08dccab --- /dev/null +++ b/lib/screens/desktop_login_screen.dart @@ -0,0 +1,374 @@ +// lib/screens/desktop_login_screen.dart + +import 'package:flutter/material.dart'; +import '../features/auth/services/auth_service.dart'; +import 'home_desktop_screen.dart'; +import '../core/app_decoration.dart'; + +class DesktopLoginScreen extends StatefulWidget { + const DesktopLoginScreen({Key? key}) : super(key: key); + + @override + State createState() => _DesktopLoginScreenState(); +} + +class _DesktopLoginScreenState extends State with SingleTickerProviderStateMixin { + final TextEditingController _emailCtrl = TextEditingController(); + final TextEditingController _passCtrl = TextEditingController(); + + final AuthService _auth = AuthService(); + + AnimationController? _controller; + Animation? _leftWidthAnim; + Animation? _leftTextOpacityAnim; + Animation? _formOpacityAnim; + Animation? _formOffsetAnim; + + final double _collapsedWidth = 220; + final Duration _duration = const Duration(milliseconds: 700); + final Curve _curve = Curves.easeInOutCubic; + + bool _isAnimating = false; + bool _loading = false; // network loading flag + + @override + void dispose() { + _controller?.dispose(); + _emailCtrl.dispose(); + _passCtrl.dispose(); + super.dispose(); + } + + Future _startCollapseAnimation(double initialLeftWidth) async { + _controller?.dispose(); + + _controller = AnimationController(vsync: this, duration: _duration); + + _leftWidthAnim = Tween(begin: initialLeftWidth, end: _collapsedWidth).animate( + CurvedAnimation(parent: _controller!, curve: _curve), + ); + _leftTextOpacityAnim = Tween(begin: 1.0, end: 0.0).animate( + CurvedAnimation(parent: _controller!, curve: const Interval(0.0, 0.35, curve: Curves.easeOut)), + ); + + _formOpacityAnim = Tween(begin: 1.0, end: 0.0).animate( + CurvedAnimation(parent: _controller!, curve: const Interval(0.0, 0.55, curve: Curves.easeOut)), + ); + _formOffsetAnim = Tween(begin: 0.0, end: -60.0).animate( + CurvedAnimation(parent: _controller!, curve: const Interval(0.0, 0.55, curve: Curves.easeOut)), + ); + + setState(() => _isAnimating = true); + await _controller!.forward(); + await Future.delayed(const Duration(milliseconds: 120)); + } + + Future _performLoginFlow(double initialLeftWidth) async { + if (_isAnimating || _loading) return; + + setState(() { + _loading = true; + }); + + final email = _emailCtrl.text.trim(); + final password = _passCtrl.text; + + if (email.isEmpty) { + ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Enter email'))); + setState(() => _loading = false); + return; + } + if (password.isEmpty) { + ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Enter password'))); + setState(() => _loading = false); + return; + } + + try { + // Capture user model returned by AuthService (AuthService already saves prefs) + await _auth.login(email, password); + + // on success run opening animation + await _startCollapseAnimation(initialLeftWidth); + + if (!mounted) return; + + Navigator.of(context).pushReplacement(PageRouteBuilder( + pageBuilder: (context, a1, a2) => const HomeDesktopScreen(skipSidebarEntranceAnimation: true), + transitionDuration: Duration.zero, + reverseTransitionDuration: Duration.zero, + )); + } catch (e) { + if (!mounted) return; + final message = e.toString().replaceAll('Exception: ', ''); + ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(message))); + setState(() => _isAnimating = false); + } finally { + if (mounted) setState(() { + _loading = false; + }); + } + } + + void _openRegister() { + Navigator.of(context).push(MaterialPageRoute(builder: (_) => const DesktopRegisterScreen())); + } + + @override + Widget build(BuildContext context) { + final screenW = MediaQuery.of(context).size.width; + + final double safeInitialWidth = (screenW * 0.45).clamp(360.0, screenW * 0.65); + final bool animAvailable = _controller != null && _leftWidthAnim != null; + final Listenable animation = _controller ?? AlwaysStoppedAnimation(0.0); + + return Scaffold( + body: SafeArea( + child: AnimatedBuilder( + animation: animation, + builder: (context, child) { + final leftWidth = animAvailable ? _leftWidthAnim!.value : safeInitialWidth; + final leftTextOpacity = animAvailable && _leftTextOpacityAnim != null ? _leftTextOpacityAnim!.value : 1.0; + final formOpacity = animAvailable && _formOpacityAnim != null ? _formOpacityAnim!.value : 1.0; + final formOffset = animAvailable && _formOffsetAnim != null ? _formOffsetAnim!.value : 0.0; + + return Row( + children: [ + Container( + width: leftWidth, + height: double.infinity, + // color: const Color(0xFF0B63D6), + decoration: AppDecoration.blueGradient, + padding: const EdgeInsets.symmetric(horizontal: 36, vertical: 28), + child: Opacity( + opacity: leftTextOpacity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const SizedBox(height: 4), + const Text('EVENTIFY', style: TextStyle(color: Colors.white, fontWeight: FontWeight.w800, fontSize: 22)), + const Spacer(), + const Text('Welcome Back!', style: TextStyle(color: Colors.white, fontSize: 34, fontWeight: FontWeight.bold)), + const SizedBox(height: 12), + const Text( + 'Sign in to access your dashboard, manage events, and stay connected.', + style: TextStyle(color: Colors.white70, fontSize: 14), + ), + const Spacer(flex: 2), + Opacity( + opacity: leftWidth > (_collapsedWidth + 8) ? 1.0 : 0.0, + child: const Padding( + padding: EdgeInsets.only(bottom: 12.0), + child: Text('© Eventify', style: TextStyle(color: Colors.white54)), + ), + ), + ], + ), + ), + ), + + Expanded( + child: Transform.translate( + offset: Offset(formOffset, 0), + child: Opacity( + opacity: formOpacity, + child: Container( + color: Colors.white, + padding: const EdgeInsets.symmetric(horizontal: 48, vertical: 36), + child: Center( + child: ConstrainedBox( + constraints: const BoxConstraints(maxWidth: 520), + child: Card( + elevation: 0, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 28.0, vertical: 28.0), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + const Text('Sign In', style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold), textAlign: TextAlign.center), + const SizedBox(height: 6), + const Text('Please enter your details to continue', textAlign: TextAlign.center, style: TextStyle(color: Colors.black54)), + const SizedBox(height: 22), + TextField( + controller: _emailCtrl, + decoration: InputDecoration( + prefixIcon: const Icon(Icons.email), + labelText: 'Email Address', + border: OutlineInputBorder(borderRadius: BorderRadius.circular(8)), + ), + ), + const SizedBox(height: 12), + TextField( + controller: _passCtrl, + obscureText: true, + decoration: InputDecoration( + prefixIcon: const Icon(Icons.lock), + labelText: 'Password', + border: OutlineInputBorder(borderRadius: BorderRadius.circular(8)), + ), + ), + const SizedBox(height: 12), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row(children: [ + Checkbox(value: true, onChanged: (_) {}), + const Text('Remember me') + ]), + TextButton(onPressed: () {}, child: const Text('Forgot Password?')) + ], + ), + const SizedBox(height: 8), + SizedBox( + height: 50, + child: ElevatedButton( + onPressed: (_isAnimating || _loading) + ? null + : () { + final double initial = safeInitialWidth; + _performLoginFlow(initial); + }, + style: ElevatedButton.styleFrom(shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8))), + child: (_isAnimating || _loading) + ? const SizedBox(width: 20, height: 20, child: CircularProgressIndicator(color: Colors.white, strokeWidth: 2)) + : const Text('Sign In', style: TextStyle(fontSize: 16)), + ), + ), + const SizedBox(height: 12), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + TextButton(onPressed: _openRegister, child: const Text("Don't have an account? Register")), + TextButton(onPressed: () {}, child: const Text('Contact support')) + ], + ) + ], + ), + ), + ), + ), + ), + ), + ), + ), + ), + ], + ); + }, + ), + ), + ); + } +} + +class DesktopRegisterScreen extends StatefulWidget { + const DesktopRegisterScreen({Key? key}) : super(key: key); + + @override + State createState() => _DesktopRegisterScreenState(); +} + +class _DesktopRegisterScreenState extends State { + final TextEditingController _emailCtrl = TextEditingController(); + final TextEditingController _phoneCtrl = TextEditingController(); + final TextEditingController _passCtrl = TextEditingController(); + final TextEditingController _confirmCtrl = TextEditingController(); + final AuthService _auth = AuthService(); + + bool _loading = false; + + @override + void dispose() { + _emailCtrl.dispose(); + _phoneCtrl.dispose(); + _passCtrl.dispose(); + _confirmCtrl.dispose(); + super.dispose(); + } + + Future _performRegister() async { + final email = _emailCtrl.text.trim(); + final phone = _phoneCtrl.text.trim(); + final pass = _passCtrl.text; + final confirm = _confirmCtrl.text; + + if (email.isEmpty) { + ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Enter email'))); + return; + } + if (phone.isEmpty) { + ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Enter phone number'))); + return; + } + if (pass.isEmpty) { + ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Enter password'))); + return; + } + if (pass != confirm) { + ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Passwords do not match'))); + return; + } + + setState(() => _loading = true); + + try { + await _auth.register( + email: email, + phoneNumber: phone, + password: pass, + ); + + if (!mounted) return; + Navigator.of(context).pushReplacement(MaterialPageRoute(builder: (_) => const HomeDesktopScreen(skipSidebarEntranceAnimation: true))); + } catch (e) { + if (!mounted) return; + final message = e.toString().replaceAll('Exception: ', ''); + ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(message))); + } finally { + if (mounted) setState(() => _loading = false); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: const Text('Register')), + body: SafeArea( + child: Center( + child: SingleChildScrollView( + padding: const EdgeInsets.all(20), + child: ConstrainedBox( + constraints: const BoxConstraints(maxWidth: 520), + child: Card( + child: Padding( + padding: const EdgeInsets.all(18.0), + child: Column( + children: [ + TextField(controller: _emailCtrl, decoration: const InputDecoration(labelText: 'Email')), + const SizedBox(height: 8), + TextField(controller: _phoneCtrl, decoration: const InputDecoration(labelText: 'Phone')), + const SizedBox(height: 8), + TextField(controller: _passCtrl, obscureText: true, decoration: const InputDecoration(labelText: 'Password')), + const SizedBox(height: 8), + TextField(controller: _confirmCtrl, obscureText: true, decoration: const InputDecoration(labelText: 'Confirm password')), + const SizedBox(height: 16), + Row( + children: [ + ElevatedButton(onPressed: _loading ? null : _performRegister, child: _loading ? const SizedBox(width: 20, height: 20, child: CircularProgressIndicator(color: Colors.white, strokeWidth: 2)) : const Text('Register')), + const SizedBox(width: 12), + OutlinedButton(onPressed: () => Navigator.of(context).pop(), child: const Text('Cancel')), + ], + ) + ], + ), + ), + ), + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/form_screen.dart b/lib/screens/form_screen.dart new file mode 100644 index 0000000..0ffadad --- /dev/null +++ b/lib/screens/form_screen.dart @@ -0,0 +1,81 @@ +import 'package:flutter/material.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'dart:convert'; +import 'package:image_picker/image_picker.dart'; + +class UserFormScreen extends StatefulWidget { + @override + _UserFormScreenState createState() => _UserFormScreenState(); +} + +class _UserFormScreenState extends State { + final _formKey = GlobalKey(); + String _username = '', _email = '', _location = ''; + String? _profileImage; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: Text('User Details')), + body: Padding( + padding: EdgeInsets.all(16), + child: Form( + key: _formKey, + child: Column( + children: [ + GestureDetector( + onTap: () async { + final picked = await ImagePicker().pickImage(source: ImageSource.gallery); + if (picked != null) { + final bytes = await picked.readAsBytes(); + String base64Image = base64Encode(bytes); + setState(() { _profileImage = base64Image; }); + } + }, + child: CircleAvatar( + radius: 50, + backgroundColor: Colors.grey[300], + backgroundImage: _profileImage != null ? MemoryImage(base64Decode(_profileImage!)) : null, + child: _profileImage == null ? Icon(Icons.person, size: 50, color: Colors.white) : null, + ), + ), + SizedBox(height: 16), + TextFormField( + decoration: InputDecoration(labelText: 'Username'), + validator: (value) => value!.isEmpty ? 'Please enter a username' : null, + onSaved: (value) => _username = value!, + ), + TextFormField( + decoration: InputDecoration(labelText: 'Email'), + validator: (value) => value!.isEmpty ? 'Please enter an email' : null, + onSaved: (value) => _email = value!, + ), + TextFormField( + decoration: InputDecoration(labelText: 'Location'), + validator: (value) => value!.isEmpty ? 'Please enter a location' : null, + onSaved: (value) => _location = value!, + ), + SizedBox(height: 20), + ElevatedButton( + child: Text('Submit'), + onPressed: () async { + if (_formKey.currentState!.validate()) { + _formKey.currentState!.save(); + final prefs = await SharedPreferences.getInstance(); + await prefs.setString('username', _username); + await prefs.setString('email', _email); + await prefs.setString('location', _location); + if (_profileImage != null) { + await prefs.setString('profileImage', _profileImage!); + } + Navigator.pushReplacementNamed(context, '/home'); + } + }, + ), + ], + ), + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/screens/home_desktop_screen.dart b/lib/screens/home_desktop_screen.dart new file mode 100644 index 0000000..2400a0e --- /dev/null +++ b/lib/screens/home_desktop_screen.dart @@ -0,0 +1,1042 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +import '../features/events/models/event_models.dart'; +import '../features/events/services/events_service.dart'; +import 'calendar_screen.dart'; +import 'profile_screen.dart'; +import 'booking_screen.dart'; +import 'settings_screen.dart'; +import 'learn_more_screen.dart'; +import '../core/app_decoration.dart'; + +class HomeDesktopScreen extends StatefulWidget { + final bool skipSidebarEntranceAnimation; + const HomeDesktopScreen({Key? key, this.skipSidebarEntranceAnimation = false}) : super(key: key); + + @override + State createState() => _HomeDesktopScreenState(); +} + +class _HomeDesktopScreenState extends State with SingleTickerProviderStateMixin { + final EventsService _eventsService = EventsService(); + + // Navigation state + int selectedMenu = 0; // 0 = Home, 1 = Calendar, 2 = Profile, 3 = Bookings, 4 = Contribute, 5 = Settings + + // Backend-driven data for Home + List _events = []; + List _types = []; + bool _loading = true; + bool _loadingTypes = true; + + // Selection: either a backend id (event type) or a fixed label filter. + int _SelectedTypeId = -1; + String? _selectedTypeLabel; + + // fixed categories required by product + final List _fixedCategories = [ + 'All Events', + ]; + + // User prefs + String _username = 'Guest'; + String _location = 'Unknown'; + String _pincode = 'all'; + String? _profileImage; + + // Sidebar text animation + late final AnimationController _sidebarTextController; + late final Animation _sidebarTextOpacity; + + // Sidebar width constant (used when computing main content width) + static const double _sidebarWidth = 220; + + // Topbar compact breakpoint (content width) + static const double _compactTopBarWidth = 720; + + // --- marquee (featured events) fields --- + late final ScrollController _marqueeController; + Timer? _marqueeTimer; + // Speed in pixels per second + double _marqueeSpeed = 40.0; + final Duration _marqueeTick = const Duration(milliseconds: 16); + + @override + void initState() { + super.initState(); + + _sidebarTextController = AnimationController(vsync: this, duration: const Duration(milliseconds: 420)); + _sidebarTextOpacity = Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation(parent: _sidebarTextController, curve: Curves.easeOut)); + + _marqueeController = ScrollController(); + + if (widget.skipSidebarEntranceAnimation) { + _sidebarTextController.value = 1.0; + } else { + WidgetsBinding.instance.addPostFrameCallback((_) { + if (mounted) _sidebarTextController.forward(); + }); + } + + // load initial data for home only + _loadPreferencesAndData(); + } + + @override + void dispose() { + _sidebarTextController.dispose(); + _marqueeTimer?.cancel(); + _marqueeController.dispose(); + super.dispose(); + } + + // ------------------------ Data loaders ------------------------ + Future _loadPreferencesAndData() async { + setState(() { + _loading = true; + _loadingTypes = true; + }); + + final prefs = await SharedPreferences.getInstance(); + // UI display name should come from display_name (profile). Backend identity is separate. + _username = prefs.getString('display_name') ?? prefs.getString('username') ?? 'Jane Doe'; + _location = prefs.getString('location') ?? 'Whitefield, Bengaluru'; + _pincode = prefs.getString('pincode') ?? 'all'; + _profileImage = prefs.getString('profileImage'); + + await Future.wait([ + _fetchEventTypes(), + _fetchEventsByPincode(_pincode), + ]); + + if (mounted) setState(() { + _loading = false; + _loadingTypes = false; + }); + + // start marquee when we have events + _restartMarquee(); + } + + Future _fetchEventTypes() async { + try { + final types = await _eventsService.getEventTypes(); + if (mounted) setState(() => _types = types); + } catch (e) { + if (mounted) ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Failed to load categories: ${e.toString()}'))); + } + } + + Future _fetchEventsByPincode(String pincode) async { + try { + final events = await _eventsService.getEventsByPincode(pincode); + if (mounted) setState(() => _events = events); + } catch (e) { + if (mounted) ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Failed to load events: ${e.toString()}'))); + } + + // ensure marquee restarts when event list changes + _restartMarquee(); + } + + /// Public refresh entry used by UI (pull-to-refresh). + Future _refreshHome() async { + // Prevent duplicate refresh triggers + if (_loading) return; + + setState(() => _loading = true); + try { + await _loadPreferencesAndData(); + } finally { + // _loadPreferencesAndData normally clears _loading, but ensure we reset if needed. + if (mounted && _loading) setState(() => _loading = false); + } + } + + // ------------------------ Helpers ------------------------ + String? _chooseEventImage(EventModel e) { + if (e.thumbImg != null && e.thumbImg!.trim().isNotEmpty) return e.thumbImg!.trim(); + if (e.images.isNotEmpty && e.images.first.image.trim().isNotEmpty) return e.images.first.image.trim(); + return null; + } + + Widget _profileAvatar() { + // If profile image exists and is a network URL -> show it + if (_profileImage != null && _profileImage!.trim().isNotEmpty) { + final url = _profileImage!.trim(); + + if (url.startsWith('http')) { + return CircleAvatar( + radius: 20, + backgroundColor: Colors.grey.shade200, + backgroundImage: NetworkImage(url), + onBackgroundImageError: (_, __) {}, + child: const Icon(Icons.person, color: Colors.transparent), + ); + } + } + + // Fallback → initials (clean & readable) + final name = _username.trim(); + String initials = 'U'; + + if (name.isNotEmpty) { + if (name.contains('@')) { + // Email → first letter only + initials = name[0].toUpperCase(); + } else { + final parts = name.split(' ').where((p) => p.isNotEmpty).toList(); + initials = parts.isEmpty ? 'U' : parts.take(2).map((p) => p[0].toUpperCase()).join(); + } + } + + return CircleAvatar( + radius: 20, + backgroundColor: Colors.blue.shade600, + child: Text( + initials, + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + ), + ), + ); + } + + // ------------------------ Marquee control ------------------------ + void _restartMarquee() { + // stop previous timer + _marqueeTimer?.cancel(); + if (_events.isEmpty) { + // reset position + if (_marqueeController.hasClients) _marqueeController.jumpTo(0); + return; + } + + // Wait for next frame so scroll metrics are available (after the duplicated row is built) + WidgetsBinding.instance.addPostFrameCallback((_) { + if (!mounted) return; + if (!_marqueeController.hasClients) { + // Try again next frame + WidgetsBinding.instance.addPostFrameCallback((_) => _restartMarquee()); + return; + } + + final maxScroll = _marqueeController.position.maxScrollExtent; + if (maxScroll <= 0) { + // Nothing to scroll + return; + } + + // Start a periodic timer that increments offset smoothly + final tickSeconds = _marqueeTick.inMilliseconds / 1000.0; + final delta = _marqueeSpeed * tickSeconds; + + _marqueeTimer?.cancel(); + _marqueeTimer = Timer.periodic(_marqueeTick, (_) { + if (!mounted || !_marqueeController.hasClients) return; + + final cur = _marqueeController.offset; + final max = _marqueeController.position.maxScrollExtent; + final half = max / 2.0; // because we duplicate the list twice + + double next = cur + delta; + if (next >= max) { + // wrap back by half (seamless loop) + final wrapped = next - half; + _marqueeController.jumpTo(wrapped.clamp(0.0, max)); + } else { + // small incremental jump gives smooth appearance + _marqueeController.jumpTo(next); + } + }); + }); + } + + // ------------------------ Filtering logic ------------------------ + List get _filteredEvents { + if (_selectedTypeLabel != null && _selectedTypeLabel!.toLowerCase() != 'all events') { + final label = _selectedTypeLabel!.toLowerCase(); + return _events.where((e) { + final nameFromBackend = (e.eventTypeId != null && e.eventTypeId! > 0) + ? (_types.firstWhere((t) => t.id == e.eventTypeId, orElse: () => EventTypeModel(id: -1, name: '', iconUrl: null)).name) + : ''; + final candidateNames = [ + e.venueName, + e.title, + e.name, + nameFromBackend, + ]; + return candidateNames.any((c) => c != null && c.toLowerCase().contains(label)); + }).toList(); + } + + if (_SelectedTypeId != -1) { + return _events.where((e) => e.eventTypeId == _SelectedTypeId).toList(); + } + + return _events; + } + + void _selectBackendType(int id) { + setState(() { + _SelectedTypeId = id; + _selectedTypeLabel = null; + }); + } + + void _selectFixedLabel(String label) { + setState(() { + if (label.toLowerCase() == 'all events') { + _SelectedTypeId = -1; + _selectedTypeLabel = null; + } else { + _SelectedTypeId = -1; + _selectedTypeLabel = label; + } + }); + } + + // ------------------------ Left panel (nav) ------------------------ + Widget _buildLeftPanel() { + final theme = Theme.of(context); + // Layout: top area (logo + nav list) scrolls if necessary, bottom area (host panel + settings) remains pinned. + return Container( + width: _sidebarWidth, + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage('assets/images/gradient_dark_blue.png'), + fit: BoxFit.cover, + ), + ), + child: SafeArea( + child: Column( + children: [ + const SizedBox(height: 18), + FadeTransition( + opacity: _sidebarTextOpacity, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0), + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 18.0), + child: Text('EVENTIFY', style: theme.textTheme.titleMedium?.copyWith(color: theme.colorScheme.onPrimary, fontWeight: FontWeight.bold, fontSize: 18)), + ), + ), + ), + const SizedBox(height: 16), + + // Expandable nav list + Expanded( + child: SingleChildScrollView( + physics: const ClampingScrollPhysics(), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + _navItem(icon: Icons.home, label: 'Home', idx: 0), + _navItem(icon: Icons.location_on, label: 'Events near you', idx: 0), + _navItem(icon: Icons.calendar_today, label: 'Upcoming events', idx: 0), + _navItem(icon: Icons.calendar_view_month, label: 'Calendar', idx: 1), + + // <-- Profile between Calendar and Contribute + _navItem(icon: Icons.person, label: 'Profile', idx: 2), + + _navItem(icon: Icons.add, label: 'Contribute', idx: 4), + const SizedBox(height: 12), + // optionally more items... + ], + ), + ), + ), + + // bottom pinned area + Padding( + padding: const EdgeInsets.symmetric(horizontal: 12.0), + child: Column( + children: [ + _buildHostPanel(), + const SizedBox(height: 12), + _navItem(icon: Icons.settings, label: 'Settings', idx: 5), + const SizedBox(height: 12), + ], + ), + ), + ], + ), + ), + ); + } + + Widget _buildHostPanel() { + final theme = Theme.of(context); + return Container( + width: double.infinity, + padding: const EdgeInsets.all(12), + decoration: BoxDecoration( + image: const DecorationImage( + image: AssetImage('assets/images/gradient_dark_blue.png'), + fit: BoxFit.cover, + ), + borderRadius: BorderRadius.circular(12), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Hosting a private or ticketed event?', style: theme.textTheme.bodyMedium?.copyWith(color: theme.colorScheme.onPrimary, fontWeight: FontWeight.bold)), + const SizedBox(height: 6), + Text('Schedule a call back for setting up event.', style: theme.textTheme.bodySmall?.copyWith(color: theme.colorScheme.onPrimary.withOpacity(0.85), fontSize: 12)), + const SizedBox(height: 10), + ElevatedButton(onPressed: () {}, style: ElevatedButton.styleFrom(backgroundColor: theme.colorScheme.primary), child: Text('Schedule Call', style: theme.textTheme.labelLarge?.copyWith(color: theme.colorScheme.onPrimary))), + ], + ), + ); + } + + Widget _navItem({required IconData icon, required String label, required int idx}) { + final theme = Theme.of(context); + final selected = selectedMenu == idx; + final color = selected ? theme.colorScheme.onPrimary : theme.colorScheme.onPrimary.withOpacity(0.9); + return ListTile( + leading: Icon(icon, color: color), + title: Text(label, style: TextStyle(color: color)), + dense: true, + onTap: () { + setState(() { + selectedMenu = idx; + }); + if (idx == 0) _refreshHome(); + }, + ); + } + + // ------------------------ Top bar (common, responsive) ------------------------ + Widget _buildTopBar() { + // The top bar sits inside the white content area (to the right of the sidebar). + // The search box is centered inside the content area (slightly toward the right because of fixed width). + final theme = Theme.of(context); + return LayoutBuilder(builder: (context, constraints) { + final isCompact = constraints.maxWidth < _compactTopBarWidth; + + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 18), + child: Row( + children: [ + // Left: location or icon when compact + if (!isCompact) + _fullLocationWidget() + else + IconButton( + tooltip: 'Location', + onPressed: () {}, + icon: Icon(Icons.location_on, color: theme.iconTheme.color), + ), + + const SizedBox(width: 12), + + // Center: place the search bar centered in content area using Center + fixed width box. + if (!isCompact) + Expanded( + child: Align( + alignment: Alignment.center, + child: Padding( + // ⬇️ Increase LEFT padding to move search bar more to the right + padding: const EdgeInsets.only(left: 120), + child: SizedBox( + width: 520, + height: 44, + child: TextField( + decoration: InputDecoration( + filled: true, + fillColor: theme.cardColor, + prefixIcon: Icon(Icons.search, color: theme.hintColor), + hintText: 'Search events, pages, features...', + hintStyle: theme.textTheme.bodyMedium?.copyWith(color: theme.hintColor), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(12), + borderSide: BorderSide.none, + ), + ), + style: theme.textTheme.bodyLarge, + ), + ), + ), + ), + ) + else + IconButton( + tooltip: 'Search', + onPressed: () {}, + icon: Icon(Icons.search, color: theme.iconTheme.color), + ), + + // Spacer ensures right side stays right-aligned + const Spacer(), + + // Right: notifications + (optionally username) + avatar + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Stack( + children: [ + IconButton(onPressed: () {}, icon: Icon(Icons.notifications_none, color: theme.iconTheme.color)), + Positioned(right: 6, top: 6, child: CircleAvatar(radius: 8, backgroundColor: Colors.red, child: Text('2', style: theme.textTheme.bodySmall?.copyWith(color: Colors.white, fontSize: 10)))), + ], + ), + const SizedBox(width: 8), + if (!isCompact) ...[ + Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Text(_username, style: theme.textTheme.bodyLarge?.copyWith(fontWeight: FontWeight.bold)), + Text('Explorer', style: theme.textTheme.bodySmall?.copyWith(color: theme.hintColor, fontSize: 12)), + ]), + const SizedBox(width: 8), + ], + GestureDetector(onTap: () => _openProfile(), child: _profileAvatar()), + ], + ), + ], + ), + ); + }); + } + + Widget _fullLocationWidget() { + final theme = Theme.of(context); + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Location', style: theme.textTheme.bodySmall?.copyWith(color: theme.hintColor, fontSize: 12)), + const SizedBox(height: 4), + Row(children: [ + Icon(Icons.location_on, size: 18, color: theme.hintColor), + const SizedBox(width: 6), + Text(_location, style: theme.textTheme.bodyLarge?.copyWith(fontWeight: FontWeight.w600)), + const SizedBox(width: 6), + Icon(Icons.arrow_drop_down, size: 18, color: theme.hintColor), + ]), + ], + ); + } + + void _openProfile() { + setState(() => selectedMenu = 2); + } + + // ------------------------ Home content (index 0) ------------------------ + Widget _homeContent() { + final theme = Theme.of(context); + + // Entire home content is a vertical scrollable wrapped in RefreshIndicator for pull-to-refresh behaviour. + return RefreshIndicator( + onRefresh: _refreshHome, + color: theme.colorScheme.primary, + child: SingleChildScrollView( + physics: const AlwaysScrollableScrollPhysics(), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const SizedBox(height: 8), + + // HERO / welcome panel + Padding( + padding: const EdgeInsets.symmetric(horizontal: 24.0), + child: Container( + padding: const EdgeInsets.all(20), + decoration: AppDecoration.blueGradientRounded(16), + child: Row( + children: [ + // left welcome + Expanded( + flex: 6, + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Text('Welcome Back,', style: theme.textTheme.bodyMedium?.copyWith(color: Colors.white.withOpacity(0.9), fontSize: 16)), + const SizedBox(height: 6), + Text(_username, style: const TextStyle(color: Colors.white, fontSize: 30, fontWeight: FontWeight.bold)), + ]), + ), + + const SizedBox(width: 16), + + // right: horizontal featured events (backend-driven) + Expanded( + flex: 4, + child: SizedBox( + height: 90, + child: _events.isEmpty + ? const SizedBox() + : _buildMarqueeFeaturedEvents(), + ), + ), + ], + ), + ), + ), + + const SizedBox(height: 18), + + // Events header + Padding( + padding: const EdgeInsets.fromLTRB(24, 0, 24, 8), + child: Row(children: [ + Expanded(child: Text('Events Around You', style: theme.textTheme.titleLarge?.copyWith(fontWeight: FontWeight.bold))), + TextButton(onPressed: () {}, child: Text('View All', style: theme.textTheme.bodyMedium)), + ]), + ), + + // type chips: fixed categories first, then backend categories + if (!_loadingTypes) SizedBox(height: 56, child: _buildTypeChips()), + + const SizedBox(height: 14), + + // events area: use LayoutBuilder to decide between grid and horizontal scroll + Padding( + padding: const EdgeInsets.symmetric(horizontal: 24), + child: LayoutBuilder( + builder: (context, constraints) { + // constraints.maxWidth is the available width inside the white content area (after padding) + return _buildEventsArea(constraints.maxWidth); + }, + ), + ), + + const SizedBox(height: 40), + ], + ), + ), + ); + } + + /// Build marquee (continuous leftward scroll) by duplicating the events list and using a ScrollController. + Widget _buildMarqueeFeaturedEvents() { + // Duplicate events for seamless loop + final display = []; + display.addAll(_events); + display.addAll(_events); + + return ClipRRect( + borderRadius: BorderRadius.circular(8), + child: SingleChildScrollView( + controller: _marqueeController, + scrollDirection: Axis.horizontal, + physics: const NeverScrollableScrollPhysics(), + child: Row( + children: List.generate(display.length, (i) { + final e = display[i]; + final img = _chooseEventImage(e); + return Padding( + padding: const EdgeInsets.only(right: 12.0), + child: SizedBox(width: 220, child: _miniEventCard(e, img)), + ); + }), + ), + ), + ); + } + + Widget _buildTypeChips() { + final chips = []; + + // fixed categories first + for (final name in _fixedCategories) { + final isSelected = _selectedTypeLabel != null ? _selectedTypeLabel == name : (name == 'All Events' && _SelectedTypeId == -1 && _selectedTypeLabel == null); + chips.add(_chipWidget( + label: name, + onTap: () => _selectFixedLabel(name), + selected: isSelected, + )); + } + + // then backend categories (if any) + for (final t in _types) { + final isSelected = (_selectedTypeLabel == null && _SelectedTypeId == t.id); + chips.add(_chipWidget(label: t.name, onTap: () => _selectBackendType(t.id), selected: isSelected)); + } + + return ListView.separated( + padding: const EdgeInsets.symmetric(horizontal: 24), + scrollDirection: Axis.horizontal, + itemBuilder: (_, idx) => chips[idx], + separatorBuilder: (_, __) => const SizedBox(width: 8), + itemCount: chips.length, + ); + } + + Widget _chipWidget({ + required String label, + required VoidCallback onTap, + required bool selected, + }) { + final theme = Theme.of(context); + return InkWell( + borderRadius: BorderRadius.circular(10), + onTap: onTap, + child: Container( + height: 40, // 👈 fixed height for all chips + alignment: Alignment.center, + padding: const EdgeInsets.symmetric(horizontal: 16), + decoration: BoxDecoration( + color: selected ? theme.colorScheme.primary.withOpacity(0.08) : theme.cardColor, + borderRadius: BorderRadius.circular(10), // 👈 box shape (not pill) + border: Border.all( + color: selected ? theme.colorScheme.primary : theme.dividerColor, + width: 1, + ), + ), + child: Text( + label, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + color: selected ? theme.colorScheme.primary : theme.textTheme.bodyLarge?.color, + ), + ), + ), + ); + } + + // ------------------------ + // EVENTS AREA: fixed 3-columns grid on wide widths; fallback horizontal on narrow widths. + // ------------------------ + Widget _buildEventsArea(double contentWidth) { + // Preferred card width you'd like to keep (matches your reference) + const double preferredCardWidth = 360.0; + const double cardHeight = 220.0; // matches reference proportions + const double spacing = 18.0; + + final list = _filteredEvents; + final theme = Theme.of(context); + + if (_loading) { + return Padding(padding: const EdgeInsets.only(top: 32), child: Center(child: CircularProgressIndicator(color: theme.colorScheme.primary))); + } + if (list.isEmpty) { + return Padding(padding: const EdgeInsets.symmetric(vertical: 40), child: Center(child: Text('No events available', style: theme.textTheme.bodyMedium))); + } + + // Determine if we have space to show exactly 3 columns. + // Required width for 3 columns = 3 * preferredCardWidth + 2 * spacing + final double requiredWidthForThree = preferredCardWidth * 3 + spacing * 2; + + if (contentWidth >= requiredWidthForThree) { + // Enough space: force a 3-column grid (this ensures exactly 3 cards per row) + return GridView.builder( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemCount: list.length, + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 3, // always 3 when space allows + mainAxisExtent: cardHeight, + crossAxisSpacing: spacing, + mainAxisSpacing: spacing, + ), + itemBuilder: (ctx, idx) { + final e = list[idx]; + final img = _chooseEventImage(e); + return _eventCardForGrid(e, img); + }, + ); + } else { + // Not enough space for 3 columns — use horizontal scroll preserving card width. + // This keeps behaviour sensible on narrower desktop windows. + final double preferredWidth = preferredCardWidth; + return SizedBox( + height: cardHeight, + child: ListView.separated( + scrollDirection: Axis.horizontal, + itemCount: list.length, + separatorBuilder: (_, __) => const SizedBox(width: spacing), + itemBuilder: (ctx, idx) { + final e = list[idx]; + final img = _chooseEventImage(e); + return SizedBox(width: preferredWidth, child: _eventCardForFixedSize(e, img, preferredWidth)); + }, + ), + ); + } + } + + // small horizontal card used inside HERO right area + Widget _miniEventCard(EventModel e, String? img) { + final theme = Theme.of(context); + return Container( + width: 220, + padding: const EdgeInsets.all(8), + decoration: BoxDecoration(color: theme.cardColor, borderRadius: BorderRadius.circular(12)), + child: Row(children: [ + ClipRRect( + borderRadius: BorderRadius.circular(8), + child: img != null ? Image.network(img, width: 64, height: 64, fit: BoxFit.cover) : Container(width: 64, height: 64, color: Theme.of(context).dividerColor), + ), + const SizedBox(width: 8), + Expanded( + child: Column(mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ + Text(e.title ?? e.name ?? '', maxLines: 1, overflow: TextOverflow.ellipsis, style: Theme.of(context).textTheme.bodyLarge?.copyWith(fontWeight: FontWeight.bold)), + const SizedBox(height: 6), + Text(e.startDate ?? '', style: Theme.of(context).textTheme.bodySmall?.copyWith(color: Theme.of(context).hintColor, fontSize: 12)), + ]), + ), + ]), + ); + } + + // ---------- Cards ---------- + // Card used in grid (we can rely on grid cell having fixed height) + Widget _eventCardForGrid(EventModel e, String? img) { + final theme = Theme.of(context); + + // Styling constants to match reference + const double cardRadius = 16.0; + const double imageHeight = 140.0; + const double horizontalPadding = 12.0; + const double verticalPadding = 10.0; + + // Friendly formatted date label + final dateLabel = (e.startDate != null && e.endDate != null && e.startDate == e.endDate) + ? e.startDate! + : ((e.startDate != null && e.endDate != null) ? '${e.startDate} - ${e.endDate}' : (e.startDate ?? '')); + + return GestureDetector( + onTap: () => Navigator.push(context, MaterialPageRoute(builder: (_) => LearnMoreScreen(eventId: e.id))), + child: Container( + decoration: BoxDecoration( + color: theme.cardColor, + borderRadius: BorderRadius.circular(cardRadius), + boxShadow: [ + BoxShadow(color: Colors.black.withOpacity(0.08), blurRadius: 18, offset: const Offset(0, 10)), + BoxShadow(color: Colors.black.withOpacity(0.03), blurRadius: 6, offset: const Offset(0, 3)), + ], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // image flush to top corners + ClipRRect( + borderRadius: const BorderRadius.vertical(top: Radius.circular(cardRadius)), + child: img != null + ? Image.network(img, width: double.infinity, height: imageHeight, fit: BoxFit.cover, errorBuilder: (_, __, ___) => Container(height: imageHeight, color: theme.dividerColor)) + : Container(height: imageHeight, width: double.infinity, color: theme.dividerColor), + ), + + // content area + Padding( + padding: const EdgeInsets.fromLTRB(horizontalPadding, verticalPadding, horizontalPadding, verticalPadding), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Title (2 lines) + Text( + e.title ?? e.name ?? '', + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: theme.textTheme.bodyLarge?.copyWith(fontWeight: FontWeight.w700, fontSize: 14), + ), + + const SizedBox(height: 8), + + // single row: date • location (icons small, subtle) + Row( + children: [ + // calendar small badge + Container( + width: 18, + height: 18, + decoration: BoxDecoration(color: theme.colorScheme.primary.withOpacity(0.12), borderRadius: BorderRadius.circular(4)), + child: Icon(Icons.calendar_today, size: 12, color: theme.colorScheme.primary), + ), + const SizedBox(width: 8), + Expanded( + child: Text( + dateLabel, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: theme.textTheme.bodySmall?.copyWith(color: theme.hintColor, fontSize: 13), + ), + ), + + const Padding( + padding: EdgeInsets.symmetric(horizontal: 8.0), + child: Text('•', style: TextStyle(color: Colors.black26)), + ), + + Container( + width: 18, + height: 18, + decoration: BoxDecoration(color: theme.colorScheme.primary.withOpacity(0.12), borderRadius: BorderRadius.circular(4)), + child: Icon(Icons.location_on, size: 12, color: theme.colorScheme.primary), + ), + const SizedBox(width: 8), + Expanded( + child: Text( + e.place ?? '', + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: theme.textTheme.bodySmall?.copyWith(color: theme.hintColor, fontSize: 13), + ), + ), + ], + ), + ], + ), + ), + ], + ), + ), + ); + } + + // Card used in horizontal list (fixed width) + Widget _eventCardForFixedSize(EventModel e, String? img, double width) { + final theme = Theme.of(context); + + // Styling constants to match grid card + const double cardRadius = 16.0; + const double imageHeight = 140.0; + const double horizontalPadding = 12.0; + const double verticalPadding = 10.0; + + final dateLabel = (e.startDate != null && e.endDate != null && e.startDate == e.endDate) + ? e.startDate! + : ((e.startDate != null && e.endDate != null) ? '${e.startDate} - ${e.endDate}' : (e.startDate ?? '')); + + return GestureDetector( + onTap: () => Navigator.push(context, MaterialPageRoute(builder: (_) => LearnMoreScreen(eventId: e.id))), + child: Container( + width: width, + decoration: BoxDecoration( + color: theme.cardColor, + borderRadius: BorderRadius.circular(cardRadius), + boxShadow: [ + BoxShadow(color: Colors.black.withOpacity(0.08), blurRadius: 18, offset: const Offset(0, 10)), + BoxShadow(color: Colors.black.withOpacity(0.03), blurRadius: 6, offset: const Offset(0, 3)), + ], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + ClipRRect( + borderRadius: const BorderRadius.vertical(top: Radius.circular(cardRadius)), + child: img != null + ? Image.network(img, width: width, height: imageHeight, fit: BoxFit.cover, errorBuilder: (_, __, ___) => Container(height: imageHeight, color: theme.dividerColor)) + : Container(height: imageHeight, width: width, color: theme.dividerColor), + ), + + Padding( + padding: const EdgeInsets.fromLTRB(horizontalPadding, verticalPadding, horizontalPadding, verticalPadding), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + e.title ?? e.name ?? '', + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: theme.textTheme.bodyLarge?.copyWith(fontWeight: FontWeight.w700, fontSize: 14), + ), + const SizedBox(height: 8), + Row( + children: [ + Container( + width: 18, + height: 18, + decoration: BoxDecoration(color: theme.colorScheme.primary.withOpacity(0.12), borderRadius: BorderRadius.circular(4)), + child: Icon(Icons.calendar_today, size: 12, color: theme.colorScheme.primary), + ), + const SizedBox(width: 8), + Flexible(child: Text(dateLabel, maxLines: 1, overflow: TextOverflow.ellipsis, style: theme.textTheme.bodySmall?.copyWith(color: theme.hintColor, fontSize: 13))), + const Padding( + padding: EdgeInsets.symmetric(horizontal: 8.0), + child: Text('•', style: TextStyle(color: Colors.black26)), + ), + Container( + width: 18, + height: 18, + decoration: BoxDecoration(color: theme.colorScheme.primary.withOpacity(0.12), borderRadius: BorderRadius.circular(4)), + child: Icon(Icons.location_on, size: 12, color: theme.colorScheme.primary), + ), + const SizedBox(width: 8), + Expanded(child: Text(e.place ?? '', maxLines: 1, overflow: TextOverflow.ellipsis, style: theme.textTheme.bodySmall?.copyWith(color: theme.hintColor, fontSize: 13))), + ], + ), + ], + ), + ), + ], + ), + ), + ); + } + + // ------------------------ Page routing ------------------------ + Widget _getCurrentPage() { + switch (selectedMenu) { + case 1: + return const CalendarScreen(); + case 2: + return const ProfileScreen(); + case 3: + return BookingScreen(onBook: () {}, image: ''); + case 4: + // Contribute placeholder (kept simple) + return SingleChildScrollView( + padding: const EdgeInsets.all(28), + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Text('Contribute', style: Theme.of(context).textTheme.headlineSmall?.copyWith(fontWeight: FontWeight.bold)), + const SizedBox(height: 14), + const Text('Submit events or contact the Eventify team.'), + const SizedBox(height: 24), + Card( + elevation: 1, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + child: Padding( + padding: const EdgeInsets.all(18), + child: Column(children: [ + TextField(decoration: InputDecoration(labelText: 'Event title', border: OutlineInputBorder(borderRadius: BorderRadius.circular(8)))), + const SizedBox(height: 12), + TextField(decoration: InputDecoration(labelText: 'Location', border: OutlineInputBorder(borderRadius: BorderRadius.circular(8)))), + const SizedBox(height: 12), + TextField(maxLines: 4, decoration: InputDecoration(labelText: 'Description', border: OutlineInputBorder(borderRadius: BorderRadius.circular(8)))), + const SizedBox(height: 12), + Row(children: [ + ElevatedButton(onPressed: () {}, child: const Text('Submit')), + const SizedBox(width: 12), + OutlinedButton(onPressed: () {}, child: const Text('Reset')), + ]) + ]), + ), + ), + ]), + ); + case 5: + return const SettingsScreen(); + default: + return _homeContent(); + } + } + + // ------------------------ Build ------------------------ + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + + return Scaffold( + backgroundColor: theme.scaffoldBackgroundColor, + body: Row( + children: [ + _buildLeftPanel(), + Expanded( + child: Column( + children: [ + // Show top bar ONLY when Home is active + if (selectedMenu == 0) _buildTopBar(), + // Page content under the top bar (or directly if top bar hidden) + Expanded(child: _getCurrentPage()), + ], + ), + ), + ], + ), + ); + } +} diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dart new file mode 100644 index 0000000..7cc73b9 --- /dev/null +++ b/lib/screens/home_screen.dart @@ -0,0 +1,946 @@ +// lib/screens/home_screen.dart +import 'dart:async'; +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +import '../features/events/models/event_models.dart'; +import '../features/events/services/events_service.dart'; +import 'calendar_screen.dart'; +import 'profile_screen.dart'; +import 'contribute_screen.dart'; +import 'learn_more_screen.dart'; +import 'search_screen.dart'; +import '../core/app_decoration.dart'; + +class HomeScreen extends StatefulWidget { + const HomeScreen({Key? key}) : super(key: key); + @override + _HomeScreenState createState() => _HomeScreenState(); +} + +/// Main screen that hosts 4 tabs in an IndexedStack (Home, Calendar, Contribute, Profile). +class _HomeScreenState extends State with SingleTickerProviderStateMixin { + int _selectedIndex = 0; + String _username = ''; + String _location = ''; + String _pincode = 'all'; + + final EventsService _eventsService = EventsService(); + + // backend-driven + List _events = []; + List _types = []; + int _selectedTypeId = -1; // -1 == All + + bool _loading = true; + + // Hero carousel + final PageController _heroPageController = PageController(); + int _heroCurrentPage = 0; + Timer? _autoScrollTimer; + + @override + void initState() { + super.initState(); + _loadUserDataAndEvents(); + _startAutoScroll(); + } + + @override + void dispose() { + _autoScrollTimer?.cancel(); + _heroPageController.dispose(); + super.dispose(); + } + + void _startAutoScroll() { + _autoScrollTimer?.cancel(); + _autoScrollTimer = Timer.periodic(const Duration(seconds: 3), (timer) { + if (_heroEvents.isEmpty) return; + final nextPage = (_heroCurrentPage + 1) % _heroEvents.length; + if (_heroPageController.hasClients) { + _heroPageController.animateToPage( + nextPage, + duration: const Duration(milliseconds: 500), + curve: Curves.easeInOut, + ); + } + }); + } + + Future _loadUserDataAndEvents() async { + setState(() => _loading = true); + final prefs = await SharedPreferences.getInstance(); + _username = prefs.getString('display_name') ?? prefs.getString('username') ?? ''; + _location = prefs.getString('location') ?? 'Whitefield, Bengaluru'; + _pincode = prefs.getString('pincode') ?? 'all'; + + try { + final types = await _events_service_getEventTypesSafe(); + final events = await _events_service_getEventsSafe(_pincode); + if (mounted) { + setState(() { + _types = types; + _events = events; + _selectedTypeId = -1; + }); + } + } catch (e) { + if (mounted) { + ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(e.toString()))); + } + } finally { + if (mounted) setState(() => _loading = false); + } + } + + Future> _events_service_getEventTypesSafe() async { + try { + return await _eventsService.getEventTypes(); + } catch (_) { + return []; + } + } + + Future> _events_service_getEventsSafe(String pincode) async { + try { + return await _eventsService.getEventsByPincode(pincode); + } catch (_) { + return []; + } + } + + Future _refresh() async { + await _loadUserDataAndEvents(); + } + + void _bookEventAtIndex(int index) { + if (index >= 0 && index < _events.length) { + setState(() => _events.removeAt(index)); + } + } + + Widget _categoryChip({ + required String label, + required bool selected, + required VoidCallback onTap, + IconData? icon, + }) { + final theme = Theme.of(context); + return InkWell( + borderRadius: BorderRadius.circular(20), + onTap: onTap, + child: Container( + height: 40, + alignment: Alignment.center, + padding: const EdgeInsets.symmetric(horizontal: 16), + decoration: BoxDecoration( + color: selected ? theme.colorScheme.primary : theme.cardColor, + borderRadius: BorderRadius.circular(20), + border: Border.all( + color: selected ? theme.colorScheme.primary : theme.dividerColor, + width: 1, + ), + boxShadow: selected + ? [ + BoxShadow( + color: theme.colorScheme.primary.withOpacity(0.3), + blurRadius: 8, + offset: const Offset(0, 4), + ) + ] + : [], + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + if (icon != null) ...[ + Icon(icon, size: 16, color: selected ? Colors.white : theme.colorScheme.primary), + const SizedBox(width: 6), + ], + Text( + label, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + color: selected ? Colors.white : theme.textTheme.bodyLarge?.color, + ), + ), + ], + ), + ), + ); + } + + Future _openLocationSearch() async { + final selected = await Navigator.of(context).push(PageRouteBuilder( + opaque: false, + pageBuilder: (context, animation, secondaryAnimation) => const SearchScreen(), + transitionsBuilder: (context, animation, secondaryAnimation, child) { + return FadeTransition(opacity: animation, child: child); + }, + transitionDuration: const Duration(milliseconds: 220), + )); + + if (selected != null && selected is String) { + final prefs = await SharedPreferences.getInstance(); + await prefs.setString('location', selected); + setState(() { + _location = selected; + }); + await _refresh(); + } + } + + void _openEventSearch() { + final theme = Theme.of(context); + showModalBottomSheet( + context: context, + isScrollControlled: true, + backgroundColor: Colors.transparent, + builder: (ctx) { + return DraggableScrollableSheet( + expand: false, + initialChildSize: 0.6, + minChildSize: 0.3, + maxChildSize: 0.95, + builder: (context, scrollController) { + String query = ''; + List results = List.from(_events); + return StatefulBuilder(builder: (context, setModalState) { + void _onQueryChanged(String v) { + query = v.trim().toLowerCase(); + final r = _events.where((e) { + final title = (e.title ?? e.name ?? '').toLowerCase(); + return title.contains(query); + }).toList(); + setModalState(() { + results = r; + }); + } + + return Container( + decoration: BoxDecoration( + color: theme.cardColor, + borderRadius: const BorderRadius.vertical(top: Radius.circular(20)), + ), + child: SafeArea( + top: false, + child: SingleChildScrollView( + controller: scrollController, + padding: const EdgeInsets.fromLTRB(16, 12, 16, 24), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Center( + child: Container( + width: 48, + height: 6, + decoration: BoxDecoration(color: theme.dividerColor, borderRadius: BorderRadius.circular(6)), + ), + ), + const SizedBox(height: 12), + Row( + children: [ + Expanded( + child: Container( + height: 48, + padding: const EdgeInsets.symmetric(horizontal: 12), + decoration: BoxDecoration(color: theme.cardColor, borderRadius: BorderRadius.circular(12), border: Border.all(color: theme.dividerColor)), + child: Row( + children: [ + Icon(Icons.search, color: theme.hintColor), + const SizedBox(width: 8), + Expanded( + child: TextField( + style: theme.textTheme.bodyLarge, + decoration: InputDecoration( + hintText: 'Search events by name', + hintStyle: theme.textTheme.bodyMedium?.copyWith(color: theme.hintColor), + border: InputBorder.none, + ), + autofocus: true, + onChanged: _onQueryChanged, + textInputAction: TextInputAction.search, + onSubmitted: (v) => _onQueryChanged(v), + ), + ) + ], + ), + ), + ), + const SizedBox(width: 8), + IconButton( + icon: Icon(Icons.close, color: theme.iconTheme.color), + onPressed: () => Navigator.of(context).pop(), + ) + ], + ), + const SizedBox(height: 12), + if (_loading) + Center(child: CircularProgressIndicator(color: theme.colorScheme.primary)) + else if (results.isEmpty) + Padding( + padding: const EdgeInsets.symmetric(vertical: 24), + child: Center(child: Text(query.isEmpty ? 'Type to search events' : 'No events found', style: theme.textTheme.bodyMedium?.copyWith(color: theme.hintColor))), + ) + else + ListView.separated( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + itemBuilder: (ctx, idx) { + final ev = results[idx]; + final img = (ev.thumbImg != null && ev.thumbImg!.isNotEmpty) ? ev.thumbImg! : (ev.images.isNotEmpty ? ev.images.first.image : null); + final title = ev.title ?? ev.name ?? ''; + final subtitle = ev.startDate ?? ''; + return ListTile( + contentPadding: const EdgeInsets.symmetric(horizontal: 0, vertical: 8), + leading: img != null && img.isNotEmpty + ? ClipRRect(borderRadius: BorderRadius.circular(8), child: Image.network(img, width: 56, height: 56, fit: BoxFit.cover)) + : Container(width: 56, height: 56, decoration: BoxDecoration(color: theme.dividerColor, borderRadius: BorderRadius.circular(8)), child: Icon(Icons.event, color: theme.hintColor)), + title: Text(title, maxLines: 1, overflow: TextOverflow.ellipsis, style: theme.textTheme.bodyLarge), + subtitle: Text(subtitle, maxLines: 1, overflow: TextOverflow.ellipsis, style: theme.textTheme.bodyMedium?.copyWith(color: theme.hintColor)), + onTap: () { + Navigator.of(context).pop(); + if (ev.id != null) { + Navigator.of(context).push(MaterialPageRoute(builder: (_) => LearnMoreScreen(eventId: ev.id))); + } + }, + ); + }, + separatorBuilder: (_, __) => Divider(color: theme.dividerColor), + itemCount: results.length, + ), + ], + ), + ), + ), + ); + }); + }, + ); + }, + ); + } + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + + return Scaffold( + backgroundColor: theme.scaffoldBackgroundColor, + body: Stack( + children: [ + // IndexedStack keeps each tab alive and preserves state. + IndexedStack( + index: _selectedIndex, + children: [ + _buildHomeContent(), // index 0 + const CalendarScreen(), // index 1 + const ContributeScreen(), // index 2 (full page, scrollable) + const ProfileScreen(), // index 3 + ], + ), + + // Floating bottom navigation (always visible) + Positioned( + left: 16, + right: 16, + bottom: 16, + child: _buildFloatingBottomNav(), + ), + ], + ), + ); + } + + Widget _buildFloatingBottomNav() { + final theme = Theme.of(context); + return Container( + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 10), + decoration: BoxDecoration( + color: theme.cardColor, + borderRadius: BorderRadius.circular(20), + boxShadow: [BoxShadow(color: theme.shadowColor.withOpacity(0.06), blurRadius: 12)], + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + _bottomNavItem(0, Icons.home, 'Home'), + _bottomNavItem(1, Icons.calendar_today, 'Calendar'), + _bottomNavItem(2, Icons.volunteer_activism, 'Contribute'), + _bottomNavItem(3, Icons.person, 'Profile'), + ], + ), + ); + } + + Widget _bottomNavItem(int index, IconData icon, String label) { + final theme = Theme.of(context); + bool active = _selectedIndex == index; + return GestureDetector( + onTap: () { + setState(() { + _selectedIndex = index; + }); + }, + child: Column(mainAxisSize: MainAxisSize.min, children: [ + Container( + padding: const EdgeInsets.all(8), + decoration: BoxDecoration( + color: active ? theme.colorScheme.primary.withOpacity(0.08) : Colors.transparent, + shape: BoxShape.circle, + ), + child: Icon(icon, color: active ? theme.colorScheme.primary : theme.iconTheme.color), + ), + const SizedBox(height: 4), + Text(label, style: theme.textTheme.bodySmall?.copyWith(color: active ? theme.colorScheme.primary : theme.iconTheme.color, fontSize: 12)), + ]), + ); + } + + // Get hero events (first 4 events for the carousel) + List get _heroEvents => _events.take(4).toList(); + + Widget _buildHomeContent() { + final theme = Theme.of(context); + + // Get current hero event image for full-screen blurred background + String? currentBgImage; + if (_heroEvents.isNotEmpty && _heroCurrentPage < _heroEvents.length) { + final event = _heroEvents[_heroCurrentPage]; + if (event.thumbImg != null && event.thumbImg!.isNotEmpty) { + currentBgImage = event.thumbImg; + } else if (event.images.isNotEmpty && event.images.first.image.isNotEmpty) { + currentBgImage = event.images.first.image; + } + } + + return Stack( + children: [ + // Full-screen blurred background of current event image OR the AppDecoration blue gradient if no image + Positioned.fill( + child: currentBgImage != null + ? Image.network( + currentBgImage, + fit: BoxFit.cover, + errorBuilder: (context, error, stackTrace) => Container(decoration: AppDecoration.blueGradient), + ) + : Container( + decoration: AppDecoration.blueGradient, + ), + ), + + // Blur overlay on background (applies both when an image is present and when using the blue gradient) + Positioned.fill( + child: BackdropFilter( + filter: ImageFilter.blur(sigmaX: 40, sigmaY: 40), + child: Container( + color: Colors.black.withOpacity(0.15), + ), + ), + ), + + // Hero section with cards + _buildHeroSection(), + + // Draggable bottom sheet + DraggableScrollableSheet( + initialChildSize: 0.28, + minChildSize: 0.22, + maxChildSize: 0.92, + builder: (context, scrollController) { + return Container( + decoration: BoxDecoration( + color: theme.scaffoldBackgroundColor, + borderRadius: const BorderRadius.vertical(top: Radius.circular(28)), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.15), + blurRadius: 20, + offset: const Offset(0, -5), + ), + ], + ), + child: _buildSheetContent(scrollController), + ); + }, + ), + ], + ); + } + + Widget _buildHeroSection() { + final theme = Theme.of(context); + + // 0.5 cm gap approximation in logical pixels (approx. 32) + const double gapBetweenLocationAndHero = 32.0; + + return SafeArea( + bottom: false, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + // Top bar with location and search + Padding( + padding: const EdgeInsets.fromLTRB(16, 12, 16, 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + // Location pill + GestureDetector( + onTap: _openLocationSearch, + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10), + decoration: BoxDecoration( + color: Colors.white.withOpacity(0.2), + borderRadius: BorderRadius.circular(25), + border: Border.all(color: Colors.white.withOpacity(0.3)), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + const Icon(Icons.location_on_outlined, color: Colors.white, size: 18), + const SizedBox(width: 6), + Text( + _location.length > 20 ? '${_location.substring(0, 20)}...' : _location, + style: const TextStyle(color: Colors.white, fontSize: 14, fontWeight: FontWeight.w500), + ), + const SizedBox(width: 4), + const Icon(Icons.keyboard_arrow_down, color: Colors.white, size: 18), + ], + ), + ), + ), + // Search button + GestureDetector( + onTap: _openEventSearch, + child: Container( + width: 48, + height: 48, + decoration: BoxDecoration( + color: Colors.white.withOpacity(0.2), + shape: BoxShape.circle, + border: Border.all(color: Colors.white.withOpacity(0.3)), + ), + child: const Icon(Icons.search, color: Colors.white, size: 24), + ), + ), + ], + ), + ), + + // 0.5 cm gap (approx. 32 logical pixels) + const SizedBox(height: gapBetweenLocationAndHero), + + // Hero image carousel (PageView) and fixed indicators under it. + _heroEvents.isEmpty + ? SizedBox( + height: 360, + child: Center( + child: _loading ? const CircularProgressIndicator(color: Colors.white) : const Text('No events available', style: TextStyle(color: Colors.white70)), + ), + ) + : Column( + children: [ + // PageView with only the images/titles + SizedBox( + height: 360, + child: PageView.builder( + controller: _heroPageController, + onPageChanged: (page) { + setState(() => _heroCurrentPage = page); + }, + itemCount: _heroEvents.length, + itemBuilder: (context, index) { + return _buildHeroEventImage(_heroEvents[index]); + }, + ), + ), + + // fixed indicators (outside PageView) + const SizedBox(height: 12), + SizedBox( + height: 28, + child: Center( + child: AnimatedBuilder( + animation: _heroPageController, + builder: (context, child) { + double page = _heroCurrentPage.toDouble(); + if (_heroPageController.hasClients) { + page = _heroPageController.page ?? page; + } + return Row( + mainAxisSize: MainAxisSize.min, + children: List.generate(_heroEvents.length, (i) { + final dx = (i - page).abs(); + final t = 1.0 - dx.clamp(0.0, 1.0); // 1 when focused, 0 when far + final width = 10 + (36 - 10) * t; // interpolate between 10 and 36 + final opacity = 0.35 + (0.65 * t); + return GestureDetector( + onTap: () { + if (_heroPageController.hasClients) { + _heroPageController.animateToPage( + i, + duration: const Duration(milliseconds: 300), + curve: Curves.easeInOut, + ); + } + }, + child: Container( + margin: const EdgeInsets.symmetric(horizontal: 8), + width: width, + height: 10, + decoration: BoxDecoration( + color: Colors.white.withOpacity(opacity), + borderRadius: BorderRadius.circular(6), + ), + ), + ); + }), + ); + }, + ), + ), + ), + + // spacing so the sheet handle doesn't overlap the indicator + const SizedBox(height: 8), + ], + ), + ], + ), + ); + } + + /// Build a hero image card (image + gradient + title). + /// If there's no image, show the AppDecoration blue gradient rounded background + /// and a black overlay gradient for contrast. + Widget _buildHeroEventImage(EventModel event) { + String? img; + if (event.thumbImg != null && event.thumbImg!.isNotEmpty) { + img = event.thumbImg; + } else if (event.images.isNotEmpty && event.images.first.image.isNotEmpty) { + img = event.images.first.image; + } + + final radius = 24.0; + final startDate = event.startDate ?? ''; + + return GestureDetector( + onTap: () { + if (event.id != null) { + Navigator.push(context, MaterialPageRoute(builder: (_) => LearnMoreScreen(eventId: event.id))); + } + }, + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 24), + child: ClipRRect( + borderRadius: BorderRadius.circular(radius), + child: Stack( + fit: StackFit.expand, + children: [ + // If image available show it; otherwise use AppDecoration blue gradient. + if (img != null && img.isNotEmpty) + Image.network( + img, + fit: BoxFit.cover, + errorBuilder: (context, error, stackTrace) => Container(decoration: AppDecoration.blueGradientRounded(radius)), + ) + else + Container( + decoration: AppDecoration.blueGradientRounded(radius), + ), + + // BLACK gradient overlay to darken bottom area for text (stronger to match your reference) + Container( + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.bottomCenter, + end: Alignment.topCenter, + colors: [ + Colors.black.withOpacity(0.72), // strong black near bottom for contrast + Colors.black.withOpacity(0.38), + Colors.black.withOpacity(0.08), // subtle near top + ], + stops: const [0.0, 0.45, 1.0], + ), + ), + ), + + // Title and date positioned bottom-left + Padding( + padding: const EdgeInsets.fromLTRB(20, 20, 20, 18), + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + if (startDate.isNotEmpty) + Text( + startDate, + style: TextStyle( + color: Colors.white.withOpacity(0.9), + fontSize: 14, + fontWeight: FontWeight.w600, + ), + ), + if (startDate.isNotEmpty) const SizedBox(height: 8), + Text( + event.title ?? event.name ?? '', + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: const TextStyle( + color: Colors.white, + fontSize: 22, + fontWeight: FontWeight.bold, + height: 1.1, + shadows: [ + Shadow(color: Colors.black38, blurRadius: 6, offset: Offset(0, 2)), + ], + ), + ), + ], + ), + ), + ], + ), + ), + ), + ); + } + + Widget _buildSheetContent(ScrollController scrollController) { + final theme = Theme.of(context); + + return ListView( + controller: scrollController, + padding: EdgeInsets.zero, + children: [ + // Drag handle and "see more" text + Padding( + padding: const EdgeInsets.only(top: 12, bottom: 8), + child: Column( + children: [ + // Arrow up icon + Icon( + Icons.keyboard_arrow_up, + color: theme.hintColor, + size: 28, + ), + Text( + 'see more', + style: TextStyle( + color: theme.hintColor, + fontSize: 13, + fontWeight: FontWeight.w500, + ), + ), + ], + ), + ), + + // "Events Around You" header + Padding( + padding: const EdgeInsets.fromLTRB(20, 12, 20, 16), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + 'Events Around You', + style: theme.textTheme.titleLarge?.copyWith( + fontWeight: FontWeight.bold, + fontSize: 22, + ), + ), + TextButton( + onPressed: () { + // View all action + }, + child: Text( + 'View All', + style: TextStyle( + color: theme.colorScheme.primary, + fontWeight: FontWeight.w600, + ), + ), + ), + ], + ), + ), + + // Category chips + SizedBox( + height: 48, + child: ListView( + scrollDirection: Axis.horizontal, + padding: const EdgeInsets.symmetric(horizontal: 16), + children: [ + _categoryChip( + label: 'All Events', + icon: Icons.grid_view_rounded, + selected: _selectedTypeId == -1, + onTap: () => _onSelectType(-1), + ), + const SizedBox(width: 10), + for (final t in _types) ...[ + _categoryChip( + label: t.name, + icon: _getIconForType(t.name), + selected: _selectedTypeId == t.id, + onTap: () => _onSelectType(t.id), + ), + const SizedBox(width: 10), + ], + ], + ), + ), + + const SizedBox(height: 16), + + // Event cards + if (_loading) + const Padding( + padding: EdgeInsets.all(40), + child: Center(child: CircularProgressIndicator()), + ) + else if (_events.isEmpty) + Padding( + padding: const EdgeInsets.all(40), + child: Center( + child: Text( + 'No events found', + style: theme.textTheme.bodyLarge?.copyWith(color: theme.hintColor), + ), + ), + ) + else + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Column( + children: [ + for (int i = 0; i < _events.length; i++) ...[ + _buildEventCard(_events[i], i), + ], + ], + ), + ), + + // Bottom padding for nav bar + const SizedBox(height: 100), + ], + ); + } + + IconData _getIconForType(String typeName) { + final name = typeName.toLowerCase(); + if (name.contains('music')) return Icons.music_note; + if (name.contains('art') || name.contains('comedy')) return Icons.palette; + if (name.contains('festival')) return Icons.celebration; + if (name.contains('heritage') || name.contains('history')) return Icons.account_balance; + if (name.contains('sport')) return Icons.sports; + if (name.contains('food')) return Icons.restaurant; + return Icons.event; + } + + void _onSelectType(int id) async { + setState(() { + _selectedTypeId = id; + }); + + try { + final all = await _eventsService.getEventsByPincode(_pincode); + final filtered = id == -1 ? all : all.where((e) => e.eventTypeId == id).toList(); + if (mounted) setState(() => _events = filtered); + } catch (e) { + if (mounted) ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(e.toString()))); + } + } + + Widget _buildEventCard(EventModel e, int index) { + final theme = Theme.of(context); + String? img; + if (e.thumbImg != null && e.thumbImg!.isNotEmpty) { + img = e.thumbImg; + } else if (e.images.isNotEmpty && e.images.first.image.isNotEmpty) { + img = e.images.first.image; + } + + return GestureDetector( + onTap: () { + if (e.id != null) { + Navigator.push(context, MaterialPageRoute(builder: (_) => LearnMoreScreen(eventId: e.id))); + } + }, + child: Container( + margin: const EdgeInsets.only(bottom: 18), + decoration: BoxDecoration( + color: theme.cardColor, + borderRadius: BorderRadius.circular(16), + boxShadow: [ + BoxShadow(color: theme.shadowColor.withOpacity(0.12), blurRadius: 18, offset: const Offset(0, 8)), + BoxShadow(color: theme.shadowColor.withOpacity(0.04), blurRadius: 6, offset: const Offset(0, 2)), + ], + ), + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + ClipRRect( + borderRadius: const BorderRadius.vertical(top: Radius.circular(16)), + child: img != null && img.isNotEmpty + ? Image.network(img, fit: BoxFit.cover, width: double.infinity, height: 160) + : Image.asset('assets/images/event1.jpg', fit: BoxFit.cover, width: double.infinity, height: 160), + ), + Padding( + padding: const EdgeInsets.fromLTRB(12, 12, 12, 12), + child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Text( + e.title ?? e.name ?? '', + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: theme.textTheme.titleMedium?.copyWith(fontWeight: FontWeight.bold, fontSize: 16), + ), + const SizedBox(height: 8), + Row( + children: [ + Icon(Icons.calendar_today, size: 14, color: theme.colorScheme.primary), + const SizedBox(width: 6), + Flexible( + flex: 2, + child: Text( + '${e.startDate ?? ''}', + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: theme.textTheme.bodySmall?.copyWith(color: theme.textTheme.bodySmall?.color?.withOpacity(0.9), fontSize: 13), + ), + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8.0), + child: Text('•', style: TextStyle(color: theme.textTheme.bodySmall?.color?.withOpacity(0.4))), + ), + Icon(Icons.location_on, size: 14, color: theme.colorScheme.primary), + const SizedBox(width: 6), + Flexible( + flex: 3, + child: Text( + e.place ?? '', + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: theme.textTheme.bodySmall?.copyWith(color: theme.textTheme.bodySmall?.color?.withOpacity(0.9), fontSize: 13), + ), + ), + ], + ), + ]), + ) + ]), + ), + ); + } + + String _getShortEmailLabel() { + try { + final parts = _username.split('@'); + if (parts.isNotEmpty && parts[0].isNotEmpty) return parts[0]; + } catch (_) {} + return 'You'; + } +} diff --git a/lib/screens/learn_more_screen.dart b/lib/screens/learn_more_screen.dart new file mode 100644 index 0000000..a8835ad --- /dev/null +++ b/lib/screens/learn_more_screen.dart @@ -0,0 +1,174 @@ +// lib/screens/learn_more_screen.dart + +import 'package:flutter/material.dart'; +import '../features/events/models/event_models.dart'; +import '../features/events/services/events_service.dart'; +import 'booking_screen.dart'; + +class LearnMoreScreen extends StatefulWidget { + final int eventId; + const LearnMoreScreen({Key? key, required this.eventId}) : super(key: key); + + @override + State createState() => _LearnMoreScreenState(); +} + +class _LearnMoreScreenState extends State { + final EventsService _service = EventsService(); + + bool _loading = true; + EventModel? _event; + String? _error; + + @override + void initState() { + super.initState(); + _loadEvent(); + } + + Future _loadEvent() async { + setState(() { + _loading = true; + _error = null; + }); + + try { + final ev = await _service.getEventDetails(widget.eventId); + if (!mounted) return; + setState(() => _event = ev); + } catch (e) { + if (!mounted) return; + setState(() => _error = e.toString()); + } finally { + if (mounted) setState(() => _loading = false); + } + } + + Widget _buildImageCarousel() { + final imgs = _event?.images ?? []; + final thumb = _event?.thumbImg; + final list = []; + + if (thumb != null && thumb.isNotEmpty) list.add(thumb); + for (final i in imgs) { + if (i.image.isNotEmpty && !list.contains(i.image)) list.add(i.image); + } + + if (list.isEmpty) { + return Container( + height: 220, + color: Colors.grey.shade200, + child: const Center(child: Icon(Icons.event, size: 80, color: Colors.grey)), + ); + } + + return SizedBox( + height: 220, + child: PageView.builder( + itemCount: list.length, + itemBuilder: (context, i) => Image.network(list[i], fit: BoxFit.cover, width: double.infinity), + ), + ); + } + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + + return Scaffold( + appBar: AppBar( + title: const Text('Event Details'), + ), + body: _loading + ? const Center(child: CircularProgressIndicator()) + : _error != null + ? Center(child: Text('Error: $_error')) + : _event == null + ? const Center(child: Text('Event not found')) + : SingleChildScrollView( + child: DefaultTextStyle.merge( + // force child Text widgets to use theme-aware foreground color (works in light/dark) + style: TextStyle(color: theme.colorScheme.onSurface, height: 1.45), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + _buildImageCarousel(), + Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Title — use theme typography + Text( + _event!.title ?? _event!.name ?? '', + style: theme.textTheme.headlineSmall?.copyWith(fontSize: 22, fontWeight: FontWeight.bold), + ), + const SizedBox(height: 8), + + // Meta row (date, location) — icons will use theme icon color + Row( + children: [ + Icon(Icons.calendar_today, size: 16, color: theme.iconTheme.color), + const SizedBox(width: 6), + Text( + '${_event!.startDate}${_event!.startTime != null ? ' • ${_event!.startTime}' : ''}', + style: theme.textTheme.bodyMedium, + ), + const SizedBox(width: 12), + Icon(Icons.location_on, size: 16, color: theme.iconTheme.color), + const SizedBox(width: 6), + Flexible(child: Text(_event!.place ?? _event!.venueName ?? '', style: theme.textTheme.bodyMedium)), + ], + ), + const SizedBox(height: 12), + + // Description — themed body text (no hardcoded black) + Text( + _event!.description ?? '', + style: theme.textTheme.bodyMedium, + ), + const SizedBox(height: 16), + + // Important section (if present) + if ((_event!.importantInformation ?? '').isNotEmpty) ...[ + Text('Important', style: theme.textTheme.titleMedium?.copyWith(fontWeight: FontWeight.bold)), + const SizedBox(height: 6), + Text(_event!.importantInformation!, style: theme.textTheme.bodyMedium), + const SizedBox(height: 12), + ], + + // Book button + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + ElevatedButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (_) => BookingScreen( + onBook: () { + ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Booked (demo)'))); + }, + image: _event!.thumbImg ?? '', + ), + ), + ); + }, + child: const Padding( + padding: EdgeInsets.symmetric(horizontal: 14, vertical: 12), + child: Text('Book Tickets'), + ), + ), + ], + ), + ], + ), + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/screens/login_screen.dart b/lib/screens/login_screen.dart new file mode 100644 index 0000000..acd724e --- /dev/null +++ b/lib/screens/login_screen.dart @@ -0,0 +1,358 @@ +// lib/screens/login_screen.dart + +import 'package:flutter/material.dart'; +import '../features/auth/services/auth_service.dart'; +import 'home_screen.dart'; +import '../core/app_decoration.dart'; + +class LoginScreen extends StatefulWidget { + const LoginScreen({Key? key}) : super(key: key); + + @override + State createState() => _LoginScreenState(); +} + +class _LoginScreenState extends State { + final _formKey = GlobalKey(); + + final TextEditingController _emailCtrl = TextEditingController(); + final TextEditingController _passCtrl = TextEditingController(); + final FocusNode _emailFocus = FocusNode(); + final FocusNode _passFocus = FocusNode(); + + final AuthService _auth = AuthService(); + bool _loading = false; + + @override + void dispose() { + _emailCtrl.dispose(); + _passCtrl.dispose(); + _emailFocus.dispose(); + _passFocus.dispose(); + super.dispose(); + } + + String? _emailValidator(String? v) { + if (v == null || v.trim().isEmpty) return 'Enter email'; + final email = v.trim(); + // Basic email pattern check + final emailRegex = RegExp(r"^[^@]+@[^@]+\.[^@]+"); + if (!emailRegex.hasMatch(email)) return 'Enter a valid email'; + return null; + } + + String? _passwordValidator(String? v) { + if (v == null || v.trim().isEmpty) return 'Enter password'; + if (v.length < 6) return 'Password must be at least 6 characters'; + return null; + } + + Future _performLogin() async { + final form = _formKey.currentState; + if (form == null) return; + if (!form.validate()) return; + + final email = _emailCtrl.text.trim(); + final password = _passCtrl.text; + + setState(() => _loading = true); + + try { + // AuthService.login now returns a UserModel and also persists profile info. + await _auth.login(email, password); + + if (!mounted) return; + // small delay for UX + await Future.delayed(const Duration(milliseconds: 150)); + + Navigator.of(context).pushReplacement(PageRouteBuilder( + pageBuilder: (context, a1, a2) => const HomeScreen(), + transitionDuration: const Duration(milliseconds: 650), + reverseTransitionDuration: const Duration(milliseconds: 350), + transitionsBuilder: (context, animation, secondaryAnimation, child) { + return FadeTransition(opacity: animation, child: child); + }, + )); + } catch (e) { + if (!mounted) return; + final message = e.toString().replaceAll('Exception: ', ''); + ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(message))); + } finally { + if (mounted) setState(() => _loading = false); + } + } + + void _openRegister() { + Navigator.of(context).push(MaterialPageRoute(builder: (_) => const RegisterScreen(isDesktop: false))); + } + + @override + Widget build(BuildContext context) { + const primary = Color(0xFF0B63D6); + final width = MediaQuery.of(context).size.width; + + return Scaffold( + // backgroundColor: primary, + body: Container( + decoration: AppDecoration.blueGradient, + child: SafeArea( + child: Center( + child: SingleChildScrollView( + padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 18), + child: ConstrainedBox( + constraints: BoxConstraints(maxWidth: width < 720 ? width : 720), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + const SizedBox(height: 6), + const Text('Welcome', style: TextStyle(fontSize: 34, fontWeight: FontWeight.bold, color: Colors.white)), + const SizedBox(height: 6), + const Text('Sign in to continue', style: TextStyle(color: Colors.white70, fontSize: 16)), + const SizedBox(height: 26), + + // HERO card + Hero( + tag: 'headerCard', + flightShuttleBuilder: (flightContext, animation, flightDirection, fromContext, toContext) { + return Material( + color: Colors.transparent, + child: ScaleTransition( + scale: animation.drive(Tween(begin: 0.98, end: 1.0).chain(CurveTween(curve: Curves.easeOut))), + child: fromContext.widget, + ), + ); + }, + child: Material( + type: MaterialType.transparency, + child: Container( + width: double.infinity, + decoration: AppDecoration.blueGradientRounded(20).copyWith( + boxShadow: const [BoxShadow(color: Colors.black26, blurRadius: 18, offset: Offset(0, 8))], + ), + padding: const EdgeInsets.fromLTRB(18, 18, 18, 18), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const SizedBox(height: 8), + const Text('Eventify', style: TextStyle(color: Colors.white, fontSize: 22, fontWeight: FontWeight.bold)), + const SizedBox(height: 12), + + // white card inside the blue card — now uses Form + Form( + key: _formKey, + child: Container( + decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(12)), + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 14), + child: Column( + children: [ + // Email + TextFormField( + controller: _emailCtrl, + focusNode: _emailFocus, + keyboardType: TextInputType.emailAddress, + autofillHints: const [AutofillHints.email], + decoration: InputDecoration( + labelText: 'Email', + border: InputBorder.none, + prefixIcon: Icon(Icons.email, color: primary), + ), + validator: _emailValidator, + textInputAction: TextInputAction.next, + onFieldSubmitted: (_) { + FocusScope.of(context).requestFocus(_passFocus); + }, + ), + const Divider(), + // Password + TextFormField( + controller: _passCtrl, + focusNode: _passFocus, + obscureText: true, + decoration: InputDecoration( + labelText: 'Password', + border: InputBorder.none, + prefixIcon: Icon(Icons.lock, color: primary), + ), + validator: _passwordValidator, + textInputAction: TextInputAction.done, + onFieldSubmitted: (_) => _performLogin(), + ), + ], + ), + ), + ), + + const SizedBox(height: 18), + + // Login button + SizedBox( + width: double.infinity, + child: ElevatedButton( + onPressed: _loading ? null : _performLogin, + style: ElevatedButton.styleFrom( + backgroundColor: Colors.white, + foregroundColor: primary, + padding: const EdgeInsets.symmetric(vertical: 14), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), + ), + child: _loading + ? SizedBox(height: 18, width: 18, child: CircularProgressIndicator(strokeWidth: 2, color: primary)) + : const Text('Login', style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600)), + ), + ), + + const SizedBox(height: 8), + ], + ), + ), + ), + ), + + const SizedBox(height: 18), + Center( + child: Column( + children: [ + const SizedBox(height: 8), + TextButton( + onPressed: _openRegister, + child: const Text("Don't have an account? Register", style: TextStyle(color: Colors.white)), + ), + ], + ), + ), + ], + ), + ), + ), + ), + ), + ), + ); +} +} + +/// Register screen calls backend register endpoint via AuthService.register +class RegisterScreen extends StatefulWidget { + final bool isDesktop; + const RegisterScreen({Key? key, this.isDesktop = false}) : super(key: key); + + @override + State createState() => _RegisterScreenState(); +} + +class _RegisterScreenState extends State { + final _formKey = GlobalKey(); + final TextEditingController _emailCtrl = TextEditingController(); + final TextEditingController _phoneCtrl = TextEditingController(); + final TextEditingController _passCtrl = TextEditingController(); + final TextEditingController _confirmCtrl = TextEditingController(); + final AuthService _auth = AuthService(); + + bool _loading = false; + + @override + void dispose() { + _emailCtrl.dispose(); + _phoneCtrl.dispose(); + _passCtrl.dispose(); + _confirmCtrl.dispose(); + super.dispose(); + } + + Future _performRegister() async { + if (!(_formKey.currentState?.validate() ?? false)) return; + + final email = _emailCtrl.text.trim(); + final phone = _phoneCtrl.text.trim(); + final pass = _passCtrl.text; + final confirm = _confirmCtrl.text; + + if (pass != confirm) { + ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Passwords do not match'))); + return; + } + + setState(() => _loading = true); + + try { + await _auth.register( + email: email, + phoneNumber: phone, + password: pass, + ); + + if (!mounted) return; + + Navigator.of(context).pushReplacement(MaterialPageRoute(builder: (_) => const HomeScreen())); + } catch (e) { + if (!mounted) return; + final message = e.toString().replaceAll('Exception: ', ''); + ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(message))); + } finally { + if (mounted) setState(() => _loading = false); + } + } + + String? _emailValidator(String? v) { + if (v == null || v.trim().isEmpty) return 'Enter email'; + final emailRegex = RegExp(r"^[^@]+@[^@]+\.[^@]+"); + if (!emailRegex.hasMatch(v.trim())) return 'Enter a valid email'; + return null; + } + + String? _phoneValidator(String? v) { + if (v == null || v.trim().isEmpty) return 'Enter phone number'; + if (v.trim().length < 7) return 'Enter a valid phone number'; + return null; + } + + String? _passwordValidator(String? v) { + if (v == null || v.isEmpty) return 'Enter password'; + if (v.length < 6) return 'Password must be at least 6 characters'; + return null; + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: const Text('Register')), + body: SafeArea( + child: Center( + child: SingleChildScrollView( + padding: const EdgeInsets.all(20), + child: ConstrainedBox( + constraints: const BoxConstraints(maxWidth: 520), + child: Card( + child: Padding( + padding: const EdgeInsets.all(18.0), + child: Form( + key: _formKey, + child: Column( + children: [ + TextFormField(controller: _emailCtrl, decoration: const InputDecoration(labelText: 'Email'), validator: _emailValidator, keyboardType: TextInputType.emailAddress), + const SizedBox(height: 8), + TextFormField(controller: _phoneCtrl, decoration: const InputDecoration(labelText: 'Phone'), validator: _phoneValidator, keyboardType: TextInputType.phone), + const SizedBox(height: 8), + TextFormField(controller: _passCtrl, obscureText: true, decoration: const InputDecoration(labelText: 'Password'), validator: _passwordValidator), + const SizedBox(height: 8), + TextFormField(controller: _confirmCtrl, obscureText: true, decoration: const InputDecoration(labelText: 'Confirm password'), validator: _passwordValidator), + const SizedBox(height: 16), + SizedBox( + width: double.infinity, + child: ElevatedButton( + onPressed: _loading ? null : _performRegister, + child: _loading ? const SizedBox(width: 20, height: 20, child: CircularProgressIndicator(color: Colors.white, strokeWidth: 2)) : const Text('Register'), + ), + ), + ], + ), + ), + ), + ), + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/privacy_policy_screen.dart b/lib/screens/privacy_policy_screen.dart new file mode 100644 index 0000000..324a536 --- /dev/null +++ b/lib/screens/privacy_policy_screen.dart @@ -0,0 +1,104 @@ +import 'package:flutter/material.dart'; + +class PrivacyPolicyScreen extends StatelessWidget { + const PrivacyPolicyScreen({Key? key}) : super(key: key); + + static const String _policy = ''' +Privacy Policy for Eventify™ +Effective Date: 16 September 2025 +Last Updated: 16 September 2025 + +Eventify™ (“we,” “our,” or “us”) respects your privacy and is committed to protecting it through this Privacy Policy. This Privacy Policy explains how we collect, use, and safeguard personal information when you use our application Eventify™ (the “App”). Eventify™ is currently in its beta testing phase and may undergo adjustments or improvements in the future. + +By using Eventify™, you agree to the collection and use of information in accordance with this Privacy Policy. + +Information We Collect +Currently, as part of our internal beta testing, Eventify™ may collect limited information, which includes: + +• Calendar entries and event data you choose to create or manage within the App. + +• Basic account information, if required for testing purposes (such as name or email). + +• Device information (such as operating system type, app version, and performance logs) to improve stability and functionality during the beta phase. + +• Usage data (like features accessed and time spent in the app) to help us optimize performance. + +We do not intentionally collect sensitive personal data unless explicitly required for testing and with your consent. + +How We Use Your Information +We use the information we collect to: + +• Provide and improve the functionality of Eventify™. + +• Identify issues and enhance user experience during the beta testing phase. + +• Communicate with testers about app updates or feedback requests. + +• Ensure the security and stability of the application. + +Your data will not be sold or shared with third parties for commercial purposes. + +Data Sharing and Disclosure +We may share information in limited circumstances: + +• With service providers that help us process data and improve app performance. + +• If required by law, regulation, or legal process. + +• In the event of a company restructuring, merger, or acquisition. + +Outside of these circumstances, your personal data will remain private. + +Data Security +We implement industry-standard security measures to protect your data. However, since Eventify™ is in its beta stage, no method of transmission or storage can be guaranteed entirely secure. We encourage testers to avoid entering sensitive or confidential information in the App during beta testing. + +Data Retention +Data collected during the beta testing phase will only be retained for as long as necessary to fulfill the purposes outlined in this Policy. Test data may be deleted upon conclusion of the beta testing program, unless otherwise required by law. + +Your Rights +Depending on your region, you may have rights regarding your personal data, including: + +• Accessing the data we hold about you. + +• Requesting correction or deletion of your data. + +• Withdrawing consent at any time (note: withdrawal may affect participation in beta testing). + +You may contact us to exercise these rights. + +Children’s Privacy +Eventify™ is not directed toward children under 13 years of age. We do not knowingly collect personal data from children. If we learn that information of a child under 13 has been collected, we will promptly delete it. + +Changes to This Privacy Policy +As Eventify™ evolves from beta to public release, we may update this Privacy Policy from time to time. Any changes will be reflected with a new “Last Updated” date. We encourage testers to review this page periodically to stay informed. + +Contact Us +If you have questions, concerns, or feedback regarding this Privacy Policy, you may contact us at: + +Eventify™ Support Team +Email: info@wp.sicherhaven.com +'''; + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + final textStyle = theme.textTheme.bodyMedium; + final headingStyle = theme.textTheme.titleMedium?.copyWith(fontWeight: FontWeight.bold); + + return Scaffold( + appBar: AppBar( + title: const Text('Privacy Policy'), + centerTitle: true, + ), + body: SafeArea( + child: SingleChildScrollView( + padding: const EdgeInsets.symmetric(horizontal: 18.0, vertical: 20.0), + child: SelectableText( + _policy, + style: textStyle?.copyWith(height: 1.45, color: theme.colorScheme.onSurface) ?? TextStyle(height: 1.45, color: theme.colorScheme.onSurface), + ), + ), + ), + ); + } +} diff --git a/lib/screens/profile_screen.dart b/lib/screens/profile_screen.dart new file mode 100644 index 0000000..5bc0909 --- /dev/null +++ b/lib/screens/profile_screen.dart @@ -0,0 +1,482 @@ +import 'dart:io'; + +import 'package:flutter/foundation.dart' show kIsWeb; +import 'package:flutter/material.dart'; +import 'package:image_picker/image_picker.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +import '../features/events/services/events_service.dart'; +import '../features/events/models/event_models.dart'; +import 'learn_more_screen.dart'; +import 'settings_screen.dart'; // <- added import +import '../core/app_decoration.dart'; + +class ProfileScreen extends StatefulWidget { + const ProfileScreen({Key? key}) : super(key: key); + + @override + State createState() => _ProfileScreenState(); +} + +class _ProfileScreenState extends State { + String _username = ''; + String _email = 'not provided'; + String _profileImage = ''; // per-account stored path or URL (may be empty) + final ImagePicker _picker = ImagePicker(); + + final EventsService _eventsService = EventsService(); + + // events coming from backend + List _upcomingEvents = []; + List _pastEvents = []; + + bool _loadingEvents = true; + + @override + void initState() { + super.initState(); + _loadProfile(); + } + + /// Load profile for the currently signed-in account. + Future _loadProfile() async { + final prefs = await SharedPreferences.getInstance(); + // current_email marks the active account (set at login/register) + final currentEmail = prefs.getString('current_email') ?? prefs.getString('email') ?? ''; + + _email = currentEmail.isNotEmpty ? currentEmail : 'not provided'; + + // per-account display name key + final displayKey = currentEmail.isNotEmpty ? 'display_name_$currentEmail' : 'display_name'; + final profileImageKey = currentEmail.isNotEmpty ? 'profileImage_$currentEmail' : 'profileImage'; + + // Prefer per-account display_name, else fallback to email + _username = prefs.getString(displayKey) ?? prefs.getString('display_name') ?? _email; + _profileImage = prefs.getString(profileImageKey) ?? prefs.getString('profileImage') ?? ''; + + // load events for this account's pincode (or default) + await _loadEventsForProfile(prefs); + if (mounted) setState(() {}); + } + + Future _loadEventsForProfile([SharedPreferences? prefs]) async { + setState(() { + _loadingEvents = true; + _upcomingEvents = []; + _pastEvents = []; + }); + + prefs ??= await SharedPreferences.getInstance(); + final pincode = prefs.getString('pincode') ?? 'all'; + + try { + final events = await _eventsService.getEventsByPincode(pincode); + + final now = DateTime.now(); + final upcoming = []; + final past = []; + + DateTime? tryParseDate(String? s) { + if (s == null) return null; + try { + return DateTime.tryParse(s); + } catch (_) { + return null; + } + } + + for (final e in events) { + final parsed = tryParseDate(e.startDate); + if (parsed == null) { + upcoming.add(e); + } else { + if (parsed.isBefore(DateTime(now.year, now.month, now.day))) { + past.add(e); + } else { + upcoming.add(e); + } + } + } + + upcoming.sort((a, b) { + final da = tryParseDate(a.startDate) ?? DateTime(9999); + final db = tryParseDate(b.startDate) ?? DateTime(9999); + return da.compareTo(db); + }); + past.sort((a, b) { + final da = tryParseDate(a.startDate) ?? DateTime(0); + final db = tryParseDate(b.startDate) ?? DateTime(0); + return db.compareTo(da); + }); + + if (mounted) { + setState(() { + _upcomingEvents = upcoming; + _pastEvents = past; + }); + } + } catch (e) { + if (mounted) { + ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Failed to load events: $e'))); + } + } finally { + if (mounted) setState(() => _loadingEvents = false); + } + } + + Future _saveProfile(String name, String email, String profileImage) async { + final prefs = await SharedPreferences.getInstance(); + final currentEmail = prefs.getString('current_email') ?? prefs.getString('email') ?? email; + + final displayKey = currentEmail.isNotEmpty ? 'display_name_$currentEmail' : 'display_name'; + final profileImageKey = currentEmail.isNotEmpty ? 'profileImage_$currentEmail' : 'profileImage'; + + await prefs.setString(displayKey, name); + await prefs.setString(profileImageKey, profileImage); + + // update 'email' canonical pointer and 'current_email' (defensive) + await prefs.setString('email', currentEmail); + await prefs.setString('current_email', currentEmail); + + setState(() { + _username = name; + _email = currentEmail.isNotEmpty ? currentEmail : 'not provided'; + _profileImage = profileImage; + }); + } + + // ---------- Image picking / manual path ---------- + Future _pickFromGallery() async { + try { + final XFile? xfile = await _picker.pickImage(source: ImageSource.gallery, imageQuality: 85); + if (xfile == null) return; + if (kIsWeb) { + ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Use "Enter Asset Path" on web/desktop or add server URL.'))); + return; + } + final String path = xfile.path; + await _saveProfile(_username, _email, path); + } catch (e) { + debugPrint('Image pick error: $e'); + ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Failed to pick image: $e'))); + } + } + + Future _enterAssetPathDialog() async { + final ctl = TextEditingController(text: _profileImage); + final result = await showDialog( + context: context, + builder: (ctx) { + final theme = Theme.of(ctx); + return AlertDialog( + title: const Text('Enter image path or URL'), + content: Column( + mainAxisSize: MainAxisSize.min, + children: [ + TextField( + controller: ctl, + decoration: const InputDecoration( + labelText: 'Asset path (e.g. assets/images/profile.jpg) or URL', + ), + ), + const SizedBox(height: 8), + Text( + 'Use an asset path (for bundled images) or an https:// URL (web).', + style: theme.textTheme.bodySmall?.copyWith(color: theme.hintColor), + ), + ], + ), + actions: [ + TextButton(onPressed: () => Navigator.of(ctx).pop(null), child: const Text('Cancel')), + ElevatedButton(onPressed: () => Navigator.of(ctx).pop(ctl.text.trim()), child: const Text('Use')), + ], + ); + }, + ); + + if (result == null || result.isEmpty) return; + await _saveProfile(_username, _email, result); + } + + Future _openEditDialog() async { + final nameCtl = TextEditingController(text: _username); + final emailCtl = TextEditingController(text: _email); + + showModalBottomSheet( + context: context, + isScrollControlled: true, + backgroundColor: Colors.transparent, + builder: (ctx) { + final theme = Theme.of(ctx); + return DraggableScrollableSheet( + expand: false, + initialChildSize: 0.44, + minChildSize: 0.28, + maxChildSize: 0.92, + builder: (context, scrollController) { + return Container( + padding: const EdgeInsets.fromLTRB(18, 14, 18, 18), + decoration: BoxDecoration( + color: theme.cardColor, + borderRadius: const BorderRadius.vertical(top: Radius.circular(20)), + ), + child: SingleChildScrollView( + controller: scrollController, + child: Column( + children: [ + Container(width: 48, height: 6, decoration: BoxDecoration(color: theme.dividerColor, borderRadius: BorderRadius.circular(6))), + const SizedBox(height: 12), + Row( + children: [ + Text('Edit profile', style: theme.textTheme.titleMedium?.copyWith(fontWeight: FontWeight.bold)), + const Spacer(), + IconButton( + icon: const Icon(Icons.photo_camera), + onPressed: () async { + Navigator.of(context).pop(); // close sheet then launch picker to avoid nested modal issues + await _pickFromGallery(); + }, + ), + IconButton( + icon: const Icon(Icons.link), + onPressed: () { + Navigator.of(context).pop(); + _enterAssetPathDialog(); + }, + ), + ], + ), + const SizedBox(height: 8), + + TextField(controller: nameCtl, decoration: InputDecoration(labelText: 'Name', filled: true, fillColor: theme.cardColor, border: OutlineInputBorder(borderRadius: BorderRadius.circular(8)))), + const SizedBox(height: 8), + TextField(controller: emailCtl, decoration: InputDecoration(labelText: 'Email', filled: true, fillColor: theme.cardColor, border: OutlineInputBorder(borderRadius: BorderRadius.circular(8)))), + const SizedBox(height: 14), + + Row( + children: [ + const Spacer(), + TextButton(onPressed: () => Navigator.of(context).pop(), child: const Text('Cancel')), + const SizedBox(width: 8), + ElevatedButton( + onPressed: () async { + final newName = nameCtl.text.trim().isEmpty ? _email : nameCtl.text.trim(); + final newEmail = emailCtl.text.trim().isEmpty ? _email : emailCtl.text.trim(); + + // If user changes email here (edge-case) we will treat newEmail as current account pointer. + await _saveProfile(newName, newEmail, _profileImage); + Navigator.of(context).pop(); + }, + child: const Text('Save'), + ), + ], + ), + const SizedBox(height: 8), + Text( + 'Tip: tap the camera icon to pick from gallery (mobile). Or tap the link icon to paste an asset path or URL.', + style: theme.textTheme.bodySmall?.copyWith(color: theme.hintColor), + ), + ], + ), + ), + ); + }, + ); + }, + ); + } + + // ---------- UI helpers ---------- + Widget _topIcon(IconData icon, {VoidCallback? onTap}) { + final theme = Theme.of(context); + return InkWell( + onTap: onTap ?? () {}, + borderRadius: BorderRadius.circular(12), + child: Container( + width: 44, + height: 44, + decoration: BoxDecoration(color: theme.cardColor.withOpacity(0.6), borderRadius: BorderRadius.circular(12)), + child: Icon(icon, color: theme.iconTheme.color), + ), + ); + } + + Widget _eventListTileFromModel(EventModel ev, {bool faded = false}) { + final theme = Theme.of(context); + final title = ev.title ?? ev.name ?? ''; + final dateLabel = (ev.startDate != null && ev.endDate != null && ev.startDate == ev.endDate) + ? ev.startDate! + : ((ev.startDate != null && ev.endDate != null) ? '${ev.startDate} - ${ev.endDate}' : (ev.startDate ?? '')); + final location = ev.place ?? ''; + final imageUrl = (ev.thumbImg != null && ev.thumbImg!.isNotEmpty) ? ev.thumbImg! : (ev.images.isNotEmpty ? ev.images.first.image : null); + + final titleStyle = theme.textTheme.bodyLarge?.copyWith(fontWeight: FontWeight.w600, color: faded ? theme.hintColor : theme.textTheme.bodyLarge?.color); + final subtitleStyle = theme.textTheme.bodySmall?.copyWith(fontSize: 13, color: faded ? theme.hintColor.withOpacity(0.7) : theme.hintColor); + + Widget leadingWidget() { + if (imageUrl != null && imageUrl.trim().isNotEmpty) { + if (imageUrl.startsWith('http')) { + return ClipRRect(borderRadius: BorderRadius.circular(8), child: Image.network(imageUrl, width: 56, height: 56, fit: BoxFit.cover, errorBuilder: (_, __, ___) => Container(width: 56, height: 56, color: Theme.of(context).dividerColor, child: Icon(Icons.image, color: Theme.of(context).hintColor)))); + } else if (!kIsWeb) { + final path = imageUrl; + if (path.startsWith('/') || path.contains(Platform.pathSeparator)) { + final file = File(path); + if (file.existsSync()) { + return ClipRRect(borderRadius: BorderRadius.circular(8), child: Image.file(file, width: 56, height: 56, fit: BoxFit.cover, errorBuilder: (_, __, ___) => Container(width: 56, height: 56, color: Theme.of(context).dividerColor, child: Icon(Icons.image, color: Theme.of(context).hintColor)))); + } else { + return ClipRRect(borderRadius: BorderRadius.circular(8), child: Image.asset(imageUrl, width: 56, height: 56, fit: BoxFit.cover, errorBuilder: (_, __, ___) => Container(width: 56, height: 56, color: Theme.of(context).dividerColor, child: Icon(Icons.image, color: Theme.of(context).hintColor)))); + } + } else { + return ClipRRect(borderRadius: BorderRadius.circular(8), child: Image.asset(imageUrl, width: 56, height: 56, fit: BoxFit.cover, errorBuilder: (_, __, ___) => Container(width: 56, height: 56, color: Theme.of(context).dividerColor, child: Icon(Icons.image, color: Theme.of(context).hintColor)))); + } + } else { + return ClipRRect(borderRadius: BorderRadius.circular(8), child: Image.asset(imageUrl, width: 56, height: 56, fit: BoxFit.cover, errorBuilder: (_, __, ___) => Container(width: 56, height: 56, color: Theme.of(context).dividerColor, child: Icon(Icons.image, color: Theme.of(context).hintColor)))); + } + } + + return Container(width: 56, height: 56, color: Theme.of(context).dividerColor, child: Icon(Icons.image, color: Theme.of(context).hintColor)); + } + + return Container( + margin: const EdgeInsets.symmetric(vertical: 8), + decoration: BoxDecoration( + color: Theme.of(context).cardColor, + borderRadius: BorderRadius.circular(14), + boxShadow: [BoxShadow(color: Theme.of(context).shadowColor.withOpacity(0.06), blurRadius: 10, offset: const Offset(0, 6))], + ), + child: ListTile( + onTap: () { + if (ev.id != null) { + Navigator.of(context).push(MaterialPageRoute(builder: (_) => LearnMoreScreen(eventId: ev.id))); + } + }, + contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), + leading: ClipRRect(borderRadius: BorderRadius.circular(8), child: leadingWidget()), + title: Text(title, style: titleStyle), + subtitle: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const SizedBox(height: 6), + Text(dateLabel, style: subtitleStyle), + const SizedBox(height: 2), + Text(location, style: subtitleStyle), + ], + ), + trailing: Container( + width: 40, + height: 40, + decoration: BoxDecoration(color: Theme.of(context).colorScheme.primary.withOpacity(0.12), borderRadius: BorderRadius.circular(10)), + child: Icon(Icons.qr_code_scanner, color: Theme.of(context).colorScheme.primary), + ), + ), + ); + } + + Widget _buildProfileAvatar() { + final path = _profileImage.trim(); + if (path.startsWith('http')) { + return ClipOval(child: Image.network(path, width: 96, height: 96, fit: BoxFit.cover, errorBuilder: (_, __, ___) => const Icon(Icons.person, size: 48, color: Colors.grey))); + } + if (kIsWeb) { + return ClipOval(child: Image.asset(path.isNotEmpty ? path : 'assets/images/profile.jpg', width: 96, height: 96, fit: BoxFit.cover, errorBuilder: (_, __, ___) => const Icon(Icons.person, size: 48, color: Colors.grey))); + } + if (path.isNotEmpty && (path.startsWith('/') || path.contains(Platform.pathSeparator))) { + final file = File(path); + if (file.existsSync()) { + return ClipOval(child: Image.file(file, width: 96, height: 96, fit: BoxFit.cover, errorBuilder: (_, __, ___) => const Icon(Icons.person, size: 48, color: Colors.grey))); + } else { + return ClipOval(child: Image.asset('assets/images/profile.jpg', width: 96, height: 96, fit: BoxFit.cover, errorBuilder: (_, __, ___) => const Icon(Icons.person, size: 48, color: Colors.grey))); + } + } + return ClipOval(child: Image.asset('assets/images/profile.jpg', width: 96, height: 96, fit: BoxFit.cover, errorBuilder: (_, __, ___) => const Icon(Icons.person, size: 48, color: Colors.grey))); + } + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + final gradient = const LinearGradient(colors: [Color(0xFF0B63D6), Color(0xFF1449B8)], begin: Alignment.topLeft, end: Alignment.bottomRight); + + return Scaffold( + backgroundColor: theme.scaffoldBackgroundColor, + body: Column( + children: [ + Container( + width: double.infinity, + decoration: AppDecoration.blueGradient.copyWith(borderRadius: const BorderRadius.only(bottomLeft: Radius.circular(24), bottomRight: Radius.circular(24))), + child: SafeArea( + bottom: false, + child: Padding( + padding: const EdgeInsets.fromLTRB(20, 18, 20, 20), + child: Column( + children: [ + Row( + children: [ + const Expanded(child: SizedBox()), + Text('Profile', style: theme.textTheme.titleMedium?.copyWith(color: Colors.white, fontWeight: FontWeight.w600)), + Expanded( + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + GestureDetector( + onTap: () => _openEditDialog(), + child: Container(margin: const EdgeInsets.only(right: 10), width: 40, height: 40, decoration: BoxDecoration(color: Colors.white24, borderRadius: BorderRadius.circular(10)), child: const Icon(Icons.edit, color: Colors.white)), + ), + // <-- REPLACED the reminder icon with settings icon and navigation + GestureDetector( + onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const SettingsScreen())), + child: Container(width: 40, height: 40, decoration: BoxDecoration(color: Colors.white24, borderRadius: BorderRadius.circular(10)), child: const Icon(Icons.settings, color: Colors.white)), + ), + ], + ), + ), + ], + ), + + const SizedBox(height: 18), + + GestureDetector( + onTap: () => _openEditDialog(), + child: CircleAvatar(radius: 48, backgroundColor: Colors.white, child: _buildProfileAvatar()), + ), + + const SizedBox(height: 12), + Text(_username, style: theme.textTheme.titleLarge?.copyWith(color: Colors.white, fontWeight: FontWeight.bold)), + const SizedBox(height: 6), + Container(padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6), decoration: BoxDecoration(color: Colors.white24, borderRadius: BorderRadius.circular(16)), child: Text(_email, style: const TextStyle(color: Colors.white70))), + ], + ), + ), + ), + ), + + Expanded( + child: SingleChildScrollView( + padding: const EdgeInsets.fromLTRB(18, 18, 18, 24), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Removed Upcoming Events section — kept only Past Events below + + Text('Past Events', style: theme.textTheme.titleMedium?.copyWith(fontWeight: FontWeight.bold)), + const SizedBox(height: 12), + + if (_loadingEvents) + const SizedBox.shrink() + else if (_pastEvents.isEmpty) + Padding( + padding: const EdgeInsets.symmetric(vertical: 12), + child: Text('No past events', style: theme.textTheme.bodyMedium?.copyWith(color: theme.hintColor)), + ) + else + Column(children: _pastEvents.map((e) => _eventListTileFromModel(e, faded: true)).toList()), + + const SizedBox(height: 28), + ], + ), + ), + ), + ], + ), + ); + } +} diff --git a/lib/screens/responsive_layout.dart b/lib/screens/responsive_layout.dart new file mode 100644 index 0000000..2b9bfe4 --- /dev/null +++ b/lib/screens/responsive_layout.dart @@ -0,0 +1,51 @@ +// lib/widgets/responsive_layout.dart +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; + +/// Simple responsive layout chooser. +/// +/// Behavior: +/// - On desktop platforms (Windows / macOS / Linux) -> always use `desktop`. +/// - On web -> treat as desktop (tablet/desktop UI). If you want web to act +/// like mobile at very narrow widths, you can change that logic here. +/// - On mobile platforms (Android / iOS) -> use `mobile` when width < mobileBreakpoint, +/// otherwise use `desktop`. +/// +/// Tablet uses the desktop UI by design (per your request). +class ResponsiveLayout extends StatelessWidget { + final Widget mobile; + final Widget desktop; + final double mobileBreakpoint; + + const ResponsiveLayout({ + Key? key, + required this.mobile, + required this.desktop, + this.mobileBreakpoint = 700, // tune this value if you prefer different breakpoint + }) : assert(mobileBreakpoint > 0), + super(key: key); + + bool _isMobilePlatform() { + // kIsWeb is true for web builds. + if (kIsWeb) return false; // treat web as desktop/tablet by default + // defaultTargetPlatform works on Flutter (all non-web platforms). + return defaultTargetPlatform == TargetPlatform.android || defaultTargetPlatform == TargetPlatform.iOS; + } + + bool _chooseMobile(BuildContext context) { + final width = MediaQuery.of(context).size.width; + + // If running on Android/iOS, allow width to determine mobile vs desktop. + if (_isMobilePlatform()) { + return width < mobileBreakpoint; + } + + // On desktop platforms (Windows/macOS/Linux) and on web, always use desktop UI. + return false; + } + + @override + Widget build(BuildContext context) { + return _chooseMobile(context) ? mobile : desktop; + } +} diff --git a/lib/screens/search_screen.dart b/lib/screens/search_screen.dart new file mode 100644 index 0000000..42184ff --- /dev/null +++ b/lib/screens/search_screen.dart @@ -0,0 +1,307 @@ +// lib/screens/search_screen.dart +import 'dart:ui'; +import 'package:flutter/material.dart'; + +// Location packages (add to pubspec.yaml) +// geolocator -> for permission & coordinates +// geocoding -> for reverse geocoding coordinates to a placemark +import 'package:geolocator/geolocator.dart'; +import 'package:geocoding/geocoding.dart'; + +class SearchScreen extends StatefulWidget { + const SearchScreen({Key? key}) : super(key: key); + + /// Returns a String to the caller via Navigator.pop(string). + /// Could be: + /// - a city name (e.g. "Bengaluru") + /// - 'Current Location' or a resolved locality like "Whitefield, Bengaluru" + @override + State createState() => _SearchScreenState(); +} + +class _SearchScreenState extends State { + final TextEditingController _ctrl = TextEditingController(); + final List _popularCities = const [ + 'Delhi NCR', + 'Mumbai', + 'Kolkata', + 'Bengaluru', + 'Hyderabad', + 'Chandigarh', + 'Pune', + 'Chennai', + 'Ahmedabad', + 'Jaipur', + ]; + + List _filtered = []; + bool _loadingLocation = false; + + @override + void initState() { + super.initState(); + _filtered = List.from(_popularCities); + } + + @override + void dispose() { + _ctrl.dispose(); + super.dispose(); + } + + void _onQueryChanged(String q) { + final ql = q.trim().toLowerCase(); + setState(() { + if (ql.isEmpty) { + _filtered = List.from(_popularCities); + } else { + _filtered = _popularCities.where((c) => c.toLowerCase().contains(ql)).toList(); + } + }); + } + + void _selectAndClose(String city) { + Navigator.of(context).pop(city); + } + + Future _useCurrentLocation() async { + setState(() => _loadingLocation = true); + + try { + // Check / request permission + LocationPermission permission = await Geolocator.checkPermission(); + if (permission == LocationPermission.denied) { + permission = await Geolocator.requestPermission(); + } + + if (permission == LocationPermission.deniedForever || permission == LocationPermission.denied) { + // Can't get permission — inform user and return a fallback label + ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Location permission denied'))); + Navigator.of(context).pop('Current Location'); + return; + } + + // Get current position + final pos = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.best); + + // Try reverse geocoding to get a readable place name + try { + final placemarks = await placemarkFromCoordinates(pos.latitude, pos.longitude); + if (placemarks.isNotEmpty) { + final p = placemarks.first; + final parts = []; + if ((p.subLocality ?? '').isNotEmpty) parts.add(p.subLocality!); + if ((p.locality ?? '').isNotEmpty) parts.add(p.locality!); + if ((p.subAdministrativeArea ?? '').isNotEmpty) parts.add(p.subAdministrativeArea!); + if ((p.administrativeArea ?? '').isNotEmpty) parts.add(p.administrativeArea!); + final label = parts.isNotEmpty ? parts.join(', ') : 'Current Location'; + Navigator.of(context).pop(label); + return; + } + } catch (_) { + // ignore reverse geocode failures and fallback to coordinates or simple label + } + + // fallback: return lat,lng string or simple label + Navigator.of(context).pop('${pos.latitude.toStringAsFixed(5)},${pos.longitude.toStringAsFixed(5)}'); + } catch (e) { + // If any error, fallback to simple label + ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('Could not determine location: $e'))); + Navigator.of(context).pop('Current Location'); + } finally { + if (mounted) setState(() => _loadingLocation = false); + } + } + + @override + Widget build(BuildContext context) { + // Full-screen transparent Scaffold so the BackdropFilter can blur underlying UI. + return Scaffold( + backgroundColor: Colors.transparent, + body: GestureDetector( + // Tap outside sheet to dismiss + onTap: () => Navigator.of(context).pop(), + behavior: HitTestBehavior.opaque, + child: Stack( + children: [ + // BackdropFilter + dim overlay + BackdropFilter( + filter: ImageFilter.blur(sigmaX: 8.0, sigmaY: 8.0), + child: Container(color: Colors.black.withOpacity(0.16)), + ), + + // Align bottom: the sheet content + Align( + alignment: Alignment.bottomCenter, + child: _SearchBottomSheet( + controller: _ctrl, + filteredCities: _filtered, + onCityTap: (city) => _selectAndClose(city), + onQueryChanged: _onQueryChanged, + onUseCurrentLocation: _useCurrentLocation, + loadingLocation: _loadingLocation, + ), + ), + ], + ), + ), + ); + } +} + +class _SearchBottomSheet extends StatelessWidget { + final TextEditingController controller; + final List filteredCities; + final void Function(String) onCityTap; + final void Function(String) onQueryChanged; + final Future Function() onUseCurrentLocation; + final bool loadingLocation; + + const _SearchBottomSheet({ + Key? key, + required this.controller, + required this.filteredCities, + required this.onCityTap, + required this.onQueryChanged, + required this.onUseCurrentLocation, + required this.loadingLocation, + }) : super(key: key); + + Widget _cityChip(String name, BuildContext context, void Function() onTap) { + return InkWell( + onTap: onTap, + borderRadius: BorderRadius.circular(12), + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12), + decoration: BoxDecoration(color: Colors.grey[100], borderRadius: BorderRadius.circular(12)), + child: Text(name, style: const TextStyle(color: Colors.black87)), + ), + ); + } + + @override + Widget build(BuildContext context) { + // The bottom sheet container + return Padding( + padding: const EdgeInsets.all(0), + child: Container( + // limit height so it looks like a sheet + constraints: BoxConstraints(maxHeight: MediaQuery.of(context).size.height * 0.78, minHeight: 240), + decoration: const BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.vertical(top: Radius.circular(24)), + boxShadow: [BoxShadow(color: Colors.black26, blurRadius: 12)], + ), + child: SafeArea( + top: false, + child: SingleChildScrollView( + padding: const EdgeInsets.fromLTRB(20, 18, 20, 28), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // center drag handle + Center( + child: Container(width: 48, height: 6, decoration: BoxDecoration(color: Colors.grey[300], borderRadius: BorderRadius.circular(6))), + ), + const SizedBox(height: 12), + + // Header + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + const Text('Set Your Location', style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold)), + // Close button (inside sheet) + InkWell( + onTap: () => Navigator.of(context).pop(), + borderRadius: BorderRadius.circular(12), + child: Container(width: 40, height: 40, decoration: BoxDecoration(color: Colors.grey[100], borderRadius: BorderRadius.circular(10)), child: const Icon(Icons.close, color: Colors.black54)), + ), + ], + ), + const SizedBox(height: 14), + + // Search field (now functional) + Container( + padding: const EdgeInsets.symmetric(horizontal: 12), + decoration: BoxDecoration(color: Colors.grey[100], borderRadius: BorderRadius.circular(12)), + child: Row( + children: [ + const Icon(Icons.search, color: Colors.black38), + const SizedBox(width: 10), + Expanded( + child: TextField( + controller: controller, + decoration: const InputDecoration(hintText: 'Search city, area or locality', border: InputBorder.none), + textInputAction: TextInputAction.search, + onChanged: onQueryChanged, + onSubmitted: (v) { + final q = v.trim(); + if (q.isEmpty) return; + // If there's an exact/first match in filteredCities, pick it; otherwise pass the raw query. + final match = filteredCities.isNotEmpty ? filteredCities.first : null; + Navigator.of(context).pop(match ?? q); + }, + ), + ), + if (controller.text.isNotEmpty) + IconButton( + icon: const Icon(Icons.clear), + onPressed: () { + controller.clear(); + onQueryChanged(''); + }, + ), + ], + ), + ), + const SizedBox(height: 14), + + // Use current location button + ElevatedButton( + onPressed: loadingLocation ? null : () => onUseCurrentLocation(), + style: ElevatedButton.styleFrom( + padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 12), + backgroundColor: const Color(0xFF0B63D6), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + ), + child: Row( + children: [ + const Icon(Icons.my_location, color: Colors.white), + const SizedBox(width: 12), + Expanded(child: Text(loadingLocation ? 'Detecting location...' : 'Use Current Location', style: const TextStyle(color: Colors.white))), + if (loadingLocation) + const SizedBox(width: 18, height: 18, child: CircularProgressIndicator(color: Colors.white, strokeWidth: 2)) + else + const Icon(Icons.chevron_right, color: Colors.white), + ], + ), + ), + const SizedBox(height: 18), + + // Popular cities + const Text('Popular Cities', style: TextStyle(fontWeight: FontWeight.bold)), + const SizedBox(height: 12), + + Wrap( + spacing: 12, + runSpacing: 12, + children: [ + for (final city in filteredCities.take(8)) _cityChip(city, context, () => onCityTap(city)), + // if filteredCities is empty show empty state + if (filteredCities.isEmpty) + Padding( + padding: const EdgeInsets.symmetric(vertical: 12), + child: Text('No suggestions', style: TextStyle(color: Colors.grey[600])), + ) + ], + ), + + const SizedBox(height: 8), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/settings_screen.dart b/lib/screens/settings_screen.dart new file mode 100644 index 0000000..69d3245 --- /dev/null +++ b/lib/screens/settings_screen.dart @@ -0,0 +1,254 @@ +import 'package:flutter/material.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'login_screen.dart'; +import 'desktop_login_screen.dart'; +import '../core/theme_manager.dart'; +import 'privacy_policy_screen.dart'; // new import +import '../core/app_decoration.dart'; + +class SettingsScreen extends StatefulWidget { + const SettingsScreen({Key? key}) : super(key: key); + + @override + State createState() => _SettingsScreenState(); +} + +class _SettingsScreenState extends State { + bool _notifications = true; + String _appVersion = '1.2(p)'; + + @override + void initState() { + super.initState(); + _loadPreferences(); + } + + Future _loadPreferences() async { + final prefs = await SharedPreferences.getInstance(); + setState(() { + _notifications = prefs.getBool('reminders_enabled') ?? true; + // app version may come from pubspec or preferences; kept static otherwise + }); + } + + Future _saveNotifications(bool value) async { + final prefs = await SharedPreferences.getInstance(); + await prefs.setBool('reminders_enabled', value); + setState(() => _notifications = value); + } + + Future _confirmLogout() async { + final should = await showDialog( + context: context, + builder: (ctx) { + return AlertDialog( + title: const Text('Logout'), + content: const Text('Are you sure you want to logout? This will clear saved login data.'), + actions: [ + TextButton(onPressed: () => Navigator.of(ctx).pop(false), child: const Text('Cancel')), + ElevatedButton(onPressed: () => Navigator.of(ctx).pop(true), child: const Text('Logout')), + ], + ); + }, + ); + + if (should == true) { + await _performLogout(); + } + } + + Future _performLogout() async { + final prefs = await SharedPreferences.getInstance(); + await prefs.remove('username'); + await prefs.remove('email'); + await prefs.remove('profileImage'); + + // Decide which login screen to show depending on current window width + final double width = MediaQuery.of(context).size.width; + const double desktopBreakpoint = 820; // same breakpoint used elsewhere + final bool isDesktop = width >= desktopBreakpoint; + + // Navigate and remove all previous routes + Navigator.of(context).pushAndRemoveUntil( + MaterialPageRoute( + builder: (_) => isDesktop ? const DesktopLoginScreen() : const LoginScreen(), + ), + (route) => false, + ); + } + + Widget _buildTile({required IconData icon, required String title, String? subtitle, VoidCallback? onTap}) { + return Container( + margin: const EdgeInsets.symmetric(vertical: 6), + decoration: BoxDecoration( + color: Theme.of(context).cardColor, + borderRadius: BorderRadius.circular(12), + boxShadow: const [BoxShadow(color: Colors.black12, blurRadius: 6, offset: Offset(0, 4))], + ), + child: ListTile( + leading: Container( + width: 44, + height: 44, + decoration: BoxDecoration(color: Theme.of(context).scaffoldBackgroundColor, borderRadius: BorderRadius.circular(10)), + child: Icon(icon, color: const Color(0xFF0B63D6)), + ), + title: Text(title, style: const TextStyle(fontWeight: FontWeight.w600)), + subtitle: subtitle != null ? Text(subtitle) : null, + onTap: onTap, + contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8), + ), + ); + } + + @override + Widget build(BuildContext context) { + const primary = Color(0xFF0B63D6); + + return Scaffold( + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + body: SafeArea( + child: Column( + children: [ + // Header + Container( + width: double.infinity, + padding: const EdgeInsets.fromLTRB(20, 18, 20, 18), + decoration: AppDecoration.blueGradient.copyWith( + borderRadius: const BorderRadius.only(bottomLeft: Radius.circular(24), bottomRight: Radius.circular(24)), + ), + child: Row( + children: [ + const Expanded(child: Text('Settings', style: TextStyle(color: Colors.white, fontSize: 20, fontWeight: FontWeight.w600))), + InkWell( + onTap: () => ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Help tapped (demo)'))), + child: Container( + width: 40, + height: 40, + decoration: BoxDecoration(color: Colors.white24, borderRadius: BorderRadius.circular(10)), + child: const Icon(Icons.help_outline, color: Colors.white), + ), + ), + ], + ), + ), + + const SizedBox(height: 18), + + // Content + Expanded( + child: SingleChildScrollView( + padding: const EdgeInsets.fromLTRB(18, 0, 18, 24), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Account + const Text('Account', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold)), + const SizedBox(height: 12), + _buildTile( + icon: Icons.person, + title: 'Edit Profile', + subtitle: 'Change username, email or photo', + onTap: () { + ScaffoldMessenger.of(context).showSnackBar(const SnackBar(content: Text('Open Profile tab (demo)'))); + }, + ), + const SizedBox(height: 12), + + // Preferences + const Text('Preferences', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold)), + const SizedBox(height: 12), + + // Reminders switch wrapped in card-like container + Container( + margin: const EdgeInsets.symmetric(vertical: 6), + decoration: BoxDecoration( + color: Theme.of(context).cardColor, + borderRadius: BorderRadius.circular(12), + boxShadow: const [BoxShadow(color: Colors.black12, blurRadius: 6, offset: Offset(0, 4))], + ), + child: SwitchListTile( + tileColor: Theme.of(context).cardColor, + contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4), + value: _notifications, + onChanged: (v) => _saveNotifications(v), + title: const Text('Reminders'), + secondary: const Icon(Icons.notifications, color: primary), + ), + ), + + const SizedBox(height: 8), + + // Dark Mode switch wrapped in card-like container and hooked to ThemeManager + Container( + margin: const EdgeInsets.symmetric(vertical: 6), + decoration: BoxDecoration( + color: Theme.of(context).cardColor, + borderRadius: BorderRadius.circular(12), + boxShadow: const [BoxShadow(color: Colors.black12, blurRadius: 6, offset: Offset(0, 4))], + ), + child: ValueListenableBuilder( + valueListenable: ThemeManager.themeMode, + builder: (context, mode, _) { + final isDark = mode == ThemeMode.dark; + return SwitchListTile( + tileColor: Theme.of(context).cardColor, + contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4), + value: isDark, + onChanged: (v) => ThemeManager.setThemeMode(v ? ThemeMode.dark : ThemeMode.light), + title: const Text('Dark Mode'), + secondary: const Icon(Icons.dark_mode, color: primary), + ); + }, + ), + ), + + const SizedBox(height: 18), + + // About + const Text('About', style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold)), + const SizedBox(height: 12), + _buildTile(icon: Icons.info_outline, title: 'App Version', subtitle: _appVersion, onTap: () {}), + const SizedBox(height: 12), + + // Privacy Policy tile now navigates to PrivacyPolicyScreen + _buildTile( + icon: Icons.privacy_tip_outlined, + title: 'Privacy Policy', + subtitle: 'Demo app', + onTap: () { + Navigator.of(context).push(MaterialPageRoute(builder: (_) => const PrivacyPolicyScreen())); + }, + ), + + const SizedBox(height: 24), + + // Logout area + Center( + child: Column( + children: [ + ElevatedButton( + onPressed: _confirmLogout, + style: ElevatedButton.styleFrom( + backgroundColor: primary, + padding: const EdgeInsets.symmetric(horizontal: 28, vertical: 14), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)), + ), + child: const Text('Logout', style: TextStyle(color: Colors.white)), + ), + const SizedBox(height: 12), + const Text('Logging out will return you to the login screen.', style: TextStyle(color: Colors.black54, fontSize: 12)), + ], + ), + ), + + const SizedBox(height: 32), + ], + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/screens/tickets_booked_screen.dart b/lib/screens/tickets_booked_screen.dart new file mode 100644 index 0000000..cc7c7b6 --- /dev/null +++ b/lib/screens/tickets_booked_screen.dart @@ -0,0 +1,134 @@ +// lib/screens/tickets_booked_screen.dart +import 'package:flutter/material.dart'; + +class TicketsBookedScreen extends StatelessWidget { + const TicketsBookedScreen({Key? key}) : super(key: key); + + void _onScannerTap(BuildContext context) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text('Scanner tapped (demo)')), + ); + } + + void _onWhatsappTap(BuildContext context) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text('Chat/WhatsApp tapped (demo)')), + ); + } + + void _onCallTap(BuildContext context) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text('Call tapped (demo)')), + ); + } + + @override + Widget build(BuildContext context) { + final Color bg = Color(0xFFF7F5FB); // app background + final Color primary = Color(0xFF0B63D6); // blue theme + + return Scaffold( + backgroundColor: bg, + appBar: AppBar( + backgroundColor: bg, + elevation: 0, + iconTheme: IconThemeData(color: Colors.black87), + title: Text('Tickets Booked', style: TextStyle(color: Colors.black87)), + centerTitle: false, + ), + body: SafeArea( + child: Column( + children: [ + SizedBox(height: 36), + + // Confirmation text + Center( + child: Column( + children: [ + Text( + 'Your tickets have been booked!', + style: TextStyle(fontSize: 20, fontWeight: FontWeight.w600, color: Colors.black87), + ), + SizedBox(height: 10), + Text( + 'Enjoy the event.', + style: TextStyle(fontSize: 14, color: Colors.black54), + ), + ], + ), + ), + + SizedBox(height: 36), + + // Row of rounded blue icons + Padding( + padding: const EdgeInsets.symmetric(horizontal: 28.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + _actionButton(context, primary, Icons.qr_code_scanner, 'Scanner', _onScannerTap), + _actionButton(context, primary, Icons.chat, 'Chat', _onWhatsappTap), // 👈 replaced + _actionButton(context, primary, Icons.call, 'Call', _onCallTap), + ], + ), + ), + + SizedBox(height: 28), + + Padding( + padding: const EdgeInsets.symmetric(horizontal: 28.0), + child: Text( + 'Save this confirmation — you may need it at the venue.\nUse the buttons above to share or show your ticket.', + textAlign: TextAlign.center, + style: TextStyle(color: Colors.black54), + ), + ), + + Spacer(), + + // Return to Home button + Padding( + padding: const EdgeInsets.only(bottom: 22.0), + child: ElevatedButton( + onPressed: () { + Navigator.of(context).popUntil((route) => route.isFirst); + }, + style: ElevatedButton.styleFrom( + backgroundColor: primary, + padding: EdgeInsets.symmetric(horizontal: 28, vertical: 14), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)), + ), + child: Text('Return to Home', style: TextStyle(color: Colors.white)), + ), + ), + ], + ), + ), + ); + } + + // helper + Widget _actionButton( + BuildContext context, Color color, IconData icon, String label, Function onTap) { + return Column( + children: [ + InkWell( + onTap: () => onTap(context), + borderRadius: BorderRadius.circular(16), + child: Container( + width: 72, + height: 72, + decoration: BoxDecoration( + color: color, + borderRadius: BorderRadius.circular(16), + boxShadow: [BoxShadow(color: Colors.black12, blurRadius: 8, offset: Offset(0, 4))], + ), + child: Center(child: Icon(icon, color: Colors.white, size: 30)), + ), + ), + SizedBox(height: 10), + Text(label, style: TextStyle(color: Colors.black87)), + ], + ); + } +} diff --git a/linux/.gitignore b/linux/.gitignore new file mode 100644 index 0000000..d3896c9 --- /dev/null +++ b/linux/.gitignore @@ -0,0 +1 @@ +flutter/ephemeral diff --git a/linux/CMakeLists.txt b/linux/CMakeLists.txt new file mode 100644 index 0000000..4d7fd41 --- /dev/null +++ b/linux/CMakeLists.txt @@ -0,0 +1,128 @@ +# Project-level configuration. +cmake_minimum_required(VERSION 3.13) +project(runner LANGUAGES CXX) + +# The name of the executable created for the application. Change this to change +# the on-disk name of your application. +set(BINARY_NAME "figma_events") +# The unique GTK application identifier for this application. See: +# https://wiki.gnome.org/HowDoI/ChooseApplicationID +set(APPLICATION_ID "com.example.figma_events") + +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent +# versions of CMake. +cmake_policy(SET CMP0063 NEW) + +# Load bundled libraries from the lib/ directory relative to the binary. +set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") + +# Root filesystem for cross-building. +if(FLUTTER_TARGET_PLATFORM_SYSROOT) + set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) + set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +endif() + +# Define build configuration options. +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Debug" CACHE + STRING "Flutter build mode" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Profile" "Release") +endif() + +# Compilation settings that should be applied to most targets. +# +# Be cautious about adding new options here, as plugins use this function by +# default. In most cases, you should add new options to specific targets instead +# of modifying this function. +function(APPLY_STANDARD_SETTINGS TARGET) + target_compile_features(${TARGET} PUBLIC cxx_std_14) + target_compile_options(${TARGET} PRIVATE -Wall -Werror) + target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") + target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") +endfunction() + +# Flutter library and tool build rules. +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") +add_subdirectory(${FLUTTER_MANAGED_DIR}) + +# System-level dependencies. +find_package(PkgConfig REQUIRED) +pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) + +# Application build; see runner/CMakeLists.txt. +add_subdirectory("runner") + +# Run the Flutter tool portions of the build. This must not be removed. +add_dependencies(${BINARY_NAME} flutter_assemble) + +# Only the install-generated bundle's copy of the executable will launch +# correctly, since the resources must in the right relative locations. To avoid +# people trying to run the unbundled copy, put it in a subdirectory instead of +# the default top-level location. +set_target_properties(${BINARY_NAME} + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" +) + + +# Generated plugin build rules, which manage building the plugins and adding +# them to the application. +include(flutter/generated_plugins.cmake) + + +# === Installation === +# By default, "installing" just makes a relocatable bundle in the build +# directory. +set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) +endif() + +# Start with a clean build bundle directory every time. +install(CODE " + file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") + " COMPONENT Runtime) + +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) + install(FILES "${bundled_library}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endforeach(bundled_library) + +# Copy the native assets provided by the build.dart from all packages. +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/") +install(DIRECTORY "${NATIVE_ASSETS_DIR}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +# Fully re-copy the assets directory on each build to avoid having stale files +# from a previous install. +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") +install(CODE " + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") + " COMPONENT Runtime) +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) + +# Install the AOT library on non-Debug builds only. +if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") + install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() diff --git a/linux/flutter/CMakeLists.txt b/linux/flutter/CMakeLists.txt new file mode 100644 index 0000000..d5bd016 --- /dev/null +++ b/linux/flutter/CMakeLists.txt @@ -0,0 +1,88 @@ +# This file controls Flutter-level build steps. It should not be edited. +cmake_minimum_required(VERSION 3.10) + +set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") + +# Configuration provided via flutter tool. +include(${EPHEMERAL_DIR}/generated_config.cmake) + +# TODO: Move the rest of this into files in ephemeral. See +# https://github.com/flutter/flutter/issues/57146. + +# Serves the same purpose as list(TRANSFORM ... PREPEND ...), +# which isn't available in 3.10. +function(list_prepend LIST_NAME PREFIX) + set(NEW_LIST "") + foreach(element ${${LIST_NAME}}) + list(APPEND NEW_LIST "${PREFIX}${element}") + endforeach(element) + set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) +endfunction() + +# === Flutter Library === +# System-level dependencies. +find_package(PkgConfig REQUIRED) +pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) +pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) +pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) + +set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") + +# Published to parent scope for install step. +set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) +set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) +set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) +set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) + +list(APPEND FLUTTER_LIBRARY_HEADERS + "fl_basic_message_channel.h" + "fl_binary_codec.h" + "fl_binary_messenger.h" + "fl_dart_project.h" + "fl_engine.h" + "fl_json_message_codec.h" + "fl_json_method_codec.h" + "fl_message_codec.h" + "fl_method_call.h" + "fl_method_channel.h" + "fl_method_codec.h" + "fl_method_response.h" + "fl_plugin_registrar.h" + "fl_plugin_registry.h" + "fl_standard_message_codec.h" + "fl_standard_method_codec.h" + "fl_string_codec.h" + "fl_value.h" + "fl_view.h" + "flutter_linux.h" +) +list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") +add_library(flutter INTERFACE) +target_include_directories(flutter INTERFACE + "${EPHEMERAL_DIR}" +) +target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") +target_link_libraries(flutter INTERFACE + PkgConfig::GTK + PkgConfig::GLIB + PkgConfig::GIO +) +add_dependencies(flutter flutter_assemble) + +# === Flutter tool backend === +# _phony_ is a non-existent file to force this command to run every time, +# since currently there's no way to get a full input/output list from the +# flutter tool. +add_custom_command( + OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} + ${CMAKE_CURRENT_BINARY_DIR}/_phony_ + COMMAND ${CMAKE_COMMAND} -E env + ${FLUTTER_TOOL_ENVIRONMENT} + "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" + ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} + VERBATIM +) +add_custom_target(flutter_assemble DEPENDS + "${FLUTTER_LIBRARY}" + ${FLUTTER_LIBRARY_HEADERS} +) diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc new file mode 100644 index 0000000..64a0ece --- /dev/null +++ b/linux/flutter/generated_plugin_registrant.cc @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + +#include + +void fl_register_plugins(FlPluginRegistry* registry) { + g_autoptr(FlPluginRegistrar) file_selector_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin"); + file_selector_plugin_register_with_registrar(file_selector_linux_registrar); +} diff --git a/linux/flutter/generated_plugin_registrant.h b/linux/flutter/generated_plugin_registrant.h new file mode 100644 index 0000000..e0f0a47 --- /dev/null +++ b/linux/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void fl_register_plugins(FlPluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake new file mode 100644 index 0000000..2db3c22 --- /dev/null +++ b/linux/flutter/generated_plugins.cmake @@ -0,0 +1,24 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST + file_selector_linux +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/linux/runner/CMakeLists.txt b/linux/runner/CMakeLists.txt new file mode 100644 index 0000000..e97dabc --- /dev/null +++ b/linux/runner/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.13) +project(runner LANGUAGES CXX) + +# Define the application target. To change its name, change BINARY_NAME in the +# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer +# work. +# +# Any new source files that you add to the application should be added here. +add_executable(${BINARY_NAME} + "main.cc" + "my_application.cc" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" +) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. +apply_standard_settings(${BINARY_NAME}) + +# Add preprocessor definitions for the application ID. +add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") + +# Add dependency libraries. Add any application-specific dependencies here. +target_link_libraries(${BINARY_NAME} PRIVATE flutter) +target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) + +target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") diff --git a/linux/runner/main.cc b/linux/runner/main.cc new file mode 100644 index 0000000..e7c5c54 --- /dev/null +++ b/linux/runner/main.cc @@ -0,0 +1,6 @@ +#include "my_application.h" + +int main(int argc, char** argv) { + g_autoptr(MyApplication) app = my_application_new(); + return g_application_run(G_APPLICATION(app), argc, argv); +} diff --git a/linux/runner/my_application.cc b/linux/runner/my_application.cc new file mode 100644 index 0000000..a05378a --- /dev/null +++ b/linux/runner/my_application.cc @@ -0,0 +1,144 @@ +#include "my_application.h" + +#include +#ifdef GDK_WINDOWING_X11 +#include +#endif + +#include "flutter/generated_plugin_registrant.h" + +struct _MyApplication { + GtkApplication parent_instance; + char** dart_entrypoint_arguments; +}; + +G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) + +// Called when first Flutter frame received. +static void first_frame_cb(MyApplication* self, FlView *view) +{ + gtk_widget_show(gtk_widget_get_toplevel(GTK_WIDGET(view))); +} + +// Implements GApplication::activate. +static void my_application_activate(GApplication* application) { + MyApplication* self = MY_APPLICATION(application); + GtkWindow* window = + GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); + + // Use a header bar when running in GNOME as this is the common style used + // by applications and is the setup most users will be using (e.g. Ubuntu + // desktop). + // If running on X and not using GNOME then just use a traditional title bar + // in case the window manager does more exotic layout, e.g. tiling. + // If running on Wayland assume the header bar will work (may need changing + // if future cases occur). + gboolean use_header_bar = TRUE; +#ifdef GDK_WINDOWING_X11 + GdkScreen* screen = gtk_window_get_screen(window); + if (GDK_IS_X11_SCREEN(screen)) { + const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); + if (g_strcmp0(wm_name, "GNOME Shell") != 0) { + use_header_bar = FALSE; + } + } +#endif + if (use_header_bar) { + GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); + gtk_widget_show(GTK_WIDGET(header_bar)); + gtk_header_bar_set_title(header_bar, "figma_events"); + gtk_header_bar_set_show_close_button(header_bar, TRUE); + gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); + } else { + gtk_window_set_title(window, "figma_events"); + } + + gtk_window_set_default_size(window, 1280, 720); + + g_autoptr(FlDartProject) project = fl_dart_project_new(); + fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); + + FlView* view = fl_view_new(project); + GdkRGBA background_color; + // Background defaults to black, override it here if necessary, e.g. #00000000 for transparent. + gdk_rgba_parse(&background_color, "#000000"); + fl_view_set_background_color(view, &background_color); + gtk_widget_show(GTK_WIDGET(view)); + gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); + + // Show the window when Flutter renders. + // Requires the view to be realized so we can start rendering. + g_signal_connect_swapped(view, "first-frame", G_CALLBACK(first_frame_cb), self); + gtk_widget_realize(GTK_WIDGET(view)); + + fl_register_plugins(FL_PLUGIN_REGISTRY(view)); + + gtk_widget_grab_focus(GTK_WIDGET(view)); +} + +// Implements GApplication::local_command_line. +static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { + MyApplication* self = MY_APPLICATION(application); + // Strip out the first argument as it is the binary name. + self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); + + g_autoptr(GError) error = nullptr; + if (!g_application_register(application, nullptr, &error)) { + g_warning("Failed to register: %s", error->message); + *exit_status = 1; + return TRUE; + } + + g_application_activate(application); + *exit_status = 0; + + return TRUE; +} + +// Implements GApplication::startup. +static void my_application_startup(GApplication* application) { + //MyApplication* self = MY_APPLICATION(object); + + // Perform any actions required at application startup. + + G_APPLICATION_CLASS(my_application_parent_class)->startup(application); +} + +// Implements GApplication::shutdown. +static void my_application_shutdown(GApplication* application) { + //MyApplication* self = MY_APPLICATION(object); + + // Perform any actions required at application shutdown. + + G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application); +} + +// Implements GObject::dispose. +static void my_application_dispose(GObject* object) { + MyApplication* self = MY_APPLICATION(object); + g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); + G_OBJECT_CLASS(my_application_parent_class)->dispose(object); +} + +static void my_application_class_init(MyApplicationClass* klass) { + G_APPLICATION_CLASS(klass)->activate = my_application_activate; + G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; + G_APPLICATION_CLASS(klass)->startup = my_application_startup; + G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown; + G_OBJECT_CLASS(klass)->dispose = my_application_dispose; +} + +static void my_application_init(MyApplication* self) {} + +MyApplication* my_application_new() { + // Set the program name to the application ID, which helps various systems + // like GTK and desktop environments map this running application to its + // corresponding .desktop file. This ensures better integration by allowing + // the application to be recognized beyond its binary name. + g_set_prgname(APPLICATION_ID); + + return MY_APPLICATION(g_object_new(my_application_get_type(), + "application-id", APPLICATION_ID, + "flags", G_APPLICATION_NON_UNIQUE, + nullptr)); +} diff --git a/linux/runner/my_application.h b/linux/runner/my_application.h new file mode 100644 index 0000000..72271d5 --- /dev/null +++ b/linux/runner/my_application.h @@ -0,0 +1,18 @@ +#ifndef FLUTTER_MY_APPLICATION_H_ +#define FLUTTER_MY_APPLICATION_H_ + +#include + +G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, + GtkApplication) + +/** + * my_application_new: + * + * Creates a new Flutter-based application. + * + * Returns: a new #MyApplication. + */ +MyApplication* my_application_new(); + +#endif // FLUTTER_MY_APPLICATION_H_ diff --git a/macos/.gitignore b/macos/.gitignore new file mode 100644 index 0000000..746adbb --- /dev/null +++ b/macos/.gitignore @@ -0,0 +1,7 @@ +# Flutter-related +**/Flutter/ephemeral/ +**/Pods/ + +# Xcode-related +**/dgph +**/xcuserdata/ diff --git a/macos/Flutter/Flutter-Debug.xcconfig b/macos/Flutter/Flutter-Debug.xcconfig new file mode 100644 index 0000000..c2efd0b --- /dev/null +++ b/macos/Flutter/Flutter-Debug.xcconfig @@ -0,0 +1 @@ +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/macos/Flutter/Flutter-Release.xcconfig b/macos/Flutter/Flutter-Release.xcconfig new file mode 100644 index 0000000..c2efd0b --- /dev/null +++ b/macos/Flutter/Flutter-Release.xcconfig @@ -0,0 +1 @@ +#include "ephemeral/Flutter-Generated.xcconfig" diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift new file mode 100644 index 0000000..90d7d0f --- /dev/null +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -0,0 +1,16 @@ +// +// Generated file. Do not edit. +// + +import FlutterMacOS +import Foundation + +import file_selector_macos +import geolocator_apple +import shared_preferences_foundation + +func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin")) + GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin")) + SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) +} diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..57ac651 --- /dev/null +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,705 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXAggregateTarget section */ + 33CC111A2044C6BA0003C045 /* Flutter Assemble */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */; + buildPhases = ( + 33CC111E2044C6BF0003C045 /* ShellScript */, + ); + dependencies = ( + ); + name = "Flutter Assemble"; + productName = FLX; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C80D7294CF71000263BE5 /* RunnerTests.swift */; }; + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; }; + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; }; + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC10EC2044A3C60003C045; + remoteInfo = Runner; + }; + 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33CC10E52044A3C60003C045 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 33CC111A2044C6BA0003C045; + remoteInfo = FLX; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 33CC110E2044A8840003C045 /* Bundle Framework */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Bundle Framework"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; + 33CC10ED2044A3C60003C045 /* figma_events.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "figma_events.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; + 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; + 33CC10F72044A3C60003C045 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = Runner/Info.plist; sourceTree = ""; }; + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainFlutterWindow.swift; sourceTree = ""; }; + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Debug.xcconfig"; sourceTree = ""; }; + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Flutter-Release.xcconfig"; sourceTree = ""; }; + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = "Flutter-Generated.xcconfig"; path = "ephemeral/Flutter-Generated.xcconfig"; sourceTree = ""; }; + 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; + 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; + 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 331C80D2294CF70F00263BE5 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10EA2044A3C60003C045 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C80D6294CF71000263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C80D7294CF71000263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 33BA886A226E78AF003329D5 /* Configs */ = { + isa = PBXGroup; + children = ( + 33E5194F232828860026EE4D /* AppInfo.xcconfig */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 333000ED22D3DE5D00554162 /* Warnings.xcconfig */, + ); + path = Configs; + sourceTree = ""; + }; + 33CC10E42044A3C60003C045 = { + isa = PBXGroup; + children = ( + 33FAB671232836740065AC1E /* Runner */, + 33CEB47122A05771004F2AC0 /* Flutter */, + 331C80D6294CF71000263BE5 /* RunnerTests */, + 33CC10EE2044A3C60003C045 /* Products */, + D73912EC22F37F3D000D13A0 /* Frameworks */, + ); + sourceTree = ""; + }; + 33CC10EE2044A3C60003C045 /* Products */ = { + isa = PBXGroup; + children = ( + 33CC10ED2044A3C60003C045 /* figma_events.app */, + 331C80D5294CF71000263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 33CC11242044D66E0003C045 /* Resources */ = { + isa = PBXGroup; + children = ( + 33CC10F22044A3C60003C045 /* Assets.xcassets */, + 33CC10F42044A3C60003C045 /* MainMenu.xib */, + 33CC10F72044A3C60003C045 /* Info.plist */, + ); + name = Resources; + path = ..; + sourceTree = ""; + }; + 33CEB47122A05771004F2AC0 /* Flutter */ = { + isa = PBXGroup; + children = ( + 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */, + 33CEB47222A05771004F2AC0 /* Flutter-Debug.xcconfig */, + 33CEB47422A05771004F2AC0 /* Flutter-Release.xcconfig */, + 33CEB47722A0578A004F2AC0 /* Flutter-Generated.xcconfig */, + ); + path = Flutter; + sourceTree = ""; + }; + 33FAB671232836740065AC1E /* Runner */ = { + isa = PBXGroup; + children = ( + 33CC10F02044A3C60003C045 /* AppDelegate.swift */, + 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, + 33E51913231747F40026EE4D /* DebugProfile.entitlements */, + 33E51914231749380026EE4D /* Release.entitlements */, + 33CC11242044D66E0003C045 /* Resources */, + 33BA886A226E78AF003329D5 /* Configs */, + ); + path = Runner; + sourceTree = ""; + }; + D73912EC22F37F3D000D13A0 /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C80D4294CF70F00263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 331C80D1294CF70F00263BE5 /* Sources */, + 331C80D2294CF70F00263BE5 /* Frameworks */, + 331C80D3294CF70F00263BE5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 331C80DA294CF71000263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C80D5294CF71000263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 33CC10EC2044A3C60003C045 /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 33CC10E92044A3C60003C045 /* Sources */, + 33CC10EA2044A3C60003C045 /* Frameworks */, + 33CC10EB2044A3C60003C045 /* Resources */, + 33CC110E2044A8840003C045 /* Bundle Framework */, + 3399D490228B24CF009A79C7 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + 33CC11202044C79F0003C045 /* PBXTargetDependency */, + ); + name = Runner; + productName = Runner; + productReference = 33CC10ED2044A3C60003C045 /* figma_events.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 33CC10E52044A3C60003C045 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = YES; + LastSwiftUpdateCheck = 0920; + LastUpgradeCheck = 1510; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C80D4294CF70F00263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 33CC10EC2044A3C60003C045; + }; + 33CC10EC2044A3C60003C045 = { + CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 1100; + ProvisioningStyle = Automatic; + SystemCapabilities = { + com.apple.Sandbox = { + enabled = 1; + }; + }; + }; + 33CC111A2044C6BA0003C045 = { + CreatedOnToolsVersion = 9.2; + ProvisioningStyle = Manual; + }; + }; + }; + buildConfigurationList = 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 33CC10E42044A3C60003C045; + productRefGroup = 33CC10EE2044A3C60003C045 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 33CC10EC2044A3C60003C045 /* Runner */, + 331C80D4294CF70F00263BE5 /* RunnerTests */, + 33CC111A2044C6BA0003C045 /* Flutter Assemble */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C80D3294CF70F00263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10EB2044A3C60003C045 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */, + 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3399D490228B24CF009A79C7 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n"; + }; + 33CC111E2044C6BF0003C045 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + Flutter/ephemeral/FlutterInputs.xcfilelist, + ); + inputPaths = ( + Flutter/ephemeral/tripwire, + ); + outputFileListPaths = ( + Flutter/ephemeral/FlutterOutputs.xcfilelist, + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C80D1294CF70F00263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C80D8294CF71000263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 33CC10E92044A3C60003C045 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, + 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, + 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C80DA294CF71000263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC10EC2044A3C60003C045 /* Runner */; + targetProxy = 331C80D9294CF71000263BE5 /* PBXContainerItemProxy */; + }; + 33CC11202044C79F0003C045 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 33CC111A2044C6BA0003C045 /* Flutter Assemble */; + targetProxy = 33CC111F2044C79F0003C045 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 33CC10F42044A3C60003C045 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 33CC10F52044A3C60003C045 /* Base */, + ); + name = MainMenu.xib; + path = Runner; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 331C80DB294CF71000263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.figmaEvents.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/figma_events.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/figma_events"; + }; + name = Debug; + }; + 331C80DC294CF71000263BE5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.figmaEvents.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/figma_events.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/figma_events"; + }; + name = Release; + }; + 331C80DD294CF71000263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = com.example.figmaEvents.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/figma_events.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/figma_events"; + }; + name = Profile; + }; + 338D0CE9231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + 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_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + 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_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.15; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Profile; + }; + 338D0CEA231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Profile; + }; + 338D0CEB231458BD00FA5F75 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Profile; + }; + 33CC10F92044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + 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_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + 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_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + 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_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.15; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 33CC10FA2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + 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_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + 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_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CODE_SIGN_IDENTITY = "-"; + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.15; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + 33CC10FC2044A3C60003C045 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 33CC10FD2044A3C60003C045 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + PROVISIONING_PROFILE_SPECIFIER = ""; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 33CC111C2044C6BA0003C045 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Manual; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 33CC111D2044C6BA0003C045 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C80DB294CF71000263BE5 /* Debug */, + 331C80DC294CF71000263BE5 /* Release */, + 331C80DD294CF71000263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10E82044A3C60003C045 /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10F92044A3C60003C045 /* Debug */, + 33CC10FA2044A3C60003C045 /* Release */, + 338D0CE9231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC10FC2044A3C60003C045 /* Debug */, + 33CC10FD2044A3C60003C045 /* Release */, + 338D0CEA231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 33CC111B2044C6BA0003C045 /* Build configuration list for PBXAggregateTarget "Flutter Assemble" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 33CC111C2044C6BA0003C045 /* Debug */, + 33CC111D2044C6BA0003C045 /* Release */, + 338D0CEB231458BD00FA5F75 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 33CC10E52044A3C60003C045 /* Project object */; +} diff --git a/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000..6a06496 --- /dev/null +++ b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,99 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/macos/Runner.xcworkspace/contents.xcworkspacedata b/macos/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..1d526a1 --- /dev/null +++ b/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/macos/Runner/AppDelegate.swift b/macos/Runner/AppDelegate.swift new file mode 100644 index 0000000..b3c1761 --- /dev/null +++ b/macos/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import Cocoa +import FlutterMacOS + +@main +class AppDelegate: FlutterAppDelegate { + override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { + return true + } + + override func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { + return true + } +} diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..a2ec33f --- /dev/null +++ b/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_16.png", + "scale" : "1x" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "2x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_32.png", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "app_icon_64.png", + "scale" : "2x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_128.png", + "scale" : "1x" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "2x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_256.png", + "scale" : "1x" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "2x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_512.png", + "scale" : "1x" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "app_icon_1024.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png new file mode 100644 index 0000000..82b6f9d Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png new file mode 100644 index 0000000..13b35eb Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png new file mode 100644 index 0000000..0a3f5fa Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png new file mode 100644 index 0000000..bdb5722 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png new file mode 100644 index 0000000..f083318 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png new file mode 100644 index 0000000..326c0e7 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png new file mode 100644 index 0000000..2f1632c Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png differ diff --git a/macos/Runner/Base.lproj/MainMenu.xib b/macos/Runner/Base.lproj/MainMenu.xib new file mode 100644 index 0000000..80e867a --- /dev/null +++ b/macos/Runner/Base.lproj/MainMenu.xib @@ -0,0 +1,343 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/macos/Runner/Configs/AppInfo.xcconfig b/macos/Runner/Configs/AppInfo.xcconfig new file mode 100644 index 0000000..0eb84b9 --- /dev/null +++ b/macos/Runner/Configs/AppInfo.xcconfig @@ -0,0 +1,14 @@ +// Application-level settings for the Runner target. +// +// This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the +// future. If not, the values below would default to using the project name when this becomes a +// 'flutter create' template. + +// The application's name. By default this is also the title of the Flutter window. +PRODUCT_NAME = figma_events + +// The application's bundle identifier +PRODUCT_BUNDLE_IDENTIFIER = com.example.figmaEvents + +// The copyright displayed in application information +PRODUCT_COPYRIGHT = Copyright © 2025 com.example. All rights reserved. diff --git a/macos/Runner/Configs/Debug.xcconfig b/macos/Runner/Configs/Debug.xcconfig new file mode 100644 index 0000000..36b0fd9 --- /dev/null +++ b/macos/Runner/Configs/Debug.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Debug.xcconfig" +#include "Warnings.xcconfig" diff --git a/macos/Runner/Configs/Release.xcconfig b/macos/Runner/Configs/Release.xcconfig new file mode 100644 index 0000000..dff4f49 --- /dev/null +++ b/macos/Runner/Configs/Release.xcconfig @@ -0,0 +1,2 @@ +#include "../../Flutter/Flutter-Release.xcconfig" +#include "Warnings.xcconfig" diff --git a/macos/Runner/Configs/Warnings.xcconfig b/macos/Runner/Configs/Warnings.xcconfig new file mode 100644 index 0000000..42bcbf4 --- /dev/null +++ b/macos/Runner/Configs/Warnings.xcconfig @@ -0,0 +1,13 @@ +WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings +GCC_WARN_UNDECLARED_SELECTOR = YES +CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES +CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE +CLANG_WARN__DUPLICATE_METHOD_MATCH = YES +CLANG_WARN_PRAGMA_PACK = YES +CLANG_WARN_STRICT_PROTOTYPES = YES +CLANG_WARN_COMMA = YES +GCC_WARN_STRICT_SELECTOR_MATCH = YES +CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES +CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES +GCC_WARN_SHADOW = YES +CLANG_WARN_UNREACHABLE_CODE = YES diff --git a/macos/Runner/DebugProfile.entitlements b/macos/Runner/DebugProfile.entitlements new file mode 100644 index 0000000..dddb8a3 --- /dev/null +++ b/macos/Runner/DebugProfile.entitlements @@ -0,0 +1,12 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.cs.allow-jit + + com.apple.security.network.server + + + diff --git a/macos/Runner/Info.plist b/macos/Runner/Info.plist new file mode 100644 index 0000000..4789daa --- /dev/null +++ b/macos/Runner/Info.plist @@ -0,0 +1,32 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + $(PRODUCT_COPYRIGHT) + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/macos/Runner/MainFlutterWindow.swift b/macos/Runner/MainFlutterWindow.swift new file mode 100644 index 0000000..3cc05eb --- /dev/null +++ b/macos/Runner/MainFlutterWindow.swift @@ -0,0 +1,15 @@ +import Cocoa +import FlutterMacOS + +class MainFlutterWindow: NSWindow { + override func awakeFromNib() { + let flutterViewController = FlutterViewController() + let windowFrame = self.frame + self.contentViewController = flutterViewController + self.setFrame(windowFrame, display: true) + + RegisterGeneratedPlugins(registry: flutterViewController) + + super.awakeFromNib() + } +} diff --git a/macos/Runner/Release.entitlements b/macos/Runner/Release.entitlements new file mode 100644 index 0000000..852fa1a --- /dev/null +++ b/macos/Runner/Release.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.security.app-sandbox + + + diff --git a/macos/RunnerTests/RunnerTests.swift b/macos/RunnerTests/RunnerTests.swift new file mode 100644 index 0000000..61f3bd1 --- /dev/null +++ b/macos/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import Cocoa +import FlutterMacOS +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/pubspec.lock b/pubspec.lock new file mode 100644 index 0000000..27e303b --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,730 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + ansicolor: + dependency: transitive + description: + name: ansicolor + sha256: "50e982d500bc863e1d703448afdbf9e5a72eb48840a4f766fa361ffd6877055f" + url: "https://pub.dev" + source: hosted + version: "2.0.3" + archive: + dependency: transitive + description: + name: archive + sha256: "2fde1607386ab523f7a36bb3e7edb43bd58e6edaf2ffb29d8a6d578b297fdbbd" + url: "https://pub.dev" + source: hosted + version: "4.0.7" + 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: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" + url: "https://pub.dev" + source: hosted + version: "2.13.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + characters: + dependency: transitive + description: + name: characters + sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: "959525d3162f249993882720d52b7e0c833978df229be20702b33d48d91de70f" + url: "https://pub.dev" + source: hosted + version: "2.0.4" + 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" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + cross_file: + dependency: transitive + description: + name: cross_file + sha256: "7caf6a750a0c04effbb52a676dce9a4a592e10ad35c34d6d2d0e4811160d5670" + url: "https://pub.dev" + source: hosted + version: "0.3.4+2" + crypto: + dependency: transitive + description: + name: crypto + sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" + url: "https://pub.dev" + source: hosted + version: "3.0.6" + csslib: + dependency: transitive + description: + name: csslib + sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e" + url: "https://pub.dev" + source: hosted + version: "1.0.2" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" + source: hosted + version: "1.0.8" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + ffi: + dependency: transitive + description: + name: ffi + sha256: "289279317b4b16eb2bb7e271abccd4bf84ec9bdcbe999e278a94b804f5630418" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + file_selector_linux: + dependency: transitive + description: + name: file_selector_linux + sha256: "54cbbd957e1156d29548c7d9b9ec0c0ebb6de0a90452198683a7d23aed617a33" + url: "https://pub.dev" + source: hosted + version: "0.9.3+2" + file_selector_macos: + dependency: transitive + description: + name: file_selector_macos + sha256: "19124ff4a3d8864fdc62072b6a2ef6c222d55a3404fe14893a3c02744907b60c" + url: "https://pub.dev" + source: hosted + version: "0.9.4+4" + file_selector_platform_interface: + dependency: transitive + description: + name: file_selector_platform_interface + sha256: a3994c26f10378a039faa11de174d7b78eb8f79e4dd0af2a451410c1a5c3f66b + url: "https://pub.dev" + source: hosted + version: "2.6.2" + file_selector_windows: + dependency: transitive + description: + name: file_selector_windows + sha256: "320fcfb6f33caa90f0b58380489fc5ac05d99ee94b61aa96ec2bff0ba81d3c2b" + url: "https://pub.dev" + source: hosted + version: "0.9.3+4" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_launcher_icons: + dependency: "direct dev" + description: + name: flutter_launcher_icons + sha256: "526faf84284b86a4cb36d20a5e45147747b7563d921373d4ee0559c54fcdbcea" + url: "https://pub.dev" + source: hosted + version: "0.13.1" + flutter_native_splash: + dependency: "direct dev" + description: + name: flutter_native_splash + sha256: "4fb9f4113350d3a80841ce05ebf1976a36de622af7d19aca0ca9a9911c7ff002" + url: "https://pub.dev" + source: hosted + version: "2.4.7" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + sha256: b0694b7fb1689b0e6cc193b3f1fcac6423c4f93c74fb20b806c6b6f196db0c31 + url: "https://pub.dev" + source: hosted + version: "2.0.30" + 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" + geocoding: + dependency: "direct main" + description: + name: geocoding + sha256: "790eea732b22a08dd36fc3761bcd29040461ac20ece4d165264a6c0b5338f115" + url: "https://pub.dev" + source: hosted + version: "2.2.2" + geocoding_android: + dependency: transitive + description: + name: geocoding_android + sha256: "1b13eca79b11c497c434678fed109c2be020b158cec7512c848c102bc7232603" + url: "https://pub.dev" + source: hosted + version: "3.3.1" + geocoding_ios: + dependency: transitive + description: + name: geocoding_ios + sha256: "8a39bfb650af55209c42e564036a550b32d029e0733af01dc66c5afea50388d3" + url: "https://pub.dev" + source: hosted + version: "2.3.0" + geocoding_platform_interface: + dependency: transitive + description: + name: geocoding_platform_interface + sha256: "8c2c8226e5c276594c2e18bfe88b19110ed770aeb7c1ab50ede570be8b92229b" + url: "https://pub.dev" + source: hosted + version: "3.2.0" + geolocator: + dependency: "direct main" + description: + name: geolocator + sha256: "5c23f3613f50586c0bbb2b8f970240ae66b3bd992088cf60dd5ee2e6f7dde3a8" + url: "https://pub.dev" + source: hosted + version: "9.0.2" + geolocator_android: + dependency: transitive + description: + name: geolocator_android + sha256: fcb1760a50d7500deca37c9a666785c047139b5f9ee15aa5469fae7dbbe3170d + url: "https://pub.dev" + source: hosted + version: "4.6.2" + geolocator_apple: + dependency: transitive + description: + name: geolocator_apple + sha256: dbdd8789d5aaf14cf69f74d4925ad1336b4433a6efdf2fce91e8955dc921bf22 + url: "https://pub.dev" + source: hosted + version: "2.3.13" + geolocator_platform_interface: + dependency: transitive + description: + name: geolocator_platform_interface + sha256: "30cb64f0b9adcc0fb36f628b4ebf4f731a2961a0ebd849f4b56200205056fe67" + url: "https://pub.dev" + source: hosted + version: "4.2.6" + geolocator_web: + dependency: transitive + description: + name: geolocator_web + sha256: "102e7da05b48ca6bf0a5bda0010f886b171d1a08059f01bfe02addd0175ebece" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + geolocator_windows: + dependency: transitive + description: + name: geolocator_windows + sha256: "4f4218f122a6978d0ad655fa3541eea74c67417440b09f0657238810d5af6bdc" + url: "https://pub.dev" + source: hosted + version: "0.1.3" + html: + dependency: transitive + description: + name: html + sha256: "6d1264f2dffa1b1101c25a91dff0dc2daee4c18e87cd8538729773c073dbf602" + url: "https://pub.dev" + source: hosted + version: "0.15.6" + http: + dependency: transitive + description: + name: http + sha256: bb2ce4590bc2667c96f318d68cac1b5a7987ec819351d32b1c987239a815e007 + url: "https://pub.dev" + source: hosted + version: "1.5.0" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + image: + dependency: transitive + description: + name: image + sha256: "4e973fcf4caae1a4be2fa0a13157aa38a8f9cb049db6529aa00b4d71abc4d928" + url: "https://pub.dev" + source: hosted + version: "4.5.4" + image_picker: + dependency: "direct main" + description: + name: image_picker + sha256: b6951e25b795d053a6ba03af5f710069c99349de9341af95155d52665cb4607c + url: "https://pub.dev" + source: hosted + version: "0.8.9" + image_picker_android: + dependency: transitive + description: + name: image_picker_android + sha256: "8dfe08ea7fcf7467dbaf6889e72eebd5e0d6711caae201fdac780eb45232cd02" + url: "https://pub.dev" + source: hosted + version: "0.8.13+3" + image_picker_for_web: + dependency: transitive + description: + name: image_picker_for_web + sha256: "869fe8a64771b7afbc99fc433a5f7be2fea4d1cb3d7c11a48b6b579eb9c797f0" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + image_picker_ios: + dependency: transitive + description: + name: image_picker_ios + sha256: eb06fe30bab4c4497bad449b66448f50edcc695f1c59408e78aa3a8059eb8f0e + url: "https://pub.dev" + source: hosted + version: "0.8.13" + image_picker_linux: + dependency: transitive + description: + name: image_picker_linux + sha256: "1f81c5f2046b9ab724f85523e4af65be1d47b038160a8c8deed909762c308ed4" + url: "https://pub.dev" + source: hosted + version: "0.2.2" + image_picker_macos: + dependency: transitive + description: + name: image_picker_macos + sha256: d58cd9d67793d52beefd6585b12050af0a7663c0c2a6ece0fb110a35d6955e04 + url: "https://pub.dev" + source: hosted + version: "0.2.2" + image_picker_platform_interface: + dependency: transitive + description: + name: image_picker_platform_interface + sha256: "9f143b0dba3e459553209e20cc425c9801af48e6dfa4f01a0fcf927be3f41665" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + image_picker_windows: + dependency: transitive + description: + name: image_picker_windows + sha256: d248c86554a72b5495a31c56f060cf73a41c7ff541689327b1a7dbccc33adfae + url: "https://pub.dev" + source: hosted + version: "0.2.2" + intl: + dependency: transitive + description: + name: intl + sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5" + url: "https://pub.dev" + source: hosted + version: "0.20.2" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + url: "https://pub.dev" + source: hosted + version: "4.9.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + url: "https://pub.dev" + source: hosted + version: "11.0.2" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + url: "https://pub.dev" + source: hosted + version: "3.0.10" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + 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: "801fd0b26f14a4a58ccb09d5892c3fbdeff209594300a542492cf13fba9d247a" + url: "https://pub.dev" + source: hosted + version: "1.0.6" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + 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: "1a97266a94f7350d30ae522c0af07890c70b8e62c71e8e3920d1db4d23c057d1" + url: "https://pub.dev" + source: hosted + version: "7.0.1" + 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" + posix: + dependency: transitive + description: + name: posix + sha256: "6323a5b0fa688b6a010df4905a56b00181479e6d10534cecfecede2aa55add61" + url: "https://pub.dev" + source: hosted + version: "6.0.3" + shared_preferences: + dependency: "direct main" + description: + name: shared_preferences + sha256: "6e8bf70b7fef813df4e9a36f658ac46d107db4b4cfe1048b477d4e453a8159f5" + url: "https://pub.dev" + source: hosted + version: "2.5.3" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + sha256: "0b0f98d535319cb5cdd4f65783c2a54ee6d417a2f093dbb18be3e36e4c3d181f" + url: "https://pub.dev" + source: hosted + version: "2.4.14" + shared_preferences_foundation: + dependency: transitive + description: + name: shared_preferences_foundation + sha256: "6a52cfcdaeac77cad8c97b539ff688ccfc458c007b4db12be584fbe5c0e49e03" + url: "https://pub.dev" + source: hosted + version: "2.5.4" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + sha256: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019 + url: "https://pub.dev" + source: hosted + version: "2.4.3" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + simple_gesture_detector: + dependency: transitive + description: + name: simple_gesture_detector + sha256: ba2cd5af24ff20a0b8d609cec3f40e5b0744d2a71804a2616ae086b9c19d19a3 + url: "https://pub.dev" + source: hosted + version: "0.2.1" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" + url: "https://pub.dev" + source: hosted + version: "1.10.1" + 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" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + table_calendar: + dependency: "direct main" + description: + name: table_calendar + sha256: "0c0c6219878b363a2d5f40c7afb159d845f253d061dc3c822aa0d5fe0f721982" + url: "https://pub.dev" + source: hosted + version: "3.2.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test_api: + dependency: transitive + description: + name: test_api + sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00" + url: "https://pub.dev" + source: hosted + version: "0.7.6" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + universal_io: + dependency: transitive + description: + name: universal_io + sha256: f63cbc48103236abf48e345e07a03ce5757ea86285ed313a6a032596ed9301e2 + url: "https://pub.dev" + source: hosted + version: "2.3.1" + uuid: + dependency: transitive + description: + name: uuid + sha256: a11b666489b1954e01d992f3d601b1804a33937b5a8fe677bd26b8a9f96f96e8 + url: "https://pub.dev" + source: hosted + version: "4.5.2" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b + url: "https://pub.dev" + source: hosted + version: "2.2.0" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60" + url: "https://pub.dev" + source: hosted + version: "15.0.2" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + 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: "971043b3a0d3da28727e40ed3e0b5d18b742fa5a68665cca88e74b7876d5e025" + url: "https://pub.dev" + source: hosted + version: "6.6.1" + yaml: + dependency: transitive + description: + name: yaml + sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce + url: "https://pub.dev" + source: hosted + version: "3.1.3" +sdks: + dart: ">=3.9.0 <4.0.0" + flutter: ">=3.35.0" diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 0000000..a4b52f8 --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,45 @@ +name: figma +description: A Flutter event app +publish_to: 'none' +version: 1.0.0+1 + +environment: + sdk: ">=2.17.0 <3.0.0" + +dependencies: + flutter: + sdk: flutter + cupertino_icons: ^1.0.2 + shared_preferences: ^2.0.15 + image_picker: ^0.8.4+3 + table_calendar: ^3.2.0 + geolocator: ^9.0.2 + geocoding: ^2.0.5 + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_launcher_icons: ^0.13.1 + flutter_native_splash: ^2.4.1 + +flutter: + uses-material-design: true + assets: + - assets/images/ + + + +flutter_launcher_icons: + android: true + ios: true + image_path: "assets/icon/app_icon.png" + adaptive_icon_background: "#FFFFFF" + min_sdk_android: 21 + +flutter_native_splash: + color: "#FFFFFF" + image: assets/images/splash_icon.png + + android_12: + color: "#FFFFFF" + image: assets/images/splash_icon.png diff --git a/test/widget_test.dart b/test/widget_test.dart new file mode 100644 index 0000000..91cf34f --- /dev/null +++ b/test/widget_test.dart @@ -0,0 +1,30 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility in the flutter_test package. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:figma/main.dart'; + +void main() { + testWidgets('Counter increments smoke test', (WidgetTester tester) async { + // Build our app and trigger a frame. + await tester.pumpWidget(const MyApp()); + + // Verify that our counter starts at 0. + expect(find.text('0'), findsOneWidget); + expect(find.text('1'), findsNothing); + + // Tap the '+' icon and trigger a frame. + await tester.tap(find.byIcon(Icons.add)); + await tester.pump(); + + // Verify that our counter has incremented. + expect(find.text('0'), findsNothing); + expect(find.text('1'), 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..434c1f0 --- /dev/null +++ b/web/index.html @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + figma_events + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/web/manifest.json b/web/manifest.json new file mode 100644 index 0000000..7c7e84b --- /dev/null +++ b/web/manifest.json @@ -0,0 +1,35 @@ +{ + "name": "figma_events", + "short_name": "figma_events", + "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" + } + ] +} diff --git a/web/splash/img/dark-1x.png b/web/splash/img/dark-1x.png new file mode 100644 index 0000000..7952084 Binary files /dev/null and b/web/splash/img/dark-1x.png differ diff --git a/web/splash/img/dark-2x.png b/web/splash/img/dark-2x.png new file mode 100644 index 0000000..29fc508 Binary files /dev/null and b/web/splash/img/dark-2x.png differ diff --git a/web/splash/img/dark-3x.png b/web/splash/img/dark-3x.png new file mode 100644 index 0000000..8a08b00 Binary files /dev/null and b/web/splash/img/dark-3x.png differ diff --git a/web/splash/img/dark-4x.png b/web/splash/img/dark-4x.png new file mode 100644 index 0000000..3289821 Binary files /dev/null and b/web/splash/img/dark-4x.png differ diff --git a/web/splash/img/light-1x.png b/web/splash/img/light-1x.png new file mode 100644 index 0000000..7952084 Binary files /dev/null and b/web/splash/img/light-1x.png differ diff --git a/web/splash/img/light-2x.png b/web/splash/img/light-2x.png new file mode 100644 index 0000000..29fc508 Binary files /dev/null and b/web/splash/img/light-2x.png differ diff --git a/web/splash/img/light-3x.png b/web/splash/img/light-3x.png new file mode 100644 index 0000000..8a08b00 Binary files /dev/null and b/web/splash/img/light-3x.png differ diff --git a/web/splash/img/light-4x.png b/web/splash/img/light-4x.png new file mode 100644 index 0000000..3289821 Binary files /dev/null and b/web/splash/img/light-4x.png differ diff --git a/windows/.gitignore b/windows/.gitignore new file mode 100644 index 0000000..d492d0d --- /dev/null +++ b/windows/.gitignore @@ -0,0 +1,17 @@ +flutter/ephemeral/ + +# Visual Studio user-specific files. +*.suo +*.user +*.userosscache +*.sln.docstates + +# Visual Studio build-related files. +x64/ +x86/ + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt new file mode 100644 index 0000000..9bef744 --- /dev/null +++ b/windows/CMakeLists.txt @@ -0,0 +1,108 @@ +# Project-level configuration. +cmake_minimum_required(VERSION 3.14) +project(figma_events LANGUAGES CXX) + +# The name of the executable created for the application. Change this to change +# the on-disk name of your application. +set(BINARY_NAME "figma_events") + +# Explicitly opt in to modern CMake behaviors to avoid warnings with recent +# versions of CMake. +cmake_policy(VERSION 3.14...3.25) + +# Define build configuration option. +get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +if(IS_MULTICONFIG) + set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" + CACHE STRING "" FORCE) +else() + if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Debug" CACHE + STRING "Flutter build mode" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Profile" "Release") + endif() +endif() +# Define settings for the Profile build mode. +set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") +set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") +set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") +set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") + +# Use Unicode for all projects. +add_definitions(-DUNICODE -D_UNICODE) + +# Compilation settings that should be applied to most targets. +# +# Be cautious about adding new options here, as plugins use this function by +# default. In most cases, you should add new options to specific targets instead +# of modifying this function. +function(APPLY_STANDARD_SETTINGS TARGET) + target_compile_features(${TARGET} PUBLIC cxx_std_17) + target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") + target_compile_options(${TARGET} PRIVATE /EHsc) + target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") + target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") +endfunction() + +# Flutter library and tool build rules. +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") +add_subdirectory(${FLUTTER_MANAGED_DIR}) + +# Application build; see runner/CMakeLists.txt. +add_subdirectory("runner") + + +# Generated plugin build rules, which manage building the plugins and adding +# them to the application. +include(flutter/generated_plugins.cmake) + + +# === Installation === +# Support files are copied into place next to the executable, so that it can +# run in place. This is done instead of making a separate bundle (as on Linux) +# so that building and running from within Visual Studio will work. +set(BUILD_BUNDLE_DIR "$") +# Make the "install" step default, as it's required to run. +set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) +endif() + +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +if(PLUGIN_BUNDLED_LIBRARIES) + install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() + +# Copy the native assets provided by the build.dart from all packages. +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") +install(DIRECTORY "${NATIVE_ASSETS_DIR}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +# Fully re-copy the assets directory on each build to avoid having stale files +# from a previous install. +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") +install(CODE " + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") + " COMPONENT Runtime) +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) + +# Install the AOT library on non-Debug builds only. +install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + CONFIGURATIONS Profile;Release + COMPONENT Runtime) diff --git a/windows/flutter/CMakeLists.txt b/windows/flutter/CMakeLists.txt new file mode 100644 index 0000000..903f489 --- /dev/null +++ b/windows/flutter/CMakeLists.txt @@ -0,0 +1,109 @@ +# This file controls Flutter-level build steps. It should not be edited. +cmake_minimum_required(VERSION 3.14) + +set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") + +# Configuration provided via flutter tool. +include(${EPHEMERAL_DIR}/generated_config.cmake) + +# TODO: Move the rest of this into files in ephemeral. See +# https://github.com/flutter/flutter/issues/57146. +set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") + +# Set fallback configurations for older versions of the flutter tool. +if (NOT DEFINED FLUTTER_TARGET_PLATFORM) + set(FLUTTER_TARGET_PLATFORM "windows-x64") +endif() + +# === Flutter Library === +set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") + +# Published to parent scope for install step. +set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) +set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) +set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) +set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) + +list(APPEND FLUTTER_LIBRARY_HEADERS + "flutter_export.h" + "flutter_windows.h" + "flutter_messenger.h" + "flutter_plugin_registrar.h" + "flutter_texture_registrar.h" +) +list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") +add_library(flutter INTERFACE) +target_include_directories(flutter INTERFACE + "${EPHEMERAL_DIR}" +) +target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") +add_dependencies(flutter flutter_assemble) + +# === Wrapper === +list(APPEND CPP_WRAPPER_SOURCES_CORE + "core_implementations.cc" + "standard_codec.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") +list(APPEND CPP_WRAPPER_SOURCES_PLUGIN + "plugin_registrar.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") +list(APPEND CPP_WRAPPER_SOURCES_APP + "flutter_engine.cc" + "flutter_view_controller.cc" +) +list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") + +# Wrapper sources needed for a plugin. +add_library(flutter_wrapper_plugin STATIC + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_PLUGIN} +) +apply_standard_settings(flutter_wrapper_plugin) +set_target_properties(flutter_wrapper_plugin PROPERTIES + POSITION_INDEPENDENT_CODE ON) +set_target_properties(flutter_wrapper_plugin PROPERTIES + CXX_VISIBILITY_PRESET hidden) +target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) +target_include_directories(flutter_wrapper_plugin PUBLIC + "${WRAPPER_ROOT}/include" +) +add_dependencies(flutter_wrapper_plugin flutter_assemble) + +# Wrapper sources needed for the runner. +add_library(flutter_wrapper_app STATIC + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_APP} +) +apply_standard_settings(flutter_wrapper_app) +target_link_libraries(flutter_wrapper_app PUBLIC flutter) +target_include_directories(flutter_wrapper_app PUBLIC + "${WRAPPER_ROOT}/include" +) +add_dependencies(flutter_wrapper_app flutter_assemble) + +# === Flutter tool backend === +# _phony_ is a non-existent file to force this command to run every time, +# since currently there's no way to get a full input/output list from the +# flutter tool. +set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") +set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) +add_custom_command( + OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} + ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} + ${CPP_WRAPPER_SOURCES_APP} + ${PHONY_OUTPUT} + COMMAND ${CMAKE_COMMAND} -E env + ${FLUTTER_TOOL_ENVIRONMENT} + "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" + ${FLUTTER_TARGET_PLATFORM} $ + VERBATIM +) +add_custom_target(flutter_assemble DEPENDS + "${FLUTTER_LIBRARY}" + ${FLUTTER_LIBRARY_HEADERS} + ${CPP_WRAPPER_SOURCES_CORE} + ${CPP_WRAPPER_SOURCES_PLUGIN} + ${CPP_WRAPPER_SOURCES_APP} +) diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc new file mode 100644 index 0000000..f35b3a6 --- /dev/null +++ b/windows/flutter/generated_plugin_registrant.cc @@ -0,0 +1,17 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#include "generated_plugin_registrant.h" + +#include +#include + +void RegisterPlugins(flutter::PluginRegistry* registry) { + FileSelectorWindowsRegisterWithRegistrar( + registry->GetRegistrarForPlugin("FileSelectorWindows")); + GeolocatorWindowsRegisterWithRegistrar( + registry->GetRegistrarForPlugin("GeolocatorWindows")); +} diff --git a/windows/flutter/generated_plugin_registrant.h b/windows/flutter/generated_plugin_registrant.h new file mode 100644 index 0000000..dc139d8 --- /dev/null +++ b/windows/flutter/generated_plugin_registrant.h @@ -0,0 +1,15 @@ +// +// Generated file. Do not edit. +// + +// clang-format off + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void RegisterPlugins(flutter::PluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake new file mode 100644 index 0000000..389222b --- /dev/null +++ b/windows/flutter/generated_plugins.cmake @@ -0,0 +1,25 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST + file_selector_windows + geolocator_windows +) + +list(APPEND FLUTTER_FFI_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) + +foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) +endforeach(ffi_plugin) diff --git a/windows/runner/CMakeLists.txt b/windows/runner/CMakeLists.txt new file mode 100644 index 0000000..394917c --- /dev/null +++ b/windows/runner/CMakeLists.txt @@ -0,0 +1,40 @@ +cmake_minimum_required(VERSION 3.14) +project(runner LANGUAGES CXX) + +# Define the application target. To change its name, change BINARY_NAME in the +# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer +# work. +# +# Any new source files that you add to the application should be added here. +add_executable(${BINARY_NAME} WIN32 + "flutter_window.cpp" + "main.cpp" + "utils.cpp" + "win32_window.cpp" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" + "Runner.rc" + "runner.exe.manifest" +) + +# Apply the standard set of build settings. This can be removed for applications +# that need different build settings. +apply_standard_settings(${BINARY_NAME}) + +# Add preprocessor definitions for the build version. +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") +target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") + +# Disable Windows macros that collide with C++ standard library functions. +target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") + +# Add dependency libraries and include directories. Add any application-specific +# dependencies here. +target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) +target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") +target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") + +# Run the Flutter tool portions of the build. This must not be removed. +add_dependencies(${BINARY_NAME} flutter_assemble) diff --git a/windows/runner/Runner.rc b/windows/runner/Runner.rc new file mode 100644 index 0000000..ffa1834 --- /dev/null +++ b/windows/runner/Runner.rc @@ -0,0 +1,121 @@ +// Microsoft Visual C++ generated resource script. +// +#pragma code_page(65001) +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_APP_ICON ICON "resources\\app_icon.ico" + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) +#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD +#else +#define VERSION_AS_NUMBER 1,0,0,0 +#endif + +#if defined(FLUTTER_VERSION) +#define VERSION_AS_STRING FLUTTER_VERSION +#else +#define VERSION_AS_STRING "1.0.0" +#endif + +VS_VERSION_INFO VERSIONINFO + FILEVERSION VERSION_AS_NUMBER + PRODUCTVERSION VERSION_AS_NUMBER + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK +#ifdef _DEBUG + FILEFLAGS VS_FF_DEBUG +#else + FILEFLAGS 0x0L +#endif + FILEOS VOS__WINDOWS32 + FILETYPE VFT_APP + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904e4" + BEGIN + VALUE "CompanyName", "com.example" "\0" + VALUE "FileDescription", "figma_events" "\0" + VALUE "FileVersion", VERSION_AS_STRING "\0" + VALUE "InternalName", "figma_events" "\0" + VALUE "LegalCopyright", "Copyright (C) 2025 com.example. All rights reserved." "\0" + VALUE "OriginalFilename", "figma_events.exe" "\0" + VALUE "ProductName", "figma_events" "\0" + VALUE "ProductVersion", VERSION_AS_STRING "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1252 + END +END + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED diff --git a/windows/runner/flutter_window.cpp b/windows/runner/flutter_window.cpp new file mode 100644 index 0000000..955ee30 --- /dev/null +++ b/windows/runner/flutter_window.cpp @@ -0,0 +1,71 @@ +#include "flutter_window.h" + +#include + +#include "flutter/generated_plugin_registrant.h" + +FlutterWindow::FlutterWindow(const flutter::DartProject& project) + : project_(project) {} + +FlutterWindow::~FlutterWindow() {} + +bool FlutterWindow::OnCreate() { + if (!Win32Window::OnCreate()) { + return false; + } + + RECT frame = GetClientArea(); + + // The size here must match the window dimensions to avoid unnecessary surface + // creation / destruction in the startup path. + flutter_controller_ = std::make_unique( + frame.right - frame.left, frame.bottom - frame.top, project_); + // Ensure that basic setup of the controller was successful. + if (!flutter_controller_->engine() || !flutter_controller_->view()) { + return false; + } + RegisterPlugins(flutter_controller_->engine()); + SetChildContent(flutter_controller_->view()->GetNativeWindow()); + + flutter_controller_->engine()->SetNextFrameCallback([&]() { + this->Show(); + }); + + // Flutter can complete the first frame before the "show window" callback is + // registered. The following call ensures a frame is pending to ensure the + // window is shown. It is a no-op if the first frame hasn't completed yet. + flutter_controller_->ForceRedraw(); + + return true; +} + +void FlutterWindow::OnDestroy() { + if (flutter_controller_) { + flutter_controller_ = nullptr; + } + + Win32Window::OnDestroy(); +} + +LRESULT +FlutterWindow::MessageHandler(HWND hwnd, UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + // Give Flutter, including plugins, an opportunity to handle window messages. + if (flutter_controller_) { + std::optional result = + flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, + lparam); + if (result) { + return *result; + } + } + + switch (message) { + case WM_FONTCHANGE: + flutter_controller_->engine()->ReloadSystemFonts(); + break; + } + + return Win32Window::MessageHandler(hwnd, message, wparam, lparam); +} diff --git a/windows/runner/flutter_window.h b/windows/runner/flutter_window.h new file mode 100644 index 0000000..6da0652 --- /dev/null +++ b/windows/runner/flutter_window.h @@ -0,0 +1,33 @@ +#ifndef RUNNER_FLUTTER_WINDOW_H_ +#define RUNNER_FLUTTER_WINDOW_H_ + +#include +#include + +#include + +#include "win32_window.h" + +// A window that does nothing but host a Flutter view. +class FlutterWindow : public Win32Window { + public: + // Creates a new FlutterWindow hosting a Flutter view running |project|. + explicit FlutterWindow(const flutter::DartProject& project); + virtual ~FlutterWindow(); + + protected: + // Win32Window: + bool OnCreate() override; + void OnDestroy() override; + LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, + LPARAM const lparam) noexcept override; + + private: + // The project to run. + flutter::DartProject project_; + + // The Flutter instance hosted by this window. + std::unique_ptr flutter_controller_; +}; + +#endif // RUNNER_FLUTTER_WINDOW_H_ diff --git a/windows/runner/main.cpp b/windows/runner/main.cpp new file mode 100644 index 0000000..3161652 --- /dev/null +++ b/windows/runner/main.cpp @@ -0,0 +1,43 @@ +#include +#include +#include + +#include "flutter_window.h" +#include "utils.h" + +int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, + _In_ wchar_t *command_line, _In_ int show_command) { + // Attach to console when present (e.g., 'flutter run') or create a + // new console when running with a debugger. + if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { + CreateAndAttachConsole(); + } + + // Initialize COM, so that it is available for use in the library and/or + // plugins. + ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); + + flutter::DartProject project(L"data"); + + std::vector command_line_arguments = + GetCommandLineArguments(); + + project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); + + FlutterWindow window(project); + Win32Window::Point origin(10, 10); + Win32Window::Size size(1280, 720); + if (!window.Create(L"figma_events", origin, size)) { + return EXIT_FAILURE; + } + window.SetQuitOnClose(true); + + ::MSG msg; + while (::GetMessage(&msg, nullptr, 0, 0)) { + ::TranslateMessage(&msg); + ::DispatchMessage(&msg); + } + + ::CoUninitialize(); + return EXIT_SUCCESS; +} diff --git a/windows/runner/resource.h b/windows/runner/resource.h new file mode 100644 index 0000000..66a65d1 --- /dev/null +++ b/windows/runner/resource.h @@ -0,0 +1,16 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Runner.rc +// +#define IDI_APP_ICON 101 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/windows/runner/resources/app_icon.ico b/windows/runner/resources/app_icon.ico new file mode 100644 index 0000000..c04e20c Binary files /dev/null and b/windows/runner/resources/app_icon.ico differ diff --git a/windows/runner/runner.exe.manifest b/windows/runner/runner.exe.manifest new file mode 100644 index 0000000..153653e --- /dev/null +++ b/windows/runner/runner.exe.manifest @@ -0,0 +1,14 @@ + + + + + PerMonitorV2 + + + + + + + + + diff --git a/windows/runner/utils.cpp b/windows/runner/utils.cpp new file mode 100644 index 0000000..3a0b465 --- /dev/null +++ b/windows/runner/utils.cpp @@ -0,0 +1,65 @@ +#include "utils.h" + +#include +#include +#include +#include + +#include + +void CreateAndAttachConsole() { + if (::AllocConsole()) { + FILE *unused; + if (freopen_s(&unused, "CONOUT$", "w", stdout)) { + _dup2(_fileno(stdout), 1); + } + if (freopen_s(&unused, "CONOUT$", "w", stderr)) { + _dup2(_fileno(stdout), 2); + } + std::ios::sync_with_stdio(); + FlutterDesktopResyncOutputStreams(); + } +} + +std::vector GetCommandLineArguments() { + // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. + int argc; + wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); + if (argv == nullptr) { + return std::vector(); + } + + std::vector command_line_arguments; + + // Skip the first argument as it's the binary name. + for (int i = 1; i < argc; i++) { + command_line_arguments.push_back(Utf8FromUtf16(argv[i])); + } + + ::LocalFree(argv); + + return command_line_arguments; +} + +std::string Utf8FromUtf16(const wchar_t* utf16_string) { + if (utf16_string == nullptr) { + return std::string(); + } + unsigned int target_length = ::WideCharToMultiByte( + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, + -1, nullptr, 0, nullptr, nullptr) + -1; // remove the trailing null character + int input_length = (int)wcslen(utf16_string); + std::string utf8_string; + if (target_length == 0 || target_length > utf8_string.max_size()) { + return utf8_string; + } + utf8_string.resize(target_length); + int converted_length = ::WideCharToMultiByte( + CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, + input_length, utf8_string.data(), target_length, nullptr, nullptr); + if (converted_length == 0) { + return std::string(); + } + return utf8_string; +} diff --git a/windows/runner/utils.h b/windows/runner/utils.h new file mode 100644 index 0000000..3879d54 --- /dev/null +++ b/windows/runner/utils.h @@ -0,0 +1,19 @@ +#ifndef RUNNER_UTILS_H_ +#define RUNNER_UTILS_H_ + +#include +#include + +// Creates a console for the process, and redirects stdout and stderr to +// it for both the runner and the Flutter library. +void CreateAndAttachConsole(); + +// Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string +// encoded in UTF-8. Returns an empty std::string on failure. +std::string Utf8FromUtf16(const wchar_t* utf16_string); + +// Gets the command line arguments passed in as a std::vector, +// encoded in UTF-8. Returns an empty std::vector on failure. +std::vector GetCommandLineArguments(); + +#endif // RUNNER_UTILS_H_ diff --git a/windows/runner/win32_window.cpp b/windows/runner/win32_window.cpp new file mode 100644 index 0000000..60608d0 --- /dev/null +++ b/windows/runner/win32_window.cpp @@ -0,0 +1,288 @@ +#include "win32_window.h" + +#include +#include + +#include "resource.h" + +namespace { + +/// Window attribute that enables dark mode window decorations. +/// +/// Redefined in case the developer's machine has a Windows SDK older than +/// version 10.0.22000.0. +/// See: https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute +#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE +#define DWMWA_USE_IMMERSIVE_DARK_MODE 20 +#endif + +constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; + +/// Registry key for app theme preference. +/// +/// A value of 0 indicates apps should use dark mode. A non-zero or missing +/// value indicates apps should use light mode. +constexpr const wchar_t kGetPreferredBrightnessRegKey[] = + L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"; +constexpr const wchar_t kGetPreferredBrightnessRegValue[] = L"AppsUseLightTheme"; + +// The number of Win32Window objects that currently exist. +static int g_active_window_count = 0; + +using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); + +// Scale helper to convert logical scaler values to physical using passed in +// scale factor +int Scale(int source, double scale_factor) { + return static_cast(source * scale_factor); +} + +// Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. +// This API is only needed for PerMonitor V1 awareness mode. +void EnableFullDpiSupportIfAvailable(HWND hwnd) { + HMODULE user32_module = LoadLibraryA("User32.dll"); + if (!user32_module) { + return; + } + auto enable_non_client_dpi_scaling = + reinterpret_cast( + GetProcAddress(user32_module, "EnableNonClientDpiScaling")); + if (enable_non_client_dpi_scaling != nullptr) { + enable_non_client_dpi_scaling(hwnd); + } + FreeLibrary(user32_module); +} + +} // namespace + +// Manages the Win32Window's window class registration. +class WindowClassRegistrar { + public: + ~WindowClassRegistrar() = default; + + // Returns the singleton registrar instance. + static WindowClassRegistrar* GetInstance() { + if (!instance_) { + instance_ = new WindowClassRegistrar(); + } + return instance_; + } + + // Returns the name of the window class, registering the class if it hasn't + // previously been registered. + const wchar_t* GetWindowClass(); + + // Unregisters the window class. Should only be called if there are no + // instances of the window. + void UnregisterWindowClass(); + + private: + WindowClassRegistrar() = default; + + static WindowClassRegistrar* instance_; + + bool class_registered_ = false; +}; + +WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; + +const wchar_t* WindowClassRegistrar::GetWindowClass() { + if (!class_registered_) { + WNDCLASS window_class{}; + window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); + window_class.lpszClassName = kWindowClassName; + window_class.style = CS_HREDRAW | CS_VREDRAW; + window_class.cbClsExtra = 0; + window_class.cbWndExtra = 0; + window_class.hInstance = GetModuleHandle(nullptr); + window_class.hIcon = + LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); + window_class.hbrBackground = 0; + window_class.lpszMenuName = nullptr; + window_class.lpfnWndProc = Win32Window::WndProc; + RegisterClass(&window_class); + class_registered_ = true; + } + return kWindowClassName; +} + +void WindowClassRegistrar::UnregisterWindowClass() { + UnregisterClass(kWindowClassName, nullptr); + class_registered_ = false; +} + +Win32Window::Win32Window() { + ++g_active_window_count; +} + +Win32Window::~Win32Window() { + --g_active_window_count; + Destroy(); +} + +bool Win32Window::Create(const std::wstring& title, + const Point& origin, + const Size& size) { + Destroy(); + + const wchar_t* window_class = + WindowClassRegistrar::GetInstance()->GetWindowClass(); + + const POINT target_point = {static_cast(origin.x), + static_cast(origin.y)}; + HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); + UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); + double scale_factor = dpi / 96.0; + + HWND window = CreateWindow( + window_class, title.c_str(), WS_OVERLAPPEDWINDOW, + Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), + Scale(size.width, scale_factor), Scale(size.height, scale_factor), + nullptr, nullptr, GetModuleHandle(nullptr), this); + + if (!window) { + return false; + } + + UpdateTheme(window); + + return OnCreate(); +} + +bool Win32Window::Show() { + return ShowWindow(window_handle_, SW_SHOWNORMAL); +} + +// static +LRESULT CALLBACK Win32Window::WndProc(HWND const window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + if (message == WM_NCCREATE) { + auto window_struct = reinterpret_cast(lparam); + SetWindowLongPtr(window, GWLP_USERDATA, + reinterpret_cast(window_struct->lpCreateParams)); + + auto that = static_cast(window_struct->lpCreateParams); + EnableFullDpiSupportIfAvailable(window); + that->window_handle_ = window; + } else if (Win32Window* that = GetThisFromHandle(window)) { + return that->MessageHandler(window, message, wparam, lparam); + } + + return DefWindowProc(window, message, wparam, lparam); +} + +LRESULT +Win32Window::MessageHandler(HWND hwnd, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept { + switch (message) { + case WM_DESTROY: + window_handle_ = nullptr; + Destroy(); + if (quit_on_close_) { + PostQuitMessage(0); + } + return 0; + + case WM_DPICHANGED: { + auto newRectSize = reinterpret_cast(lparam); + LONG newWidth = newRectSize->right - newRectSize->left; + LONG newHeight = newRectSize->bottom - newRectSize->top; + + SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, + newHeight, SWP_NOZORDER | SWP_NOACTIVATE); + + return 0; + } + case WM_SIZE: { + RECT rect = GetClientArea(); + if (child_content_ != nullptr) { + // Size and position the child window. + MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, + rect.bottom - rect.top, TRUE); + } + return 0; + } + + case WM_ACTIVATE: + if (child_content_ != nullptr) { + SetFocus(child_content_); + } + return 0; + + case WM_DWMCOLORIZATIONCOLORCHANGED: + UpdateTheme(hwnd); + return 0; + } + + return DefWindowProc(window_handle_, message, wparam, lparam); +} + +void Win32Window::Destroy() { + OnDestroy(); + + if (window_handle_) { + DestroyWindow(window_handle_); + window_handle_ = nullptr; + } + if (g_active_window_count == 0) { + WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); + } +} + +Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { + return reinterpret_cast( + GetWindowLongPtr(window, GWLP_USERDATA)); +} + +void Win32Window::SetChildContent(HWND content) { + child_content_ = content; + SetParent(content, window_handle_); + RECT frame = GetClientArea(); + + MoveWindow(content, frame.left, frame.top, frame.right - frame.left, + frame.bottom - frame.top, true); + + SetFocus(child_content_); +} + +RECT Win32Window::GetClientArea() { + RECT frame; + GetClientRect(window_handle_, &frame); + return frame; +} + +HWND Win32Window::GetHandle() { + return window_handle_; +} + +void Win32Window::SetQuitOnClose(bool quit_on_close) { + quit_on_close_ = quit_on_close; +} + +bool Win32Window::OnCreate() { + // No-op; provided for subclasses. + return true; +} + +void Win32Window::OnDestroy() { + // No-op; provided for subclasses. +} + +void Win32Window::UpdateTheme(HWND const window) { + DWORD light_mode; + DWORD light_mode_size = sizeof(light_mode); + LSTATUS result = RegGetValue(HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey, + kGetPreferredBrightnessRegValue, + RRF_RT_REG_DWORD, nullptr, &light_mode, + &light_mode_size); + + if (result == ERROR_SUCCESS) { + BOOL enable_dark_mode = light_mode == 0; + DwmSetWindowAttribute(window, DWMWA_USE_IMMERSIVE_DARK_MODE, + &enable_dark_mode, sizeof(enable_dark_mode)); + } +} diff --git a/windows/runner/win32_window.h b/windows/runner/win32_window.h new file mode 100644 index 0000000..e901dde --- /dev/null +++ b/windows/runner/win32_window.h @@ -0,0 +1,102 @@ +#ifndef RUNNER_WIN32_WINDOW_H_ +#define RUNNER_WIN32_WINDOW_H_ + +#include + +#include +#include +#include + +// A class abstraction for a high DPI-aware Win32 Window. Intended to be +// inherited from by classes that wish to specialize with custom +// rendering and input handling +class Win32Window { + public: + struct Point { + unsigned int x; + unsigned int y; + Point(unsigned int x, unsigned int y) : x(x), y(y) {} + }; + + struct Size { + unsigned int width; + unsigned int height; + Size(unsigned int width, unsigned int height) + : width(width), height(height) {} + }; + + Win32Window(); + virtual ~Win32Window(); + + // Creates a win32 window with |title| that is positioned and sized using + // |origin| and |size|. New windows are created on the default monitor. Window + // sizes are specified to the OS in physical pixels, hence to ensure a + // consistent size this function will scale the inputted width and height as + // as appropriate for the default monitor. The window is invisible until + // |Show| is called. Returns true if the window was created successfully. + bool Create(const std::wstring& title, const Point& origin, const Size& size); + + // Show the current window. Returns true if the window was successfully shown. + bool Show(); + + // Release OS resources associated with window. + void Destroy(); + + // Inserts |content| into the window tree. + void SetChildContent(HWND content); + + // Returns the backing Window handle to enable clients to set icon and other + // window properties. Returns nullptr if the window has been destroyed. + HWND GetHandle(); + + // If true, closing this window will quit the application. + void SetQuitOnClose(bool quit_on_close); + + // Return a RECT representing the bounds of the current client area. + RECT GetClientArea(); + + protected: + // Processes and route salient window messages for mouse handling, + // size change and DPI. Delegates handling of these to member overloads that + // inheriting classes can handle. + virtual LRESULT MessageHandler(HWND window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept; + + // Called when CreateAndShow is called, allowing subclass window-related + // setup. Subclasses should return false if setup fails. + virtual bool OnCreate(); + + // Called when Destroy is called. + virtual void OnDestroy(); + + private: + friend class WindowClassRegistrar; + + // OS callback called by message pump. Handles the WM_NCCREATE message which + // is passed when the non-client area is being created and enables automatic + // non-client DPI scaling so that the non-client area automatically + // responds to changes in DPI. All other messages are handled by + // MessageHandler. + static LRESULT CALLBACK WndProc(HWND const window, + UINT const message, + WPARAM const wparam, + LPARAM const lparam) noexcept; + + // Retrieves a class instance pointer for |window| + static Win32Window* GetThisFromHandle(HWND const window) noexcept; + + // Update the window frame's theme to match the system theme. + static void UpdateTheme(HWND const window); + + bool quit_on_close_ = false; + + // window handle for top level window. + HWND window_handle_ = nullptr; + + // window handle for hosted content. + HWND child_content_ = nullptr; +}; + +#endif // RUNNER_WIN32_WINDOW_H_