WT1.1.2e error fixes
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import 'package:aitrainer_app/bloc/account/account_bloc.dart';
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||
import 'package:aitrainer_app/repository/user_repository.dart';
|
||||
import 'package:aitrainer_app/service/exercise_tree_service.dart';
|
||||
import 'package:aitrainer_app/service/exercisetype_service.dart';
|
||||
import 'package:aitrainer_app/util/common.dart';
|
||||
import 'package:flutter_form_bloc/flutter_form_bloc.dart';
|
||||
|
||||
@@ -50,6 +53,12 @@ class LoginFormBloc extends FormBloc<String, String> with Common {
|
||||
} else {
|
||||
// Emit either Loaded or Error
|
||||
await userRepository.getUser();
|
||||
await ExerciseTypeApi().getExerciseTypes();
|
||||
await ExerciseTreeApi().getExerciseTree();
|
||||
if ( Cache().userLoggedIn != null && Cache().userLoggedIn.customerId > 0) {
|
||||
ExerciseRepository exerciseRepository = ExerciseRepository();
|
||||
await exerciseRepository.getExercisesByCustomer(Cache().userLoggedIn.customerId);
|
||||
}
|
||||
emitSuccess(canSubmitAgain: false);
|
||||
accountBloc.add(AccountLogInFinished(customer: Cache().userLoggedIn));
|
||||
}
|
||||
|
||||
@@ -35,6 +35,10 @@ class MenuBloc extends Bloc<MenuEvent, MenuState> with Trans {
|
||||
|
||||
void setMenuInfo() {
|
||||
double percent = Cache().getPercentExercises();
|
||||
if ( percent == -1 ) {
|
||||
exerciseRepository.getBaseExerciseFinishedPercent();
|
||||
percent = Cache().getPercentExercises();
|
||||
}
|
||||
if ( context == null ) return;
|
||||
percent = percent * 100;
|
||||
print("Percent " + percent.toString());
|
||||
|
||||
@@ -38,6 +38,7 @@ class UserRepository {
|
||||
rc = await FirebaseApi().registerEmail(modelUser.email, modelUser.password);
|
||||
}
|
||||
if ( rc == FirebaseApi.SIGN_IN_OK ) {
|
||||
print("Firebase login ok");
|
||||
await CustomerApi().getUserByEmail(modelUser.email);
|
||||
Cache().afterFirebaseLogin();
|
||||
}
|
||||
|
||||
@@ -72,14 +72,13 @@ class FirebaseApi {
|
||||
throw Exception("Password too short");
|
||||
} else if (e.code == 'email-already-in-use') {
|
||||
print('The account already exists for that email.');
|
||||
throw Exception("Customer exists");
|
||||
rc = REGISTER_EMAIL_IN_USE;
|
||||
throw Exception("Customer exists");
|
||||
}
|
||||
} catch (e) {
|
||||
print(e);
|
||||
throw Exception(e.toString());
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ class _CustomerGoalPage extends State<CustomerGoalPage> {
|
||||
children: [
|
||||
FlatButton(
|
||||
child: Image.asset(
|
||||
"asset/image/WT_gain_muscle.png",
|
||||
"asset/image/Gain_muscle.png",
|
||||
height: 180,
|
||||
),
|
||||
padding: EdgeInsets.all(0.0),
|
||||
|
||||
+5
-7
@@ -2,7 +2,6 @@ import 'package:aitrainer_app/bloc/login_form_bloc.dart';
|
||||
import 'package:aitrainer_app/bloc/account/account_bloc.dart';
|
||||
import 'package:aitrainer_app/localization/app_localization.dart';
|
||||
import 'package:aitrainer_app/repository/user_repository.dart';
|
||||
import 'package:aitrainer_app/service/firebase_api.dart';
|
||||
import 'package:aitrainer_app/util/common.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:aitrainer_app/widgets/splash.dart';
|
||||
@@ -61,8 +60,6 @@ class _LoginWidget extends State<LoginWidget> with Common, Trans {
|
||||
image: DecorationImage(
|
||||
image: AssetImage('asset/image/WT_login.png'),
|
||||
fit: BoxFit.cover,
|
||||
//height: double.infinity,
|
||||
//width: double.infinity,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
),
|
||||
@@ -78,10 +75,11 @@ class _LoginWidget extends State<LoginWidget> with Common, Trans {
|
||||
return Form(
|
||||
key: _formKey,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(left: 25, right: 100),
|
||||
padding: const EdgeInsets.only(left: 15, right: 50),
|
||||
child:
|
||||
ListView(shrinkWrap: false, padding: EdgeInsets.only(top: 120.0),
|
||||
ListView(shrinkWrap: false, padding: EdgeInsets.only(top: 150.0),
|
||||
children: <Widget>[
|
||||
Divider(color: Colors.transparent),
|
||||
/* FlatButton(
|
||||
child: new Image.asset(
|
||||
'asset/image/login_fb.png',
|
||||
@@ -155,13 +153,13 @@ class _LoginWidget extends State<LoginWidget> with Common, Trans {
|
||||
onTap: () =>
|
||||
Navigator.of(context).pushNamed('registration'),
|
||||
),
|
||||
Spacer(flex: 1),
|
||||
Spacer(flex: 2),
|
||||
new InkWell(
|
||||
child: new Text(
|
||||
AppLocalizations.of(context).translate('I forgot the password')),
|
||||
onTap: () => Navigator.of(context).pushNamed('resetPassword'),
|
||||
),
|
||||
Spacer(flex: 1),
|
||||
Spacer(flex: 2),
|
||||
new InkWell(
|
||||
child: new Text(
|
||||
AppLocalizations.of(context).translate('Privacy')),
|
||||
|
||||
@@ -54,7 +54,7 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> with Trans {
|
||||
)
|
||||
),
|
||||
image: "asset/image/edzesnaplom400400.jpg",
|
||||
left: 10,
|
||||
left: 5,
|
||||
onTap: () => this.callBackExerciseLog(exerciseRepository, customerRepository),
|
||||
isLocked: false,
|
||||
),
|
||||
@@ -70,7 +70,7 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> with Trans {
|
||||
backgroundColor: Colors.black54.withOpacity(0.4)),
|
||||
),
|
||||
image: "asset/image/testemfejl400x400.jpg",
|
||||
left: 10,
|
||||
left: 5,
|
||||
onTap: () => {
|
||||
args['customerId'] = Cache().userLoggedIn.customerId,
|
||||
Navigator.of(context).pushNamed('mydevelopmentBodyPage', arguments: args)
|
||||
@@ -88,13 +88,13 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> with Trans {
|
||||
fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
image: "asset/image/izomcsop400400.jpg",
|
||||
left: 10,
|
||||
left: 5,
|
||||
onTap: () => {Navigator.of(context).pushNamed('mydevelopmentMusclePage', arguments: args)},
|
||||
isLocked: true,
|
||||
),
|
||||
ImageButton(
|
||||
width: imageWidth,
|
||||
left: 10,
|
||||
left: 5,
|
||||
textAlignment: Alignment.topLeft,
|
||||
text: t("Predictions"),
|
||||
style: GoogleFonts.robotoMono(
|
||||
|
||||
@@ -52,7 +52,7 @@ class _MyExercisePlanPage extends State<MyExercisePlanPage> with Trans {
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
image: "asset/image/exercise_plan_execute.jpg",
|
||||
top: 130,
|
||||
left: 10,
|
||||
left: 5,
|
||||
onTap:() => {
|
||||
args['customerId'] = Cache().userLoggedIn.customerId,
|
||||
Navigator.of(context).pushNamed('exerciseExecutePlanPage',
|
||||
@@ -69,7 +69,7 @@ class _MyExercisePlanPage extends State<MyExercisePlanPage> with Trans {
|
||||
textStyle: TextStyle(fontSize: 14, color: Colors.orange, fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
image: "asset/image/exercise_plan_custom.jpg",
|
||||
left: 10,
|
||||
left: 5,
|
||||
onTap:() => {
|
||||
args['exerciseRepository'] = exerciseRepository,
|
||||
args['customerId'] = Cache().userLoggedIn.customerId,
|
||||
@@ -87,7 +87,7 @@ class _MyExercisePlanPage extends State<MyExercisePlanPage> with Trans {
|
||||
textStyle: TextStyle(fontSize: 14, color: Colors.orange, fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
image: "asset/image/exercise_plan_suggested.jpg",
|
||||
left: 10,
|
||||
left: 5,
|
||||
onTap:() => {
|
||||
|
||||
},
|
||||
@@ -102,7 +102,7 @@ class _MyExercisePlanPage extends State<MyExercisePlanPage> with Trans {
|
||||
textStyle: TextStyle(fontSize: 14, color: Colors.orange, fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
image: "asset/image/exercise_plan_special.jpg",
|
||||
left: 10,
|
||||
left: 5,
|
||||
onTap:() => {
|
||||
|
||||
},
|
||||
@@ -117,7 +117,7 @@ class _MyExercisePlanPage extends State<MyExercisePlanPage> with Trans {
|
||||
textStyle: TextStyle(fontSize: 14, color: Colors.orange, fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
image: "asset/image/exercise_plan_stars.jpg",
|
||||
left: 10,
|
||||
left: 5,
|
||||
onTap:() => {
|
||||
|
||||
},
|
||||
|
||||
@@ -78,12 +78,13 @@ class _RegistrationWidget extends State<RegistrationWidget> with Common {
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(left: 25, right: 100),
|
||||
padding: const EdgeInsets.only(left: 25, right: 50),
|
||||
child: ListView(
|
||||
shrinkWrap: false,
|
||||
padding: EdgeInsets.only(top: 120.0),
|
||||
padding: EdgeInsets.only(top: 150.0),
|
||||
//mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: <Widget>[
|
||||
Divider(color: Colors.transparent,),
|
||||
//Spacer(flex:4),
|
||||
|
||||
/* FlatButton(
|
||||
|
||||
@@ -111,6 +111,7 @@ class _AppBarNav extends State<AppBarNav> with SingleTickerProviderStateMixin,
|
||||
double cWidth = mediaSizeWidth(context);
|
||||
double percent = Cache().getPercentExercises();
|
||||
if ( percent == -1) {
|
||||
menuBloc.menuTreeRepository.createTree();
|
||||
ExerciseRepository exerciseRepository = ExerciseRepository();
|
||||
exerciseRepository.getBaseExerciseFinishedPercent();
|
||||
percent = Cache().getPercentExercises();
|
||||
|
||||
@@ -37,7 +37,7 @@ class ImageButton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double top = width - (style.fontSize - 5) * text.length < 0 ? width - 2 * style.fontSize - 10 : width - style.fontSize - 10;
|
||||
double top = width - (style.fontSize - 5) * text.length - 2 * left < 0 ? width - 2 * style.fontSize - 10 : width - style.fontSize - 10;
|
||||
print ("Top: " + top.toStringAsFixed(0) + " length: " + ((style.fontSize - 5) * text.length).toString());
|
||||
return Stack(
|
||||
//alignment: textAlignment,
|
||||
|
||||
@@ -43,7 +43,7 @@ class MenuInfoWidget extends StatelessWidget with Common {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
int length = title.length + text2.length + text3.length + link.length;
|
||||
return Container(
|
||||
return /* Container(
|
||||
height: length > 100? 350 : 250,
|
||||
width: 180,
|
||||
padding: EdgeInsets.all(25.0),
|
||||
@@ -56,7 +56,7 @@ class MenuInfoWidget extends StatelessWidget with Common {
|
||||
),
|
||||
child: BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: 9, sigmaY: 9),
|
||||
child: Container(
|
||||
child:*/ Container(
|
||||
padding: EdgeInsets.only(top: 10.0, left: 15, right: 10, bottom: 5),
|
||||
|
||||
decoration: BoxDecoration(
|
||||
@@ -65,37 +65,40 @@ class MenuInfoWidget extends StatelessWidget with Common {
|
||||
borderRadius: BorderRadius.all(Radius.circular(10.0)),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
maxLines: 1,
|
||||
maxLines: 4,
|
||||
textAlign: TextAlign.center,
|
||||
style:
|
||||
TextStyle(color: titleColor, fontSize: titleSize, fontFamily: 'Arial', fontWeight: titleWeight),
|
||||
TextStyle(color: titleColor, fontSize: titleSize, fontWeight: titleWeight),
|
||||
),
|
||||
Divider(),
|
||||
Text(
|
||||
text,
|
||||
maxLines: 6,
|
||||
style: TextStyle(color: textColor, fontSize: textSize, fontFamily: 'Arial', fontWeight: textWeight),
|
||||
style: TextStyle(color: textColor, fontSize: textSize, fontWeight: textWeight),
|
||||
),
|
||||
Divider(),
|
||||
Text(
|
||||
text2,
|
||||
maxLines: 6,
|
||||
style: TextStyle(color: textColor, fontSize: textSize, fontFamily: 'Arial', fontWeight: textWeight),
|
||||
style: TextStyle(color: textColor, fontSize: textSize, fontWeight: textWeight),
|
||||
),
|
||||
Divider(),
|
||||
Text(
|
||||
text3,
|
||||
maxLines: 6,
|
||||
style: TextStyle(color: textColor, fontSize: textSize, fontFamily: 'Arial', fontWeight: textWeight),
|
||||
style: TextStyle(color: textColor, fontSize: textSize, fontWeight: textWeight),
|
||||
),
|
||||
getLink(),
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
//),
|
||||
// )
|
||||
);
|
||||
}
|
||||
|
||||
Widget getLink() {
|
||||
|
||||
Reference in New Issue
Block a user