wt1.1b exercise description, bug fixing + custom exercise fix
This commit is contained in:
@@ -191,10 +191,10 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
SliverGrid gridCalculation(CustomExerciseFormBloc bloc) {
|
||||
return SliverGrid(
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
crossAxisCount: 3,
|
||||
mainAxisSpacing: 10.0,
|
||||
crossAxisSpacing: 10.0,
|
||||
childAspectRatio: 4.0,
|
||||
childAspectRatio: 2.0,
|
||||
),
|
||||
delegate: SliverChildListDelegate(
|
||||
[
|
||||
@@ -209,29 +209,6 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
filled: false,
|
||||
labelText: "1RM by Wendler: ",
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:30),
|
||||
textFieldBloc: bloc.rmMcGothlinField,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
labelText: "1RM by McGlothin: ",
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:30),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rmLombardiField,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
labelText: "1RM by Lambordini: ",
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:30),
|
||||
@@ -292,6 +269,43 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
filled: false,
|
||||
labelText: "1RM 90%: ",
|
||||
)),
|
||||
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:30),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rm75Field,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12, fontWeight: FontWeight.bold),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
labelText: "1RM 75%: ",
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:30),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rm75OconnorField,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12, fontWeight: FontWeight.bold),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
labelText: "1RM 75%: by O'Connor",
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:30),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rm75WendlerField,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12, fontWeight: FontWeight.bold),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
labelText: "1RM 75% by Wendler: ",
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:30),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:aitrainer_app/bloc/exercise_form_bloc.dart';
|
||||
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/model/exercise_type.dart';
|
||||
@@ -26,7 +27,9 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> {
|
||||
final exerciseBloc = BlocProvider.of<ExerciseFormBloc>(context);
|
||||
|
||||
exerciseBloc.exerciseRepository.setExerciseType(exerciseType);
|
||||
String exerciseName = exerciseBloc.exerciseRepository.exerciseType.name;
|
||||
String exerciseName = AppLanguage().appLocal == Locale("en") ?
|
||||
exerciseBloc.exerciseRepository.exerciseType.name :
|
||||
exerciseBloc.exerciseRepository.exerciseType.nameTranslation;
|
||||
|
||||
return Form(
|
||||
autovalidate: true,
|
||||
@@ -68,13 +71,34 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> {
|
||||
children: <Widget>[
|
||||
Divider(color: Colors.transparent,),
|
||||
Divider(color: Colors.transparent,),
|
||||
Divider(color: Colors.transparent,),
|
||||
Text(AppLocalizations.of(context).translate('Save Exercise'),
|
||||
style: TextStyle(fontSize: 14, color: Colors.blueAccent)),
|
||||
Text(exerciseName,
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: Colors.deepOrange),
|
||||
overflow: TextOverflow.fade,
|
||||
maxLines: 1,
|
||||
softWrap: true,
|
||||
),
|
||||
|
||||
|
||||
Text(AppLocalizations.of(context).translate(exerciseName) + " " +
|
||||
AppLocalizations.of(context).translate('Save Exercise'),
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: Colors.deepOrange)),
|
||||
Divider(color: Colors.transparent,),
|
||||
Divider(color: Colors.transparent,),
|
||||
FlatButton(
|
||||
child: Row(
|
||||
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Icon(Icons.description),
|
||||
Text(AppLocalizations.of(context).translate("Description"),
|
||||
style: TextStyle(
|
||||
color: Colors.blueAccent, fontWeight: FontWeight.normal, fontSize: 14 )),
|
||||
Icon(Icons.arrow_forward_ios),
|
||||
]),
|
||||
textColor: Colors.blueAccent,
|
||||
color: Colors.transparent,
|
||||
onPressed: () => {
|
||||
Navigator.of(context).pushNamed('exerciseTypeDescription', arguments: exerciseBloc.exerciseRepository),
|
||||
},
|
||||
),
|
||||
Divider(color: Colors.transparent,),
|
||||
columnQuantityUnit(exerciseBloc),
|
||||
Divider(color: Colors.transparent,),
|
||||
@@ -138,36 +162,6 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> {
|
||||
bloc.exerciseRepository.exerciseType.unitQuantityUnit),
|
||||
),
|
||||
),
|
||||
/*TextFormField(
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
hintStyle: TextStyle(fontSize: 16, color: Colors.black54, fontWeight: FontWeight.w100),
|
||||
hintText: AppLocalizations.of(context).translate("The number of the exercise done with"),
|
||||
labelStyle: TextStyle(fontSize: 16, color: Colors.lightBlue),
|
||||
labelText: AppLocalizations.of(context).translate(
|
||||
bloc.exerciseRepository.exerciseType.unitQuantityUnit),
|
||||
),
|
||||
autovalidate: true,
|
||||
textAlign: TextAlign.center,
|
||||
initialValue: "",
|
||||
style: TextStyle(fontSize: 30,
|
||||
color: Colors.lightBlue,
|
||||
fontWeight: FontWeight.bold),
|
||||
validator: (input) {
|
||||
return validateNumberInput(input);
|
||||
},
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter(RegExp(r"[\d.]"))
|
||||
//WhitelistingTextInputFormatter(RegExp(r"[\d.]"))
|
||||
],
|
||||
onChanged: (input) => {
|
||||
print ("UnitQuantity value $input"),
|
||||
bloc.exerciseRepository.setUnitQuantity(
|
||||
double.parse(input))
|
||||
},
|
||||
|
||||
), */
|
||||
new InkWell(
|
||||
child: new Text(AppLocalizations.of(context).translate(
|
||||
bloc.exerciseRepository.exerciseType.unitQuantityUnit),
|
||||
@@ -207,36 +201,6 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> {
|
||||
bloc.exerciseRepository.exerciseType.unit),
|
||||
),
|
||||
),
|
||||
/* TextFormField(
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
hintText: AppLocalizations.of(context).translate("The number of the exercise"),
|
||||
hintStyle: TextStyle(fontSize: 16, color: Colors.black54, fontWeight: FontWeight.w100),
|
||||
labelStyle: TextStyle(fontSize: 16, color: Colors.deepOrange),
|
||||
labelText: AppLocalizations.of(context).translate(
|
||||
bloc.exerciseRepository.exerciseType.unit),
|
||||
),
|
||||
autovalidate: true,
|
||||
textAlign: TextAlign.center,
|
||||
initialValue: "",
|
||||
style: TextStyle(fontSize: 50,
|
||||
color: Colors.deepOrange,
|
||||
fontWeight: FontWeight.bold),
|
||||
validator: (input) {
|
||||
return validateNumberInput(input);
|
||||
},
|
||||
inputFormatters: [
|
||||
WhitelistingTextInputFormatter(RegExp(r"[\d.]"))
|
||||
],
|
||||
onChanged: (input) =>
|
||||
{
|
||||
print ("Quantity value $input"),
|
||||
bloc.exerciseRepository.setQuantity(double.parse(input)),
|
||||
bloc.exerciseRepository.setUnit(bloc.exerciseRepository.exerciseType.unit)
|
||||
|
||||
}
|
||||
),*/
|
||||
|
||||
]);
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
import 'package:aitrainer_app/localization/app_language.dart';
|
||||
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ExerciseTypeDescription extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ExerciseRepository exerciseRepository =
|
||||
ModalRoute.of(context).settings.arguments;
|
||||
String exerciseDescription = AppLanguage().appLocal == Locale("en")
|
||||
? exerciseRepository.exerciseType.description
|
||||
: exerciseRepository.exerciseType.descriptionTranslation;
|
||||
|
||||
|
||||
String exerciseName = AppLanguage().appLocal == Locale("en") ?
|
||||
exerciseRepository.exerciseType.name :
|
||||
exerciseRepository.exerciseType.nameTranslation;
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'asset/image/WT_long_logo.png',
|
||||
fit: BoxFit.cover,
|
||||
height: 65.0,
|
||||
),
|
||||
],
|
||||
),
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back, color: Colors.white),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
),
|
||||
body: Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: MediaQuery.of(context).size.height,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('asset/image/WT_light_background.png'),
|
||||
fit: BoxFit.fill,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
),
|
||||
padding: EdgeInsets.only(left: 20, top: 20, right: 15),
|
||||
child: ListView(
|
||||
|
||||
children: [
|
||||
Text(exerciseName,
|
||||
style: TextStyle(color: Colors.blueGrey,
|
||||
fontSize: 20, fontWeight: FontWeight.bold),
|
||||
),
|
||||
Divider(color: Colors.transparent,),
|
||||
InkWell(
|
||||
child: Text(exerciseDescription,
|
||||
style: TextStyle(color: Colors.blueGrey,
|
||||
fontSize: 18, fontWeight: FontWeight.normal),),
|
||||
),
|
||||
]
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -7,7 +7,7 @@ import 'package:aitrainer_app/widgets/splash.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
//import 'package:flutter_facebook_login/flutter_facebook_login.dart';
|
||||
import 'package:flutter_facebook_login/flutter_facebook_login.dart';
|
||||
import 'package:flutter_form_bloc/flutter_form_bloc.dart';
|
||||
|
||||
import '../library_keys.dart';
|
||||
@@ -87,7 +87,7 @@ class _LoginWidget extends State<LoginWidget> {
|
||||
width: cWidth * .85,
|
||||
),
|
||||
onPressed: () => {
|
||||
//_fbLogin(),
|
||||
_fbLogin(),
|
||||
print("Login with FB"),
|
||||
},
|
||||
),
|
||||
@@ -172,7 +172,7 @@ class _LoginWidget extends State<LoginWidget> {
|
||||
content: Text(error, style: TextStyle(color: Colors.white))));
|
||||
}
|
||||
|
||||
/* Future<Null> _fbLogin() async {
|
||||
Future<Null> _fbLogin() async {
|
||||
final FacebookLogin facebookSignIn = new FacebookLogin();
|
||||
final FacebookLoginResult result = await facebookSignIn.logIn(['email']);
|
||||
|
||||
@@ -197,5 +197,5 @@ class _LoginWidget extends State<LoginWidget> {
|
||||
'Here\'s the error Facebook gave us: ${result.errorMessage}');
|
||||
break;
|
||||
}
|
||||
} */
|
||||
}
|
||||
}
|
||||
|
||||
+50
-35
@@ -1,6 +1,8 @@
|
||||
import 'package:aitrainer_app/bloc/menu/menu_bloc.dart';
|
||||
import 'package:aitrainer_app/bloc/settings/settings_bloc.dart';
|
||||
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/widgets/bottom_nav.dart';
|
||||
import 'package:aitrainer_app/widgets/splash.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -15,7 +17,10 @@ class SettingsPage extends StatelessWidget{
|
||||
Widget build(BuildContext context) {
|
||||
// ignore: close_sinks
|
||||
SettingsBloc settingsBloc = BlocProvider.of<SettingsBloc>(context);
|
||||
settingsBloc.setLocale(AppLanguage().appLocal);
|
||||
settingsBloc.context = context;
|
||||
|
||||
MenuBloc menuBloc = BlocProvider.of<MenuBloc>(context);
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Row(
|
||||
@@ -45,47 +50,18 @@ class SettingsPage extends StatelessWidget{
|
||||
listener: (context, state) {
|
||||
if ( state is SettingsError ) {
|
||||
|
||||
} else if ( state is SettingsReady ) {
|
||||
menuBloc.add(MenuRecreateTree());
|
||||
}
|
||||
},
|
||||
// ignore: missing_return
|
||||
builder: (context, state) {
|
||||
if ( state is SettingsLoading ) {
|
||||
return LoadingDialog();
|
||||
} else if ( state is SettingsReady || state is SettingsInitial) {
|
||||
return ListView(
|
||||
padding: EdgeInsets.only(top: 150),
|
||||
children: <Widget>[
|
||||
ListTile(
|
||||
leading: Icon(Icons.language),
|
||||
subtitle: Text(
|
||||
AppLocalizations.of(context).translate(
|
||||
"Change App Language")),
|
||||
title: DropdownButton(
|
||||
|
||||
value: state.props[0] == Locale('en')
|
||||
? AppLocalizations.of(context).translate(
|
||||
"English")
|
||||
: AppLocalizations.of(context).translate(
|
||||
"Hungarian"),
|
||||
items: [AppLocalizations.of(context).translate(
|
||||
"English"), AppLocalizations.of(context)
|
||||
.translate("Hungarian")
|
||||
]
|
||||
.map<DropdownMenuItem<String>>((String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(value),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (String lang) =>
|
||||
settingsBloc.add(
|
||||
SettingsChangeLanguage(language: lang)
|
||||
),
|
||||
)
|
||||
|
||||
),
|
||||
]
|
||||
);
|
||||
} else if ( state is SettingsInitial) {
|
||||
return settingsUI(context, settingsBloc, menuBloc);
|
||||
} else if ( state is SettingsReady ) {
|
||||
return settingsUI(context, settingsBloc, menuBloc);
|
||||
} else {
|
||||
return Container();
|
||||
}
|
||||
@@ -97,4 +73,43 @@ class SettingsPage extends StatelessWidget{
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
ListView settingsUI(BuildContext context, SettingsBloc settingsBloc, MenuBloc menuBloc) {
|
||||
return ListView(
|
||||
padding: EdgeInsets.only(top: 150),
|
||||
children: <Widget>[
|
||||
ListTile(
|
||||
leading: Icon(Icons.language),
|
||||
subtitle: Text(
|
||||
AppLocalizations.of(context).translate(
|
||||
"Change App Language")),
|
||||
title: DropdownButton(
|
||||
|
||||
value: settingsBloc.getLocale() == Locale('en')
|
||||
? AppLocalizations.of(context).translate(
|
||||
"English")
|
||||
: AppLocalizations.of(context).translate(
|
||||
"Hungarian"),
|
||||
items: [AppLocalizations.of(context).translate(
|
||||
"English"), AppLocalizations.of(context)
|
||||
.translate("Hungarian")
|
||||
]
|
||||
.map<DropdownMenuItem<String>>((String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(value),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (String lang) =>
|
||||
{
|
||||
settingsBloc.add(
|
||||
SettingsChangeLanguage(language: lang)
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user