wt1.0 bug fixing, push notification

This commit is contained in:
Bossanyi Tibor 2020-07-12 14:17:59 +02:00
parent f0f0136d65
commit 4e38d3da22
67 changed files with 1472 additions and 213 deletions

View File

@ -24,6 +24,7 @@ if (flutterVersionName == null) {
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
@ -60,4 +61,5 @@ flutter {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.google.firebase:firebase-analytics:17.2.2'
}

View File

@ -0,0 +1,40 @@
{
"project_info": {
"project_number": "926782702216",
"firebase_url": "https://aitrainer-af0ec.firebaseio.com",
"project_id": "aitrainer-af0ec",
"storage_bucket": "aitrainer-af0ec.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:926782702216:android:94700653fb91484add953d",
"android_client_info": {
"package_name": "com.aitrainer.aitrainer_app"
}
},
"oauth_client": [
{
"client_id": "926782702216-al3vjap51m6pgpa066d1oni0bdjpu7pr.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyDOTAvDONK1PB_fPFDxSZp4X-jr0Cf57Yk"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "926782702216-al3vjap51m6pgpa066d1oni0bdjpu7pr.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}

View File

@ -5,6 +5,7 @@
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name="io.flutter.app.FlutterApplication"
android:label="WorkoutTest"
@ -37,6 +38,10 @@
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="FLUTTER_NOTIFICATION_CLICK" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -1,13 +1,14 @@
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.3.72'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "com.android.tools.build:gradle:3.5.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.google.gms:google-services:4.3.3"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

File diff suppressed because one or more lines are too long

View File

@ -22,7 +22,10 @@
"Selected Language": "Választott nyelv",
"gdpr_text": "",
"Please log in": "Kérlek jelentkezz be",
"Customer does not exist or the password is wrong": "A felhasználónév nem létezik vagy a jelszó rossz.",
"Please select an exercise": "Válassz ki egy gyakorlatot",
"Customer exists": "Ez az email cím már regisztrálva van",
"Cardio": "Kardió",
"400m": "400m",
"300m": "300m",
@ -75,6 +78,21 @@
"Next": "Tovább",
"Select a gender": "Válaszd ki a nemet",
"Goal Settings": "Cél"
"Set Your Goals": "Mi a célod?",
"Gain Muscle": "Izomépítés",
"Loose Weight": "Fogyás",
"Your Fitness State": "Milyen a fizikai állapotod?",
"Beginner": "Kezdő",
"I am beginner": "Kezdő / Újrakezdő vagyok",
"Intermediate": "Középhaladó",
"I am intermediate": "1-3-szor mozgok egy héten",
"Advanced": "Haladó",
"I am advanced": "4+ alkalommal sportolok egy héten",
"Professional": "Professzionális",
"I am professional": "Professzionális sportoló vagyok",
"Your Body Type": "Milyen a testtípusod?",
"Ectomorph": "Ectomorf",
"Endomorph":"Endomorf",
"Mezomorph":"Mezomorf"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -0,0 +1,513 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
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 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>"; };
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 */
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 */,
);
sourceTree = "<group>";
};
97C146EF1CF9000F007C117D /* Products */ = {
isa = PBXGroup;
children = (
97C146EE1CF9000F007C117D /* Runner.app */,
);
name = Products;
sourceTree = "<group>";
};
97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup;
children = (
97C146FA1CF9000F007C117D /* Main.storyboard */,
97C146FD1CF9000F007C117D /* Assets.xcassets */,
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
97C147021CF9000F007C117D /* Info.plist */,
97C146F11CF9000F007C117D /* Supporting Files */,
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
);
path = Runner;
sourceTree = "<group>";
};
97C146F11CF9000F007C117D /* Supporting Files */ = {
isa = PBXGroup;
children = (
);
name = "Supporting Files";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
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 = {
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 1100;
};
};
};
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject " " */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 97C146E51CF9000F007C117D;
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
97C146ED1CF9000F007C117D /* Runner */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
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;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
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;
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 */
97C146EA1CF9000F007C117D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase 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;
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;
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 = 8.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;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.aitrainer.aitrainer_app;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Profile;
};
97C147031CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
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;
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 = 8.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;
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;
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 = 8.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;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.aitrainer.aitrainer_app;
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;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.aitrainer.aitrainer_app;
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 */
97C146E91CF9000F007C117D /* Build configuration list for PBXProject " " */ = {
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 = "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,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1150"
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:&#9;&#9;.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:&#9;&#9;.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:&#9;&#9;.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
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"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</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,27 @@
import 'package:firebase_messaging/firebase_messaging.dart';
class PushNotificationsManager {
PushNotificationsManager._();
factory PushNotificationsManager() => _instance;
static final PushNotificationsManager _instance = PushNotificationsManager._();
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
bool _initialized = false;
Future<void> init() async {
if (!_initialized) {
// For iOS request permission first.
_firebaseMessaging.requestNotificationPermissions();
_firebaseMessaging.configure();
// For testing purposes print the Firebase Messaging token
String token = await _firebaseMessaging.getToken();
print("FirebaseMessaging token: $token");
_initialized = true;
}
}
}

View File

@ -1,4 +1,5 @@
import 'dart:convert';
import 'package:aitrainer_app/util/common.dart';
import 'package:flutter/cupertino.dart';
import 'package:http/http.dart' as http;
import 'package:aitrainer_app/model/auth.dart';
@ -39,16 +40,18 @@ class APIClient extends ChangeNotifier {
);
authToken = responseJson['token'];
}
final response = await http.post(url,
headers: {
'Content-Type': 'application/json',
'Content-Type': 'application/json; charset=UTF-8',
'Authorization' : "Bearer " + authToken
},
body: body
body: body,
);
print(" ------------ response: " + response.body.toString());
String decodedResponse = Common.utf8convert(response.body);
print(" ------------ response: " + decodedResponse);
notifyListeners();
return response.body;
return decodedResponse;
}
static dynamic authenticateUser(String email, String password) async {

View File

@ -37,8 +37,13 @@ class CustomerApi {
final String responseBody = await _client.post(
"registration",
body);
Customer customer = Customer.fromJson(jsonDecode(responseBody));
Auth().afterRegistration(customer);
Customer customer;
try {
customer = Customer.fromJson(jsonDecode(responseBody));
Auth().afterRegistration(customer);
} on FormatException catch(exception) {
throw new Exception(responseBody);
}
}
@ -48,10 +53,16 @@ class CustomerApi {
final String responseBody = await _client.post(
"login",
body);
Customer customer = Customer.fromJson(jsonDecode(responseBody));
Auth().afterRegistration(customer);
Customer customer;
try {
customer = Customer.fromJson(jsonDecode(responseBody));
Auth().afterRegistration(customer);
} on FormatException catch(exception) {
throw new Exception(responseBody);
}
}
Future<void> getCustomer(int customerId) async {
String body = "";
print(" ===== get the customer by id: " + customerId.toString() );

View File

@ -1,3 +1,5 @@
import 'dart:convert';
import 'package:aitrainer_app/localization/app_language.dart';
import 'package:aitrainer_app/model/auth.dart';
import 'package:aitrainer_app/model/exercise_type.dart';
@ -40,4 +42,9 @@ class Common {
return dateName;
}
static String utf8convert(String text) {
List<int> bytes = text.toString().codeUnits;
return utf8.decode(bytes);
}
}

View File

@ -7,6 +7,8 @@ import 'package:flutter/services.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:aitrainer_app/model/auth.dart';
import '../push_notifications.dart';
class Session {
Future<SharedPreferences> _prefs = SharedPreferences.getInstance();
@ -22,6 +24,7 @@ class Session {
_fetchToken(_sharedPreferences, callback);
initDeviceLocale();
appLanguage.fetchLocale();
PushNotificationsManager().init();
}
}

View File

@ -1,8 +1,9 @@
import 'package:aitrainer_app/localization/app_language.dart';
import 'package:aitrainer_app/localization/app_localization.dart';
import 'package:aitrainer_app/model/auth.dart';
import 'package:aitrainer_app/util/common.dart';
import 'package:aitrainer_app/viewmodel/customer_changing_view_model.dart';
import 'package:aitrainer_app/viewmodel/customer_view_model.dart';
import 'package:aitrainer_app/viewmodel/exercise_changing_view_model.dart';
import 'package:aitrainer_app/viewmodel/exercise_view_model.dart';
import 'package:shared_preferences/shared_preferences.dart';
@ -20,6 +21,10 @@ class AccountPage extends StatefulWidget{
_state = new _AccountPagePageState();
return _state;
}
State getState() {
return _state;
}
}
class _AccountPagePageState extends State<AccountPage> {
@ -27,23 +32,36 @@ class _AccountPagePageState extends State<AccountPage> {
final AppLanguage appLanguage = AppLanguage();
final Future<SharedPreferences> _prefs = SharedPreferences.getInstance();
final BottomNavigator bottomNav = BottomNavigator();
bool _loggedIn = Auth().userLoggedIn != null && Auth().userLoggedIn.email.length > 0;
Future<List<ExerciseViewModel>> _exercises;
ExerciseChangingViewModel model;
ExerciseChangingViewModel exerciseChangingViewModel;
@override
void initState() {
exerciseChangingViewModel = Provider.of<ExerciseChangingViewModel>(context, listen: false);
super.initState();
model = Provider.of<ExerciseChangingViewModel>(context, listen: false);
if ( Auth().userLoggedIn != null ) {
_exercises = model.getExercisesByCustomer(Auth().userLoggedIn.customerId);
}
}
@override
Widget build(BuildContext context) {
return Consumer<CustomerChangingViewModel>(
builder: (context, model, child ) {
if ( model.customer == null ) {
CustomerViewModel customerViewModel = CustomerViewModel();
model.customer = customerViewModel;
if ( model.customer.getCustomer() == null ) {
model.customer.setCustomer(Auth().userLoggedIn);
}
}
if ( Auth().userLoggedIn != null ) {
_exercises =
exerciseChangingViewModel.getExercisesByCustomer(
Auth().userLoggedIn.customerId);
}
return Scaffold(
appBar: AppBar(
title: Text(AppLocalizations.of(context).translate('Account')),
@ -75,18 +93,19 @@ class _AccountPagePageState extends State<AccountPage> {
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(_loggedIn ? Auth().userLoggedIn.email + " " +
Auth().userLoggedIn.name + " " +
Text(Auth().userLoggedIn != null ?
Auth().userLoggedIn.name + " " +
Auth().userLoggedIn.firstname : "",
style: TextStyle(color: Colors.blue)),
Icon(Icons.arrow_forward_ios),
]),
textColor: Colors.grey,
color: Colors.white,
onPressed: () {
if (_loggedIn) {
Navigator.of(context).pushNamed('customerModifyPage');
print("Profile");
onPressed: () => {
if (model.customer.getCustomer() != null) {
Navigator.of(context).pushNamed(
'customerModifyPage'),
print("Profile"),
}
},
),
@ -100,22 +119,24 @@ class _AccountPagePageState extends State<AccountPage> {
subtitle: Text(AppLocalizations.of(context).translate(
"Selected Language")),
),
loginOut(),
exercises( model ),
loginOut( model ),
exercises(exerciseChangingViewModel),
]
)
),
bottomNavigationBar: bottomNav.buildBottomNavigator(context, widget._state)
bottomNavigationBar: bottomNav.buildBottomNavigator(
context, widget._state)
);
});
}
ListTile loginOut() {
ListTile loginOut( CustomerChangingViewModel model ) {
ListTile element = ListTile();
String text = "Logout";
Color buttonColor = Colors.orange;
if ( ! _loggedIn ) {
if ( model.customer.getCustomer() == null ) {
text = "Login";
buttonColor = Colors.blue;
}
@ -135,19 +156,18 @@ class _AccountPagePageState extends State<AccountPage> {
]),
textColor: buttonColor,
color: Colors.white,
onPressed: () {
onPressed: () => {
setState(() {
if ( ! _loggedIn) {
if ( model.customer.getCustomer() == null ) {
print("Login");
Navigator.of(context).pushNamed("login");
Navigator.of(context).pushNamed("login", arguments: widget._state);
} else {
print("Logout");
_loggedIn = false;
Auth().logout();
model.customer.setCustomer(null);
}
});
})
},
),
);

View File

@ -12,16 +12,19 @@ class CustomerBodyTypePage extends StatefulWidget{
}
}
class GenderItem {
GenderItem(this.dbValue,this.name);
final String dbValue;
String name;
class BodyTypeItem {
static String endomorph = "endomorph";
static String ectomorph = "ectomorph";
static String mesomorph = "mesomorph";
}
class _CustomerBodyTypePageState extends State<CustomerBodyTypePage> {
String selected;
@override
Widget build(BuildContext context) {
final CustomerChangingViewModel changingViewModel = ModalRoute.of(context).settings.arguments;
final double cWidth = MediaQuery.of(context).size.width*0.75;
return Scaffold(
appBar: AppBar(
@ -46,36 +49,142 @@ class _CustomerBodyTypePageState extends State<CustomerBodyTypePage> {
alignment: Alignment.center,
),
),
child: Center(
child: Column(
children: [
Divider(),
InkWell(
child: Text("Your Body Type",
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Divider(),
Wrap(
//runAlignment: WrapAlignment.center,
alignment: WrapAlignment.center,
children: [
Text(
AppLocalizations.of(context).translate("Your Body Type"),
textAlign: TextAlign.center,
style: TextStyle(color: Colors.orange,
fontSize: 50, fontFamily: 'Arial',
fontWeight: FontWeight.w900 ),),
highlightColor: Colors.white,
),
RaisedButton(
color: Colors.orange,
textColor: Colors.white,
child: InkWell(
child: Text(AppLocalizations.of(context).translate("Next"))),
onPressed: () => {
//changingViewModel.saveCustomer(),
Navigator.of(context).pop(),
Navigator.of(context).pushNamed("customerWelcomePage", arguments: changingViewModel)
},
)
],
fontSize: 42, fontFamily: 'Arial',
fontWeight: FontWeight.w900 ),)
]
),
)
Divider(),
FlatButton(
child: Container(
width: cWidth,
child: Column(
children: [
Text(AppLocalizations.of(context).translate("Endomorph"),
textWidthBasis: TextWidthBasis.longestLine,
style: TextStyle(color: Colors.blue,
fontSize: 32, fontFamily: 'Arial',
fontWeight: FontWeight.w900 )),
],
)
),
padding: EdgeInsets.all(10.0),
shape: getShape(changingViewModel, BodyTypeItem.endomorph ),
onPressed:() =>
{
setState((){
selected = BodyTypeItem.endomorph;
changingViewModel.customer.setBodyType(selected);
print(selected);
}),
}
),
Divider(),
FlatButton(
child: Container(
width: cWidth,
child: Column(
children: [
InkWell(
child: Text(AppLocalizations.of(context).translate("Ectomorph"),
style: TextStyle(color: Colors.blue,
fontSize: 32, fontFamily: 'Arial',
fontWeight: FontWeight.w900 ),),
highlightColor: Colors.white,
),
],
),
),
padding: EdgeInsets.all(10.0),
shape: getShape(changingViewModel, BodyTypeItem.ectomorph ),
onPressed:() =>
{
setState((){
selected = BodyTypeItem.ectomorph;
changingViewModel.customer.setBodyType(selected);
print(selected);
}),
}
),
Divider(),
FlatButton(
child: Container(
width: cWidth,
child: Column(
children: [
InkWell(
child: Text(AppLocalizations.of(context).translate("Mesomorph"),
style: TextStyle(color: Colors.blue,
fontSize: 32, fontFamily: 'Arial',
fontWeight: FontWeight.w900 ),),
highlightColor: Colors.white,
),
],
),
),
padding: EdgeInsets.all(10.0),
shape: getShape(changingViewModel, BodyTypeItem.mesomorph ),
onPressed:() =>
{
setState((){
selected = BodyTypeItem.mesomorph;
changingViewModel.customer.setBodyType(selected);
print(selected);
}),
}
),
Divider(),
RaisedButton(
color: Colors.orange,
textColor: Colors.white,
child: InkWell(
child: Text(AppLocalizations.of(context).translate("Next"))),
onPressed: () => {
changingViewModel.saveCustomer(),
Navigator.of(context).pop(),
Navigator.of(context).pushNamed("customerWelcomePage", arguments: changingViewModel)
},
)
],
),
),
);
}
dynamic getShape( CustomerChangingViewModel changingViewModel, String fitnessLevel ) {
String selected = changingViewModel.customer.bodyType;
dynamic returnCode = ( selected == fitnessLevel ) ?
RoundedRectangleBorder(
side: BorderSide(width: 4, color: Colors.orange),
)
:
RoundedRectangleBorder(
side: BorderSide(width: 1, color: Colors.blue),
);
//return
return returnCode;
}
}

View File

@ -1,6 +1,8 @@
import 'package:aitrainer_app/localization/app_localization.dart';
import 'package:aitrainer_app/viewmodel/customer_changing_view_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
// ignore: must_be_immutable
class CustomerFitnessPage extends StatefulWidget{
@ -12,17 +14,24 @@ class CustomerFitnessPage extends StatefulWidget{
}
}
class GenderItem {
GenderItem(this.dbValue,this.name);
final String dbValue;
String name;
class FitnessItem {
static String beginner = "beginner";
static String intermediate = "intermediate";
static String advanced = "advanced";
static String professional = "professional";
}
//TODO
// dropbox for professional sport
class _CustomerFitnessPageState extends State<CustomerFitnessPage> {
String selected;
@override
Widget build(BuildContext context) {
final double cWidth = MediaQuery.of(context).size.width*0.75;
final CustomerChangingViewModel changingViewModel = ModalRoute.of(context).settings.arguments;
selected = changingViewModel.customer.fitnessLevel;
return Scaffold(
appBar: AppBar(
title: Row(
@ -38,43 +47,205 @@ class _CustomerFitnessPageState extends State<CustomerFitnessPage> {
),
backgroundColor: Colors.transparent,
),
body: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('asset/image/WT_light_background.png'),
fit: BoxFit.cover,
alignment: Alignment.center,
body: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Container(
padding: EdgeInsets.only(bottom: 200),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('asset/image/WT_light_background.png'),
fit: BoxFit.cover,
alignment: Alignment.center,
),
),
),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Divider(),
InkWell(
child: Text("Your Fitness State",
style: TextStyle(color: Colors.orange,
fontSize: 50, fontFamily: 'Arial',
fontWeight: FontWeight.w900 ),),
highlightColor: Colors.white,
Wrap(
//runAlignment: WrapAlignment.center,
alignment: WrapAlignment.center,
children: [
Text(
AppLocalizations.of(context).translate("Your Fitness State"),
textAlign: TextAlign.center,
style: TextStyle(color: Colors.orange,
fontSize: 42, fontFamily: 'Arial',
fontWeight: FontWeight.w900 ),)
]
),
RaisedButton(
color: Colors.orange,
textColor: Colors.white,
child: InkWell(
child: Text(AppLocalizations.of(context).translate("Next"))),
onPressed: () => {
//changingViewModel.saveCustomer(),
Navigator.of(context).pop(),
Navigator.of(context).pushNamed("customerBodyTypePage", arguments: changingViewModel)
},
)
],
Divider(),
FlatButton(
child: Container(
width: cWidth,
child: Column(
children: [
Text(AppLocalizations.of(context).translate("Beginner"),
textWidthBasis: TextWidthBasis.longestLine,
style: TextStyle(color: Colors.blue,
fontSize: 32, fontFamily: 'Arial',
fontWeight: FontWeight.w900 )),
Text(AppLocalizations.of(context).translate("I am beginner"),
style: TextStyle(color: Colors.black,
fontSize: 20, fontFamily: 'Arial',
fontWeight: FontWeight.w100 ),),
],
)
),
padding: EdgeInsets.all(10.0),
shape: getShape(changingViewModel, FitnessItem.beginner ),
onPressed:() =>
{
setState((){
selected = FitnessItem.beginner;
changingViewModel.customer.setFitnessLevel(selected);
print(selected);
}),
}
),
Divider(),
FlatButton(
child: Container(
width: cWidth,
child: Column(
children: [
InkWell(
child: Text(AppLocalizations.of(context).translate("Intermediate"),
style: TextStyle(color: Colors.blue,
fontSize: 32, fontFamily: 'Arial',
fontWeight: FontWeight.w900 ),),
highlightColor: Colors.white,
),
InkWell(
child: Text(AppLocalizations.of(context).translate("I am intermediate"),
style: TextStyle(color: Colors.black,
fontSize: 20, fontFamily: 'Arial',
fontWeight: FontWeight.w100 ),),
highlightColor: Colors.white,
),
],
),
),
padding: EdgeInsets.all(10.0),
shape: getShape(changingViewModel, FitnessItem.intermediate ),
onPressed:() =>
{
setState((){
selected = FitnessItem.intermediate;
changingViewModel.customer.setFitnessLevel(selected);
print(selected);
}),
}
),
Divider(),
FlatButton(
child: Container(
width: cWidth,
child: Column(
children: [
InkWell(
child: Text(AppLocalizations.of(context).translate("Advanced"),
style: TextStyle(color: Colors.blue,
fontSize: 32, fontFamily: 'Arial',
fontWeight: FontWeight.w900 ),),
highlightColor: Colors.white,
),
InkWell(
child: Text(AppLocalizations.of(context).translate("I am advanced"),
style: TextStyle(color: Colors.black,
fontSize: 20, fontFamily: 'Arial',
fontWeight: FontWeight.w100 ),),
highlightColor: Colors.white,
),
],
),
),
padding: EdgeInsets.all(10.0),
shape: getShape(changingViewModel, FitnessItem.advanced ),
onPressed:() =>
{
setState((){
selected = FitnessItem.advanced;
changingViewModel.customer.setFitnessLevel(selected);
print(selected);
}),
}
),
Divider(),
FlatButton(
child: Container(
width: cWidth,
child: Column(
children: [
InkWell(
child: Text(AppLocalizations.of(context).translate("Professional"),
style: TextStyle(color: Colors.blue,
fontSize: 32, fontFamily: 'Arial',
fontWeight: FontWeight.w900 ),),
highlightColor: Colors.white,
),
InkWell(
child: Text(AppLocalizations.of(context).translate("I am professional"),
style: TextStyle(color: Colors.black,
fontSize: 20, fontFamily: 'Arial',
fontWeight: FontWeight.w100 ),),
highlightColor: Colors.white,
),
],
),
),
padding: EdgeInsets.all(10.0),
shape: getShape(changingViewModel, FitnessItem.professional ),
onPressed:() =>
{
setState((){
selected = FitnessItem.professional;
changingViewModel.customer.setFitnessLevel(selected);
print(selected);
}),
}
),
Divider(),
RaisedButton(
color: Colors.orange,
textColor: Colors.white,
child: InkWell(
child: Text(AppLocalizations.of(context).translate("Next"))),
onPressed: () => {
changingViewModel.saveCustomer(),
Navigator.of(context).pop(),
Navigator.of(context).pushNamed("customerBodyTypePage", arguments: changingViewModel)
},
)
],
),
)
),
)
);
}
dynamic getShape( CustomerChangingViewModel changingViewModel, String fitnessLevel ) {
String selected = changingViewModel.customer.fitnessLevel;
dynamic returnCode = ( selected == fitnessLevel ) ?
RoundedRectangleBorder(
side: BorderSide(width: 4, color: Colors.orange),
)
:
RoundedRectangleBorder(
side: BorderSide(width: 1, color: Colors.blue),
);
//return
return returnCode;
}
}

View File

@ -1,5 +1,6 @@
import 'package:aitrainer_app/localization/app_localization.dart';
import 'package:aitrainer_app/viewmodel/customer_changing_view_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
// ignore: must_be_immutable
@ -12,17 +13,23 @@ class CustomerGoalPage extends StatefulWidget{
}
}
class GenderItem {
GenderItem(this.dbValue,this.name);
final String dbValue;
String name;
class GoalsItem{
static String muscle = "gain_muscle";
static String weight = "weight_loss";
}
class _CustomerGoalPageState extends State<CustomerGoalPage> {
String selected;
initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
final double cWidth = MediaQuery.of(context).size.width*0.75;
final CustomerChangingViewModel changingViewModel = ModalRoute.of(context).settings.arguments;
selected = changingViewModel.customer.goal;
return Scaffold(
appBar: AppBar(
title: Row(
@ -46,79 +53,104 @@ class _CustomerGoalPageState extends State<CustomerGoalPage> {
alignment: Alignment.center,
),
),
child: Center(
child: Column(
children: [
Divider(),
InkWell(
child: Text("Set Your Goals",
style: TextStyle(color: Colors.orange,
fontSize: 50, fontFamily: 'Arial',
fontWeight: FontWeight.w900 ),),
highlightColor: Colors.white,
),
child: SingleChildScrollView(
child: Center(
child: Column(
children: [
Divider(),
InkWell(
child: Text(AppLocalizations.of(context).translate("Set Your Goals"),
style: TextStyle(color: Colors.orange,
fontSize: 50, fontFamily: 'Arial',
fontWeight: FontWeight.w900 ),),
highlightColor: Colors.white,
),
Stack(
alignment: Alignment.bottomLeft,
overflow: Overflow.visible,
children: [
FlatButton(
child: Image.asset("asset/image/WT_gain_muscle.png", height: 250,),
padding: EdgeInsets.all(0.0),
onPressed:() =>
{
print("gain muscle"),
changingViewModel.customer.setGoal("gain_muscle"),
}
),
InkWell(
child: Text("Gain Muscle",
style: TextStyle(color: Colors.white,
fontSize: 36, fontFamily: 'Arial',
fontWeight: FontWeight.w900 ),),
highlightColor: Colors.white,
)
]
),
Stack(
alignment: Alignment.bottomLeft,
overflow: Overflow.visible,
children: [
FlatButton(
child: Image.asset("asset/image/WT_weight_loss.png", height: 220,),
Stack(
alignment: Alignment.bottomLeft,
overflow: Overflow.visible,
children: [
FlatButton(
child: Image.asset("asset/image/WT_gain_muscle.png", height: 180,),
padding: EdgeInsets.all(0.0),
shape: getShape(changingViewModel, GoalsItem.muscle ),
onPressed:() =>
{
print("weight_loss"),
changingViewModel.customer.setGoal("weight_loss"),
print("gain muscle"),
setState((){
selected = GoalsItem.muscle;
changingViewModel.customer.setGoal(GoalsItem.muscle);
}),
}
),
InkWell(
child: Text("Loose Weight",
style: TextStyle(color: Colors.white,
fontSize: 36, fontFamily: 'Arial',
fontWeight: FontWeight.w900 ),),
highlightColor: Colors.white,
)
InkWell(
child: Text(AppLocalizations.of(context).translate("Gain Muscle"),
style: TextStyle(color: Colors.white,
fontSize: 32, fontFamily: 'Arial',
fontWeight: FontWeight.w900 ),),
highlightColor: Colors.white,
)
]
),
RaisedButton(
),
Divider(),
Stack(
alignment: Alignment.bottomLeft,
overflow: Overflow.visible,
children: [
FlatButton(
child: Image.asset("asset/image/WT_weight_loss.png", height: 180,),
padding: EdgeInsets.all(0.0),
shape: getShape(changingViewModel, GoalsItem.weight ),
onPressed:() =>
{
print("weight_loss"),
setState((){
selected = GoalsItem.weight;
changingViewModel.customer.setGoal(GoalsItem.weight);
}),
color: Colors.orange,
textColor: Colors.white,
child: InkWell(
child: Text(AppLocalizations.of(context).translate("Next"))),
onPressed: () => {
//changingViewModel.saveCustomer(),
Navigator.of(context).pop(),
Navigator.of(context).pushNamed("customerFitnessPage", arguments: changingViewModel)
},
)
],
),
}
),
InkWell(
child: Text(AppLocalizations.of(context).translate("Loose Weight"),
style: TextStyle(color: Colors.white,
fontSize: 32, fontFamily: 'Arial',
fontWeight: FontWeight.w900 ),),
highlightColor: Colors.white,
)
]
),
Divider(),
RaisedButton(
color: Colors.orange,
textColor: Colors.white,
child: InkWell(
child: Text(AppLocalizations.of(context).translate("Next"))),
onPressed: () => {
changingViewModel.saveCustomer(),
Navigator.of(context).pop(),
Navigator.of(context).pushNamed("customerFitnessPage", arguments: changingViewModel)
},
)
],
),
)
)
),
);
}
dynamic getShape( CustomerChangingViewModel changingViewModel, String goal ) {
String selectedGoal = changingViewModel.customer.goal;
dynamic returnCode = ( selectedGoal == goal ) ?
RoundedRectangleBorder(
side: BorderSide(width: 4, color: Colors.red),
)
: null;
//return
return returnCode;
}
}

View File

@ -1,11 +1,11 @@
import 'package:aitrainer_app/localization/app_localization.dart';
import 'package:aitrainer_app/model/auth.dart';
import 'package:aitrainer_app/viewmodel/customer_changing_view_model.dart';
import 'package:aitrainer_app/viewmodel/customer_view_model.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';
import 'package:provider/provider.dart';
// ignore: must_be_immutable
class CustomerModifyPage extends StatefulWidget{
_CustomerModifyPageState _state;
@ -39,11 +39,12 @@ class _CustomerModifyPageState extends State<CustomerModifyPage> {
@override
Widget build(BuildContext context) {
final CustomerViewModel model = CustomerViewModel();
model.customer = Auth().userLoggedIn;
final CustomerChangingViewModel customerChangeModel =
CustomerChangingViewModel(model);
customerChangeModel.customer.customer.sex = selectedGender.dbValue;
//final CustomerViewModel model = CustomerViewModel();
//model.customer = Auth().userLoggedIn;
//final CustomerChangingViewModel customerChangeModel =
// CustomerChangingViewModel(model);
CustomerChangingViewModel customerChangingViewModel = Provider.of<CustomerChangingViewModel>(context, listen: false);
customerChangingViewModel.customer.customer.sex = selectedGender.dbValue;
// we cannot initialize the translations in the initState
genders.forEach((GenderItem element) {
@ -103,8 +104,8 @@ class _CustomerModifyPageState extends State<CustomerModifyPage> {
filled: true,
labelText: AppLocalizations.of(context).translate('Email'),
),
initialValue: customerChangeModel.customer.customer.email,
onFieldSubmitted: (input) => customerChangeModel.customer.setEmail(input)
initialValue: customerChangingViewModel.customer.customer.email,
onFieldSubmitted: (input) => customerChangingViewModel.customer.setEmail(input)
)
)
],
@ -123,8 +124,8 @@ class _CustomerModifyPageState extends State<CustomerModifyPage> {
filled: true,
labelText: AppLocalizations.of(context).translate('Password (Leave empty if you don\'t want to change)' ),
),
initialValue: customerChangeModel.customer.customer.password,
onFieldSubmitted: (input) => customerChangeModel.customer.setPassword(input)
initialValue: customerChangingViewModel.customer.customer.password,
onFieldSubmitted: (input) => customerChangingViewModel.customer.setPassword(input)
)
)
],
@ -142,8 +143,8 @@ class _CustomerModifyPageState extends State<CustomerModifyPage> {
filled: true,
labelText: AppLocalizations.of(context).translate('Name'),
),
initialValue: customerChangeModel.customer.customer.name,
onFieldSubmitted: (input) => customerChangeModel.customer.setName(input)
initialValue: customerChangingViewModel.customer.customer.name,
onFieldSubmitted: (input) => customerChangingViewModel.customer.setName(input)
)
)
],
@ -163,8 +164,8 @@ class _CustomerModifyPageState extends State<CustomerModifyPage> {
labelText: AppLocalizations.of(context).translate('First Name'),
),
keyboardType: TextInputType.emailAddress,
initialValue: customerChangeModel.customer.customer.firstname,
onFieldSubmitted: (input) => customerChangeModel.customer.setFirstName(input)
initialValue: customerChangingViewModel.customer.customer.firstname,
onFieldSubmitted: (input) => customerChangingViewModel.customer.setFirstName(input)
)
)
],
@ -186,8 +187,8 @@ class _CustomerModifyPageState extends State<CustomerModifyPage> {
inputFormatters: <TextInputFormatter>[
WhitelistingTextInputFormatter.digitsOnly
],
initialValue: customerChangeModel.customer.customer.birthYear.toString(),
onFieldSubmitted: (input) => customerChangeModel.customer.setBirthYear(int.parse(input))
initialValue: customerChangingViewModel.customer.customer.birthYear.toString(),
onFieldSubmitted: (input) => customerChangingViewModel.customer.setBirthYear(int.parse(input))
)
)
],
@ -208,9 +209,9 @@ class _CustomerModifyPageState extends State<CustomerModifyPage> {
inputFormatters: <TextInputFormatter>[
WhitelistingTextInputFormatter.digitsOnly
],
initialValue: customerChangeModel.customer.customer.weight.toString(),
initialValue: customerChangingViewModel.customer.customer.weight.toString(),
keyboardType: TextInputType.number,
onFieldSubmitted: (input) => customerChangeModel.customer.setWeight(int.parse(input)),
onFieldSubmitted: (input) => customerChangingViewModel.customer.setWeight(int.parse(input)),
)
)
],
@ -236,7 +237,7 @@ class _CustomerModifyPageState extends State<CustomerModifyPage> {
onChanged:(GenderItem gender) => {
setState(() {
selectedGender = gender;
customerChangeModel.customer.setSex(gender.dbValue);
customerChangingViewModel.customer.setSex(gender.dbValue);
print ("Gender " + gender.name);
})
@ -259,8 +260,8 @@ class _CustomerModifyPageState extends State<CustomerModifyPage> {
child: InkWell(
child: Text(AppLocalizations.of(context).translate("Next"))),
onPressed: () => {
customerChangeModel.saveCustomer(),
Navigator.of(context).pushNamed("customerGoalPage", arguments: customerChangeModel)
customerChangingViewModel.saveCustomer(),
Navigator.of(context).pushNamed("customerGoalPage", arguments: customerChangingViewModel)
},
)
)

View File

@ -1,5 +1,4 @@
import 'package:aitrainer_app/localization/app_localization.dart';
import 'package:aitrainer_app/viewmodel/customer_changing_view_model.dart';
import 'package:flutter/material.dart';
// ignore: must_be_immutable
@ -12,16 +11,9 @@ class CustomerWelcomePage extends StatefulWidget{
}
}
class GenderItem {
GenderItem(this.dbValue,this.name);
final String dbValue;
String name;
}
class _CustomerWelcomePageState extends State<CustomerWelcomePage> {
@override
Widget build(BuildContext context) {
final CustomerChangingViewModel changingViewModel = ModalRoute.of(context).settings.arguments;
return Scaffold(
appBar: AppBar(
@ -62,7 +54,7 @@ class _CustomerWelcomePageState extends State<CustomerWelcomePage> {
onPressed: () => {
Navigator.of(context).pop(),
Navigator.of(context).pushNamed("home", arguments: changingViewModel)
Navigator.of(context).pushNamed("home")
},
)
],

View File

@ -1,6 +1,7 @@
import 'package:aitrainer_app/localization/app_localization.dart';
import 'package:aitrainer_app/model/auth.dart';
import 'package:aitrainer_app/viewmodel/exercise_changing_view_model.dart';
import 'package:aitrainer_app/view/account.dart';
import 'package:aitrainer_app/viewmodel/customer_changing_view_model.dart';
import 'package:aitrainer_app/viewmodel/user_changing_view_model.dart';
import 'package:aitrainer_app/viewmodel/user_view_model.dart';
import 'package:flutter/material.dart';
@ -12,7 +13,8 @@ class LoginPage extends StatefulWidget{
_LoginPageState createState() => _LoginPageState();
}
class _LoginPageState extends State {
class _LoginPageState extends State<LoginPage> {
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
final UserViewModel user = UserViewModel();
final bool _obscureText = true;
final _formKey = GlobalKey<FormState>();
@ -20,10 +22,13 @@ class _LoginPageState extends State {
@override
Widget build(BuildContext context) {
UserChangingViewModel model = UserChangingViewModel(user);
ExerciseChangingViewModel exerciseModel = Provider.of<ExerciseChangingViewModel>(context, listen: false);
CustomerChangingViewModel customerChangingViewModel = Provider.of<CustomerChangingViewModel>(context, listen: false);
user.createNew();
Future<dynamic> customer;
final State<AccountPage> stateAccount = ModalRoute.of(context).settings.arguments;
return Scaffold(
key: _scaffoldKey,
body: Container(
decoration: BoxDecoration(
image: DecorationImage(
@ -100,10 +105,17 @@ class _LoginPageState extends State {
{
if (_formKey.currentState.validate()) {
model = UserChangingViewModel(user),
model.getUser(),
exerciseModel.setCustomer(
Auth().userLoggedIn),
Navigator.pop(context),
model.getUser().then((_) =>
{
if ( stateAccount != null ) {
stateAccount.setState(() {
print("update account");
}),
},
customerChangingViewModel.customer.setCustomer(Auth().userLoggedIn),
Navigator.pop(context),
}).catchError(( error, stackTrace )=> showInSnackBar(error)
),
}
}),
]),
@ -136,4 +148,15 @@ class _LoginPageState extends State {
)
);
}
void showInSnackBar(String error) {
_scaffoldKey.currentState.showSnackBar(
SnackBar(
backgroundColor: Colors.orange,
content: Text(
AppLocalizations.of(context).translate("Customer does not exist or the password is wrong") + " " + error,
style: TextStyle(color: Colors.white))
)
);
}
}

View File

@ -111,7 +111,13 @@ class _MenuPageState extends State<MenuPage> {
model.setCustomer(Auth().userLoggedIn),
if ( Auth().userLoggedIn == null ) {
Scaffold.of(context)
. showSnackBar(SnackBar(content: Text('Please log in')))
. showSnackBar(
SnackBar(
backgroundColor: Colors.orange,
content: Text(
AppLocalizations.of(context).translate('Please log in'),
style: TextStyle(color: Colors.white))
))
} else {
Navigator.of(context).pushNamed('exerciseNewPage'),
}

View File

@ -1,16 +1,19 @@
import 'package:aitrainer_app/localization/app_localization.dart';
import 'package:aitrainer_app/model/auth.dart';
import 'package:aitrainer_app/viewmodel/customer_changing_view_model.dart';
import 'package:aitrainer_app/viewmodel/user_changing_view_model.dart';
import 'package:aitrainer_app/viewmodel/user_view_model.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:aitrainer_app/widgets/nav_drawer.dart';
import 'package:provider/provider.dart';
class RegistrationPage extends StatefulWidget{
_RegistrationPageState createState() => _RegistrationPageState();
}
class _RegistrationPageState extends State {
class _RegistrationPageState extends State<RegistrationPage> {
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
final UserViewModel user = UserViewModel();
bool _obscureText = true;
@ -19,10 +22,11 @@ class _RegistrationPageState extends State {
@override
Widget build(BuildContext context) {
UserChangingViewModel model = UserChangingViewModel(user);
CustomerChangingViewModel customerChangingViewModel = Provider.of<CustomerChangingViewModel>(context, listen: false);
user.createNew();
return Scaffold(
key: _scaffoldKey,
body: Container(
decoration: BoxDecoration(
image: DecorationImage(
@ -91,8 +95,13 @@ class _RegistrationPageState extends State {
onPressed:() => {
if (_formKey.currentState.validate()) {
model = UserChangingViewModel(user),
model.addUser(),
Navigator.of(context).pushNamed("customerModifyPage",)
model.addUser().then((_) =>
{
Navigator.of(context).pushNamed("customerModifyPage",),
customerChangingViewModel.customer.setCustomer(Auth().userLoggedIn),
}).catchError(( error, stackTrace )=> showInSnackBar()
),
}
}),
]),
@ -119,4 +128,15 @@ class _RegistrationPageState extends State {
);
}
void showInSnackBar() {
_scaffoldKey.currentState.showSnackBar(
SnackBar(
backgroundColor: Colors.orange,
content: Text(
AppLocalizations.of(context).translate("Customer exists"),
style: TextStyle(color: Colors.white))
)
);
}
}

View File

@ -19,7 +19,19 @@ class CustomerViewModel {
}
int get birthYear {
return this.birthYear;
return this.customer.birthYear;
}
String get goal {
return this.customer.goal;
}
String get fitnessLevel {
return this.customer.fitnessLevel;
}
String get bodyType {
return this.customer.bodyType;
}
setName(String name) {
@ -69,4 +81,8 @@ class CustomerViewModel {
Customer getCustomer() {
return this.customer;
}
void setCustomer ( Customer customer ) {
this.customer = customer;
}
}

View File

@ -42,7 +42,7 @@ class BottomNavigator {
break;
case 1:
throw new StateError('This is a Dart exception on event.');
//throw new StateError('This is a Dart exception on event.');
break;
case 2:

View File

@ -127,6 +127,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "5.1.0"
firebase_messaging:
dependency: "direct main"
description:
name: firebase_messaging
url: "https://pub.dartlang.org"
source: hosted
version: "6.0.16"
flutter:
dependency: "direct main"
description: flutter
@ -151,6 +158,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.7.5"
flutter_local_notifications:
dependency: "direct main"
description:
name: flutter_local_notifications
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
flutter_local_notifications_platform_interface:
dependency: transitive
description:
name: flutter_local_notifications_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
flutter_localizations:
dependency: "direct main"
description: flutter
@ -334,6 +355,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.2"
pool:
dependency: transitive
description:

View File

@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
version: 1.1.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
@ -29,6 +29,8 @@ dependencies:
cupertino_icons: ^0.1.3
devicelocale: ^0.3.1
sentry: ^3.0.1
firebase_messaging: ^6.0.16
flutter_local_notifications: 1.1.1
mockito: ^4.1.1