diff --git a/example/memories/.gitignore b/example/memories/.gitignore new file mode 100644 index 0000000..954dde9 --- /dev/null +++ b/example/memories/.gitignore @@ -0,0 +1,48 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.build/ +.buildlog/ +.history +.svn/ +.swiftpm/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release + +# Environment variable files +.env diff --git a/example/memories/.metadata b/example/memories/.metadata new file mode 100644 index 0000000..9876868 --- /dev/null +++ b/example/memories/.metadata @@ -0,0 +1,33 @@ +# 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: "6fba2447e95c451518584c35e25f5433f14d888c" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: 6fba2447e95c451518584c35e25f5433f14d888c + base_revision: 6fba2447e95c451518584c35e25f5433f14d888c + - platform: android + create_revision: 6fba2447e95c451518584c35e25f5433f14d888c + base_revision: 6fba2447e95c451518584c35e25f5433f14d888c + - platform: ios + create_revision: 6fba2447e95c451518584c35e25f5433f14d888c + base_revision: 6fba2447e95c451518584c35e25f5433f14d888c + + # 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/example/memories/README.md b/example/memories/README.md new file mode 100644 index 0000000..bef0cd1 --- /dev/null +++ b/example/memories/README.md @@ -0,0 +1,100 @@ +# Memories App + +A beautiful photo memories app built with Flutter, showcasing Cloudinary SDK integration for cloud-based image storage and management. + +## Features + +- 📸 Select multiple photos from gallery +- ☁️ Cloud storage with Cloudinary +- 🖼️ Optimized image delivery and transformations +- 📝 Create named memory collections +- 💾 Persistent data storage +- 📅 Automatic date tracking for each memory +- 🗑️ Delete memories and cloud images +- 🌐 Seamless image upload and retrieval +- 🔒 Secure image storage with environment variables + +## Cloudinary Integration + +This app demonstrates real-world usage of the Cloudinary SDK for Flutter: + +- **Image Upload**: Upload photos directly to Cloudinary cloud storage +- **Optimized Delivery**: Automatic image optimization and responsive delivery +- **Image Transformations**: Support for on-the-fly image transformations +- **Secure Configuration**: Environment-based API credentials management +- **Cloud Management**: Delete images from cloud storage when memories are removed + +## Screenshots + +| ![Home screen](screenshots/home.jpg) | ![Add memory](screenshots/add.jpg) | ![Photo viewer](screenshots/view.jpg) | +|:---:|:---:|:---:| +| Home screen | Add memory | Photo viewer | + + + +## Environment Setup + +1. Create a `.env` file in the project root: + +```env +CLOUDINARY_CLOUD_NAME=your_cloud_name +CLOUDINARY_API_KEY=your_api_key +CLOUDINARY_API_SECRET=your_api_secret +CLOUDINARY_UPLOAD_PRESET=your_upload_preset +``` + +2. Add `.env` to your `.gitignore` to keep credentials secure + +3. Get your Cloudinary credentials from [Cloudinary Dashboard](https://cloudinary.com/console) + +## Platform Setup + +### Android +Add to `android/app/src/main/AndroidManifest.xml`: + +```xml + + +``` + +### iOS +Add to `ios/Runner/Info.plist`: + +```xml +NSPhotoLibraryUsageDescription +We need access to your photo library to select photos for your memories +NSCameraUsageDescription +We need access to your camera to take photos for your memories +``` + +## How to Use + +1. **Set up Cloudinary**: Configure your `.env` file with Cloudinary credentials +2. **Run the app**: `flutter run` +3. **Add a memory**: Tap the + button +4. **Select photos**: Tap "Add Photos" to pick from gallery (uploads to Cloudinary) +5. **Name your memory**: Enter a title for your collection +6. **Save**: Tap "Save" to create the memory +7. **View photos**: Images are loaded from Cloudinary with optimized delivery +8. **Delete**: Remove memories (also deletes images from Cloudinary cloud) + +## Dependencies + +- `cloudinary_sdk`: Cloudinary SDK for Flutter - cloud image storage +- `flutter_dotenv`: Environment variable management +- `image_picker`: Photo selection from gallery +- `path_provider`: File system access +- `intl`: Date formatting +- `shared_preferences`: Local data persistence +- `http`: Network requests + +## Getting Started + +1. Clone the repository +2. Run `flutter pub get` +3. Set up your `.env` file with Cloudinary credentials +4. Run the app with `flutter run` + +For help with Cloudinary integration, visit the [Cloudinary Documentation](https://cloudinary.com/documentation). + +For Flutter development, view the [Flutter documentation](https://docs.flutter.dev/). diff --git a/example/memories/analysis_options.yaml b/example/memories/analysis_options.yaml new file mode 100644 index 0000000..0d29021 --- /dev/null +++ b/example/memories/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/example/memories/android/.gitignore b/example/memories/android/.gitignore new file mode 100644 index 0000000..be3943c --- /dev/null +++ b/example/memories/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/example/memories/android/app/build.gradle.kts b/example/memories/android/app/build.gradle.kts new file mode 100644 index 0000000..2fcd4fd --- /dev/null +++ b/example/memories/android/app/build.gradle.kts @@ -0,0 +1,44 @@ +plugins { + id("com.android.application") + id("kotlin-android") + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "com.momories.memories" + compileSdk = flutter.compileSdkVersion + ndkVersion = "27.0.12077973" + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_11.toString() + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId = "com.momories.memories" + // You can update the following values to match your application needs. + // For more information, see: https://flutter.dev/to/review-gradle-config. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig = signingConfigs.getByName("debug") + } + } +} + +flutter { + source = "../.." +} diff --git a/example/memories/android/app/src/debug/AndroidManifest.xml b/example/memories/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/example/memories/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/example/memories/android/app/src/main/AndroidManifest.xml b/example/memories/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..54c32aa --- /dev/null +++ b/example/memories/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/example/memories/android/app/src/main/kotlin/com/momories/memories/MainActivity.kt b/example/memories/android/app/src/main/kotlin/com/momories/memories/MainActivity.kt new file mode 100644 index 0000000..00a3d2d --- /dev/null +++ b/example/memories/android/app/src/main/kotlin/com/momories/memories/MainActivity.kt @@ -0,0 +1,5 @@ +package com.momories.memories + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity : FlutterActivity() diff --git a/example/memories/android/app/src/main/res/drawable-v21/launch_background.xml b/example/memories/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/example/memories/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/example/memories/android/app/src/main/res/drawable/launch_background.xml b/example/memories/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000..304732f --- /dev/null +++ b/example/memories/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/example/memories/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/example/memories/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..db77bb4 Binary files /dev/null and b/example/memories/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/example/memories/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/example/memories/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..17987b7 Binary files /dev/null and b/example/memories/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/example/memories/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/example/memories/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..09d4391 Binary files /dev/null and b/example/memories/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/example/memories/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/example/memories/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..d5f1c8d Binary files /dev/null and b/example/memories/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/example/memories/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/example/memories/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..4d6372e Binary files /dev/null and b/example/memories/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/example/memories/android/app/src/main/res/values-night/styles.xml b/example/memories/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..06952be --- /dev/null +++ b/example/memories/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/example/memories/android/app/src/main/res/values/styles.xml b/example/memories/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..cb1ef88 --- /dev/null +++ b/example/memories/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/example/memories/android/app/src/profile/AndroidManifest.xml b/example/memories/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/example/memories/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/example/memories/android/build.gradle.kts b/example/memories/android/build.gradle.kts new file mode 100644 index 0000000..89176ef --- /dev/null +++ b/example/memories/android/build.gradle.kts @@ -0,0 +1,21 @@ +allprojects { + repositories { + google() + mavenCentral() + } +} + +val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/example/memories/android/gradle.properties b/example/memories/android/gradle.properties new file mode 100644 index 0000000..f018a61 --- /dev/null +++ b/example/memories/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError +android.useAndroidX=true +android.enableJetifier=true diff --git a/example/memories/android/gradle/wrapper/gradle-wrapper.properties b/example/memories/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..ac3b479 --- /dev/null +++ b/example/memories/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/example/memories/android/settings.gradle.kts b/example/memories/android/settings.gradle.kts new file mode 100644 index 0000000..ab39a10 --- /dev/null +++ b/example/memories/android/settings.gradle.kts @@ -0,0 +1,25 @@ +pluginManagement { + val flutterSdkPath = run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.7.3" apply false + id("org.jetbrains.kotlin.android") version "2.1.0" apply false +} + +include(":app") diff --git a/example/memories/ios/.gitignore b/example/memories/ios/.gitignore new file mode 100644 index 0000000..7a7f987 --- /dev/null +++ b/example/memories/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/example/memories/ios/Flutter/AppFrameworkInfo.plist b/example/memories/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 0000000..7c56964 --- /dev/null +++ b/example/memories/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 12.0 + + diff --git a/example/memories/ios/Flutter/Debug.xcconfig b/example/memories/ios/Flutter/Debug.xcconfig new file mode 100644 index 0000000..592ceee --- /dev/null +++ b/example/memories/ios/Flutter/Debug.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/example/memories/ios/Flutter/Release.xcconfig b/example/memories/ios/Flutter/Release.xcconfig new file mode 100644 index 0000000..592ceee --- /dev/null +++ b/example/memories/ios/Flutter/Release.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/example/memories/ios/Runner.xcodeproj/project.pbxproj b/example/memories/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..85e6aeb --- /dev/null +++ b/example/memories/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,616 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 97C146E61CF9000F007C117D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 97C146ED1CF9000F007C117D; + remoteInfo = Runner; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C8082294A63A400263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C807B294A618700263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + 331C8082294A63A400263BE5 /* RunnerTests */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + 331C8081294A63A400263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C8080294A63A400263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 331C807D294A63A400263BE5 /* Sources */, + 331C807F294A63A400263BE5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 331C8086294A63A400263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = YES; + LastUpgradeCheck = 1510; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C8080294A63A400263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 97C146ED1CF9000F007C117D; + }; + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + 331C8080294A63A400263BE5 /* RunnerTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C807F294A63A400263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C807D294A63A400263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C8086294A63A400263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 97C146ED1CF9000F007C117D /* Runner */; + targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.momories.memories; + 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.momories.memories.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.momories.memories.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.momories.memories.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.momories.memories; + 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.momories.memories; + 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/example/memories/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/example/memories/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/example/memories/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/example/memories/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/memories/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/example/memories/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/example/memories/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/example/memories/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/example/memories/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/example/memories/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/memories/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000..e3773d4 --- /dev/null +++ b/example/memories/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/memories/ios/Runner.xcworkspace/contents.xcworkspacedata b/example/memories/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..1d526a1 --- /dev/null +++ b/example/memories/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/example/memories/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/memories/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/example/memories/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/example/memories/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/example/memories/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/example/memories/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/example/memories/ios/Runner/AppDelegate.swift b/example/memories/ios/Runner/AppDelegate.swift new file mode 100644 index 0000000..6266644 --- /dev/null +++ b/example/memories/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/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d36b1fa --- /dev/null +++ b/example/memories/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/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 0000000..dc9ada4 Binary files /dev/null and b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 0000000..7353c41 Binary files /dev/null and b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 0000000..797d452 Binary files /dev/null and b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 0000000..6ed2d93 Binary files /dev/null and b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 0000000..4cd7b00 Binary files /dev/null and b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 0000000..fe73094 Binary files /dev/null and b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 0000000..321773c Binary files /dev/null and b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 0000000..797d452 Binary files /dev/null and b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 0000000..502f463 Binary files /dev/null and b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 0000000..0ec3034 Binary files /dev/null and b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 0000000..0ec3034 Binary files /dev/null and b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 0000000..e9f5fea Binary files /dev/null and b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 0000000..84ac32a Binary files /dev/null and b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 0000000..8953cba Binary files /dev/null and b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 0000000..0467bf1 Binary files /dev/null and b/example/memories/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/example/memories/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/example/memories/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 0000000..0bedcf2 --- /dev/null +++ b/example/memories/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/example/memories/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/example/memories/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/example/memories/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/example/memories/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/example/memories/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/example/memories/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/example/memories/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/example/memories/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/example/memories/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/example/memories/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/example/memories/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 0000000..89c2725 --- /dev/null +++ b/example/memories/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/example/memories/ios/Runner/Base.lproj/LaunchScreen.storyboard b/example/memories/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..f2e259c --- /dev/null +++ b/example/memories/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/memories/ios/Runner/Base.lproj/Main.storyboard b/example/memories/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 0000000..f3c2851 --- /dev/null +++ b/example/memories/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/memories/ios/Runner/Info.plist b/example/memories/ios/Runner/Info.plist new file mode 100644 index 0000000..71a5142 --- /dev/null +++ b/example/memories/ios/Runner/Info.plist @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Memories + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + memories + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + CADisableMinimumFrameDurationOnPhone + + UIApplicationSupportsIndirectInputEvents + + + diff --git a/example/memories/ios/Runner/Runner-Bridging-Header.h b/example/memories/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 0000000..308a2a5 --- /dev/null +++ b/example/memories/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/example/memories/ios/RunnerTests/RunnerTests.swift b/example/memories/ios/RunnerTests/RunnerTests.swift new file mode 100644 index 0000000..86a7c3b --- /dev/null +++ b/example/memories/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/example/memories/lib/config/cloudinary_config.dart b/example/memories/lib/config/cloudinary_config.dart new file mode 100644 index 0000000..22e1f11 --- /dev/null +++ b/example/memories/lib/config/cloudinary_config.dart @@ -0,0 +1,9 @@ +import 'package:flutter_dotenv/flutter_dotenv.dart'; + +class CloudinaryConfig { + static String get cloudName => dotenv.env['CLOUDINARY_CLOUD_NAME'] ?? ''; + static String get apiKey => dotenv.env['CLOUDINARY_API_KEY'] ?? ''; + static String get apiSecret => dotenv.env['CLOUDINARY_API_SECRET'] ?? ''; + static String get uploadPreset => dotenv.env['CLOUDINARY_UPLOAD_PRESET'] ?? ''; +} + diff --git a/example/memories/lib/main.dart b/example/memories/lib/main.dart new file mode 100644 index 0000000..8a7e3ca --- /dev/null +++ b/example/memories/lib/main.dart @@ -0,0 +1,49 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_dotenv/flutter_dotenv.dart'; +import 'config/cloudinary_config.dart'; +import 'screens/home_screen.dart'; +import 'services/cloudinary_service.dart'; + +Future main() async { + WidgetsFlutterBinding.ensureInitialized(); + await dotenv.load(fileName: ".env"); + + CloudinaryService().initialize( + cloudName: CloudinaryConfig.cloudName, + uploadPreset: CloudinaryConfig.uploadPreset, + apiKey: CloudinaryConfig.apiKey, + apiSecret: CloudinaryConfig.apiSecret, + ); + + runApp(const MyApp()); +} + +class MyApp extends StatelessWidget { + const MyApp({super.key}); + + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Memories', + debugShowCheckedModeBanner: false, + theme: ThemeData( + useMaterial3: true, + colorScheme: ColorScheme.fromSeed( + seedColor: Colors.deepPurple, + brightness: Brightness.light, + ), + cardTheme: const CardThemeData( + elevation: 2, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(16)), + ), + ), + floatingActionButtonTheme: const FloatingActionButtonThemeData( + elevation: 3, + shape: CircleBorder(), + ), + ), + home: const HomeScreen(), + ); + } +} diff --git a/example/memories/lib/models/memory.dart b/example/memories/lib/models/memory.dart new file mode 100644 index 0000000..cb5b93a --- /dev/null +++ b/example/memories/lib/models/memory.dart @@ -0,0 +1,27 @@ +class Memory { + final String id; + final String title; + final List imagePaths; + final DateTime createdAt; + + Memory({ + required this.id, + required this.title, + required this.imagePaths, + required this.createdAt, + }); + + Map toJson() => { + 'id': id, + 'title': title, + 'imagePaths': imagePaths, + 'createdAt': createdAt.toIso8601String(), + }; + + factory Memory.fromJson(Map json) => Memory( + id: json['id'], + title: json['title'], + imagePaths: List.from(json['imagePaths']), + createdAt: DateTime.parse(json['createdAt']), + ); +} diff --git a/example/memories/lib/screens/add_memory_screen.dart b/example/memories/lib/screens/add_memory_screen.dart new file mode 100644 index 0000000..0b04b75 --- /dev/null +++ b/example/memories/lib/screens/add_memory_screen.dart @@ -0,0 +1,465 @@ +import 'dart:io'; +import 'package:flutter/material.dart'; +import 'package:image_picker/image_picker.dart'; +import '../models/memory.dart'; +import '../services/cloudinary_service.dart'; + +class AddMemoryScreen extends StatefulWidget { + const AddMemoryScreen({super.key}); + + @override + State createState() => _AddMemoryScreenState(); +} + +class _AddMemoryScreenState extends State { + final TextEditingController _titleController = TextEditingController(); + final List _selectedImages = []; + final ImagePicker _picker = ImagePicker(); + final CloudinaryService _cloudinaryService = CloudinaryService(); + static const int _maxPhotos = 6; + bool _isUploading = false; + int _uploadProgress = 0; + int _totalToUpload = 0; + + Future _pickImages() async { + final remainingSlots = _maxPhotos - _selectedImages.length; + if (remainingSlots <= 0) { + _showMaxPhotosDialog(); + return; + } + + final List images = await _picker.pickMultiImage(); + if (images.isNotEmpty) { + setState(() { + _selectedImages.addAll(images.take(remainingSlots)); + }); + + if (images.length > remainingSlots) { + _showMaxPhotosDialog(); + } + } + } + + void _showMaxPhotosDialog() { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text('Maximum $_maxPhotos photos allowed'), + behavior: SnackBarBehavior.floating, + duration: const Duration(seconds: 2), + ), + ); + } + + void _removeImage(int index) { + setState(() { + _selectedImages.removeAt(index); + }); + } + + Future _saveMemory() async { + if (_titleController.text.isEmpty || _selectedImages.isEmpty) { + return; + } + + setState(() { + _isUploading = true; + _totalToUpload = _selectedImages.length; + _uploadProgress = 0; + }); + + try { + final imageFiles = _selectedImages.map((img) => File(img.path)).toList(); + + final uploadedUrls = await _cloudinaryService.uploadMultipleImages( + imageFiles, + onProgress: (current, total) { + setState(() { + _uploadProgress = current; + }); + }, + ); + + if (uploadedUrls.isEmpty) { + if (mounted) { + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar( + content: Text('Failed to upload images. Please try again.'), + backgroundColor: Colors.red, + ), + ); + } + setState(() { + _isUploading = false; + }); + return; + } + + final memory = Memory( + id: DateTime.now().millisecondsSinceEpoch.toString(), + title: _titleController.text, + imagePaths: uploadedUrls, + createdAt: DateTime.now(), + ); + + if (mounted) { + Navigator.pop(context, memory); + } + } catch (e) { + if (mounted) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text('Error: $e'), backgroundColor: Colors.red), + ); + } + setState(() { + _isUploading = false; + }); + } + } + + @override + void dispose() { + _titleController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + final hasImages = _selectedImages.isNotEmpty; + final canSave = + _titleController.text.isNotEmpty && hasImages && !_isUploading; + + return Scaffold( + backgroundColor: theme.colorScheme.surface, + appBar: AppBar( + backgroundColor: Colors.transparent, + elevation: 0, + leading: TextButton( + onPressed: _isUploading ? null : () => Navigator.pop(context), + child: Text( + 'Cancel', + style: TextStyle( + fontSize: 17, + color: _isUploading + ? theme.colorScheme.onSurface.withValues(alpha: 0.3) + : theme.colorScheme.primary, + ), + ), + ), + leadingWidth: 80, + actions: [ + if (_isUploading) + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + child: Row( + children: [ + SizedBox( + width: 20, + height: 20, + child: CircularProgressIndicator( + strokeWidth: 2, + value: _totalToUpload > 0 + ? _uploadProgress / _totalToUpload + : null, + ), + ), + const SizedBox(width: 8), + Text( + 'Uploading $_uploadProgress/$_totalToUpload', + style: TextStyle( + fontSize: 14, + color: theme.colorScheme.onSurface, + ), + ), + ], + ), + ) + else + TextButton( + onPressed: canSave ? _saveMemory : null, + child: Text( + 'Done', + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.w600, + color: canSave + ? theme.colorScheme.primary + : theme.colorScheme.onSurface.withValues(alpha: 0.3), + ), + ), + ), + const SizedBox(width: 8), + ], + ), + body: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(20, 0, 20, 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + TextField( + controller: _titleController, + decoration: const InputDecoration( + hintText: 'New Memory', + border: InputBorder.none, + contentPadding: EdgeInsets.zero, + ), + style: const TextStyle( + fontSize: 34, + fontWeight: FontWeight.bold, + ), + maxLines: 1, + textCapitalization: TextCapitalization.words, + onChanged: (value) => setState(() {}), + ), + if (hasImages) + Padding( + padding: const EdgeInsets.only(top: 4), + child: Text( + '${_selectedImages.length} of $_maxPhotos photos', + style: TextStyle( + fontSize: 15, + color: theme.colorScheme.onSurfaceVariant, + ), + ), + ), + ], + ), + ), + + const SizedBox(height: 32), + + if (hasImages) ...[ + const SizedBox(height: 20), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 20), + child: _buildPhotoThumbnails(), + ), + const SizedBox(height: 20), + ], + + Padding( + padding: const EdgeInsets.symmetric(horizontal: 20), + child: GestureDetector( + onTap: _selectedImages.length < _maxPhotos ? _pickImages : null, + child: Container( + width: double.infinity, + padding: const EdgeInsets.symmetric(vertical: 48), + decoration: BoxDecoration( + color: _selectedImages.length < _maxPhotos + ? theme.colorScheme.surfaceContainerHighest.withValues( + alpha: 0.5, + ) + : theme.colorScheme.surfaceContainerHighest.withValues( + alpha: 0.3, + ), + borderRadius: BorderRadius.circular(16), + border: Border.all( + color: theme.colorScheme.outlineVariant.withValues( + alpha: 0.3, + ), + width: 1, + ), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + if (_selectedImages.length < _maxPhotos) ...[ + Icon( + Icons.photo_library_outlined, + size: 44, + color: theme.colorScheme.primary.withValues( + alpha: 0.8, + ), + ), + const SizedBox(height: 12), + Text( + hasImages ? 'Add More Photos' : 'Add Photos', + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.w500, + color: theme.colorScheme.primary, + ), + ), + if (hasImages) + Padding( + padding: const EdgeInsets.only(top: 4), + child: Text( + '${_selectedImages.length} of $_maxPhotos selected', + style: TextStyle( + fontSize: 13, + color: theme.colorScheme.onSurfaceVariant + .withValues(alpha: 0.7), + ), + ), + ), + ] else ...[ + Icon( + Icons.check_circle_rounded, + size: 44, + color: theme.colorScheme.primary.withValues( + alpha: 0.6, + ), + ), + const SizedBox(height: 12), + Text( + 'All Photos Added', + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.w500, + color: theme.colorScheme.onSurfaceVariant, + ), + ), + Padding( + padding: const EdgeInsets.only(top: 4), + child: Text( + '$_maxPhotos photos maximum', + style: TextStyle( + fontSize: 13, + color: theme.colorScheme.onSurfaceVariant + .withValues(alpha: 0.6), + ), + ), + ), + ], + ], + ), + ), + ), + ), + + const SizedBox(height: 40), + ], + ), + ), + ); + } + + Widget _buildPhotoThumbnails() { + final theme = Theme.of(context); + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Icon( + Icons.collections, + size: 16, + color: theme.colorScheme.onSurfaceVariant, + ), + const SizedBox(width: 6), + Text( + 'Photos', + style: TextStyle( + fontSize: 13, + fontWeight: FontWeight.w600, + color: theme.colorScheme.onSurfaceVariant, + letterSpacing: 0.5, + ), + ), + const Spacer(), + Text( + 'Tap × to remove', + style: TextStyle( + fontSize: 12, + color: theme.colorScheme.onSurfaceVariant.withValues( + alpha: 0.6, + ), + ), + ), + ], + ), + const SizedBox(height: 12), + SizedBox( + height: 90, + child: ListView.builder( + scrollDirection: Axis.horizontal, + itemCount: _selectedImages.length, + itemBuilder: (context, index) { + return Padding( + padding: EdgeInsets.only( + right: index < _selectedImages.length - 1 ? 12 : 0, + ), + child: Stack( + children: [ + ClipRRect( + borderRadius: BorderRadius.circular(12), + child: Container( + decoration: BoxDecoration( + border: Border.all( + color: theme.colorScheme.outlineVariant.withValues( + alpha: 0.3, + ), + width: 1, + ), + borderRadius: BorderRadius.circular(12), + ), + child: Image.file( + File(_selectedImages[index].path), + width: 90, + height: 90, + fit: BoxFit.cover, + ), + ), + ), + Positioned( + top: 6, + right: 6, + child: GestureDetector( + onTap: () => _removeImage(index), + child: Container( + padding: const EdgeInsets.all(5), + decoration: BoxDecoration( + color: Colors.red.shade600, + shape: BoxShape.circle, + boxShadow: [ + BoxShadow( + color: Colors.black.withValues(alpha: 0.3), + blurRadius: 4, + offset: const Offset(0, 2), + ), + ], + ), + child: const Icon( + Icons.close_rounded, + size: 16, + color: Colors.white, + ), + ), + ), + ), + Positioned( + bottom: 6, + left: 6, + child: Container( + padding: const EdgeInsets.symmetric( + horizontal: 6, + vertical: 3, + ), + decoration: BoxDecoration( + color: Colors.black.withValues(alpha: 0.6), + borderRadius: BorderRadius.circular(4), + ), + child: Text( + '${index + 1}', + style: const TextStyle( + color: Colors.white, + fontSize: 11, + fontWeight: FontWeight.w600, + ), + ), + ), + ), + ], + ), + ); + }, + ), + ), + ], + ); + } +} diff --git a/example/memories/lib/screens/home_screen.dart b/example/memories/lib/screens/home_screen.dart new file mode 100644 index 0000000..d12f0cc --- /dev/null +++ b/example/memories/lib/screens/home_screen.dart @@ -0,0 +1,191 @@ +import 'package:flutter/material.dart'; +import '../models/memory.dart'; +import '../services/cloudinary_service.dart'; +import '../services/storage_service.dart'; +import '../widgets/photo_grid.dart'; +import 'add_memory_screen.dart'; +import 'photo_viewer_screen.dart'; + +class HomeScreen extends StatefulWidget { + const HomeScreen({super.key}); + + @override + State createState() => _HomeScreenState(); +} + +class _HomeScreenState extends State { + List memories = []; + final StorageService _storageService = StorageService(); + final CloudinaryService _cloudinaryService = CloudinaryService(); + bool _isLoading = true; + + @override + void initState() { + super.initState(); + _loadMemories(); + } + + Future _loadMemories() async { + final loadedMemories = await _storageService.loadMemories(); + setState(() { + memories = loadedMemories; + _isLoading = false; + }); + } + + Future _saveMemories() async { + await _storageService.saveMemories(memories); + } + + void _addMemory() async { + final result = await Navigator.push( + context, + MaterialPageRoute(builder: (context) => const AddMemoryScreen()), + ); + + if (result != null) { + setState(() { + memories.insert(0, result); + }); + await _saveMemories(); + } + } + + @override + Widget build(BuildContext context) { + if (_isLoading) { + return const Scaffold(body: Center(child: CircularProgressIndicator())); + } + + return Scaffold( + appBar: AppBar( + title: const Text( + 'Memories', + style: TextStyle(fontWeight: FontWeight.bold), + ), + actions: [ + IconButton( + icon: const Icon(Icons.filter_list), + onPressed: () {}, + tooltip: 'Filter', + ), + ], + ), + body: memories.isEmpty + ? Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.photo_library_outlined, + size: 80, + color: Theme.of(context).colorScheme.secondary, + ), + const SizedBox(height: 16), + Text( + 'No Memories Yet', + style: Theme.of(context).textTheme.headlineSmall?.copyWith( + fontWeight: FontWeight.w600, + ), + ), + const SizedBox(height: 8), + Text( + 'Tap + to create your first memory', + style: Theme.of(context).textTheme.bodyLarge?.copyWith( + color: Theme.of(context).colorScheme.onSurfaceVariant, + ), + ), + ], + ), + ) + : ListView( + padding: const EdgeInsets.all(16), + children: _buildSectionedMemories(), + ), + floatingActionButton: FloatingActionButton( + onPressed: _addMemory, + tooltip: 'Add Memory', + child: const Icon(Icons.add), + ), + ); + } + + List _buildSectionedMemories() { + // Sort by most recent first + final List sorted = [...memories] + ..sort((a, b) => b.createdAt.compareTo(a.createdAt)); + + // Group by title + final Map> titleToMemories = {}; + for (final m in sorted) { + titleToMemories.putIfAbsent(m.title, () => []).add(m); + } + + final List widgets = []; + titleToMemories.forEach((title, items) { + widgets.add( + Padding( + padding: const EdgeInsets.only(top: 16, bottom: 8), + child: Text( + title, + style: const TextStyle(fontSize: 22, fontWeight: FontWeight.bold), + ), + ), + ); + + for (final memory in items) { + widgets.add(_buildMemoryCard(memory)); + } + }); + + return widgets; + } + + Widget _buildMemoryCard(Memory memory) { + return Card( + margin: const EdgeInsets.only(bottom: 12), + clipBehavior: Clip.antiAlias, + elevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + side: BorderSide( + color: Theme.of(context).colorScheme.outlineVariant.withValues(alpha: 0.5), + width: 1, + ), + ), + child: memory.imagePaths.isNotEmpty + ? PhotoGrid( + imagePaths: memory.imagePaths, + onImageTap: (index) => _openPhotoViewer(memory, index), + ) + : const SizedBox.shrink(), + ); + } + + void _openPhotoViewer(Memory memory, int initialIndex) async { + await Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PhotoViewerScreen( + imagePaths: memory.imagePaths, + initialIndex: initialIndex, + onDelete: (index) async { + final imageUrl = memory.imagePaths[index]; + + if (_cloudinaryService.isCloudinaryUrl(imageUrl)) { + await _cloudinaryService.deleteImage(imageUrl); + } + + setState(() { + memory.imagePaths.removeAt(index); + if (memory.imagePaths.isEmpty) { + memories.remove(memory); + } + }); + _saveMemories(); + }, + ), + ), + ); + } +} diff --git a/example/memories/lib/screens/photo_viewer_screen.dart b/example/memories/lib/screens/photo_viewer_screen.dart new file mode 100644 index 0000000..c31ec42 --- /dev/null +++ b/example/memories/lib/screens/photo_viewer_screen.dart @@ -0,0 +1,264 @@ +import 'package:flutter/material.dart'; +import '../widgets/cloudinary_image.dart'; + +class PhotoViewerScreen extends StatefulWidget { + final List imagePaths; + final int initialIndex; + final Future Function(int index)? onDelete; + + const PhotoViewerScreen({ + super.key, + required this.imagePaths, + this.initialIndex = 0, + this.onDelete, + }); + + @override + State createState() => _PhotoViewerScreenState(); +} + +class _PhotoViewerScreenState extends State { + late PageController _pageController; + late int _currentIndex; + final TransformationController _transformationController = + TransformationController(); + + @override + void initState() { + super.initState(); + _currentIndex = widget.initialIndex; + _pageController = PageController(initialPage: widget.initialIndex); + } + + @override + void dispose() { + _pageController.dispose(); + _transformationController.dispose(); + super.dispose(); + } + + void _resetZoom() { + _transformationController.value = Matrix4.identity(); + } + + void _confirmDelete() { + showDialog( + context: context, + builder: (context) => AlertDialog( + backgroundColor: Colors.grey.shade900, + title: const Text( + 'Delete Photo', + style: TextStyle(color: Colors.white), + ), + content: Text( + 'Are you sure you want to delete this photo?', + style: TextStyle(color: Colors.grey.shade300), + ), + actions: [ + TextButton( + onPressed: () => Navigator.pop(context), + child: Text( + 'Cancel', + style: TextStyle(color: Colors.grey.shade400), + ), + ), + FilledButton( + onPressed: () { + Navigator.pop(context); + _deleteCurrentPhoto(); + }, + style: FilledButton.styleFrom(backgroundColor: Colors.red), + child: const Text('Delete'), + ), + ], + ), + ); + } + + Future _deleteCurrentPhoto() async { + if (widget.onDelete != null) { + await widget.onDelete!(_currentIndex); + + if (widget.imagePaths.length <= 1) { + if (mounted) { + Navigator.pop(context); + } + } else { + if (_currentIndex >= widget.imagePaths.length - 1) { + setState(() { + _currentIndex = widget.imagePaths.length - 2; + }); + _pageController.jumpToPage(_currentIndex); + } + } + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.black, + extendBody: true, + appBar: AppBar( + backgroundColor: Colors.black.withValues(alpha: 0.5), + elevation: 0, + leading: IconButton( + icon: const Icon(Icons.close), + color: Colors.white, + onPressed: () => Navigator.pop(context), + ), + actions: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6), + decoration: BoxDecoration( + color: Colors.white.withValues(alpha: 0.2), + borderRadius: BorderRadius.circular(20), + ), + child: Text( + '${_currentIndex + 1} / ${widget.imagePaths.length}', + style: const TextStyle( + color: Colors.white, + fontSize: 14, + fontWeight: FontWeight.w500, + ), + ), + ), + ), + ], + ), + body: Stack( + children: [ + PageView.builder( + controller: _pageController, + onPageChanged: (index) { + _resetZoom(); + setState(() { + _currentIndex = index; + }); + }, + itemCount: widget.imagePaths.length, + itemBuilder: (context, index) { + return InteractiveViewer( + transformationController: _transformationController, + minScale: 0.5, + maxScale: 5.0, + panEnabled: true, + scaleEnabled: true, + child: Center( + child: Hero( + tag: 'photo_${widget.imagePaths[index]}', + child: CloudinaryImageWidget( + imagePath: widget.imagePaths[index], + fit: BoxFit.contain, + ), + ), + ), + ); + }, + ), + if (widget.imagePaths.length > 1) + Positioned( + bottom: 120, + left: 0, + right: 0, + child: Center( + child: Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 8, + ), + decoration: BoxDecoration( + color: Colors.black.withValues(alpha: 0.6), + borderRadius: BorderRadius.circular(20), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: List.generate( + widget.imagePaths.length > 10 + ? 10 + : widget.imagePaths.length, + (index) { + if (index == 9 && widget.imagePaths.length > 10) { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 2), + child: Text( + '...', + style: TextStyle( + color: Colors.white.withValues(alpha: 0.5), + fontSize: 16, + ), + ), + ); + } + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 2), + child: Container( + width: 6, + height: 6, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: _currentIndex == index + ? Colors.white + : Colors.white.withValues(alpha: 0.4), + ), + ), + ); + }, + ), + ), + ), + ), + ), + ], + ), + bottomNavigationBar: Container( + decoration: BoxDecoration( + color: Colors.black.withValues(alpha: 0.5), + boxShadow: [ + BoxShadow( + color: Colors.black.withValues(alpha: 0.3), + blurRadius: 8, + offset: const Offset(0, -2), + ), + ], + ), + child: SafeArea( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + IconButton( + icon: const Icon(Icons.share_outlined), + color: Colors.white, + onPressed: () {}, + tooltip: 'Share', + ), + IconButton( + icon: const Icon(Icons.zoom_out_map), + color: Colors.white, + onPressed: _resetZoom, + tooltip: 'Reset Zoom', + ), + IconButton( + icon: const Icon(Icons.favorite_border), + color: Colors.white, + onPressed: () {}, + tooltip: 'Favorite', + ), + IconButton( + icon: const Icon(Icons.delete_outline), + color: Colors.white, + onPressed: widget.onDelete != null ? _confirmDelete : null, + tooltip: 'Delete', + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/example/memories/lib/services/cloudinary_service.dart b/example/memories/lib/services/cloudinary_service.dart new file mode 100644 index 0000000..9e91993 --- /dev/null +++ b/example/memories/lib/services/cloudinary_service.dart @@ -0,0 +1,192 @@ +import 'dart:convert'; +import 'dart:io'; +import 'package:crypto/crypto.dart'; +import 'package:flutter/material.dart'; +import 'package:http/http.dart' as http; + +class CloudinaryService { + static final CloudinaryService _instance = CloudinaryService._internal(); + factory CloudinaryService() => _instance; + CloudinaryService._internal(); + + String? _cloudName; + String? _uploadPreset; + String? _apiKey; + String? _apiSecret; + bool _initialized = false; + + void initialize({ + required String cloudName, + required String uploadPreset, + String? apiKey, + String? apiSecret, + }) { + _cloudName = cloudName; + _uploadPreset = uploadPreset; + _apiKey = apiKey; + _apiSecret = apiSecret; + _initialized = true; + } + + Future uploadImage( + File imageFile, { + Function(double)? onProgress, + }) async { + if (!_initialized || _cloudName == null || _uploadPreset == null) { + throw Exception('Cloudinary not initialized. Call initialize() first.'); + } + + try { + final url = Uri.parse( + 'https://api.cloudinary.com/v1_1/$_cloudName/image/upload', + ); + + final request = http.MultipartRequest('POST', url); + + request.fields['upload_preset'] = _uploadPreset!; + request.fields['folder'] = 'memories'; + + final file = await http.MultipartFile.fromPath('file', imageFile.path); + + request.files.add(file); + + final streamedResponse = await request.send(); + final response = await http.Response.fromStream(streamedResponse); + + if (response.statusCode == 200) { + final jsonResponse = json.decode(response.body); + return jsonResponse['secure_url'] as String?; + } else { + return null; + } + } catch (e) { + return null; + } + } + + Future> uploadMultipleImages( + List imageFiles, { + Function(int current, int total)? onProgress, + }) async { + final List uploadedUrls = []; + + for (int i = 0; i < imageFiles.length; i++) { + if (onProgress != null) { + onProgress(i + 1, imageFiles.length); + } + + final url = await uploadImage(imageFiles[i]); + if (url != null) { + uploadedUrls.add(url); + } + } + + return uploadedUrls; + } + + Future deleteImage(String imageUrl) async { + if (!_initialized || _cloudName == null) { + throw Exception('Cloudinary not initialized. Call initialize() first.'); + } + + if (_apiKey == null || _apiSecret == null) { + return false; + } + + try { + final publicId = getPublicIdFromUrl(imageUrl); + if (publicId.isEmpty) return false; + + final timestamp = DateTime.now().millisecondsSinceEpoch ~/ 1000; + final signature = _generateSignature(publicId, timestamp); + + final url = Uri.parse( + 'https://api.cloudinary.com/v1_1/$_cloudName/image/destroy', + ); + + final response = await http.post( + url, + body: { + 'public_id': publicId, + 'timestamp': timestamp.toString(), + 'api_key': _apiKey!, + 'signature': signature, + }, + ); + + if (response.statusCode == 200) { + final jsonResponse = json.decode(response.body); + return jsonResponse['result'] == 'ok'; + } + return false; + } catch (e) { + return false; + } + } + + String _generateSignature(String publicId, int timestamp) { + final toSign = 'public_id=$publicId×tamp=$timestamp$_apiSecret'; + final bytes = utf8.encode(toSign); + final hash = sha1.convert(bytes); + return hash.toString(); + } + + String getPublicIdFromUrl(String url) { + try { + final uri = Uri.parse(url); + final pathSegments = uri.pathSegments; + + final uploadIndex = pathSegments.indexOf('upload'); + if (uploadIndex != -1 && uploadIndex < pathSegments.length - 1) { + final publicIdWithExtension = pathSegments + .sublist(uploadIndex + 2) + .join('/'); + return publicIdWithExtension.split('.').first; + } + } catch (e) { + debugPrint('Error extracting public ID: $e'); + } + + return ''; + } + + bool isCloudinaryUrl(String path) { + return path.startsWith('http://') || path.startsWith('https://'); + } + + String getOptimizedUrl( + String url, { + int? width, + int? height, + String quality = 'auto', + }) { + if (!isCloudinaryUrl(url)) return url; + + try { + final transformations = []; + + if (width != null) transformations.add('w_$width'); + if (height != null) transformations.add('h_$height'); + transformations.add('q_$quality'); + transformations.add('f_auto'); + + final uri = Uri.parse(url); + final uploadIndex = uri.pathSegments.indexOf('upload'); + + if (uploadIndex != -1) { + final newSegments = List.from(uri.pathSegments); + newSegments.insert(uploadIndex + 1, transformations.join(',')); + + return Uri( + scheme: uri.scheme, + host: uri.host, + pathSegments: newSegments, + ).toString(); + } + } catch (e) { + debugPrint('Error optimizing URL: $e'); + } + + return url; + } +} diff --git a/example/memories/lib/services/storage_service.dart b/example/memories/lib/services/storage_service.dart new file mode 100644 index 0000000..c3aa713 --- /dev/null +++ b/example/memories/lib/services/storage_service.dart @@ -0,0 +1,28 @@ +import 'dart:convert'; +import 'package:shared_preferences/shared_preferences.dart'; +import '../models/memory.dart'; + +class StorageService { + static const String _memoriesKey = 'memories'; + + Future saveMemories(List memories) async { + final prefs = await SharedPreferences.getInstance(); + final memoriesJson = memories + .map((memory) => json.encode(memory.toJson())) + .toList(); + await prefs.setStringList(_memoriesKey, memoriesJson); + } + + Future> loadMemories() async { + final prefs = await SharedPreferences.getInstance(); + final memoriesJson = prefs.getStringList(_memoriesKey) ?? []; + return memoriesJson + .map((jsonStr) => Memory.fromJson(json.decode(jsonStr))) + .toList(); + } + + Future clearMemories() async { + final prefs = await SharedPreferences.getInstance(); + await prefs.remove(_memoriesKey); + } +} diff --git a/example/memories/lib/widgets/cloudinary_image.dart b/example/memories/lib/widgets/cloudinary_image.dart new file mode 100644 index 0000000..130ecd4 --- /dev/null +++ b/example/memories/lib/widgets/cloudinary_image.dart @@ -0,0 +1,81 @@ +import 'dart:io'; +import 'package:flutter/material.dart'; +import 'package:cached_network_image/cached_network_image.dart'; +import '../services/cloudinary_service.dart'; + +class CloudinaryImageWidget extends StatelessWidget { + final String imagePath; + final BoxFit fit; + final double? width; + final double? height; + + const CloudinaryImageWidget({ + super.key, + required this.imagePath, + this.fit = BoxFit.cover, + this.width, + this.height, + }); + + @override + Widget build(BuildContext context) { + final cloudinaryService = CloudinaryService(); + final isUrl = cloudinaryService.isCloudinaryUrl(imagePath); + + if (isUrl) { + return CachedNetworkImage( + imageUrl: imagePath, + fit: fit, + width: width, + height: height, + placeholder: (context, url) => Container( + width: width, + height: height, + color: Colors.grey.shade200, + child: const Center( + child: SizedBox( + width: 20, + height: 20, + child: CircularProgressIndicator(strokeWidth: 2), + ), + ), + ), + errorWidget: (context, url, error) { + return Container( + width: width, + height: height, + color: Colors.grey.shade300, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Icon(Icons.error_outline, color: Colors.red, size: 32), + const SizedBox(height: 8), + Text( + 'Failed to load', + style: TextStyle(fontSize: 10, color: Colors.grey.shade600), + ), + ], + ), + ); + }, + fadeInDuration: const Duration(milliseconds: 300), + fadeOutDuration: const Duration(milliseconds: 100), + ); + } else { + return Image.file( + File(imagePath), + width: width, + height: height, + fit: fit, + errorBuilder: (context, error, stackTrace) { + return Container( + width: width, + height: height, + color: Colors.grey.shade300, + child: const Icon(Icons.broken_image, color: Colors.red), + ); + }, + ); + } + } +} diff --git a/example/memories/lib/widgets/photo_grid.dart b/example/memories/lib/widgets/photo_grid.dart new file mode 100644 index 0000000..12b42b2 --- /dev/null +++ b/example/memories/lib/widgets/photo_grid.dart @@ -0,0 +1,250 @@ +import 'package:flutter/material.dart'; +import 'cloudinary_image.dart'; + +class PhotoGrid extends StatelessWidget { + final List imagePaths; + final Function(int index)? onImageTap; + + const PhotoGrid({super.key, required this.imagePaths, this.onImageTap}); + + @override + Widget build(BuildContext context) { + if (imagePaths.isEmpty) return const SizedBox.shrink(); + + final displayPaths = imagePaths.take(6).toList(); + final remaining = imagePaths.length > 6 ? imagePaths.length - 6 : 0; + + switch (displayPaths.length) { + case 1: + return _buildSingleImage(displayPaths[0], 0); + case 2: + return _buildTwoImages(displayPaths); + case 3: + return _buildThreeImages(displayPaths); + case 4: + return _buildFourImages(displayPaths); + case 5: + return _buildFiveImages(displayPaths); + default: + return _buildSixImages(displayPaths, remaining); + } + } + + Widget _buildSingleImage(String path, int index) { + return AspectRatio( + aspectRatio: 16 / 9, + child: _buildTappableImage(path, index, BoxFit.cover), + ); + } + + Widget _buildTwoImages(List paths) { + return SizedBox( + height: 240, + child: Row( + children: [ + Expanded(child: _buildTappableImage(paths[0], 0, BoxFit.cover)), + const SizedBox(width: 4), + Expanded(child: _buildTappableImage(paths[1], 1, BoxFit.cover)), + ], + ), + ); + } + + Widget _buildThreeImages(List paths) { + return SizedBox( + height: 240, + child: Row( + children: [ + Expanded( + flex: 2, + child: _buildTappableImage(paths[0], 0, BoxFit.cover), + ), + const SizedBox(width: 4), + Expanded( + child: Column( + children: [ + Expanded(child: _buildTappableImage(paths[1], 1, BoxFit.cover)), + const SizedBox(height: 4), + Expanded(child: _buildTappableImage(paths[2], 2, BoxFit.cover)), + ], + ), + ), + ], + ), + ); + } + + Widget _buildFourImages(List paths) { + return Column( + children: [ + SizedBox( + height: 180, + child: Row( + children: [ + Expanded( + flex: 2, + child: _buildTappableImage(paths[0], 0, BoxFit.cover), + ), + const SizedBox(width: 4), + Expanded( + child: Column( + children: [ + Expanded( + child: _buildTappableImage(paths[1], 1, BoxFit.cover), + ), + const SizedBox(height: 4), + Expanded( + child: _buildTappableImage(paths[2], 2, BoxFit.cover), + ), + ], + ), + ), + ], + ), + ), + const SizedBox(height: 4), + SizedBox( + height: 100, + child: _buildTappableImage(paths[3], 3, BoxFit.cover), + ), + ], + ); + } + + Widget _buildFiveImages(List paths) { + return Column( + children: [ + SizedBox( + height: 180, + child: Row( + children: [ + Expanded( + flex: 2, + child: _buildTappableImage(paths[0], 0, BoxFit.cover), + ), + const SizedBox(width: 4), + Expanded( + child: Column( + children: [ + Expanded( + child: _buildTappableImage(paths[1], 1, BoxFit.cover), + ), + const SizedBox(height: 4), + Expanded( + child: _buildTappableImage(paths[2], 2, BoxFit.cover), + ), + ], + ), + ), + ], + ), + ), + const SizedBox(height: 4), + SizedBox( + height: 100, + child: Row( + children: [ + Expanded(child: _buildTappableImage(paths[3], 3, BoxFit.cover)), + const SizedBox(width: 4), + Expanded(child: _buildTappableImage(paths[4], 4, BoxFit.cover)), + ], + ), + ), + ], + ); + } + + Widget _buildSixImages(List paths, int remaining) { + return Column( + children: [ + SizedBox( + height: 180, + child: Row( + children: [ + Expanded( + flex: 2, + child: _buildTappableImage(paths[0], 0, BoxFit.cover), + ), + const SizedBox(width: 4), + Expanded( + child: Column( + children: [ + Expanded( + child: _buildTappableImage(paths[1], 1, BoxFit.cover), + ), + const SizedBox(height: 4), + Expanded( + child: _buildTappableImage(paths[2], 2, BoxFit.cover), + ), + ], + ), + ), + ], + ), + ), + const SizedBox(height: 4), + SizedBox( + height: 90, + child: Row( + children: [ + Expanded(child: _buildTappableImage(paths[3], 3, BoxFit.cover)), + const SizedBox(width: 4), + Expanded(child: _buildTappableImage(paths[4], 4, BoxFit.cover)), + const SizedBox(width: 4), + Expanded(child: _buildImageWithOverlay(paths[5], 5, remaining)), + ], + ), + ), + ], + ); + } + + Widget _buildTappableImage(String path, int index, BoxFit fit) { + return GestureDetector( + onTap: onImageTap != null ? () => onImageTap!(index) : null, + child: ClipRRect( + borderRadius: BorderRadius.circular(0), + child: CloudinaryImageWidget( + imagePath: path, + fit: fit, + width: double.infinity, + height: double.infinity, + ), + ), + ); + } + + Widget _buildImageWithOverlay(String path, int index, int remaining) { + return GestureDetector( + onTap: onImageTap != null ? () => onImageTap!(index) : null, + child: ClipRRect( + borderRadius: BorderRadius.circular(0), + child: Stack( + fit: StackFit.expand, + children: [ + CloudinaryImageWidget( + imagePath: path, + fit: BoxFit.cover, + width: double.infinity, + height: double.infinity, + ), + if (remaining > 0) + Container( + color: Colors.black.withValues(alpha: 0.6), + child: Center( + child: Text( + '+$remaining', + style: const TextStyle( + color: Colors.white, + fontSize: 24, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ], + ), + ), + ); + } +} diff --git a/example/memories/pubspec.yaml b/example/memories/pubspec.yaml new file mode 100644 index 0000000..a502a9b --- /dev/null +++ b/example/memories/pubspec.yaml @@ -0,0 +1,57 @@ +name: memories +description: "A simple photos app" +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 1.0.0+1 + +environment: + sdk: ^3.8.1 + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + + cupertino_icons: ^1.0.8 + image_picker: ^1.0.7 + path_provider: ^2.1.2 + intl: ^0.19.0 + shared_preferences: ^2.2.2 + cloudinary_flutter: ^1.3.0 + cloudinary_url_gen: ^1.8.0 + http: ^1.1.0 + cached_network_image: ^3.3.1 + crypto: ^3.0.3 + flutter_dotenv: ^5.1.0 + +dev_dependencies: + flutter_test: + sdk: flutter + + flutter_lints: ^5.0.0 + +flutter: + + uses-material-design: true + + assets: + - .env \ No newline at end of file diff --git a/example/memories/screenshots/add.jpg b/example/memories/screenshots/add.jpg new file mode 100644 index 0000000..b729863 Binary files /dev/null and b/example/memories/screenshots/add.jpg differ diff --git a/example/memories/screenshots/home.jpg b/example/memories/screenshots/home.jpg new file mode 100644 index 0000000..e80438b Binary files /dev/null and b/example/memories/screenshots/home.jpg differ diff --git a/example/memories/screenshots/view.jpg b/example/memories/screenshots/view.jpg new file mode 100644 index 0000000..1dc7551 Binary files /dev/null and b/example/memories/screenshots/view.jpg differ diff --git a/example/memories/test/widget_test.dart b/example/memories/test/widget_test.dart new file mode 100644 index 0000000..5c9ec4f --- /dev/null +++ b/example/memories/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:memories/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); + }); +}