WT1.1.2 build 32 login error messages fixes
This commit is contained in:
parent
3ce32434bf
commit
ed8760f8e8
@ -177,7 +177,7 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject " " */;
|
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
|
||||||
compatibilityVersion = "Xcode 10.0";
|
compatibilityVersion = "Xcode 10.0";
|
||||||
developmentRegion = en;
|
developmentRegion = en;
|
||||||
hasScannedForEncodings = 0;
|
hasScannedForEncodings = 0;
|
||||||
@ -362,7 +362,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 31;
|
CURRENT_PROJECT_VERSION = 32;
|
||||||
DEVELOPMENT_TEAM = SFJJBDCU6Z;
|
DEVELOPMENT_TEAM = SFJJBDCU6Z;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
FRAMEWORK_SEARCH_PATHS = (
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
@ -505,7 +505,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 31;
|
CURRENT_PROJECT_VERSION = 32;
|
||||||
DEVELOPMENT_TEAM = SFJJBDCU6Z;
|
DEVELOPMENT_TEAM = SFJJBDCU6Z;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
FRAMEWORK_SEARCH_PATHS = (
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
@ -540,7 +540,7 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||||
CURRENT_PROJECT_VERSION = 31;
|
CURRENT_PROJECT_VERSION = 32;
|
||||||
DEVELOPMENT_TEAM = SFJJBDCU6Z;
|
DEVELOPMENT_TEAM = SFJJBDCU6Z;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
FRAMEWORK_SEARCH_PATHS = (
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
@ -570,7 +570,7 @@
|
|||||||
/* End XCBuildConfiguration section */
|
/* End XCBuildConfiguration section */
|
||||||
|
|
||||||
/* Begin XCConfigurationList section */
|
/* Begin XCConfigurationList section */
|
||||||
97C146E91CF9000F007C117D /* Build configuration list for PBXProject " " */ = {
|
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
|
||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
buildConfigurations = (
|
buildConfigurations = (
|
||||||
97C147031CF9000F007C117D /* Debug */,
|
97C147031CF9000F007C117D /* Debug */,
|
||||||
|
@ -33,6 +33,8 @@
|
|||||||
<string>584181112271127</string>
|
<string>584181112271127</string>
|
||||||
<key>FacebookDisplayName</key>
|
<key>FacebookDisplayName</key>
|
||||||
<string>Mobile Login</string>
|
<string>Mobile Login</string>
|
||||||
|
<key>FirebaseAppDelegateProxyEnabled</key>
|
||||||
|
<string>NO</string>
|
||||||
<key>LSApplicationQueriesSchemes</key>
|
<key>LSApplicationQueriesSchemes</key>
|
||||||
<array>
|
<array>
|
||||||
<string>fbapi</string>
|
<string>fbapi</string>
|
||||||
@ -66,7 +68,5 @@
|
|||||||
</array>
|
</array>
|
||||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>FirebaseAppDelegateProxyEnabled</key>
|
|
||||||
<string>NO</string>
|
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
@ -16,6 +16,9 @@ class CustomerChangeBloc extends Bloc<CustomerChangeEvent, CustomerChangeState>
|
|||||||
double height = 170;
|
double height = 170;
|
||||||
CustomerChangeBloc({this.customerRepository}) : super(CustomerChangeInitial()) {
|
CustomerChangeBloc({this.customerRepository}) : super(CustomerChangeInitial()) {
|
||||||
year = this.customerRepository.customer.birthYear;
|
year = this.customerRepository.customer.birthYear;
|
||||||
|
if (year == 0) {
|
||||||
|
year = 1990;
|
||||||
|
}
|
||||||
weight = this.customerRepository.getWeight();
|
weight = this.customerRepository.getWeight();
|
||||||
height = this.customerRepository.getHeight();
|
height = this.customerRepository.getHeight();
|
||||||
}
|
}
|
||||||
|
@ -288,6 +288,10 @@ class ExerciseNewBloc extends Bloc<ExerciseNewEvent, ExerciseNewState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
double getBMI() {
|
double getBMI() {
|
||||||
|
if (height == 0) {
|
||||||
|
this.bmi = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
this.bmi = weight / (height * height / 10000);
|
this.bmi = weight / (height * height / 10000);
|
||||||
this.getGoalBMI();
|
this.getGoalBMI();
|
||||||
return this.bmi;
|
return this.bmi;
|
||||||
|
@ -47,8 +47,11 @@ class LoginFormBloc extends FormBloc<String, String> with Common {
|
|||||||
} else {
|
} else {
|
||||||
// Emit either Loaded or Error
|
// Emit either Loaded or Error
|
||||||
await PropertyApi().getProperties();
|
await PropertyApi().getProperties();
|
||||||
|
print("properties OK");
|
||||||
await userRepository.getUser();
|
await userRepository.getUser();
|
||||||
|
print("get User OK");
|
||||||
await ExerciseTypeApi().getExerciseTypes();
|
await ExerciseTypeApi().getExerciseTypes();
|
||||||
|
print("exerciesTypes OK");
|
||||||
await ExerciseTreeApi().getExerciseTree();
|
await ExerciseTreeApi().getExerciseTree();
|
||||||
if (Cache().userLoggedIn != null && Cache().userLoggedIn.customerId > 0) {
|
if (Cache().userLoggedIn != null && Cache().userLoggedIn.customerId > 0) {
|
||||||
ExerciseRepository exerciseRepository = ExerciseRepository();
|
ExerciseRepository exerciseRepository = ExerciseRepository();
|
||||||
|
@ -17,8 +17,7 @@ class AppLocalizations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Static member to have a simple access to the delegate from the MaterialApp
|
// Static member to have a simple access to the delegate from the MaterialApp
|
||||||
static const LocalizationsDelegate<AppLocalizations> delegate =
|
static const LocalizationsDelegate<AppLocalizations> delegate = AppLocalizationsDelegate();
|
||||||
AppLocalizationsDelegate();
|
|
||||||
|
|
||||||
Map<String, String> _localizedStrings;
|
Map<String, String> _localizedStrings;
|
||||||
|
|
||||||
@ -29,8 +28,7 @@ class AppLocalizations {
|
|||||||
Future<bool> load() async {
|
Future<bool> load() async {
|
||||||
// Load the language JSON file from the "lang" folder
|
// Load the language JSON file from the "lang" folder
|
||||||
print(" -- load language pieces " + locale.languageCode);
|
print(" -- load language pieces " + locale.languageCode);
|
||||||
String jsonString =
|
String jsonString = await rootBundle.loadString('i18n/${locale.languageCode}.json');
|
||||||
await rootBundle.loadString('i18n/${locale.languageCode}.json');
|
|
||||||
Map<String, dynamic> jsonMap = json.decode(jsonString);
|
Map<String, dynamic> jsonMap = json.decode(jsonString);
|
||||||
|
|
||||||
_localizedStrings = jsonMap.map((key, value) {
|
_localizedStrings = jsonMap.map((key, value) {
|
||||||
@ -47,13 +45,12 @@ class AppLocalizations {
|
|||||||
// This method will be called from every widget which needs a localized text
|
// This method will be called from every widget which needs a localized text
|
||||||
String translate(String key) {
|
String translate(String key) {
|
||||||
if (isTest) return key;
|
if (isTest) return key;
|
||||||
return _localizedStrings[key];
|
String translated = _localizedStrings[key];
|
||||||
|
return translated != null ? translated : key;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class AppLocalizationsDelegate
|
class AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> {
|
||||||
extends LocalizationsDelegate<AppLocalizations> {
|
|
||||||
final bool isTest;
|
final bool isTest;
|
||||||
// This delegate instance will never change (it doesn't even have fields!)
|
// This delegate instance will never change (it doesn't even have fields!)
|
||||||
// It can provide a constant constructor.
|
// It can provide a constant constructor.
|
||||||
@ -77,7 +74,6 @@ class AppLocalizationsDelegate
|
|||||||
return localizations;
|
return localizations;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool shouldReload(AppLocalizationsDelegate old) => false;
|
bool shouldReload(AppLocalizationsDelegate old) => false;
|
||||||
}
|
}
|
@ -24,23 +24,30 @@ class UserRepository {
|
|||||||
|
|
||||||
Future<void> addUser() async {
|
Future<void> addUser() async {
|
||||||
final User modelUser = this.user;
|
final User modelUser = this.user;
|
||||||
|
try {
|
||||||
String rc = await FirebaseApi().registerEmail(modelUser.email, modelUser.password);
|
String rc = await FirebaseApi().registerEmail(modelUser.email, modelUser.password);
|
||||||
if ( rc == FirebaseApi.SIGN_IN_OK ) {
|
if (rc == FirebaseApi.SIGN_IN_OK) {
|
||||||
modelUser.firebaseUid = Cache().firebaseUid;
|
modelUser.firebaseUid = Cache().firebaseUid;
|
||||||
await CustomerApi().addUser(modelUser);
|
await CustomerApi().addUser(modelUser);
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
print(e.toString());
|
||||||
|
throw new Exception(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> getUser() async {
|
Future<void> getUser() async {
|
||||||
final User modelUser = this.user;
|
final User modelUser = this.user;
|
||||||
String rc = await FirebaseApi().signInEmail(modelUser.email, modelUser.password);
|
String rc = await FirebaseApi().signInEmail(modelUser.email, modelUser.password);
|
||||||
|
|
||||||
if ( rc == FirebaseApi.SIGN_IN_OK ) {
|
if (rc == FirebaseApi.SIGN_IN_OK) {
|
||||||
print("Firebase login ok");
|
print("Firebase login ok");
|
||||||
await CustomerApi().getUserByEmail(modelUser.email);
|
await CustomerApi().getUserByEmail(modelUser.email);
|
||||||
|
print("GetUserBy Email OK");
|
||||||
Cache().afterFirebaseLogin();
|
Cache().afterFirebaseLogin();
|
||||||
} else {
|
} else {
|
||||||
throw Exception("Exception: Customer does not exist or the password is wrong");
|
print("Exception: user not found or password is wrong");
|
||||||
|
throw Exception("Customer does not exist or the password is wrong");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,26 +5,18 @@ import 'package:http/http.dart' as http;
|
|||||||
import 'package:aitrainer_app/model/cache.dart';
|
import 'package:aitrainer_app/model/cache.dart';
|
||||||
|
|
||||||
class APIClient with Common {
|
class APIClient with Common {
|
||||||
|
|
||||||
Future<String> get(String endPoint, String param) async {
|
Future<String> get(String endPoint, String param) async {
|
||||||
final url = Cache.getBaseUrl() + endPoint + param;
|
final url = Cache.getBaseUrl() + endPoint + param;
|
||||||
String authToken = Cache().getAuthToken();
|
String authToken = Cache().getAuthToken();
|
||||||
if ( authToken.length == 0 ) {
|
if (authToken.length == 0) {
|
||||||
var responseJson = await APIClient.authenticateUser(
|
var responseJson = await APIClient.authenticateUser(Cache.username, Cache.password);
|
||||||
Cache.username,
|
|
||||||
Cache.password
|
|
||||||
);
|
|
||||||
authToken = responseJson['token'];
|
authToken = responseJson['token'];
|
||||||
}
|
}
|
||||||
final response = await http.get(url,
|
final response = await http.get(url, headers: {'Content-Type': 'application/json', 'Authorization': "Bearer " + authToken});
|
||||||
headers: {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'Authorization' : "Bearer " + authToken }
|
|
||||||
);
|
|
||||||
print(" ------------get response code: " + response.statusCode.toString());
|
print(" ------------get response code: " + response.statusCode.toString());
|
||||||
if(response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
return utf8.decode(response.bodyBytes);
|
return utf8.decode(response.bodyBytes);
|
||||||
} else if(response.statusCode == 404 ) {
|
} else if (response.statusCode == 404) {
|
||||||
throw NotFoundException(message: "Not Found");
|
throw NotFoundException(message: "Not Found");
|
||||||
} else {
|
} else {
|
||||||
throw Exception("Network Error, please try again later");
|
throw Exception("Network Error, please try again later");
|
||||||
@ -35,19 +27,14 @@ class APIClient with Common {
|
|||||||
final url = Cache.getBaseUrl() + endPoint;
|
final url = Cache.getBaseUrl() + endPoint;
|
||||||
print(" ------------ http/post endpoint $endPoint body $body - url: $url ");
|
print(" ------------ http/post endpoint $endPoint body $body - url: $url ");
|
||||||
String authToken = Cache().getAuthToken();
|
String authToken = Cache().getAuthToken();
|
||||||
if ( authToken.length == 0 ) {
|
if (authToken.length == 0) {
|
||||||
var responseJson = await APIClient.authenticateUser(
|
var responseJson = await APIClient.authenticateUser(Cache.username, Cache.password);
|
||||||
Cache.username,
|
|
||||||
Cache.password
|
|
||||||
);
|
|
||||||
authToken = responseJson['token'];
|
authToken = responseJson['token'];
|
||||||
}
|
}
|
||||||
|
|
||||||
final response = await http.post(url,
|
final response = await http.post(
|
||||||
headers: {
|
url,
|
||||||
'Content-Type': 'application/json; charset=UTF-8',
|
headers: {'Content-Type': 'application/json; charset=UTF-8', 'Authorization': "Bearer " + authToken},
|
||||||
'Authorization' : "Bearer " + authToken
|
|
||||||
},
|
|
||||||
body: body,
|
body: body,
|
||||||
);
|
);
|
||||||
print(" ------------post response code: " + response.statusCode.toString());
|
print(" ------------post response code: " + response.statusCode.toString());
|
||||||
@ -62,25 +49,18 @@ class APIClient with Common {
|
|||||||
try {
|
try {
|
||||||
final body = '{"username":"$email", "password":"$password"}';
|
final body = '{"username":"$email", "password":"$password"}';
|
||||||
print("authentication with $email");
|
print("authentication with $email");
|
||||||
final response = await http.post(
|
final response = await http.post(uri, headers: {'Authorization': '1', 'Content-Type': 'application/json'}, body: body);
|
||||||
uri,
|
|
||||||
headers: {
|
|
||||||
'Authorization': '1',
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
},
|
|
||||||
body: body
|
|
||||||
);
|
|
||||||
final responseCode = response.statusCode;
|
final responseCode = response.statusCode;
|
||||||
if ( responseCode != 200) {
|
if (responseCode != 200) {
|
||||||
return { "error" : "Authentication error, total failure", };
|
return {
|
||||||
|
"error": "Authentication error, total failure",
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
final responseJson = json.decode(response.body);
|
final responseJson = json.decode(response.body);
|
||||||
return responseJson;
|
return responseJson;
|
||||||
|
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
return { "error" : "Network error, try again later "
|
return {"error": "Network error, try again later " + exception.toString()};
|
||||||
+ exception.toString()};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,22 +70,18 @@ class APIClient with Common {
|
|||||||
try {
|
try {
|
||||||
final response = await http.get(
|
final response = await http.get(
|
||||||
uri,
|
uri,
|
||||||
headers: {
|
headers: {'Authorization': authToken},
|
||||||
'Authorization': authToken
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
|
||||||
final responseJson = json.decode(response.body);
|
final responseJson = json.decode(response.body);
|
||||||
return responseJson;
|
return responseJson;
|
||||||
|
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
print(exception);
|
print(exception);
|
||||||
if(exception.toString().contains('SocketException')) {
|
if (exception.toString().contains('SocketException')) {
|
||||||
return 'NetworkError';
|
return 'NetworkError';
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -6,6 +6,7 @@ import 'package:aitrainer_app/model/property.dart';
|
|||||||
import 'package:aitrainer_app/model/user.dart';
|
import 'package:aitrainer_app/model/user.dart';
|
||||||
import 'package:aitrainer_app/service/api.dart';
|
import 'package:aitrainer_app/service/api.dart';
|
||||||
import 'package:aitrainer_app/model/cache.dart';
|
import 'package:aitrainer_app/model/cache.dart';
|
||||||
|
import 'package:aitrainer_app/util/not_found_exception.dart';
|
||||||
|
|
||||||
class CustomerApi {
|
class CustomerApi {
|
||||||
final APIClient _client = new APIClient();
|
final APIClient _client = new APIClient();
|
||||||
@ -72,12 +73,14 @@ class CustomerApi {
|
|||||||
Customer customer;
|
Customer customer;
|
||||||
try {
|
try {
|
||||||
customer = Customer.fromJson(jsonDecode(responseBody));
|
customer = Customer.fromJson(jsonDecode(responseBody));
|
||||||
/* if (customer.firebaseUid == null) {
|
if (customer.firebaseUid == null) {
|
||||||
await this.updateFirebaseUid(customer.customerId, Cache().firebaseUid);
|
await this.updateFirebaseUid(customer.customerId, Cache().firebaseUid);
|
||||||
} */
|
}
|
||||||
Cache().userLoggedIn = customer;
|
Cache().userLoggedIn = customer;
|
||||||
final List properties = await this.getActualProperties(customer.customerId);
|
final List properties = await this.getActualProperties(customer.customerId);
|
||||||
|
if (properties != null) {
|
||||||
this._initProperties(properties);
|
this._initProperties(properties);
|
||||||
|
}
|
||||||
} on FormatException {
|
} on FormatException {
|
||||||
throw new Exception(responseBody);
|
throw new Exception(responseBody);
|
||||||
}
|
}
|
||||||
@ -93,8 +96,10 @@ class CustomerApi {
|
|||||||
final List properties = await this.getActualProperties(customerId);
|
final List properties = await this.getActualProperties(customerId);
|
||||||
print(" ---- Props: " + properties.toString());
|
print(" ---- Props: " + properties.toString());
|
||||||
Cache().afterRegistration(customer);
|
Cache().afterRegistration(customer);
|
||||||
|
if (properties != null) {
|
||||||
this._initProperties(properties);
|
this._initProperties(properties);
|
||||||
} catch (exception) {
|
}
|
||||||
|
} on Exception catch (exception) {
|
||||||
print("Exception: " + exception.toString());
|
print("Exception: " + exception.toString());
|
||||||
print(" === go to registration ");
|
print(" === go to registration ");
|
||||||
Cache().logout();
|
Cache().logout();
|
||||||
@ -162,13 +167,20 @@ class CustomerApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<List<CustomerProperty>> getActualProperties(int customerId) async {
|
Future<List<CustomerProperty>> getActualProperties(int customerId) async {
|
||||||
|
List<CustomerProperty> properties;
|
||||||
|
try {
|
||||||
final body = await _client.get("customer_property/last/", customerId.toString());
|
final body = await _client.get("customer_property/last/", customerId.toString());
|
||||||
final Iterable json = jsonDecode(body);
|
final Iterable json = jsonDecode(body);
|
||||||
final List<CustomerProperty> properties = json.map((property) => CustomerProperty.fromJson(property)).toList();
|
properties = json.map((property) => CustomerProperty.fromJson(property)).toList();
|
||||||
|
|
||||||
|
if (properties != null) {
|
||||||
properties.forEach((element) {
|
properties.forEach((element) {
|
||||||
print("Property " + element.toString());
|
print("Property " + element.toString());
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
} on Exception catch (ex) {
|
||||||
|
print(ex.toString());
|
||||||
|
}
|
||||||
return properties;
|
return properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,10 +65,11 @@ class FirebaseApi {
|
|||||||
} else if (e.code == 'email-already-in-use') {
|
} else if (e.code == 'email-already-in-use') {
|
||||||
print('The account already exists for that email.');
|
print('The account already exists for that email.');
|
||||||
rc = REGISTER_EMAIL_IN_USE;
|
rc = REGISTER_EMAIL_IN_USE;
|
||||||
userCredential = await FirebaseAuth.instance.signInWithEmailAndPassword(email: email, password: password);
|
throw Exception("The email address has been registered already");
|
||||||
|
/* userCredential = await FirebaseAuth.instance.signInWithEmailAndPassword(email: email, password: password);
|
||||||
if (rc != null) {
|
if (rc != null) {
|
||||||
rc = SIGN_IN_OK;
|
rc = SIGN_IN_OK;
|
||||||
}
|
} */
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print(e);
|
print(e);
|
||||||
|
@ -51,7 +51,8 @@ class _LoginWidget extends State<LoginWidget> with Common, Trans {
|
|||||||
},
|
},
|
||||||
onFailure: (context, state) {
|
onFailure: (context, state) {
|
||||||
LoadingDialog.hide(context);
|
LoadingDialog.hide(context);
|
||||||
showInSnackBar(t(state.failureResponse));
|
Scaffold.of(context).showSnackBar(SnackBar(
|
||||||
|
backgroundColor: Colors.orange, content: Text(t(state.failureResponse), style: TextStyle(color: Colors.white))));
|
||||||
},
|
},
|
||||||
onLoaded: (context, state) {},
|
onLoaded: (context, state) {},
|
||||||
child: loadForm(loginBloc, accountBloc)),
|
child: loadForm(loginBloc, accountBloc)),
|
||||||
@ -159,9 +160,4 @@ class _LoginWidget extends State<LoginWidget> with Common, Trans {
|
|||||||
])),
|
])),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showInSnackBar(String error) {
|
|
||||||
_scaffoldKey.currentState
|
|
||||||
.showSnackBar(SnackBar(backgroundColor: Colors.orange, content: Text(error, style: TextStyle(color: Colors.white))));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import 'package:aitrainer_app/localization/app_localization.dart';
|
|||||||
import 'package:aitrainer_app/util/common.dart';
|
import 'package:aitrainer_app/util/common.dart';
|
||||||
import 'package:aitrainer_app/repository/customer_repository.dart';
|
import 'package:aitrainer_app/repository/customer_repository.dart';
|
||||||
import 'package:aitrainer_app/repository/user_repository.dart';
|
import 'package:aitrainer_app/repository/user_repository.dart';
|
||||||
|
import 'package:aitrainer_app/util/trans.dart';
|
||||||
import 'package:aitrainer_app/widgets/app_bar_min.dart';
|
import 'package:aitrainer_app/widgets/app_bar_min.dart';
|
||||||
import 'package:aitrainer_app/widgets/splash.dart';
|
import 'package:aitrainer_app/widgets/splash.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -34,11 +35,12 @@ class RegistrationWidget extends StatefulWidget {
|
|||||||
State<StatefulWidget> createState() => _RegistrationWidget();
|
State<StatefulWidget> createState() => _RegistrationWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _RegistrationWidget extends State<RegistrationWidget> with Common {
|
class _RegistrationWidget extends State<RegistrationWidget> with Common, Trans {
|
||||||
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
|
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
setContext(context);
|
||||||
// ignore: close_sinks
|
// ignore: close_sinks
|
||||||
final accountBloc = BlocProvider.of<AccountBloc>(context);
|
final accountBloc = BlocProvider.of<AccountBloc>(context);
|
||||||
return BlocProvider(
|
return BlocProvider(
|
||||||
@ -60,7 +62,8 @@ class _RegistrationWidget extends State<RegistrationWidget> with Common {
|
|||||||
},
|
},
|
||||||
onFailure: (context, state) {
|
onFailure: (context, state) {
|
||||||
LoadingDialog.hide(context);
|
LoadingDialog.hide(context);
|
||||||
showInSnackBar(state.failureResponse);
|
Scaffold.of(context).showSnackBar(SnackBar(
|
||||||
|
backgroundColor: Colors.orange, content: Text(t(state.failureResponse), style: TextStyle(color: Colors.white))));
|
||||||
},
|
},
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
bottom: false,
|
bottom: false,
|
||||||
@ -158,11 +161,4 @@ class _RegistrationWidget extends State<RegistrationWidget> with Common {
|
|||||||
);
|
);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void showInSnackBar(String error) {
|
|
||||||
_scaffoldKey.currentState.showSnackBar(SnackBar(
|
|
||||||
backgroundColor: Colors.orange,
|
|
||||||
content: Text(AppLocalizations.of(context).translate("There is an error: during registration:") + " " + error,
|
|
||||||
style: TextStyle(color: Colors.white))));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -168,7 +168,6 @@ class _BMRState extends State<BMR> with Trans {
|
|||||||
|
|
||||||
Widget getFitnessLevel() {
|
Widget getFitnessLevel() {
|
||||||
String fitnessLevel = widget.exerciseBloc.fitnessLevel;
|
String fitnessLevel = widget.exerciseBloc.fitnessLevel;
|
||||||
print("sel " + fitnessLevel + FitnessItem().getItem(fitnessLevel).stateText);
|
|
||||||
return Container(
|
return Container(
|
||||||
padding: EdgeInsets.only(left: 65, right: 65),
|
padding: EdgeInsets.only(left: 65, right: 65),
|
||||||
child: DropdownSearch<FitnessState>(
|
child: DropdownSearch<FitnessState>(
|
||||||
|
Loading…
Reference in New Issue
Block a user