基本完成

This commit is contained in:
zhutao
2025-08-28 16:27:56 +08:00
commit 5d7d233d2e
132 changed files with 6390 additions and 0 deletions

45
.gitignore vendored Normal file
View File

@@ -0,0 +1,45 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
migrate_working_dir/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.pub-cache/
.pub/
/build/
# Symbolication related
app.*.symbols
# Obfuscation related
app.*.map.json
# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release

33
.metadata Normal file
View File

@@ -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: "077b4a4ce10a07b82caa6897f0c626f9c0a3ac90"
channel: "stable"
project_type: app
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 077b4a4ce10a07b82caa6897f0c626f9c0a3ac90
base_revision: 077b4a4ce10a07b82caa6897f0c626f9c0a3ac90
- platform: android
create_revision: 077b4a4ce10a07b82caa6897f0c626f9c0a3ac90
base_revision: 077b4a4ce10a07b82caa6897f0c626f9c0a3ac90
- platform: ios
create_revision: 077b4a4ce10a07b82caa6897f0c626f9c0a3ac90
base_revision: 077b4a4ce10a07b82caa6897f0c626f9c0a3ac90
# 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'

16
README.md Normal file
View File

@@ -0,0 +1,16 @@
# food_health
A new Flutter project.
## Getting Started
This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project:
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.

30
analysis_options.yaml Normal file
View File

@@ -0,0 +1,30 @@
# 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
formatter:
trailing_commas: preserve

14
android/.gitignore vendored Normal file
View File

@@ -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

View File

@@ -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.curainhealth.food"
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.curainhealth.food"
// 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 = "../.."
}

View File

@@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET" />
</manifest>

View File

@@ -0,0 +1,45 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"
android:label="food_health">
<activity
android:name=".MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:exported="true"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:taskAffinity=""
android:theme="@style/LaunchTheme"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
<!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility and
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
<queries>
<intent>
<action android:name="android.intent.action.PROCESS_TEXT" />
<data android:mimeType="text/plain" />
</intent>
</queries>
</manifest>

View File

@@ -0,0 +1,5 @@
package com.curainhealth.food
import io.flutter.embedding.android.FlutterActivity
class MainActivity : FlutterActivity()

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?><!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:colorBackground" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?><!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>

View File

@@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET" />
</manifest>

21
android/build.gradle.kts Normal file
View File

@@ -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<Delete>("clean") {
delete(rootProject.layout.buildDirectory)
}

View File

@@ -0,0 +1,3 @@
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true

View File

@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.12-all.zip

View File

@@ -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")

BIN
assets/image/apple.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
assets/image/bg_hushi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 KiB

BIN
assets/image/empty_data.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
assets/image/google.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
assets/image/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

3
devtools_options.yaml Normal file
View File

@@ -0,0 +1,3 @@
description: This file stores settings for Dart & Flutter DevTools.
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
extensions:

34
ios/.gitignore vendored Normal file
View File

@@ -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

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>App</string>
<key>CFBundleIdentifier</key>
<string>io.flutter.flutter.app</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>App</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>12.0</string>
</dict>
</plist>

View File

@@ -0,0 +1 @@
#include "Generated.xcconfig"

View File

@@ -0,0 +1 @@
#include "Generated.xcconfig"

View File

@@ -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 = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
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 = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
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 = "<group>"; };
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
/* 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 = "<group>";
};
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
9740EEB31CF90195004384FC /* Generated.xcconfig */,
);
name = Flutter;
sourceTree = "<group>";
};
97C146E51CF9000F007C117D = {
isa = PBXGroup;
children = (
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
331C8082294A63A400263BE5 /* RunnerTests */,
);
sourceTree = "<group>";
};
97C146EF1CF9000F007C117D /* Products */ = {
isa = PBXGroup;
children = (
97C146EE1CF9000F007C117D /* Runner.app */,
331C8081294A63A400263BE5 /* RunnerTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
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 = "<group>";
};
/* 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 = "<group>";
};
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
97C147001CF9000F007C117D /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* 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.curainhealth.food;
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.curainhealth.food.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.curainhealth.food.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.curainhealth.food.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.curainhealth.food;
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.curainhealth.food;
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 */;
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>

View File

@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "331C8080294A63A400263BE5"
BuildableName = "RunnerTests.xctest"
BlueprintName = "RunnerTests"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
enableGPUValidationMode = "1"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Profile"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>

View File

@@ -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)
}
}

View File

@@ -0,0 +1,120 @@
{
"images": [
{
"size": "20x20",
"idiom": "universal",
"filename": "icon-20@2x.png",
"scale": "2x",
"platform": "ios"
},
{
"size": "20x20",
"idiom": "universal",
"filename": "icon-20@3x.png",
"scale": "3x",
"platform": "ios"
},
{
"size": "29x29",
"idiom": "universal",
"filename": "icon-29@2x.png",
"scale": "2x",
"platform": "ios"
},
{
"size": "29x29",
"idiom": "universal",
"filename": "icon-29@3x.png",
"scale": "3x",
"platform": "ios"
},
{
"size": "38x38",
"idiom": "universal",
"filename": "icon-38@2x.png",
"scale": "2x",
"platform": "ios"
},
{
"size": "38x38",
"idiom": "universal",
"filename": "icon-38@3x.png",
"scale": "3x",
"platform": "ios"
},
{
"size": "40x40",
"idiom": "universal",
"filename": "icon-40@2x.png",
"scale": "2x",
"platform": "ios"
},
{
"size": "40x40",
"idiom": "universal",
"filename": "icon-40@3x.png",
"scale": "3x",
"platform": "ios"
},
{
"size": "60x60",
"idiom": "universal",
"filename": "icon-60@2x.png",
"scale": "2x",
"platform": "ios"
},
{
"size": "60x60",
"idiom": "universal",
"filename": "icon-60@3x.png",
"scale": "3x",
"platform": "ios"
},
{
"size": "64x64",
"idiom": "universal",
"filename": "icon-64@2x.png",
"scale": "2x",
"platform": "ios"
},
{
"size": "64x64",
"idiom": "universal",
"filename": "icon-64@3x.png",
"scale": "3x",
"platform": "ios"
},
{
"size": "68x68",
"idiom": "universal",
"filename": "icon-68@2x.png",
"scale": "2x",
"platform": "ios"
},
{
"size": "76x76",
"idiom": "universal",
"filename": "icon-76@2x.png",
"scale": "2x",
"platform": "ios"
},
{
"size": "83.5x83.5",
"idiom": "universal",
"filename": "icon-83.5@2x.png",
"scale": "2x",
"platform": "ios"
},
{
"size": "1024x1024",
"idiom": "universal",
"filename": "icon-1024.png",
"scale": "1x",
"platform": "ios"
}
],
"info": {
"version": 1,
"author": "icon.wuruihong.com"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -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"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

View File

@@ -0,0 +1,8 @@
# 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.

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/>
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
</imageView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
<resources>
<image name="LaunchImage" width="168" height="185"/>
</resources>
</document>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--Flutter View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>

66
ios/Runner/Info.plist Normal file
View File

@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Demacare</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>derma_flutter</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<!-- Access Photo Library, used for selecting images for skin analysis -->
<key>NSPhotoLibraryUsageDescription</key>
<string>We need access to your photo library so you can upload photos for skin analysis.</string>
<!-- Access Camera, used for taking photos for skin analysis -->
<key>NSCameraUsageDescription</key>
<string>We need access to your camera so you can take photos for skin analysis.</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>com.googleusercontent.apps.512878764950-u703jdn6imu33rthp94dg7cl5vmrc7rf</string>
</array>
</dict>
</array>
</dict>
</plist>

View File

@@ -0,0 +1 @@
#import "GeneratedPluginRegistrant.h"

View File

@@ -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.
}
}

15
lib/api/dto/base_dto.dart Normal file
View File

@@ -0,0 +1,15 @@
class ApiDto<T> {
final int code;
final String message;
final T data;
ApiDto({required this.code, required this.message, required this.data});
factory ApiDto.fromJson(Map<String, dynamic> json) {
return ApiDto<T>(
code: json['code'],
message: json['message'],
data: json['data'],
);
}
}

View File

@@ -0,0 +1,49 @@
class FoodScanDto {
int? id;
String? foodName;
String? foodDesc;
List<String>? ingredientsList;
String? explanation;
String? suggestions;
List<String>? healthConcernsList;
int? foodType;
String? imageUrl;
FoodScanDto({
this.id,
this.foodName,
this.foodDesc,
this.ingredientsList,
this.explanation,
this.suggestions,
this.healthConcernsList,
this.foodType,
this.imageUrl,
});
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map["id"] = id;
map["food_name"] = foodName;
map["food_desc"] = foodDesc;
map["ingredients"] = ingredientsList;
map["explanation"] = explanation;
map["suggestions"] = suggestions;
map["health_concerns"] = healthConcernsList;
map["food_type"] = foodType;
map["image_url"] = imageUrl;
return map;
}
FoodScanDto.fromJson(dynamic json) {
id = json["id"] ?? 0;
foodName = json["food_name"] ?? "";
foodDesc = json["food_desc"] ?? "";
ingredientsList = json["ingredients"] != null ? json["ingredients"].cast<String>() : [];
explanation = json["explanation"] ?? "";
suggestions = json["suggestions"] ?? "";
healthConcernsList = json["health_concerns"] != null ? json["health_concerns"].cast<String>() : [];
foodType = json["food_type"] ?? 0;
imageUrl = json["image_url"] ?? "";
}
}

View File

@@ -0,0 +1,86 @@
class UserInfo {
int? id;
String? name;
dynamic avatar;
String? email;
dynamic emailVerifiedAt;
dynamic googleId;
dynamic appleId;
String? lastLoginIp;
String? lastLoginTime;
dynamic lastUsedTime;
int? status;
String? createdAt;
String? updatedAt;
UserInfo({
this.id,
this.name,
this.avatar,
this.email,
this.emailVerifiedAt,
this.googleId,
this.appleId,
this.lastLoginIp,
this.lastLoginTime,
this.lastUsedTime,
this.status,
this.createdAt,
this.updatedAt,
});
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map["id"] = id;
map["name"] = name;
map["avatar"] = avatar;
map["email"] = email;
map["email_verified_at"] = emailVerifiedAt;
map["google_id"] = googleId;
map["apple_id"] = appleId;
map["last_login_ip"] = lastLoginIp;
map["last_login_time"] = lastLoginTime;
map["last_used_time"] = lastUsedTime;
map["status"] = status;
map["created_at"] = createdAt;
map["updated_at"] = updatedAt;
return map;
}
UserInfo.fromJson(dynamic json) {
id = json["id"] ?? 0;
name = json["name"] ?? "";
avatar = json["avatar"];
email = json["email"] ?? "";
emailVerifiedAt = json["email_verified_at"];
googleId = json["google_id"];
appleId = json["apple_id"];
lastLoginIp = json["last_login_ip"] ?? "";
lastLoginTime = json["last_login_time"] ?? "";
lastUsedTime = json["last_used_time"];
status = json["status"] ?? 0;
createdAt = json["created_at"] ?? "";
updatedAt = json["updated_at"] ?? "";
}
}
class LoginDto {
String? accessToken;
UserInfo? userInfo;
LoginDto({this.accessToken, this.userInfo});
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map["accessToken"] = accessToken;
if (userInfo != null) {
map["userInfo"] = userInfo?.toJson();
}
return map;
}
LoginDto.fromJson(dynamic json) {
accessToken = json["accessToken"] ?? "";
userInfo = json["userInfo"] != null ? UserInfo.fromJson(json["userInfo"]) : null;
}
}

View File

@@ -0,0 +1,18 @@
class ProfileOptionDto {
String? key;
List<String>? valuesList;
ProfileOptionDto({this.key, this.valuesList});
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map["key"] = key;
map["values"] = valuesList;
return map;
}
ProfileOptionDto.fromJson(dynamic json) {
key = json["key"] ?? "";
valuesList = json["values"] != null ? json["values"].cast<String>() : [];
}
}

View File

@@ -0,0 +1,58 @@
class UserProfileDto {
num id;
String name;
String email;
String avatar;
String ageRange;
List<String> foodAllergiesList;
List<String> dietaryPreferencesList;
List<String> medicalInformationList;
List<String> currentMedicationsList;
String activityLevel;
UserProfileDto({
this.id = 0,
this.name = "",
this.email = "",
this.avatar = "",
this.ageRange = "",
List<String>? foodAllergiesList,
List<String>? dietaryPreferencesList,
List<String>? medicalInformationList,
List<String>? currentMedicationsList,
this.activityLevel = "",
}) : foodAllergiesList = foodAllergiesList ?? [],
dietaryPreferencesList = dietaryPreferencesList ?? [],
medicalInformationList = medicalInformationList ?? [],
currentMedicationsList = currentMedicationsList ?? [];
Map<String, dynamic> toJson() {
return {
"id": id,
"name": name,
"email": email,
"avatar": avatar,
"age_range": ageRange,
"food_allergies": foodAllergiesList,
"dietary_preferences": dietaryPreferencesList,
"medical_information": medicalInformationList,
"current_medications": currentMedicationsList,
"activity_level": activityLevel,
};
}
factory UserProfileDto.fromJson(Map<String, dynamic> json) {
return UserProfileDto(
id: json["id"] ?? 0,
name: json["name"] ?? "",
email: json["email"] ?? "",
avatar: json["avatar"] ?? "",
ageRange: json["age_range"] ?? "",
foodAllergiesList: (json["food_allergies"] as List?)?.cast<String>() ?? [],
dietaryPreferencesList: (json["dietary_preferences"] as List?)?.cast<String>() ?? [],
medicalInformationList: (json["medical_information"] as List?)?.cast<String>() ?? [],
currentMedicationsList: (json["current_medications"] as List?)?.cast<String>() ?? [],
activityLevel: json["activity_level"] ?? "",
);
}
}

View File

@@ -0,0 +1,23 @@
import 'package:dio/dio.dart';
import 'package:food_health/api/dto/food_scan_dto.dart';
import '../network/request.dart';
///食物检测
Future<FoodScanDto> foodScanApi(List<int> bytes) async {
FormData formData = FormData.fromMap({
"food_image": MultipartFile.fromBytes(
bytes,
filename: "upload.jpg",
contentType: DioMediaType("image", "jpeg"),
),
});
var res = await Request().post("/food/scan", formData);
return FoodScanDto.fromJson(res);
}
///食物检测列表
Future<List<FoodScanDto>> foodScanListApi() async {
var res = await Request().get("/food/records");
return res['list'].map<FoodScanDto>((e) => FoodScanDto.fromJson(e)).toList();
}

View File

@@ -0,0 +1,27 @@
import 'package:food_health/api/dto/profile_options_dto.dart';
import 'package:food_health/api/dto/user_profile_dto.dart';
import 'package:food_health/api/network/request.dart';
///获取用户档案
Future<UserProfileDto> getUserProfileApi() async {
var res = await Request().get("/user/profile");
return UserProfileDto.fromJson(res);
}
///获取档案选项
Future<List<ProfileOptionDto>> getProfileOptionsApi() async {
var res = await Request().get("/user/get_user_profile_options");
return (res as List).map((e) => ProfileOptionDto.fromJson(e)).toList();
}
///更新档案
Future<void> updateProfileApi(UserProfileDto userProfile) async {
await Request().post("/user/update_profile", {
"age_range": userProfile.ageRange,
"food_allergies": userProfile.foodAllergiesList,
"dietary_preferences": userProfile.dietaryPreferencesList,
"medical_information": userProfile.medicalInformationList,
"current_medications": userProfile.currentMedicationsList,
"activity_level": userProfile.activityLevel,
});
}

View File

@@ -0,0 +1,49 @@
import 'package:food_health/api/dto/login_dto.dart';
import 'package:food_health/api/network/request.dart';
import 'package:food_health/data/models/other_login_type.dart';
///检查是否注册
Future<bool> checkRegisterApi(String email) async {
var res = await Request().post("/auth/email_check", {
"email": email,
});
if (res["next"] == "login") {
return true;
}
return false;
}
///邮箱密码登陆
Future<LoginDto> loginApi(String email, String password) async {
var res = await Request().post("/auth/login/account", {
"email": email,
"password": password,
});
return LoginDto.fromJson(res);
}
///注册处
Future<LoginDto> registerApi(String email, String password, String code) async {
var res = await Request().post("/auth/register", {
"email": email,
"password": password,
"email_code": code,
});
return LoginDto.fromJson(res);
}
///发送邮箱验证码
Future<void> sendEmailCodeApi(String email) async {
return Request().post("/send_email_code", {
"email": email,
});
}
///三方登录
Future<LoginDto> thirdLoginApi(String token, OtherLoginType type) async {
var res = await Request().post("/auth/login/oauth", {
"login_token": token,
"login_type": type.value,
});
return LoginDto.fromJson(res);
}

View File

@@ -0,0 +1,64 @@
import 'package:dio/dio.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import '../../providers/app_store.dart';
import '../dto/base_dto.dart';
///请求拦截器
void onRequest(
RequestOptions options,
RequestInterceptorHandler handler,
) async {
String token = await AppStore.getToken();
options.headers['Authorization'] = 'Bearer $token';
return handler.next(options);
}
///响应拦截器
void onResponse(
Response<dynamic> response,
ResponseInterceptorHandler handler,
) {
var apiResponse = ApiDto.fromJson(response.data);
if (apiResponse.code == 1) {
response.data = apiResponse.data;
return handler.next(response);
} else {
showError(apiResponse.message);
handler.reject(
DioException(
requestOptions: response.requestOptions,
response: response,
error: {'code': 0, 'message': apiResponse.message},
),
);
}
}
///错误响应
void onError(
DioException e,
ErrorInterceptorHandler handler,
) {
var title = "";
if (e.type == DioExceptionType.connectionTimeout) {
title = "请求超时";
} else if (e.type == DioExceptionType.badResponse) {
if (e.response?.statusCode == 404) {
title = "接口404不存在";
} else {
title = "500";
}
} else if (e.type == DioExceptionType.connectionError) {
title = "网络连接失败";
} else {
title = "异常其他错误";
}
showError(title);
handler.next(e);
}
///显示错误信息
void showError(String message) {
EasyLoading.showError(message);
}

View File

@@ -0,0 +1,46 @@
import 'package:dio/dio.dart';
import '../../config/env.dart';
import 'interceptor.dart';
class Request {
static final Request _instance = Request._internal();
static Dio _dio = Dio();
//返回单例
factory Request() {
return _instance;
}
//初始化
Request._internal() {
//创建基本配置
final BaseOptions options = BaseOptions(
baseUrl: Config.baseUrl(),
connectTimeout: const Duration(seconds: 30),
receiveTimeout: const Duration(seconds: 30),
);
_dio = Dio(options);
_dio.interceptors.add(
InterceptorsWrapper(
onRequest: onRequest,
onResponse: onResponse,
onError: onError,
),
);
}
///get请求
Future<T> get<T>(String path, [Map<String, dynamic>? params]) async {
var res = await _dio.get(path, queryParameters: params);
return res.data;
}
///post请求
Future<dynamic> post(String path, Object? data) async {
var res = await _dio.post(path, data: data);
return res.data;
}
}

14
lib/api/network/safe.dart Normal file
View File

@@ -0,0 +1,14 @@
import 'package:dio/dio.dart';
/// 网络请求的错误处理封装
Future<T> safeRequest<T>(
Future<T> request, {
void Function(DioException error)? onError,
}) async {
try {
return await request;
} on DioException catch (e) {
onError?.call(e); // 额外 hook
rethrow; // 继续往上传
}
}

View File

@@ -0,0 +1,23 @@
import 'package:flutter/material.dart';
class AppContext {
static late BuildContext _context;
AppContext._();
///私有构造函数,防止外部实例化
static void setContent(BuildContext context) {
_context = context;
}
///获取全局上下文
static BuildContext get context => _context;
///获取主题
static TextTheme get textTheme => Theme.of(_context).textTheme;
static ColorScheme get colorScheme => Theme.of(_context).colorScheme;
///页面内间距
static double get pagePadding => 15;
}

19
lib/config/env.dart Normal file
View File

@@ -0,0 +1,19 @@
///环境配置
class Config {
Config._();
///获取环境
static String getEnv() {
const env = String.fromEnvironment('ENV', defaultValue: 'dev');
return env;
}
///获取接口地址
static String baseUrl() {
if (getEnv() == 'dev') {
return 'https://food-api.curain.ai/api';
} else {
return 'https://food-api.curain.ai/api';
}
}
}

View File

@@ -0,0 +1,14 @@
import 'package:flutter/material.dart';
///扩展颜色
extension CustomColors on ColorScheme {
Color get success => const Color(0xff57be80);
Color get warning => const Color(0xffff9800);
Color get info => const Color(0xff909399);
Color get danger => const Color(0xfff44545);
Color get primaryEnd => const Color(0xff06b6d4);
}

View File

@@ -0,0 +1,30 @@
import 'package:flutter/material.dart';
///颜色
final scheme = ColorScheme.fromSeed(
primary: Color(0xff3784f1),
seedColor: Color(0xff3885f2),
brightness: Brightness.light,
//卡片色
surface: Colors.white,
surfaceContainerLow: Color(0xFFF4F8FB),
surfaceContainer: Color(0xFFE9ECF3),
surfaceContainerHigh: Color(0xFFDDE2EA),
//颜色
onSurfaceVariant: Color(0xFF828282),
shadow: Color.fromRGBO(0, 0, 0, 0.1),
);
///字体
final textTheme = TextTheme(
titleLarge: TextStyle(fontSize: 24, fontWeight: FontWeight.w700, color: scheme.onSurface),
titleMedium: TextStyle(fontSize: 20, fontWeight: FontWeight.w700, color: scheme.onSurface),
titleSmall: TextStyle(fontSize: 16, fontWeight: FontWeight.w700, color: scheme.onSurface),
bodyLarge: TextStyle(fontSize: 18),
bodyMedium: TextStyle(fontSize: 16),
bodySmall: TextStyle(fontSize: 14),
labelLarge: TextStyle(fontSize: 16, color: scheme.onSurfaceVariant),
labelMedium: TextStyle(fontSize: 14, color: scheme.onSurfaceVariant),
labelSmall: TextStyle(fontSize: 12, color: scheme.onSurfaceVariant),
);

View File

@@ -0,0 +1,48 @@
import 'dart:convert';
import 'package:shared_preferences/shared_preferences.dart';
class Storage {
//存储数据
static Future<void> set(String key, dynamic value) async {
SharedPreferences sp = await SharedPreferences.getInstance();
if (value is String) {
sp.setString(key, value);
} else if (value is int) {
sp.setInt(key, value);
} else if (value is bool) {
sp.setBool(key, value);
} else if (value is double) {
sp.setDouble(key, value);
} else if (value is Map) {
String jsonStr = jsonEncode(value);
sp.setString(key, jsonStr);
}
}
//获取数据
static Future<dynamic> get(String key) async {
SharedPreferences sp = await SharedPreferences.getInstance();
var value = sp.get(key);
if (value is String) {
try {
return jsonDecode(value);
} catch (e) {
return value;
}
}
return value;
}
//删除数据
static Future<void> remove(key) async {
SharedPreferences sp = await SharedPreferences.getInstance();
sp.remove(key);
}
//判断键是否存在
static Future<bool> hasKey(String key) async {
SharedPreferences sp = await SharedPreferences.getInstance();
return sp.containsKey(key);
}
}

View File

@@ -0,0 +1,8 @@
enum OtherLoginType {
google('google'),
apple('apple');
const OtherLoginType(this.value);
final String value;
}

View File

@@ -0,0 +1,22 @@
enum SkinCheckStatus {
/// 正常
normal(1),
/// 警告
warning(2),
/// 危险
danger(3),
/// 未知
unknown(0);
final int value;
const SkinCheckStatus(this.value);
/// 根据 int 值返回对应的枚举,默认返回 online
static SkinCheckStatus fromValue(int value) {
return SkinCheckStatus.values.firstWhere((e) => e.value == value, orElse: () => SkinCheckStatus.unknown);
}
}

View File

@@ -0,0 +1,65 @@
import 'package:flutter/material.dart';
import 'package:remixicon/remixicon.dart';
import '../page/home/home_page.dart';
import '../page/profile/my/my_page.dart';
import '../page/record/list/record_list_page.dart';
import 'tabbar.dart';
class LayoutPage extends StatefulWidget {
const LayoutPage({super.key});
@override
State<LayoutPage> createState() => _LayoutPageState();
}
class _LayoutPageState extends State<LayoutPage> {
///分页
final PageController _pageController = PageController(initialPage: 0);
int get currentPage {
if (!_pageController.hasClients) return 1; // 没 attach 直接 0
return _pageController.page?.round() ?? 1;
}
//TabBar列表
final List<PageItem> _pages = [
PageItem(
name: "Home",
icon: RemixIcons.home_2_line,
page: HomePage(),
),
PageItem(name: "record", icon: RemixIcons.history_line, page: RecordListPage()),
PageItem(
name: "Home",
icon: RemixIcons.book_open_line,
page: MyPage(),
),
];
@override
Widget build(BuildContext context) {
return Scaffold(
body: PageView(
controller: _pageController,
physics: const NeverScrollableScrollPhysics(),
children: _pages.map((item) => item.page).toList(),
),
bottomNavigationBar: BottomNavigationBar(
currentIndex: currentPage,
onTap: (index) {
_pageController.jumpToPage(index);
setState(() {});
},
items: _pages.map((item) {
return BottomNavigationBarItem(
icon: Icon(item.icon),
label: item.name,
);
}).toList(),
showSelectedLabels: false,
showUnselectedLabels: false,
),
);
}
}

9
lib/layout/tabbar.dart Normal file
View File

@@ -0,0 +1,9 @@
import 'package:flutter/material.dart';
class PageItem {
final String name;
final IconData icon;
final Widget page;
PageItem({required this.name, required this.icon, required this.page});
}

55
lib/main.dart Normal file
View File

@@ -0,0 +1,55 @@
import 'package:food_health/router/routes.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:provider/provider.dart';
import 'config/theme/theme.dart';
import 'providers/app_store.dart';
void main() {
runApp(
MultiProvider(
providers: [
ChangeNotifierProvider(create: (context) => AppStore()),
],
child: MyApp(),
),
);
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return ScreenUtilInit(
designSize: const Size(375, 694),
useInheritedMediaQuery: true,
child: MaterialApp.router(
debugShowCheckedModeBanner: false,
routerConfig: goRouter,
localizationsDelegates: [],
themeMode: ThemeMode.light,
theme: ThemeData(
useMaterial3: true,
colorScheme: scheme,
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
backgroundColor: scheme.primary,
foregroundColor: scheme.onPrimary,
),
),
textTheme: textTheme,
scaffoldBackgroundColor: Color(0xffFAFAFE),
appBarTheme: AppBarTheme(
backgroundColor: scheme.surface,
scrolledUnderElevation: 0,
titleTextStyle: textTheme.titleMedium,
),
),
builder: EasyLoading.init(),
),
);
}
}

View File

@@ -0,0 +1,30 @@
import 'package:food_health/page/home/widget/home_header.dart';
import 'package:flutter/material.dart';
import '../../widgets/common/app_backend.dart';
import '../../widgets/common/app_header.dart';
import 'widget/upload_panel.dart';
class HomePage extends StatefulWidget {
const HomePage({super.key});
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
@override
Widget build(BuildContext context) {
super.build(context);
return Scaffold(
resizeToAvoidBottomInset: false,
body: AppBackend(
child: ListView(
children: [AppHeader(), HomeHeader(), UploadPanel()],
),
),
);
}
@override
bool get wantKeepAlive => true;
}

View File

@@ -0,0 +1,28 @@
import 'package:flutter/material.dart';
class HomeHeader extends StatelessWidget {
const HomeHeader({super.key});
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(top: 30, bottom: 40),
child: Column(
children: [
Text(
"Food Safety Scanner",
style: Theme.of(context).textTheme.titleLarge,
),
Container(
margin: EdgeInsets.only(top: 10),
child: Text(
"Upload a photo to check if this food is safe for you",
style: Theme.of(context).textTheme.labelMedium,
textAlign: TextAlign.center,
),
),
],
),
);
}
}

View File

@@ -0,0 +1,193 @@
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_image_compress/flutter_image_compress.dart';
import 'package:food_health/api/endpoints/food_api.dart';
import 'package:food_health/config/theme/custom_colors.dart';
import 'package:food_health/router/config/route_paths.dart';
import 'package:go_router/go_router.dart';
import 'package:image_picker/image_picker.dart';
import 'package:remixicon/remixicon.dart';
class UploadPanel extends StatefulWidget {
const UploadPanel({super.key});
@override
State<UploadPanel> createState() => _UploadPanelState();
}
class _UploadPanelState extends State<UploadPanel> {
final ImagePicker _picker = ImagePicker();
///打开相机拍照
void _handTakePhoto() async {
var photo = await _picker.pickImage(source: ImageSource.camera);
if (photo != null) {
_startDetect(photo.path);
}
}
///选择图片
void _handPickImage() async {
var result = await FilePicker.platform.pickFiles(
type: FileType.image,
allowMultiple: false,
);
if (result != null) {
_startDetect(result.files[0].path!);
}
}
///开始检测
void _startDetect(String path) async {
//压缩
final result = await FlutterImageCompress.compressWithFile(
path,
minWidth: 1080,
minHeight: 1920,
quality: 85,
rotate: 0,
);
EasyLoading.show(
status: 'Checking, please wait...',
maskType: EasyLoadingMaskType.clear,
);
var res = await foodScanApi(result!);
EasyLoading.dismiss();
context.push(RoutePaths.detail, extra: res);
}
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.all(15),
decoration: BoxDecoration(
color: Theme.of(context).cardColor,
borderRadius: BorderRadius.circular(10),
boxShadow: [
BoxShadow(
color: Color(0x1A000000),
spreadRadius: 2,
blurRadius: 5,
offset: Offset(1, 2),
),
],
),
child: Container(
padding: EdgeInsets.all(30),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border.all(
color: Theme.of(context).colorScheme.surfaceContainer,
width: 1,
),
),
child: Column(
children: [
Container(
width: 70,
height: 70,
margin: EdgeInsets.only(bottom: 20),
decoration: BoxDecoration(
shape: BoxShape.circle,
gradient: LinearGradient(
colors: [
Theme.of(context).colorScheme.primary,
Theme.of(context).colorScheme.primaryEnd,
],
),
),
child: Icon(
RemixIcons.image_line,
color: Colors.white,
size: 26,
),
),
Text(
"Upload Food Photo",
style: Theme.of(context).textTheme.titleMedium,
),
Container(
margin: EdgeInsets.only(top: 5),
child: Text(
"Take a clear photo of your food and we'll analyze it for safety based on your health profile",
style: Theme.of(context).textTheme.bodySmall,
textAlign: TextAlign.center,
),
),
Container(
margin: EdgeInsets.only(top: 40, bottom: 20),
child: Column(
spacing: 20,
children: [
_buttonItem(
title: "Take Photo",
icon: RemixIcons.camera_line,
style: BoxDecoration(
gradient: LinearGradient(
colors: [
Theme.of(context).colorScheme.primary,
Theme.of(context).colorScheme.primaryEnd,
],
),
),
onTap: () {
_handTakePhoto();
},
),
_buttonItem(
title: "Upload File",
icon: RemixIcons.upload_2_line,
color: Colors.black,
style: BoxDecoration(
color: Theme.of(context).colorScheme.surfaceContainer,
),
onTap: () {
_handPickImage();
},
),
],
),
),
Text(
"Supports JPG, PNG, HEIC formats • Max 10MB",
style: Theme.of(context).textTheme.labelSmall,
textAlign: TextAlign.center,
),
],
),
),
);
}
Widget _buttonItem({
required String title,
required IconData icon,
Color color = Colors.white,
required BoxDecoration style,
required VoidCallback onTap,
}) {
return InkWell(
onTap: onTap,
child: Container(
width: 170,
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 15),
decoration: style.copyWith(
borderRadius: BorderRadius.circular(10),
),
child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
spacing: 10,
children: [
Icon(icon, color: color, size: 20),
Text(
title,
style: TextStyle(color: color),
),
],
),
),
);
}
}

View File

@@ -0,0 +1,25 @@
import 'package:flutter/material.dart';
import 'package:food_health/api/dto/user_profile_dto.dart';
class SelectionState extends ChangeNotifier {
UserProfileDto userProfile = UserProfileDto();
SelectionState(this.userProfile);
void update(void Function(UserProfileDto) updater) {
updater(userProfile);
notifyListeners();
}
}
class SelectionProvider extends InheritedNotifier<SelectionState> {
const SelectionProvider({
super.key,
required SelectionState super.notifier,
required super.child,
});
static SelectionState of(BuildContext context) {
return context.dependOnInheritedWidgetOfExactType<SelectionProvider>()!.notifier!;
}
}

View File

@@ -0,0 +1,292 @@
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:food_health/api/dto/profile_options_dto.dart';
import 'package:food_health/api/dto/user_profile_dto.dart';
import 'package:food_health/api/endpoints/profile_api.dart';
import 'package:food_health/config/theme/custom_colors.dart';
import 'package:food_health/page/profile/edit/widget/food_allergies.dart';
import 'package:food_health/widgets/common/app_backend.dart';
import 'package:go_router/go_router.dart';
import 'package:remixicon/remixicon.dart';
import 'data/state.dart';
import 'widget/dietary_preferences.dart';
import 'widget/health_profile.dart';
class MyEditPage extends StatefulWidget {
final UserProfileDto userProfile;
const MyEditPage({super.key, required this.userProfile});
@override
State<MyEditPage> createState() => _MyEditPageState();
}
class _MyEditPageState extends State<MyEditPage> {
late SelectionState selectionState;
List<ProfileOptionDto> _options = [];
var _loading = true;
///步骤
var _step = 0;
var stepList = [
StepItem(
title: "Food Allergies",
icon: RemixIcons.shield_line,
subTitle: "Help us keep you safe by telling us about your allergies",
),
StepItem(
title: "Dietary Preferences",
icon: RemixIcons.heart_line,
subTitle: "What dietary restrictions or preferences do you follow?",
),
StepItem(
title: "Health Profile",
icon: RemixIcons.user_line,
subTitle: "Share relevant health information for personalized recommendations",
),
];
@override
void initState() {
super.initState();
_init();
}
void _init() async {
selectionState = SelectionState(widget.userProfile);
var res = await getProfileOptionsApi();
setState(() {
_options = res;
_loading = false;
});
}
///设置步骤
void _handStep(bool isNext) {
if (_step == 2 && isNext) {
_submit();
return;
}
setState(() {
_step = (_step + (isNext ? 1 : -1)).clamp(0, 2);
});
}
void _submit() async {
EasyLoading.show(
status: 'Saving…',
maskType: EasyLoadingMaskType.clear,
);
await updateProfileApi(selectionState.userProfile);
EasyLoading.dismiss();
context.pop();
}
@override
Widget build(BuildContext context) {
if (_loading) {
return Center(child: CircularProgressIndicator());
}
return Scaffold(
body: AppBackend(
child: ListView(
padding: EdgeInsets.only(top: 30),
children: [
buildHeader(),
buildStep(),
buildStepInfo(),
SelectionProvider(
notifier: selectionState,
child: Builder(
builder: (context) {
if (_step == 0) {
return FoodAllergies(
options: _options,
);
} else if (_step == 1) {
return DietaryPreferences(
options: _options,
);
} else if (_step == 2) {
return HealthProfile(
options: _options,
);
}
return SizedBox();
},
),
),
Container(
margin: EdgeInsets.only(top: 30),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Opacity(
opacity: _step == 0 ? 0.4 : 1,
child: buildItemButton(
title: "Previous",
color: Colors.black,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surfaceContainer,
),
onTap: () {
_handStep(false);
},
),
),
buildItemButton(
title: _step == 2 ? "Complete Setup" : "Continue",
decoration: BoxDecoration(
color: _step == 2 ? Theme.of(context).colorScheme.success : null,
gradient: _step == 2
? null
: LinearGradient(
colors: [
Theme.of(context).colorScheme.primary,
Theme.of(context).colorScheme.primaryEnd,
],
),
),
onTap: () {
_handStep(true);
},
),
],
),
),
],
),
),
);
}
///构建顶部
Widget buildHeader() {
return Column(
children: [
Text(
"Welcome to FoodSafe",
style: Theme.of(context).textTheme.titleLarge,
),
Container(
margin: EdgeInsets.only(top: 5),
child: Text(
"Let's personalize your food safety experience",
style: Theme.of(context).textTheme.labelMedium,
),
),
],
);
}
///步骤条
Widget buildStep() {
return Container(
margin: EdgeInsets.only(top: 20),
child: Row(
spacing: 10,
children: stepList.asMap().entries.map((entre) {
//数据
var item = entre.value;
var index = entre.key;
var isLast = index == stepList.length - 1;
//颜色
var selectColor = Theme.of(context).colorScheme.primary;
var unselectedColor = Theme.of(context).colorScheme.surfaceContainerHigh;
return Expanded(
flex: isLast ? 0 : 1,
child: Row(
spacing: 10,
children: [
Container(
width: 50,
height: 50,
decoration: BoxDecoration(
color: _step >= index ? selectColor : unselectedColor,
shape: BoxShape.circle,
),
child: Icon(
item.icon,
color: _step >= index ? Colors.white : Color(0xff9ca3af),
),
),
Visibility(
visible: !isLast,
child: Expanded(
child: Container(
height: 3,
color: _step > index ? selectColor : unselectedColor,
),
),
),
],
),
);
}).toList(),
),
);
}
///步骤条信息
Widget buildStepInfo() {
var stepInfo = stepList[_step];
return Container(
margin: EdgeInsets.only(top: 20, bottom: 30),
child: Column(
children: [
Text(
stepInfo.title,
style: Theme.of(context).textTheme.titleMedium,
),
Container(
margin: EdgeInsets.only(top: 5),
child: Text(
stepInfo.subTitle,
style: Theme.of(context).textTheme.labelMedium,
textAlign: TextAlign.center,
),
),
],
),
);
}
///item按钮
Widget buildItemButton({
required String title,
Color color = Colors.white,
required BoxDecoration decoration,
required Function() onTap,
}) {
return InkWell(
onTap: onTap,
child: Container(
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 20),
decoration: decoration.copyWith(
borderRadius: BorderRadius.circular(8),
),
child: Text(
title,
style: TextStyle(color: color),
),
),
);
}
}
class StepItem {
final IconData icon;
final String title;
final String subTitle;
StepItem({
required this.icon,
required this.title,
required this.subTitle,
});
}

View File

@@ -0,0 +1,9 @@
import 'package:food_health/api/dto/profile_options_dto.dart';
List<String> getOptions(List<ProfileOptionDto> options, String key) {
var data = options.firstWhere((item) {
return item.key == key;
});
//
return data.valuesList ?? [];
}

View File

@@ -0,0 +1,100 @@
import 'dart:ffi';
import 'package:flutter/material.dart';
///步骤内容卡片
class StepContentCard extends StatelessWidget {
final List<Widget> children;
const StepContentCard({super.key, required this.children});
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(15),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surface,
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Theme.of(context).colorScheme.shadow,
blurRadius: 7,
offset: const Offset(0, 4),
),
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: children,
),
);
}
}
///卡片标题
class CardTitle extends StatelessWidget {
final String title;
const CardTitle({super.key, required this.title});
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.only(bottom: 15),
child: Text(
title,
style: Theme.of(context).textTheme.titleSmall,
),
);
}
}
///配置列表
class OptionList extends StatelessWidget {
final List<String> options;
final List<String> selects;
final double widthFactor;
final Function(String) onTap;
const OptionList({
super.key,
required this.options,
required this.selects,
this.widthFactor = 0.5,
required this.onTap,
});
@override
Widget build(BuildContext context) {
return Wrap(
runSpacing: 20,
children: options.map((item) {
return FractionallySizedBox(
widthFactor: widthFactor,
child: InkWell(
onTap: () {
onTap(item);
},
child: Row(
spacing: 5,
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
width: 20,
height: 20,
child: Checkbox(
value: selects.contains(item),
onChanged: (_) {
onTap(item);
},
),
),
Text(item),
],
),
),
);
}).toList(),
);
}
}

View File

@@ -0,0 +1,127 @@
import 'package:flutter/material.dart';
import 'package:food_health/api/dto/profile_options_dto.dart';
import '../data/state.dart';
import '../util/common.dart';
import 'common.dart';
class DietaryPreferences extends StatefulWidget {
final List<ProfileOptionDto> options;
const DietaryPreferences({super.key, required this.options});
@override
State<DietaryPreferences> createState() => _DietaryPreferencesState();
}
class _DietaryPreferencesState extends State<DietaryPreferences> {
///切换标签
void _handToggle(String tag) {
var state = SelectionProvider.of(context);
if (getIsSelect(tag)) {
state.update((p) => p.dietaryPreferencesList.remove(tag));
} else {
state.update((p) => p.dietaryPreferencesList.add(tag));
}
}
///选中年龄
void _handAgeRange(String tag) {
var state = SelectionProvider.of(context);
state.update((p) => p.ageRange = tag);
}
///等级
void _handActivityLevel(String tag) {
var state = SelectionProvider.of(context);
state.update((p) => p.activityLevel = tag);
}
///是否标签选中
bool getIsSelect(String tag) {
var state = SelectionProvider.of(context);
return state.userProfile.dietaryPreferencesList.contains(tag);
}
@override
Widget build(BuildContext context) {
var state = SelectionProvider.of(context);
return StepContentCard(
children: [
CardTitle(title: "Dietary Restrictions & Preferences"),
Container(
margin: EdgeInsets.only(bottom: 15),
child: OptionList(
options: getOptions(widget.options, "dietary_restrictions"),
selects: state.userProfile.dietaryPreferencesList,
onTap: _handToggle,
),
),
CardTitle(title: "Age Range"),
Container(
margin: EdgeInsets.only(bottom: 15),
child: RadioGroup(
options: getOptions(widget.options, "age_ranges"),
value: state.userProfile.ageRange,
onChanged: _handAgeRange,
),
),
CardTitle(title: "Activity Level"),
RadioGroup(
options: getOptions(widget.options, "activity_levels"),
value: state.userProfile.activityLevel,
onChanged: _handActivityLevel,
),
],
);
}
}
///单选列表
class RadioGroup extends StatelessWidget {
final List<String> options;
final String value;
final int crossAxisCount;
final Function(String) onChanged;
const RadioGroup({
super.key,
required this.options,
required this.value,
this.crossAxisCount = 3,
required this.onChanged,
});
@override
Widget build(BuildContext context) {
return GridView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisSpacing: 10,
mainAxisSpacing: 10,
crossAxisCount: crossAxisCount,
mainAxisExtent: 40,
),
itemBuilder: (context, index) {
var data = options[index];
var isSelected = value == data;
return InkWell(
onTap: () {
onChanged(data);
},
child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
color: isSelected ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.surfaceContainerLow,
borderRadius: BorderRadius.circular(8),
border: Border.all(color: isSelected ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.surfaceContainer),
),
child: Text(data, style: TextStyle(color: isSelected ? Colors.white : Colors.black)),
),
);
},
itemCount: options.length,
);
}
}

View File

@@ -0,0 +1,144 @@
import 'package:flutter/material.dart';
import 'package:food_health/api/dto/profile_options_dto.dart';
import 'package:food_health/config/theme/custom_colors.dart';
import 'package:remixicon/remixicon.dart';
import '../data/state.dart';
import '../util/common.dart';
import 'common.dart';
class FoodAllergies extends StatefulWidget {
final List<ProfileOptionDto> options;
const FoodAllergies({super.key, required this.options});
@override
State<FoodAllergies> createState() => _FoodAllergiesState();
}
class _FoodAllergiesState extends State<FoodAllergies> {
final TextEditingController _otherController = TextEditingController();
@override
void initState() {
super.initState();
}
///切换标签
void _handToggle(String tag) {
var state = SelectionProvider.of(context);
if (getIsSelect(tag)) {
state.update((p) => p.foodAllergiesList.remove(tag));
} else {
state.update((p) => p.foodAllergiesList.add(tag));
}
}
void _handConfirmCustom() {
var state = SelectionProvider.of(context);
if (!getIsSelect(_otherController.text)) {
state.update((p) => p.foodAllergiesList.add(_otherController.text));
_otherController.text = "";
}
}
///是否标签选中
bool getIsSelect(String tag) {
var state = SelectionProvider.of(context);
return state.userProfile.foodAllergiesList.contains(tag);
}
@override
Widget build(BuildContext context) {
var state = SelectionProvider.of(context);
return StepContentCard(
children: [
CardTitle(title: "Common Food Allergies"),
Container(
margin: EdgeInsets.only(bottom: 15),
child: OptionList(
options: getOptions(widget.options, "common_food_allergies"),
selects: state.userProfile.foodAllergiesList,
onTap: _handToggle,
),
),
CardTitle(title: "Other Allergies"),
Container(
margin: EdgeInsets.only(bottom: 15),
child: Row(
spacing: 15,
children: [
Expanded(
child: TextField(
controller: _otherController,
style: Theme.of(context).textTheme.bodyMedium,
decoration: InputDecoration(
isCollapsed: true,
contentPadding: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
hintText: "Add custom allergy...",
filled: true,
fillColor: Theme.of(context).colorScheme.surfaceContainerLow,
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
borderSide: BorderSide(width: 1, color: Theme.of(context).colorScheme.surfaceContainer),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
borderSide: BorderSide(width: 1, color: Theme.of(context).colorScheme.surfaceContainer),
),
),
),
),
InkWell(
onTap: _handConfirmCustom,
child: Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surfaceContainer,
borderRadius: BorderRadius.circular(8),
),
child: Icon(RemixIcons.add_fill),
),
),
],
),
),
CardTitle(title: "Your Allergies"),
Wrap(
runSpacing: 10,
spacing: 10,
children: state.userProfile.foodAllergiesList.map((item) {
return InkWell(
onTap: () {
_handToggle(item);
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 3, horizontal: 10),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.danger,
borderRadius: BorderRadius.circular(8),
),
child: Row(
spacing: 5,
mainAxisSize: MainAxisSize.min,
children: [
Text(
item,
style: TextStyle(color: Colors.white, fontSize: 12),
),
Icon(
RemixIcons.close_fill,
color: Colors.white,
size: 20,
),
],
),
),
);
}).toList(),
),
],
);
}
}

Some files were not shown because too many files have changed in this diff Show More