wt1.1.1 translation fixes
This commit is contained in:
@@ -1,23 +1,24 @@
|
||||
import 'package:aitrainer_app/bloc/account/account_bloc.dart';
|
||||
import 'package:aitrainer_app/localization/app_language.dart';
|
||||
import 'package:aitrainer_app/localization/app_localization.dart';
|
||||
import 'package:aitrainer_app/model/customer.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:aitrainer_app/widgets/bottom_nav.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class AccountPage extends StatelessWidget {
|
||||
class AccountPage extends StatelessWidget with Trans {
|
||||
// ignore: close_sinks
|
||||
AccountBloc accountBloc;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
setContext(context);
|
||||
accountBloc = BlocProvider.of<AccountBloc>(context);
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(AppLocalizations.of(context).translate('Account')),
|
||||
title: Text(t('Account')),
|
||||
backgroundColor: Colors.transparent,
|
||||
),
|
||||
body: Container(
|
||||
@@ -76,7 +77,7 @@ class AccountPage extends StatelessWidget {
|
||||
ListTile(
|
||||
leading: Icon(Icons.perm_identity),
|
||||
subtitle:
|
||||
Text(AppLocalizations.of(context).translate("Profile")),
|
||||
Text(t("Profile")),
|
||||
title: FlatButton(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
@@ -118,7 +119,7 @@ class AccountPage extends StatelessWidget {
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(AppLocalizations.of(context).translate(text),
|
||||
Text(t(text),
|
||||
style: TextStyle(
|
||||
color: buttonColor
|
||||
)),
|
||||
|
||||
+179
-245
@@ -1,6 +1,7 @@
|
||||
import 'package:aitrainer_app/bloc/account/account_bloc.dart';
|
||||
import 'package:aitrainer_app/bloc/customer_change_form_bloc.dart';
|
||||
import 'package:aitrainer_app/localization/app_localization.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -9,15 +10,13 @@ import 'package:flutter_form_bloc/flutter_form_bloc.dart';
|
||||
|
||||
import '../library_keys.dart';
|
||||
|
||||
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class CustomerModifyPage extends StatelessWidget{
|
||||
class CustomerModifyPage extends StatelessWidget with Trans {
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
setContext(context);
|
||||
// ignore: close_sinks
|
||||
final accountBloc = BlocProvider.of<AccountBloc>(context);
|
||||
// we cannot initialize the translations in the initState
|
||||
@@ -31,68 +30,61 @@ class CustomerModifyPage extends StatelessWidget{
|
||||
});
|
||||
*/
|
||||
return BlocProvider(
|
||||
create: (context) =>
|
||||
CustomerChangeFormBloc(customerRepository: accountBloc.customerRepository),
|
||||
child: Builder(builder: (context) {
|
||||
// ignore: close_sinks
|
||||
final customerBloc = BlocProvider.of<CustomerChangeFormBloc>(context);
|
||||
create: (context) => CustomerChangeFormBloc(customerRepository: accountBloc.customerRepository),
|
||||
child: Builder(builder: (context) {
|
||||
// ignore: close_sinks
|
||||
final customerBloc = BlocProvider.of<CustomerChangeFormBloc>(context);
|
||||
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: true,
|
||||
appBar: AppBar(
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Text("Profil"),
|
||||
Image.asset(
|
||||
'asset/image/WT_long_logo.png',
|
||||
fit: BoxFit.cover,
|
||||
height: 65.0,
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: true,
|
||||
appBar: AppBar(
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Text("Profil"),
|
||||
Image.asset(
|
||||
'asset/image/WT_long_logo.png',
|
||||
fit: BoxFit.cover,
|
||||
height: 65.0,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
//title: Text(AppLocalizations.of(context).translate('Settings')),
|
||||
backgroundColor: Colors.transparent,
|
||||
),
|
||||
body: Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('asset/image/WT_light_background.png'),
|
||||
fit: BoxFit.cover,
|
||||
alignment: Alignment.center,
|
||||
//title: Text(AppLocalizations.of(context).translate('Settings')),
|
||||
backgroundColor: Colors.transparent,
|
||||
),
|
||||
),
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
padding: EdgeInsets.only(
|
||||
top: 40, left: 25, right: 45, bottom: 100),
|
||||
body: Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('asset/image/WT_light_background.png'),
|
||||
fit: BoxFit.cover,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
),
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
padding: EdgeInsets.only(top: 40, left: 25, right: 45, bottom: 100),
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextFieldBlocBuilder(
|
||||
key: LibraryKeys.loginEmailField,
|
||||
style: TextStyle(fontSize: 12),
|
||||
textFieldBloc: customerBloc.emailField,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white24,
|
||||
filled: true,
|
||||
labelText: t('Email'),
|
||||
),
|
||||
),
|
||||
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
|
||||
Expanded(
|
||||
child:
|
||||
TextFieldBlocBuilder(
|
||||
key: LibraryKeys.loginEmailField,
|
||||
style: TextStyle(fontSize: 12),
|
||||
textFieldBloc: customerBloc.emailField,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white24,
|
||||
filled: true,
|
||||
labelText: AppLocalizations.of(context)
|
||||
.translate('Email'),
|
||||
),
|
||||
),
|
||||
|
||||
/* TextFormField(
|
||||
/* TextFormField(
|
||||
style: TextStyle(fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white24,
|
||||
@@ -100,33 +92,29 @@ class CustomerModifyPage extends StatelessWidget{
|
||||
labelText: AppLocalizations.of(context)
|
||||
.translate('Email'),
|
||||
), */
|
||||
// initialValue: customerChangingViewModel.customer
|
||||
// .customer.email,
|
||||
// onFieldSubmitted: (input) =>
|
||||
// customerChangingViewModel.customer.setEmail(
|
||||
// input)
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
|
||||
Expanded(
|
||||
child:
|
||||
TextFieldBlocBuilder(
|
||||
style: TextStyle(fontSize: 12),
|
||||
textFieldBloc: customerBloc.passwordField,
|
||||
suffixButton: SuffixButton.obscureText,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white24,
|
||||
filled: true,
|
||||
labelText: AppLocalizations.of(context)
|
||||
.translate('Password (Leave empty if no change)'),
|
||||
),
|
||||
// initialValue: customerChangingViewModel.customer
|
||||
// .customer.email,
|
||||
// onFieldSubmitted: (input) =>
|
||||
// customerChangingViewModel.customer.setEmail(
|
||||
// input)
|
||||
)
|
||||
],
|
||||
),
|
||||
/*TextFormField(
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextFieldBlocBuilder(
|
||||
style: TextStyle(fontSize: 12),
|
||||
textFieldBloc: customerBloc.passwordField,
|
||||
suffixButton: SuffixButton.obscureText,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white24,
|
||||
filled: true,
|
||||
labelText: t('Password (Leave empty if no change)'),
|
||||
),
|
||||
),
|
||||
/*TextFormField(
|
||||
style: TextStyle(fontSize: 12),
|
||||
obscureText: true,
|
||||
decoration: InputDecoration(
|
||||
@@ -139,164 +127,110 @@ class CustomerModifyPage extends StatelessWidget{
|
||||
//initialValue: customerChangingViewModel.customer.customer.password,
|
||||
// onFieldSubmitted: (input) => customerChangingViewModel.customer.setPassword(input)
|
||||
)*/
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
|
||||
Expanded(
|
||||
child: TextFieldBlocBuilder(
|
||||
style: TextStyle(fontSize: 12),
|
||||
textFieldBloc: customerBloc.nameField,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white24,
|
||||
filled: true,
|
||||
labelText: AppLocalizations.of(context)
|
||||
.translate('Name'),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
|
||||
Expanded(
|
||||
child: TextFieldBlocBuilder(
|
||||
style: TextStyle(fontSize: 12),
|
||||
textFieldBloc: customerBloc.firstNameField,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white24,
|
||||
filled: true,
|
||||
labelText: AppLocalizations.of(context)
|
||||
.translate('First Name'),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
|
||||
Expanded(
|
||||
child: TextFieldBlocBuilder(
|
||||
style: TextStyle(fontSize: 12),
|
||||
textFieldBloc: customerBloc.birthYearField,
|
||||
inputFormatters: [
|
||||
WhitelistingTextInputFormatter (RegExp(r"[\d]"))
|
||||
],
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white24,
|
||||
filled: true,
|
||||
labelText: AppLocalizations.of(context)
|
||||
.translate('Birth Year'),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
|
||||
Expanded(
|
||||
child: TextFieldBlocBuilder(
|
||||
style: TextStyle(fontSize: 12),
|
||||
textFieldBloc: customerBloc.weightField,
|
||||
inputFormatters: [
|
||||
WhitelistingTextInputFormatter (RegExp(r"[\d]"))
|
||||
],
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white24,
|
||||
filled: true,
|
||||
labelText: AppLocalizations.of(context)
|
||||
.translate('Weight'),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
|
||||
Expanded(
|
||||
child: DropdownFieldBlocBuilder(
|
||||
selectFieldBloc: customerBloc.genderField,
|
||||
itemBuilder: (context, item) => item,
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context).translate(
|
||||
'Select a gender'),
|
||||
)
|
||||
),
|
||||
)
|
||||
/* child: DropdownButtonHideUnderline(
|
||||
child: DropdownButton<GenderItem>(
|
||||
hint: Text(
|
||||
AppLocalizations.of(context).translate(
|
||||
'Select a gender')),
|
||||
style: TextStyle(
|
||||
fontSize: 12, color: Colors.black),
|
||||
focusColor: Colors.white24,
|
||||
// value: selectedGender,
|
||||
items: genders.map((GenderItem gender) {
|
||||
return DropdownMenuItem<GenderItem>(
|
||||
value: gender,
|
||||
child: Text(gender.name)
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (GenderItem gender) => {
|
||||
// setState(() {
|
||||
// selectedGender = gender;
|
||||
// customerChangingViewModel.customer.setSex(gender.dbValue);
|
||||
|
||||
print ("Gender " + gender.name);
|
||||
//})
|
||||
//model.customer.sex =
|
||||
},
|
||||
)
|
||||
) */
|
||||
],
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextFieldBlocBuilder(
|
||||
style: TextStyle(fontSize: 12),
|
||||
textFieldBloc: customerBloc.nameField,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white24,
|
||||
filled: true,
|
||||
labelText: t('Name'),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextFieldBlocBuilder(
|
||||
style: TextStyle(fontSize: 12),
|
||||
textFieldBloc: customerBloc.firstNameField,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white24,
|
||||
filled: true,
|
||||
labelText: t('First Name'),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextFieldBlocBuilder(
|
||||
style: TextStyle(fontSize: 12),
|
||||
textFieldBloc: customerBloc.birthYearField,
|
||||
inputFormatters: [WhitelistingTextInputFormatter(RegExp(r"[\d]"))],
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white24,
|
||||
filled: true,
|
||||
labelText: t('Birth Year'),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextFieldBlocBuilder(
|
||||
style: TextStyle(fontSize: 12),
|
||||
textFieldBloc: customerBloc.weightField,
|
||||
inputFormatters: [WhitelistingTextInputFormatter(RegExp(r"[\d]"))],
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white24,
|
||||
filled: true,
|
||||
labelText: t('Weight'),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Expanded(
|
||||
child: DropdownFieldBlocBuilder(
|
||||
selectFieldBloc: customerBloc.genderField,
|
||||
itemBuilder: (context, item) => item,
|
||||
decoration: InputDecoration(
|
||||
labelText: t('Select a gender'),
|
||||
)),
|
||||
)
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Expanded(
|
||||
child: RaisedButton(
|
||||
color: Colors.orange,
|
||||
textColor: Colors.white,
|
||||
child: InkWell(child: Text(t("Next"))),
|
||||
onPressed: () => {
|
||||
customerBloc.add(SubmitFormBloc()),
|
||||
Navigator.of(context)
|
||||
.pushNamed("customerGoalPage", arguments: customerBloc.customerRepository)
|
||||
},
|
||||
))
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
|
||||
Expanded(
|
||||
child: RaisedButton(
|
||||
|
||||
color: Colors.orange,
|
||||
textColor: Colors.white,
|
||||
child: InkWell(
|
||||
child: Text(
|
||||
AppLocalizations.of(context).translate(
|
||||
"Next"))),
|
||||
onPressed: () =>
|
||||
{
|
||||
customerBloc.add(SubmitFormBloc()),
|
||||
Navigator.of(context).pushNamed("customerGoalPage", arguments: customerBloc.customerRepository)
|
||||
},
|
||||
)
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
);
|
||||
})
|
||||
);
|
||||
),
|
||||
)));
|
||||
}));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,10 +3,9 @@ import 'dart:collection';
|
||||
import 'package:aitrainer_app/bloc/exercise_add_by_plan_bloc.dart';
|
||||
import 'package:aitrainer_app/bloc/exercise_by_plan/exercise_by_plan_bloc.dart';
|
||||
import 'package:aitrainer_app/localization/app_language.dart';
|
||||
import 'package:aitrainer_app/localization/app_localization.dart';
|
||||
import 'package:aitrainer_app/model/workout_tree.dart';
|
||||
import 'package:aitrainer_app/repository/exercise_plan_repository.dart';
|
||||
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:aitrainer_app/widgets/splash.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
@@ -18,7 +17,7 @@ class ExerciseAddByPlanPage extends StatefulWidget{
|
||||
_ExerciseAddByPlanPage createState() => _ExerciseAddByPlanPage();
|
||||
}
|
||||
|
||||
class _ExerciseAddByPlanPage extends State<ExerciseAddByPlanPage> {
|
||||
class _ExerciseAddByPlanPage extends State<ExerciseAddByPlanPage> with Trans {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -28,6 +27,7 @@ class _ExerciseAddByPlanPage extends State<ExerciseAddByPlanPage> {
|
||||
final int customerId = arguments['customerId'];
|
||||
final WorkoutTree workoutTree = arguments['workoutTree'];
|
||||
final ExerciseRepository exerciseRepository = ExerciseRepository();
|
||||
setContext(context);
|
||||
|
||||
return BlocProvider(
|
||||
create: (context) =>
|
||||
@@ -155,10 +155,9 @@ class _ExerciseAddByPlanPage extends State<ExerciseAddByPlanPage> {
|
||||
filled: false,
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 12, color: Colors.black54, fontWeight: FontWeight.w100),
|
||||
hintText: AppLocalizations.of(context)
|
||||
.translate("The number of the exercise"),
|
||||
hintText: t("The number of the exercise"),
|
||||
labelStyle: TextStyle(fontSize: 12, color: Colors.deepOrange, fontWeight: FontWeight.normal),
|
||||
labelText: "Please repeat with " + exerciseBloc.unitQuantity1Field.value + " " +
|
||||
labelText: t("Please repeat with ") + exerciseBloc.unitQuantity1Field.value + " " +
|
||||
exerciseBloc.exerciseRepository.exerciseType.unitQuantityUnit + " " +
|
||||
exerciseBloc.exercisePlanRepository.actualPlanDetail.repeats.toString() + " times!",
|
||||
),
|
||||
@@ -201,7 +200,7 @@ class _ExerciseAddByPlanPage extends State<ExerciseAddByPlanPage> {
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
AppLocalizations.of(context).translate("Check"),
|
||||
t("Check"),
|
||||
style: TextStyle(fontSize: 12),)
|
||||
),
|
||||
Divider(color: Colors.transparent,),
|
||||
@@ -213,8 +212,7 @@ class _ExerciseAddByPlanPage extends State<ExerciseAddByPlanPage> {
|
||||
}
|
||||
|
||||
String validateNumberInput(input) {
|
||||
String error = AppLocalizations.of(context).translate(
|
||||
"Please type the right quantity 0-10000");
|
||||
String error = t("Please type the right quantity 0-10000");
|
||||
dynamic rc = (input != null && input.length > 0);
|
||||
if (!rc) {
|
||||
return null;
|
||||
|
||||
+193
-224
@@ -11,12 +11,11 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_form_bloc/flutter_form_bloc.dart';
|
||||
|
||||
class ExerciseControlPage extends StatefulWidget{
|
||||
class ExerciseControlPage extends StatefulWidget {
|
||||
_ExerciseControlPage createState() => _ExerciseControlPage();
|
||||
}
|
||||
|
||||
class _ExerciseControlPage extends State<ExerciseControlPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
LinkedHashMap arguments = ModalRoute.of(context).settings.arguments;
|
||||
@@ -25,27 +24,25 @@ class _ExerciseControlPage extends State<ExerciseControlPage> {
|
||||
final bool readonly = arguments['readonly'];
|
||||
|
||||
return BlocProvider(
|
||||
create: (context) =>
|
||||
ExerciseControlFormBloc(exerciseRepository: exerciseRepository, percentToCalculate: percent, readonly: readonly),
|
||||
child: BlocBuilder<ExerciseControlFormBloc, FormBlocState>(
|
||||
builder: (context, state) {
|
||||
create: (context) => ExerciseControlFormBloc(
|
||||
exerciseRepository: exerciseRepository, percentToCalculate: percent, readonly: readonly),
|
||||
child: BlocBuilder<ExerciseControlFormBloc, FormBlocState>(builder: (context, state) {
|
||||
// ignore: close_sinks
|
||||
final exerciseBloc = BlocProvider.of<ExerciseControlFormBloc>(context);
|
||||
if ( state is FormBlocLoading ) {
|
||||
if (state is FormBlocLoading) {
|
||||
return LoadingDialog();
|
||||
} else if ( state is FormBlocSuccess) {
|
||||
} else if (state is FormBlocSuccess) {
|
||||
return getControlForm(exerciseBloc);
|
||||
} else {
|
||||
return getControlForm(exerciseBloc);
|
||||
}
|
||||
}
|
||||
));
|
||||
}));
|
||||
}
|
||||
|
||||
Form getControlForm( ExerciseControlFormBloc exerciseBloc) {
|
||||
String exerciseName = AppLanguage().appLocal == Locale("en") ?
|
||||
exerciseBloc.exerciseRepository.exerciseType.name :
|
||||
exerciseBloc.exerciseRepository.exerciseType.nameTranslation;
|
||||
Form getControlForm(ExerciseControlFormBloc exerciseBloc) {
|
||||
String exerciseName = AppLanguage().appLocal == Locale("en")
|
||||
? exerciseBloc.exerciseRepository.exerciseType.name
|
||||
: exerciseBloc.exerciseRepository.exerciseType.nameTranslation;
|
||||
|
||||
return Form(
|
||||
autovalidate: true,
|
||||
@@ -70,227 +67,200 @@ class _ExerciseControlPage extends State<ExerciseControlPage> {
|
||||
),
|
||||
),
|
||||
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,
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only (top: 25, left: 25, right: 25),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: <Widget>[
|
||||
Text(exerciseName,
|
||||
style: TextStyle(fontWeight: FontWeight.bold,
|
||||
fontSize: 18,
|
||||
color: Colors.deepOrange),
|
||||
overflow: TextOverflow.fade,
|
||||
maxLines: 1,
|
||||
softWrap: true,
|
||||
),
|
||||
FlatButton(
|
||||
child: Row(
|
||||
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(top: 25, left: 25, right: 25),
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
child: Column(mainAxisAlignment: MainAxisAlignment.spaceAround, children: <Widget>[
|
||||
Text(
|
||||
exerciseName,
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18, color: Colors.deepOrange),
|
||||
overflow: TextOverflow.fade,
|
||||
maxLines: 1,
|
||||
softWrap: true,
|
||||
),
|
||||
FlatButton(
|
||||
child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
|
||||
Icon(Icons.question_answer),
|
||||
Text(AppLocalizations.of(context).translate(
|
||||
"Why do you need Exercise Control?"),
|
||||
style: TextStyle(
|
||||
color: Colors.blueAccent,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 14)),
|
||||
Text(AppLocalizations.of(context).translate("Why do you need Exercise Control?"),
|
||||
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),
|
||||
},
|
||||
),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(AppLocalizations.of(context).translate("Your 1RM:"),),
|
||||
Text(" " + exerciseBloc.initialRMField.value + " " +exerciseBloc.exerciseRepository.exerciseType
|
||||
.unitQuantityUnit,
|
||||
style: TextStyle(fontWeight: FontWeight.bold),),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(AppLocalizations.of(context).translate("1st Control Exercise:"),
|
||||
style: TextStyle(),),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: exerciseBloc.step != 1,
|
||||
textFieldBloc: exerciseBloc.quantity1Field,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.deepOrange,
|
||||
fontWeight: FontWeight.bold),
|
||||
inputFormatters: [
|
||||
WhitelistingTextInputFormatter (RegExp(r"[\d.]"))
|
||||
],
|
||||
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 12, color: Colors.black54, fontWeight: FontWeight.w100),
|
||||
hintText: AppLocalizations.of(context)
|
||||
.translate("The number of the exercise"),
|
||||
labelStyle: TextStyle(fontSize: 12, color: Colors.deepOrange, fontWeight: FontWeight.normal),
|
||||
labelText: "Please repeat with " + exerciseBloc.unitQuantity1Field.value + " " + exerciseBloc.exerciseRepository.exerciseType.unitQuantityUnit + " 12 times!",
|
||||
textColor: Colors.blueAccent,
|
||||
color: Colors.transparent,
|
||||
onPressed: () => {
|
||||
//Navigator.of(context).pushNamed('exerciseTypeDescription', arguments: exerciseBloc.exerciseRepository),
|
||||
},
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context).translate("Your 1RM:"),
|
||||
),
|
||||
),
|
||||
RaisedButton(
|
||||
padding: EdgeInsets.all(0),
|
||||
textColor: Colors.white,
|
||||
color: exerciseBloc.step == 1 ? Colors.blue : Colors.black26,
|
||||
focusColor: Colors.blueAccent,
|
||||
onPressed: () =>
|
||||
{
|
||||
exerciseBloc.submit()
|
||||
},
|
||||
child: Text(
|
||||
AppLocalizations.of(context).translate("Check"),
|
||||
style: TextStyle(fontSize: 12),)
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(AppLocalizations.of(context).translate("2nd Control Exercise:"),
|
||||
style: TextStyle(),),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: exerciseBloc.step != 2,
|
||||
textFieldBloc: exerciseBloc.quantity2Field,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.deepOrange,
|
||||
fontWeight: FontWeight.bold),
|
||||
inputFormatters: [
|
||||
WhitelistingTextInputFormatter (RegExp(r"[\d.]"))
|
||||
],
|
||||
onChanged: (input) => {
|
||||
print("Quantity 2 value $input"),
|
||||
//exerciseBloc.exerciseRepository.setQuantity(double.parse(input)),
|
||||
//exerciseBloc.exerciseRepository
|
||||
// .setUnit(exerciseBloc.exerciseRepository.exerciseType.unit)
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 12, color: Colors.black54, fontWeight: FontWeight.w100),
|
||||
hintText: AppLocalizations.of(context)
|
||||
.translate("The number of the exercise"),
|
||||
labelStyle: TextStyle(fontSize: 12, color: Colors.deepOrange, fontWeight: FontWeight.normal),
|
||||
labelText: "Please repeat with " + exerciseBloc.unitQuantity2Field.value + " " + exerciseBloc.exerciseRepository.exerciseType.unitQuantityUnit + " 12 times!",
|
||||
Text(
|
||||
" " +
|
||||
exerciseBloc.initialRMField.value +
|
||||
" " +
|
||||
exerciseBloc.exerciseRepository.exerciseType.unitQuantityUnit,
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
RaisedButton(
|
||||
padding: EdgeInsets.all(0),
|
||||
textColor: Colors.white,
|
||||
color: exerciseBloc.step == 2 ? Colors.blue : Colors.black26,
|
||||
focusColor: Colors.blueAccent,
|
||||
onPressed: () =>
|
||||
{
|
||||
exerciseBloc.submit()
|
||||
},
|
||||
child: Text(
|
||||
AppLocalizations.of(context).translate("Check"),
|
||||
style: TextStyle(fontSize: 12),)
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(AppLocalizations.of(context).translate("3rd Control Exercise:"),
|
||||
style: TextStyle(),),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: exerciseBloc.step != 3,
|
||||
textFieldBloc: exerciseBloc.quantity3Field,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.deepOrange,
|
||||
fontWeight: FontWeight.bold),
|
||||
inputFormatters: [
|
||||
WhitelistingTextInputFormatter (RegExp(r"[\d.]"))
|
||||
],
|
||||
onChanged: (input) => {
|
||||
print("Quantity 3 value $input"),
|
||||
//exerciseBloc.exerciseRepository.setQuantity(double.parse(input)),
|
||||
//exerciseBloc.exerciseRepository
|
||||
// .setUnit(exerciseBloc.exerciseRepository.exerciseType.unit)
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 12, color: Colors.black54, fontWeight: FontWeight.w100),
|
||||
hintText: AppLocalizations.of(context)
|
||||
.translate("The number of the exercise"),
|
||||
labelStyle: TextStyle(fontSize: 12, color: Colors.deepOrange, fontWeight: FontWeight.normal),
|
||||
labelText: "Please repeat with " + exerciseBloc.unitQuantity3Field.value + " " + exerciseBloc.exerciseRepository.exerciseType.unitQuantityUnit + " 12 times!",
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context).translate("1st Control Exercise:"),
|
||||
style: TextStyle(),
|
||||
),
|
||||
),
|
||||
RaisedButton(
|
||||
padding: EdgeInsets.all(0),
|
||||
textColor: Colors.white,
|
||||
color: exerciseBloc.step == 3 ? Colors.blue : Colors.black26,
|
||||
focusColor: Colors.blueAccent,
|
||||
onPressed: () =>
|
||||
{
|
||||
exerciseBloc.submit()
|
||||
},
|
||||
child: Text(
|
||||
AppLocalizations.of(context).translate("Check"),
|
||||
style: TextStyle(fontSize: 12),)
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
]),
|
||||
)
|
||||
)
|
||||
),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: exerciseBloc.step != 1,
|
||||
textFieldBloc: exerciseBloc.quantity1Field,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 14, color: Colors.deepOrange, fontWeight: FontWeight.bold),
|
||||
inputFormatters: [WhitelistingTextInputFormatter(RegExp(r"[\d.]"))],
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
hintStyle: TextStyle(fontSize: 12, color: Colors.black54, fontWeight: FontWeight.w100),
|
||||
hintText: AppLocalizations.of(context).translate("The number of the exercise"),
|
||||
labelStyle:
|
||||
TextStyle(fontSize: 12, color: Colors.deepOrange, fontWeight: FontWeight.normal),
|
||||
labelText: "Please repeat with " +
|
||||
exerciseBloc.unitQuantity1Field.value +
|
||||
" " +
|
||||
exerciseBloc.exerciseRepository.exerciseType.unitQuantityUnit +
|
||||
" " +
|
||||
exerciseBloc.times +
|
||||
" times!",
|
||||
),
|
||||
),
|
||||
RaisedButton(
|
||||
padding: EdgeInsets.all(0),
|
||||
textColor: Colors.white,
|
||||
color: exerciseBloc.step == 1 ? Colors.blue : Colors.black26,
|
||||
focusColor: Colors.blueAccent,
|
||||
onPressed: () => {exerciseBloc.submit()},
|
||||
child: Text(
|
||||
AppLocalizations.of(context).translate("Check"),
|
||||
style: TextStyle(fontSize: 12),
|
||||
)),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context).translate("2nd Control Exercise:"),
|
||||
style: TextStyle(),
|
||||
),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: exerciseBloc.step != 2,
|
||||
textFieldBloc: exerciseBloc.quantity2Field,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 14, color: Colors.deepOrange, fontWeight: FontWeight.bold),
|
||||
inputFormatters: [WhitelistingTextInputFormatter(RegExp(r"[\d.]"))],
|
||||
onChanged: (input) => {
|
||||
print("Quantity 2 value $input"),
|
||||
//exerciseBloc.exerciseRepository.setQuantity(double.parse(input)),
|
||||
//exerciseBloc.exerciseRepository
|
||||
// .setUnit(exerciseBloc.exerciseRepository.exerciseType.unit)
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
hintStyle: TextStyle(fontSize: 12, color: Colors.black54, fontWeight: FontWeight.w100),
|
||||
hintText: AppLocalizations.of(context).translate("The number of the exercise"),
|
||||
labelStyle:
|
||||
TextStyle(fontSize: 12, color: Colors.deepOrange, fontWeight: FontWeight.normal),
|
||||
labelText: "Please repeat with " +
|
||||
exerciseBloc.unitQuantity2Field.value +
|
||||
" " +
|
||||
exerciseBloc.exerciseRepository.exerciseType.unitQuantityUnit +
|
||||
" 12 times!",
|
||||
),
|
||||
),
|
||||
RaisedButton(
|
||||
padding: EdgeInsets.all(0),
|
||||
textColor: Colors.white,
|
||||
color: exerciseBloc.step == 2 ? Colors.blue : Colors.black26,
|
||||
focusColor: Colors.blueAccent,
|
||||
onPressed: () => {exerciseBloc.submit()},
|
||||
child: Text(
|
||||
AppLocalizations.of(context).translate("Check"),
|
||||
style: TextStyle(fontSize: 12),
|
||||
)),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context).translate("3rd Control Exercise:"),
|
||||
style: TextStyle(),
|
||||
),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: exerciseBloc.step != 3,
|
||||
textFieldBloc: exerciseBloc.quantity3Field,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 14, color: Colors.deepOrange, fontWeight: FontWeight.bold),
|
||||
inputFormatters: [WhitelistingTextInputFormatter(RegExp(r"[\d.]"))],
|
||||
onChanged: (input) => {
|
||||
print("Quantity 3 value $input"),
|
||||
//exerciseBloc.exerciseRepository.setQuantity(double.parse(input)),
|
||||
//exerciseBloc.exerciseRepository
|
||||
// .setUnit(exerciseBloc.exerciseRepository.exerciseType.unit)
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
hintStyle: TextStyle(fontSize: 12, color: Colors.black54, fontWeight: FontWeight.w100),
|
||||
hintText: AppLocalizations.of(context).translate("The number of the exercise"),
|
||||
labelStyle:
|
||||
TextStyle(fontSize: 12, color: Colors.deepOrange, fontWeight: FontWeight.normal),
|
||||
labelText: "Please repeat with " +
|
||||
exerciseBloc.unitQuantity3Field.value +
|
||||
" " +
|
||||
exerciseBloc.exerciseRepository.exerciseType.unitQuantityUnit +
|
||||
" 12 times!",
|
||||
),
|
||||
),
|
||||
RaisedButton(
|
||||
padding: EdgeInsets.all(0),
|
||||
textColor: Colors.white,
|
||||
color: exerciseBloc.step == 3 ? Colors.blue : Colors.black26,
|
||||
focusColor: Colors.blueAccent,
|
||||
onPressed: () => {exerciseBloc.submit()},
|
||||
child: Text(
|
||||
AppLocalizations.of(context).translate("Check"),
|
||||
style: TextStyle(fontSize: 12),
|
||||
)),
|
||||
],
|
||||
),
|
||||
]),
|
||||
))),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
String validateNumberInput(input) {
|
||||
String error = AppLocalizations.of(context).translate(
|
||||
"Please type the right quantity 0-10000");
|
||||
String error = AppLocalizations.of(context).translate("Please type the right quantity 0-10000");
|
||||
dynamic rc = (input != null && input.length > 0);
|
||||
if (!rc) {
|
||||
return null;
|
||||
@@ -307,7 +277,6 @@ class _ExerciseControlPage extends State<ExerciseControlPage> {
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
if (!(double.parse(input) < 10000 && double.parse(input) > 0)) {
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import 'dart:collection';
|
||||
|
||||
import 'package:aitrainer_app/localization/app_language.dart';
|
||||
import 'package:aitrainer_app/localization/app_localization.dart';
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
import 'package:aitrainer_app/model/exercise.dart';
|
||||
import 'package:aitrainer_app/model/exercise_type.dart';
|
||||
import 'package:aitrainer_app/repository/customer_repository.dart';
|
||||
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:aitrainer_app/widgets/app_bar_common.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_treeview/tree_view.dart';
|
||||
@@ -16,13 +16,14 @@ class ExerciseLogPage extends StatefulWidget {
|
||||
_ExerciseLogPage createState() => _ExerciseLogPage();
|
||||
}
|
||||
|
||||
class _ExerciseLogPage extends State<ExerciseLogPage> {
|
||||
class _ExerciseLogPage extends State<ExerciseLogPage> with Trans {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
LinkedHashMap arguments = ModalRoute.of(context).settings.arguments;
|
||||
final ExerciseRepository exerciseRepository = arguments['exerciseRepository'];
|
||||
final CustomerRepository customerRepository = arguments['customerRepository'];
|
||||
final int customerId = arguments['customerId'];
|
||||
setContext(context);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBarCommonNav(),
|
||||
@@ -126,8 +127,7 @@ class _ExerciseLogPage extends State<ExerciseLogPage> {
|
||||
String unitQuantity = exerciseType.unitQuantity == "1"
|
||||
? exercise.unitQuantity.toStringAsFixed(0) +
|
||||
" " +
|
||||
AppLocalizations.of(context)
|
||||
.translate(exerciseType.unitQuantityUnit) +
|
||||
t(exerciseType.unitQuantityUnit) +
|
||||
" "
|
||||
: "";
|
||||
|
||||
@@ -136,7 +136,7 @@ class _ExerciseLogPage extends State<ExerciseLogPage> {
|
||||
unitQuantity +
|
||||
exercise.quantity.toStringAsFixed(0) +
|
||||
" " +
|
||||
AppLocalizations.of(context).translate(exercise.unit);
|
||||
t(exercise.unit);
|
||||
listExercisesPerDay.add(Node(
|
||||
label: labelExercise,
|
||||
key: exercise.exerciseId.toString(),
|
||||
|
||||
@@ -56,8 +56,6 @@ class _ExercisePlanCustomPage extends State<ExercisePlanCustomPage> {
|
||||
),
|
||||
child: BlocConsumer<ExercisePlanBloc, ExercisePlanState>(listener: (context, state) {
|
||||
if (state is ExercisePlanError) {
|
||||
//showInSnackBar(state.message);
|
||||
//return exerciseWidget(bloc);
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
content: Text(
|
||||
state.message,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
|
||||
import 'package:aitrainer_app/bloc/exercise_plan/exercise_plan_bloc.dart';
|
||||
import 'package:aitrainer_app/bloc/exercise_plan_custom_form.dart';
|
||||
import 'package:aitrainer_app/localization/app_language.dart';
|
||||
import 'package:aitrainer_app/localization/app_localization.dart';
|
||||
import 'package:aitrainer_app/repository/exercise_plan_repository.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:aitrainer_app/widgets/app_bar_common.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
@@ -16,15 +16,17 @@ class ExercisePlanDetailAddPage extends StatefulWidget {
|
||||
_ExercisePlanDetailAddPage createState() => _ExercisePlanDetailAddPage();
|
||||
}
|
||||
|
||||
class _ExercisePlanDetailAddPage extends State<ExercisePlanDetailAddPage> {
|
||||
class _ExercisePlanDetailAddPage extends State<ExercisePlanDetailAddPage> with Trans {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// ignore: close_sinks
|
||||
final ExercisePlanBloc planBloc = ModalRoute.of(context).settings.arguments;
|
||||
final ExercisePlanRepository exercisePlanRepository = planBloc.exercisePlanRepository;
|
||||
setContext(context);
|
||||
|
||||
return BlocProvider(
|
||||
create: (context) => ExercisePlanCustomerFormBloc(exercisePlanRepository: exercisePlanRepository, planBloc: planBloc),
|
||||
create: (context) =>
|
||||
ExercisePlanCustomerFormBloc(exercisePlanRepository: exercisePlanRepository, planBloc: planBloc),
|
||||
child: Builder(builder: (context) {
|
||||
// ignore: close_sinks
|
||||
final bloc = BlocProvider.of<ExercisePlanCustomerFormBloc>(context);
|
||||
@@ -88,7 +90,8 @@ class _ExercisePlanDetailAddPage extends State<ExercisePlanDetailAddPage> {
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
hintStyle: TextStyle(fontSize: 16, color: Colors.black54, fontWeight: FontWeight.w100),
|
||||
hintText: AppLocalizations.of(context).translate("The number of the repeats of one serie"),
|
||||
hintText:
|
||||
AppLocalizations.of(context).translate("The number of the repeats of one serie"),
|
||||
labelStyle: TextStyle(fontSize: 16, color: Colors.lightBlue),
|
||||
labelText: AppLocalizations.of(context).translate("Repeats"),
|
||||
),
|
||||
@@ -116,10 +119,12 @@ class _ExercisePlanDetailAddPage extends State<ExercisePlanDetailAddPage> {
|
||||
focusColor: Colors.white,
|
||||
onPressed: () => {
|
||||
print("Remove " + bloc.exercisePlanRepository.actualPlanDetail.exerciseType.name),
|
||||
planBloc.add(ExercisePlanRemoveExercise(exercisePlanDetail: bloc.exercisePlanRepository.actualPlanDetail)),
|
||||
planBloc.add(ExercisePlanRemoveExercise(
|
||||
exercisePlanDetail: bloc.exercisePlanRepository.actualPlanDetail)),
|
||||
Navigator.of(context).pop(),
|
||||
},
|
||||
child: Text("Delete"), //Text(AppLocalizations.of(context).translate("Delete"), style: TextStyle(fontSize: 16),)
|
||||
child: Text(t(
|
||||
"Delete")), //Text(AppLocalizations.of(context).translate("Delete"), style: TextStyle(fontSize: 16),)
|
||||
),
|
||||
RaisedButton(
|
||||
textColor: Colors.white,
|
||||
@@ -129,9 +134,7 @@ class _ExercisePlanDetailAddPage extends State<ExercisePlanDetailAddPage> {
|
||||
bloc.submit(),
|
||||
Navigator.of(context).pop(),
|
||||
},
|
||||
child: Text(
|
||||
AppLocalizations.of(context).translate("Save"),
|
||||
style: TextStyle(fontSize: 16),
|
||||
child: Text(t("Save"), style: TextStyle(fontSize: 16),
|
||||
)),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -24,12 +24,6 @@ class _MenuPage extends State<MenuPage> {
|
||||
// ignore: close_sinks
|
||||
MenuBloc menuBloc;
|
||||
|
||||
|
||||
|
||||
void checkTest() {
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
menuBloc = BlocProvider.of<MenuBloc>(context);
|
||||
@@ -48,7 +42,7 @@ class _MenuPage extends State<MenuPage> {
|
||||
if (state is MenuError) {
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
backgroundColor: Colors.orange,
|
||||
content: Text("error", style: TextStyle(color: Colors.white))));
|
||||
content: Text(state.message, style: TextStyle(color: Colors.white))));
|
||||
} else if ( state is MenuLoading ) {
|
||||
return MenuPageWidget();
|
||||
}
|
||||
@@ -88,6 +82,7 @@ class _LoadingMenuDialog extends State<LoadingMenuDialog> {
|
||||
BlocProvider.of<MenuBloc>(context).add(MenuCreate());
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WillPopScope(
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'dart:collection';
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
import 'package:aitrainer_app/repository/customer_repository.dart';
|
||||
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:aitrainer_app/widgets/app_bar_common.dart';
|
||||
import 'package:aitrainer_app/widgets/bottom_nav.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
@@ -13,12 +14,13 @@ class MyDevelopmentPage extends StatefulWidget {
|
||||
_MyDevelopmentPage createState() => _MyDevelopmentPage();
|
||||
}
|
||||
|
||||
class _MyDevelopmentPage extends State<MyDevelopmentPage> {
|
||||
class _MyDevelopmentPage extends State<MyDevelopmentPage> with Trans {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ExerciseRepository exerciseRepository = ExerciseRepository();
|
||||
final CustomerRepository customerRepository = CustomerRepository();
|
||||
final LinkedHashMap args = LinkedHashMap();
|
||||
setContext(context);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBarCommonNav(),
|
||||
@@ -51,7 +53,7 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> {
|
||||
Navigator.of(context).pushNamed('exerciseLogPage',
|
||||
arguments: args)
|
||||
},
|
||||
child: Text("My Exercise Logs",
|
||||
child: Text(t("My Exercise Logs"),
|
||||
style: TextStyle(fontSize: 18),)
|
||||
),
|
||||
Stack(
|
||||
@@ -71,7 +73,7 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> {
|
||||
onPressed: () =>
|
||||
{
|
||||
},
|
||||
child: Text("My Whole Body Development",
|
||||
child: Text(t("My Whole Body Development"),
|
||||
style: TextStyle(fontSize: 18),)
|
||||
),
|
||||
|
||||
@@ -94,7 +96,7 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> {
|
||||
onPressed: () =>
|
||||
{
|
||||
},
|
||||
child: Text("Development Of Muscles",
|
||||
child: Text(t("Development Of Muscles"),
|
||||
style: TextStyle(fontSize: 18),)
|
||||
),
|
||||
|
||||
@@ -117,7 +119,7 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> {
|
||||
onPressed: () =>
|
||||
{
|
||||
},
|
||||
child: Text("Predictions",
|
||||
child: Text(t("Predictions"),
|
||||
style: TextStyle(fontSize: 18),)
|
||||
),
|
||||
]
|
||||
@@ -154,7 +156,7 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> {
|
||||
Navigator.of(context).pushNamed('exerciseLogPage',
|
||||
arguments: args)
|
||||
},
|
||||
child: Text("My Trainee's Exercise Logs",
|
||||
child: Text(t("My Trainee's Exercise Logs"),
|
||||
style: TextStyle(fontSize: 18),)
|
||||
);
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:collection';
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:aitrainer_app/widgets/app_bar_common.dart';
|
||||
import 'package:aitrainer_app/widgets/bottom_nav.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
@@ -11,11 +12,12 @@ class MyExercisePlanPage extends StatefulWidget {
|
||||
_MyExercisePlanPage createState() => _MyExercisePlanPage();
|
||||
}
|
||||
|
||||
class _MyExercisePlanPage extends State<MyExercisePlanPage> {
|
||||
class _MyExercisePlanPage extends State<MyExercisePlanPage> with Trans {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ExerciseRepository exerciseRepository = ExerciseRepository();
|
||||
final LinkedHashMap args = LinkedHashMap();
|
||||
setContext(context);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBarCommonNav(),
|
||||
@@ -46,7 +48,7 @@ class _MyExercisePlanPage extends State<MyExercisePlanPage> {
|
||||
Navigator.of(context).pushNamed('exerciseByPlanPage',
|
||||
arguments: args)
|
||||
},
|
||||
child: Text("Execute My Selected Training Plan",
|
||||
child: Text(t("Execute My Selected Training Plan"),
|
||||
style: TextStyle(fontSize: 18),)
|
||||
),
|
||||
|
||||
@@ -62,7 +64,7 @@ class _MyExercisePlanPage extends State<MyExercisePlanPage> {
|
||||
Navigator.of(context).pushNamed('exercisePlanCustomPage',
|
||||
arguments: args)
|
||||
},
|
||||
child: Text("Edit My Custom Plan",
|
||||
child: Text(t("Edit My Custom Plan"),
|
||||
style: TextStyle(fontSize: 18),)
|
||||
),
|
||||
FlatButton(
|
||||
@@ -74,7 +76,7 @@ class _MyExercisePlanPage extends State<MyExercisePlanPage> {
|
||||
{
|
||||
|
||||
},
|
||||
child: Text("Suggested Plan",
|
||||
child: Text(t("Suggested Training Plan"),
|
||||
style: TextStyle(fontSize: 18),)
|
||||
),
|
||||
Stack(
|
||||
@@ -95,7 +97,7 @@ class _MyExercisePlanPage extends State<MyExercisePlanPage> {
|
||||
{
|
||||
|
||||
},
|
||||
child: Text("My Special Plan",
|
||||
child: Text(t("My Special Plan"),
|
||||
style: TextStyle(fontSize: 18),)
|
||||
),
|
||||
|
||||
@@ -119,7 +121,7 @@ class _MyExercisePlanPage extends State<MyExercisePlanPage> {
|
||||
{
|
||||
|
||||
},
|
||||
child: Text("My Arnold's Plan",
|
||||
child: Text(t("My Arnold's Plan"),
|
||||
style: TextStyle(fontSize: 18),)
|
||||
),
|
||||
|
||||
@@ -160,7 +162,7 @@ class _MyExercisePlanPage extends State<MyExercisePlanPage> {
|
||||
Navigator.of(context).pushNamed('exercisePlanCustomPage',
|
||||
arguments: args)
|
||||
},
|
||||
child: Text("My Trainee's Plan",
|
||||
child: Text(t("My Trainee's Plan"),
|
||||
style: TextStyle(fontSize: 18),)
|
||||
);
|
||||
} else {
|
||||
@@ -183,7 +185,7 @@ class _MyExercisePlanPage extends State<MyExercisePlanPage> {
|
||||
Navigator.of(context).pushNamed('exerciseByPlanPage',
|
||||
arguments: args)
|
||||
},
|
||||
child: Text("Execute My Trainee's Training Plan",
|
||||
child: Text(t("Execute My Trainee's Training Plan"),
|
||||
style: TextStyle(fontSize: 18),)
|
||||
);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user