WT1.1.0+40 Premium feature settings
This commit is contained in:
+170
-219
@@ -4,6 +4,7 @@ import 'package:aitrainer_app/bloc/custom_exercise_form_bloc.dart';
|
||||
import 'package:aitrainer_app/localization/app_localization.dart';
|
||||
import 'package:aitrainer_app/model/exercise_type.dart';
|
||||
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||
import 'package:aitrainer_app/service/logging.dart';
|
||||
import 'package:aitrainer_app/widgets/splash.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -15,7 +16,7 @@ class CustomExercisePage extends StatefulWidget {
|
||||
_CustomExerciseNewPageState createState() => _CustomExerciseNewPageState();
|
||||
}
|
||||
|
||||
class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
class _CustomExerciseNewPageState extends State<CustomExercisePage> with Logging {
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
|
||||
|
||||
@override
|
||||
@@ -23,8 +24,7 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
final ExerciseType exerciseType = ModalRoute.of(context).settings.arguments;
|
||||
|
||||
return BlocProvider(
|
||||
create: (context) =>
|
||||
CustomExerciseFormBloc(exerciseRepository: ExerciseRepository()),
|
||||
create: (context) => CustomExerciseFormBloc(exerciseRepository: ExerciseRepository()),
|
||||
child: Builder(builder: (context) {
|
||||
final exerciseBloc = BlocProvider.of<CustomExerciseFormBloc>(context);
|
||||
exerciseBloc.exerciseRepository.setExerciseType(exerciseType);
|
||||
@@ -59,93 +59,58 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
onFailure: (context, state) {
|
||||
LoadingDialog.hide(context);
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
backgroundColor: Colors.orange,
|
||||
content: Text(state.failureResponse,
|
||||
style: TextStyle(color: Colors.white))));
|
||||
backgroundColor: Colors.orange, content: Text(state.failureResponse, style: TextStyle(color: Colors.white))));
|
||||
},
|
||||
child: 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'),
|
||||
image: AssetImage('asset/image/WT_light_background.png'),
|
||||
fit: BoxFit.fill,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
),
|
||||
child: CustomScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
slivers: [
|
||||
SliverList(
|
||||
delegate: SliverChildListDelegate(
|
||||
[
|
||||
Container(
|
||||
padding: EdgeInsets.only(top:20,left:25, right:25),
|
||||
alignment: Alignment.center,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text("Custom Exercise",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 14,
|
||||
color: Colors.deepOrange)),
|
||||
columnQuantityUnit(exerciseBloc),
|
||||
columnQuantity(exerciseBloc),
|
||||
]
|
||||
)
|
||||
),
|
||||
]
|
||||
),
|
||||
|
||||
),
|
||||
child: CustomScrollView(scrollDirection: Axis.vertical, slivers: [
|
||||
SliverList(
|
||||
delegate: SliverChildListDelegate([
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 20, left: 25, right: 25),
|
||||
alignment: Alignment.center,
|
||||
child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
Text("Custom Exercise",
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14, color: Colors.deepOrange)),
|
||||
columnQuantityUnit(exerciseBloc),
|
||||
columnQuantity(exerciseBloc),
|
||||
])),
|
||||
]),
|
||||
),
|
||||
gridCalculation(exerciseBloc)
|
||||
]
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
]))));
|
||||
}));
|
||||
}
|
||||
|
||||
Column columnQuantityUnit(CustomExerciseFormBloc bloc) {
|
||||
Column column = Column();
|
||||
if (bloc.exerciseRepository.exerciseType != null &&
|
||||
bloc.exerciseRepository.exerciseType.unitQuantity == "1") {
|
||||
if (bloc.exerciseRepository.exerciseType != null && bloc.exerciseRepository.exerciseType.unitQuantity == "1") {
|
||||
column = Column(children: [
|
||||
TextFieldBlocBuilder(
|
||||
textFieldBloc: bloc.unitQuantityField,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.lightBlue,
|
||||
fontWeight: FontWeight.bold),
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp(r"[\d.]"))
|
||||
],
|
||||
onChanged: (input) => {
|
||||
print("UnitQuantity value $input"),
|
||||
bloc.exerciseRepository.setUnitQuantity(double.parse(input))
|
||||
},
|
||||
style: TextStyle(fontSize: 16, color: Colors.lightBlue, fontWeight: FontWeight.bold),
|
||||
inputFormatters: [FilteringTextInputFormatter.allow(RegExp(r"[\d.]"))],
|
||||
onChanged: (input) => {log("UnitQuantity value $input"), bloc.exerciseRepository.setUnitQuantity(double.parse(input))},
|
||||
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 done with"),
|
||||
hintStyle: TextStyle(fontSize: 12, color: Colors.black54, fontWeight: FontWeight.w100),
|
||||
hintText: AppLocalizations.of(context).translate("The number of the exercise done with"),
|
||||
labelStyle: TextStyle(fontSize: 12, color: Colors.lightBlue),
|
||||
labelText: AppLocalizations.of(context).translate(
|
||||
bloc.exerciseRepository.exerciseType.unitQuantityUnit),
|
||||
labelText: AppLocalizations.of(context).translate(bloc.exerciseRepository.exerciseType.unitQuantityUnit),
|
||||
),
|
||||
),
|
||||
new InkWell(
|
||||
child: new Text(
|
||||
AppLocalizations.of(context).translate(
|
||||
bloc.exerciseRepository.exerciseType.unitQuantityUnit),
|
||||
child: new Text(AppLocalizations.of(context).translate(bloc.exerciseRepository.exerciseType.unitQuantityUnit),
|
||||
style: TextStyle(fontSize: 12)),
|
||||
),
|
||||
]);
|
||||
@@ -158,29 +123,20 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
TextFieldBlocBuilder(
|
||||
textFieldBloc: bloc.quantityField,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
color: Colors.deepOrange,
|
||||
fontWeight: FontWeight.bold),
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp(r"[\d.]"))
|
||||
],
|
||||
style: TextStyle(fontSize: 20, color: Colors.deepOrange, fontWeight: FontWeight.bold),
|
||||
inputFormatters: [FilteringTextInputFormatter.allow(RegExp(r"[\d.]"))],
|
||||
onChanged: (input) => {
|
||||
print("Quantity value $input"),
|
||||
log("Quantity value $input"),
|
||||
bloc.exerciseRepository.setQuantity(double.parse(input)),
|
||||
bloc.exerciseRepository
|
||||
.setUnit(bloc.exerciseRepository.exerciseType.unit)
|
||||
bloc.exerciseRepository.setUnit(bloc.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"),
|
||||
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),
|
||||
labelText: AppLocalizations.of(context)
|
||||
.translate(bloc.exerciseRepository.exerciseType.unit),
|
||||
labelText: AppLocalizations.of(context).translate(bloc.exerciseRepository.exerciseType.unit),
|
||||
),
|
||||
),
|
||||
]);
|
||||
@@ -191,18 +147,18 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
SliverGrid gridCalculation(CustomExerciseFormBloc bloc) {
|
||||
LinkedHashMap args = LinkedHashMap();
|
||||
return SliverGrid(
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 3,
|
||||
mainAxisSpacing: 10.0,
|
||||
crossAxisSpacing: 10.0,
|
||||
childAspectRatio: 2.0,
|
||||
),
|
||||
delegate: SliverChildListDelegate(
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 3,
|
||||
mainAxisSpacing: 10.0,
|
||||
crossAxisSpacing: 10.0,
|
||||
childAspectRatio: 2.0,
|
||||
),
|
||||
delegate: SliverChildListDelegate(
|
||||
[
|
||||
TextFieldBlocBuilder(
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
textFieldBloc: bloc.rmWendlerField,
|
||||
padding: EdgeInsets.only(left:10),
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
@@ -210,9 +166,9 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
filled: false,
|
||||
labelText: "1RM by Wendler: ",
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:10),
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rmWathenField,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12),
|
||||
@@ -222,9 +178,9 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
filled: false,
|
||||
labelText: "1RM by Wahten: ",
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:10),
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rmOconnerField,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12),
|
||||
@@ -234,9 +190,9 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
filled: false,
|
||||
labelText: "1RM by O'Conner: ",
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:10),
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rmMayhewField,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12),
|
||||
@@ -246,9 +202,9 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
filled: false,
|
||||
labelText: "1RM by Mayhew: ",
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:10),
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rmAverageField,
|
||||
style: TextStyle(color: Colors.blueAccent, fontSize: 12),
|
||||
@@ -259,138 +215,133 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
labelText: "1RM Average: ",
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rm90Field,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
labelText: "1RM 90%: ",
|
||||
)),
|
||||
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rm90Field,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
labelText: "1RM 90%: ",
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rm75Field,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12, fontWeight: FontWeight.normal),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
labelText: "1RM 75%: ",
|
||||
)),
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rm75Field,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12, fontWeight: FontWeight.normal),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
labelText: "1RM 75%: ",
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rm75OconnorField,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12, fontWeight: FontWeight.normal),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
labelText: "1RM 75%: by O'Connor",
|
||||
)),
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rm75OconnorField,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12, fontWeight: FontWeight.normal),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
labelText: "1RM 75%: by O'Connor",
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rm75WendlerField,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12, fontWeight: FontWeight.normal),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
labelText: "1RM 75% by Wendler: ",
|
||||
)),
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rm75WendlerField,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12, fontWeight: FontWeight.normal),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
labelText: "1RM 75% by Wendler: ",
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rm80Field,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
labelText: "1RM 80%: ",
|
||||
)),
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rm80Field,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
labelText: "1RM 80%: ",
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rm70Field,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
labelText: "1RM 70%: ",
|
||||
)),
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rm70Field,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
labelText: "1RM 70%: ",
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rm60Field,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
labelText: "1RM 60%: ",
|
||||
)),
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rm60Field,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
labelText: "1RM 60%: ",
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rm50Field,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
labelText: "1RM 50%: ",
|
||||
)
|
||||
),
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left: 10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rm50Field,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
labelText: "1RM 50%: ",
|
||||
)),
|
||||
RaisedButton(
|
||||
padding: EdgeInsets.all(0),
|
||||
textColor: Colors.white,
|
||||
color: Colors.blue,
|
||||
focusColor: Colors.blueAccent,
|
||||
onPressed: () =>
|
||||
{
|
||||
args['exerciseRepository'] = bloc.exerciseRepository,
|
||||
args['percent'] = 0.75,
|
||||
args['readonly'] = true,
|
||||
Navigator.of(context).pushNamed('exerciseControlPage',
|
||||
arguments: args)
|
||||
},
|
||||
child: Text("Control with 75%",
|
||||
style: TextStyle(fontSize: 12),)
|
||||
),
|
||||
padding: EdgeInsets.all(0),
|
||||
textColor: Colors.white,
|
||||
color: Colors.blue,
|
||||
focusColor: Colors.blueAccent,
|
||||
onPressed: () => {
|
||||
args['exerciseRepository'] = bloc.exerciseRepository,
|
||||
args['percent'] = 0.75,
|
||||
args['readonly'] = true,
|
||||
Navigator.of(context).pushNamed('exerciseControlPage', arguments: args)
|
||||
},
|
||||
child: Text(
|
||||
"Control with 75%",
|
||||
style: TextStyle(fontSize: 12),
|
||||
)),
|
||||
RaisedButton(
|
||||
padding: EdgeInsets.all(0),
|
||||
textColor: Colors.white,
|
||||
color: Colors.green,
|
||||
focusColor: Colors.blueAccent,
|
||||
onPressed: () =>
|
||||
{
|
||||
args['exerciseRepository'] = bloc.exerciseRepository,
|
||||
args['percent'] = 0.5,
|
||||
args['readonly'] = true,
|
||||
Navigator.of(context).pushNamed('exerciseControlPage',
|
||||
arguments: args )
|
||||
},
|
||||
child: Text("Control with 50%",
|
||||
style: TextStyle(fontSize: 12),)
|
||||
),
|
||||
],
|
||||
)
|
||||
);
|
||||
padding: EdgeInsets.all(0),
|
||||
textColor: Colors.white,
|
||||
color: Colors.green,
|
||||
focusColor: Colors.blueAccent,
|
||||
onPressed: () => {
|
||||
args['exerciseRepository'] = bloc.exerciseRepository,
|
||||
args['percent'] = 0.5,
|
||||
args['readonly'] = true,
|
||||
Navigator.of(context).pushNamed('exerciseControlPage', arguments: args)
|
||||
},
|
||||
child: Text(
|
||||
"Control with 50%",
|
||||
style: TextStyle(fontSize: 12),
|
||||
)),
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -24,8 +24,7 @@ class _CustomerBodyTypePageState extends State<CustomerBodyTypePage> {
|
||||
String selected;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final CustomerRepository customerRepository =
|
||||
ModalRoute.of(context).settings.arguments;
|
||||
final CustomerRepository customerRepository = ModalRoute.of(context).settings.arguments;
|
||||
final double cWidth = MediaQuery.of(context).size.width * 0.75;
|
||||
|
||||
return Scaffold(
|
||||
@@ -51,12 +50,10 @@ class _CustomerBodyTypePageState extends State<CustomerBodyTypePage> {
|
||||
),
|
||||
),
|
||||
child: BlocProvider(
|
||||
create: (context) =>
|
||||
CustomerChangeBloc(customerRepository: customerRepository),
|
||||
create: (context) => CustomerChangeBloc(customerRepository: customerRepository),
|
||||
child: Builder(builder: (context) {
|
||||
// ignore: close_sinks
|
||||
CustomerChangeBloc changeBloc =
|
||||
BlocProvider.of<CustomerChangeBloc>(context);
|
||||
CustomerChangeBloc changeBloc = BlocProvider.of<CustomerChangeBloc>(context);
|
||||
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@@ -67,14 +64,9 @@ class _CustomerBodyTypePageState extends State<CustomerBodyTypePage> {
|
||||
alignment: WrapAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context)
|
||||
.translate("Your Body Type"),
|
||||
AppLocalizations.of(context).translate("Your Body Type"),
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.orange,
|
||||
fontSize: 42,
|
||||
fontFamily: 'Arial',
|
||||
fontWeight: FontWeight.w900),
|
||||
style: TextStyle(color: Colors.orange, fontSize: 42, fontFamily: 'Arial', fontWeight: FontWeight.w900),
|
||||
)
|
||||
]),
|
||||
Divider(),
|
||||
@@ -83,25 +75,17 @@ class _CustomerBodyTypePageState extends State<CustomerBodyTypePage> {
|
||||
width: cWidth,
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
AppLocalizations.of(context)
|
||||
.translate("Endomorph"),
|
||||
Text(AppLocalizations.of(context).translate("Endomorph"),
|
||||
textWidthBasis: TextWidthBasis.longestLine,
|
||||
style: TextStyle(
|
||||
color: Colors.blue,
|
||||
fontSize: 32,
|
||||
fontFamily: 'Arial',
|
||||
fontWeight: FontWeight.w900)),
|
||||
style: TextStyle(color: Colors.blue, fontSize: 32, fontFamily: 'Arial', fontWeight: FontWeight.w900)),
|
||||
],
|
||||
)),
|
||||
padding: EdgeInsets.all(10.0),
|
||||
shape: getShape(
|
||||
customerRepository, BodyTypeItem.endomorph),
|
||||
shape: getShape(customerRepository, BodyTypeItem.endomorph),
|
||||
onPressed: () => {
|
||||
setState(() {
|
||||
selected = BodyTypeItem.endomorph;
|
||||
changeBloc.add(CustomerBodyTypeChange(bodyType: selected));
|
||||
print(selected);
|
||||
}),
|
||||
}),
|
||||
Divider(),
|
||||
@@ -112,13 +96,8 @@ class _CustomerBodyTypePageState extends State<CustomerBodyTypePage> {
|
||||
children: [
|
||||
InkWell(
|
||||
child: Text(
|
||||
AppLocalizations.of(context)
|
||||
.translate("Ectomorph"),
|
||||
style: TextStyle(
|
||||
color: Colors.blue,
|
||||
fontSize: 32,
|
||||
fontFamily: 'Arial',
|
||||
fontWeight: FontWeight.w900),
|
||||
AppLocalizations.of(context).translate("Ectomorph"),
|
||||
style: TextStyle(color: Colors.blue, fontSize: 32, fontFamily: 'Arial', fontWeight: FontWeight.w900),
|
||||
),
|
||||
highlightColor: Colors.white,
|
||||
),
|
||||
@@ -126,13 +105,11 @@ class _CustomerBodyTypePageState extends State<CustomerBodyTypePage> {
|
||||
),
|
||||
),
|
||||
padding: EdgeInsets.all(10.0),
|
||||
shape: getShape(customerRepository, BodyTypeItem.ectomorph ),
|
||||
|
||||
shape: getShape(customerRepository, BodyTypeItem.ectomorph),
|
||||
onPressed: () => {
|
||||
setState(() {
|
||||
selected = BodyTypeItem.ectomorph;
|
||||
changeBloc.add(CustomerBodyTypeChange(bodyType: selected));
|
||||
print(selected);
|
||||
}),
|
||||
}),
|
||||
Divider(),
|
||||
@@ -143,13 +120,8 @@ class _CustomerBodyTypePageState extends State<CustomerBodyTypePage> {
|
||||
children: [
|
||||
InkWell(
|
||||
child: Text(
|
||||
AppLocalizations.of(context)
|
||||
.translate("Mesomorph"),
|
||||
style: TextStyle(
|
||||
color: Colors.blue,
|
||||
fontSize: 32,
|
||||
fontFamily: 'Arial',
|
||||
fontWeight: FontWeight.w900),
|
||||
AppLocalizations.of(context).translate("Mesomorph"),
|
||||
style: TextStyle(color: Colors.blue, fontSize: 32, fontFamily: 'Arial', fontWeight: FontWeight.w900),
|
||||
),
|
||||
highlightColor: Colors.white,
|
||||
),
|
||||
@@ -157,22 +129,18 @@ class _CustomerBodyTypePageState extends State<CustomerBodyTypePage> {
|
||||
),
|
||||
),
|
||||
padding: EdgeInsets.all(10.0),
|
||||
shape: getShape(customerRepository, BodyTypeItem.mesomorph ),
|
||||
shape: getShape(customerRepository, BodyTypeItem.mesomorph),
|
||||
onPressed: () => {
|
||||
setState(() {
|
||||
selected = BodyTypeItem.mesomorph;
|
||||
changeBloc.add(CustomerBodyTypeChange(bodyType: selected));
|
||||
|
||||
print(selected);
|
||||
}),
|
||||
}),
|
||||
Divider(),
|
||||
RaisedButton(
|
||||
color: Colors.orange,
|
||||
textColor: Colors.white,
|
||||
child: InkWell(
|
||||
child: Text(
|
||||
AppLocalizations.of(context).translate("Next"))),
|
||||
child: InkWell(child: Text(AppLocalizations.of(context).translate("Next"))),
|
||||
onPressed: () => {
|
||||
changeBloc.add(CustomerSave()),
|
||||
Navigator.of(context).pop(),
|
||||
|
||||
@@ -180,7 +180,6 @@ class CustomerExerciseDevicePage extends StatelessWidget with Trans {
|
||||
}
|
||||
|
||||
List<Widget> getDevices(CustomerExerciseDeviceBloc bloc, double cWidth, double cHeight) {
|
||||
print("height " + cHeight.toString());
|
||||
final bool isEnglish = AppLanguage().appLocal.languageCode == "en";
|
||||
this.listDevice = List();
|
||||
final devices = bloc.devices;
|
||||
@@ -211,7 +210,6 @@ class CustomerExerciseDevicePage extends StatelessWidget with Trans {
|
||||
}
|
||||
|
||||
List<Widget> getDevicesPlace(CustomerExerciseDeviceBloc bloc, double cWidth, cHeight) {
|
||||
print("height " + cHeight.toString() + " width " + cWidth.toString());
|
||||
final bool isEnglish = AppLanguage().appLocal.languageCode == "en";
|
||||
this.listDevice = List();
|
||||
final devices = bloc.devices;
|
||||
@@ -243,7 +241,6 @@ class CustomerExerciseDevicePage extends StatelessWidget with Trans {
|
||||
}
|
||||
|
||||
void changeButtonShape(ExerciseDevice device, CustomerExerciseDeviceBloc bloc) {
|
||||
print("Device clicked: " + device.name);
|
||||
if (bloc.hasCustomerDevice(device.exerciseDeviceId)) {
|
||||
bloc.add(CustomerExerciseDeviceRemove(device: device));
|
||||
} else {
|
||||
|
||||
@@ -101,7 +101,6 @@ class _CustomerFitnessPageState extends State<CustomerFitnessPage> {
|
||||
setState(() {
|
||||
selected = FitnessState.beginner;
|
||||
changeBloc.add(CustomerFitnessChange(fitness: selected));
|
||||
print(selected);
|
||||
}),
|
||||
}),
|
||||
Divider(),
|
||||
|
||||
@@ -12,19 +12,16 @@ class GoalsItem {
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class CustomerGoalPage extends StatefulWidget {
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => _CustomerGoalPage();
|
||||
}
|
||||
|
||||
|
||||
class _CustomerGoalPage extends State<CustomerGoalPage> {
|
||||
String selected;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final CustomerRepository customerRepository =
|
||||
ModalRoute.of(context).settings.arguments;
|
||||
final CustomerRepository customerRepository = ModalRoute.of(context).settings.arguments;
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
@@ -51,111 +48,80 @@ class _CustomerGoalPage extends State<CustomerGoalPage> {
|
||||
height: double.infinity,
|
||||
width: double.infinity,
|
||||
child: BlocProvider(
|
||||
create: (context) =>
|
||||
CustomerChangeBloc(customerRepository: customerRepository),
|
||||
create: (context) => CustomerChangeBloc(customerRepository: customerRepository),
|
||||
child: Builder(builder: (context) {
|
||||
CustomerChangeBloc changeBloc =
|
||||
BlocProvider.of<CustomerChangeBloc>(context);
|
||||
|
||||
CustomerChangeBloc changeBloc = BlocProvider.of<CustomerChangeBloc>(context);
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: [
|
||||
Divider(),
|
||||
InkWell(
|
||||
child: Text(
|
||||
AppLocalizations.of(context)
|
||||
.translate("Set Your Goals"),
|
||||
style: TextStyle(
|
||||
color: Colors.orange,
|
||||
fontSize: 50,
|
||||
fontFamily: 'Arial',
|
||||
fontWeight: FontWeight.w900),
|
||||
),
|
||||
highlightColor: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
Divider(),
|
||||
InkWell(
|
||||
child: Text(
|
||||
AppLocalizations.of(context).translate("Set Your Goals"),
|
||||
style: TextStyle(color: Colors.orange, fontSize: 50, fontFamily: 'Arial', fontWeight: FontWeight.w900),
|
||||
),
|
||||
highlightColor: Colors.white,
|
||||
),
|
||||
Stack(alignment: Alignment.bottomLeft, overflow: Overflow.visible, children: [
|
||||
FlatButton(
|
||||
child: Image.asset(
|
||||
"asset/image/Gain_muscle.png",
|
||||
height: 180,
|
||||
),
|
||||
Stack(
|
||||
alignment: Alignment.bottomLeft,
|
||||
overflow: Overflow.visible,
|
||||
children: [
|
||||
FlatButton(
|
||||
child: Image.asset(
|
||||
"asset/image/Gain_muscle.png",
|
||||
height: 180,
|
||||
),
|
||||
padding: EdgeInsets.all(0.0),
|
||||
shape: getShape(changeBloc, GoalsItem.muscle),
|
||||
onPressed: () => {
|
||||
print("gain muscle"),
|
||||
setState((){
|
||||
selected = GoalsItem.muscle;
|
||||
changeBloc.add(CustomerGoalChange(goal: GoalsItem.muscle));
|
||||
}),
|
||||
|
||||
padding: EdgeInsets.all(0.0),
|
||||
shape: getShape(changeBloc, GoalsItem.muscle),
|
||||
onPressed: () => {
|
||||
setState(() {
|
||||
selected = GoalsItem.muscle;
|
||||
changeBloc.add(CustomerGoalChange(goal: GoalsItem.muscle));
|
||||
}),
|
||||
InkWell(
|
||||
child: Text(
|
||||
AppLocalizations.of(context)
|
||||
.translate("Gain Muscle"),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 32,
|
||||
fontFamily: 'Arial',
|
||||
fontWeight: FontWeight.w900),
|
||||
),
|
||||
highlightColor: Colors.white,
|
||||
)
|
||||
]),
|
||||
Divider(),
|
||||
Stack(
|
||||
alignment: Alignment.bottomLeft,
|
||||
overflow: Overflow.visible,
|
||||
children: [
|
||||
FlatButton(
|
||||
child: Image.asset(
|
||||
"asset/image/WT_weight_loss.png",
|
||||
height: 180,
|
||||
),
|
||||
padding: EdgeInsets.all(0.0),
|
||||
shape: getShape(changeBloc, GoalsItem.weight),
|
||||
onPressed: () => {
|
||||
print("weight_loss"),
|
||||
setState((){
|
||||
selected = GoalsItem.muscle;
|
||||
changeBloc.add(CustomerGoalChange(goal: GoalsItem.weight));
|
||||
}),
|
||||
|
||||
}),
|
||||
InkWell(
|
||||
child: Text(
|
||||
AppLocalizations.of(context)
|
||||
.translate("Loose Weight"),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 32,
|
||||
fontFamily: 'Arial',
|
||||
fontWeight: FontWeight.w900),
|
||||
),
|
||||
highlightColor: Colors.white,
|
||||
)
|
||||
]),
|
||||
Divider(),
|
||||
RaisedButton(
|
||||
color: Colors.orange,
|
||||
textColor: Colors.white,
|
||||
child: InkWell(
|
||||
child: Text(
|
||||
AppLocalizations.of(context).translate("Next"))),
|
||||
onPressed: () => {
|
||||
//changingViewModel.saveCustomer(),
|
||||
changeBloc.add(CustomerSave()),
|
||||
Navigator.of(context).pop(),
|
||||
Navigator.of(context).pushNamed("customerFitnessPage",
|
||||
arguments: changeBloc.customerRepository)
|
||||
},
|
||||
)
|
||||
],
|
||||
}),
|
||||
InkWell(
|
||||
child: Text(
|
||||
AppLocalizations.of(context).translate("Gain Muscle"),
|
||||
style: TextStyle(color: Colors.white, fontSize: 32, fontFamily: 'Arial', fontWeight: FontWeight.w900),
|
||||
),
|
||||
highlightColor: Colors.white,
|
||||
)
|
||||
]),
|
||||
Divider(),
|
||||
Stack(alignment: Alignment.bottomLeft, overflow: Overflow.visible, children: [
|
||||
FlatButton(
|
||||
child: Image.asset(
|
||||
"asset/image/WT_weight_loss.png",
|
||||
height: 180,
|
||||
),
|
||||
padding: EdgeInsets.all(0.0),
|
||||
shape: getShape(changeBloc, GoalsItem.weight),
|
||||
onPressed: () => {
|
||||
setState(() {
|
||||
selected = GoalsItem.muscle;
|
||||
changeBloc.add(CustomerGoalChange(goal: GoalsItem.weight));
|
||||
}),
|
||||
}),
|
||||
InkWell(
|
||||
child: Text(
|
||||
AppLocalizations.of(context).translate("Loose Weight"),
|
||||
style: TextStyle(color: Colors.white, fontSize: 32, fontFamily: 'Arial', fontWeight: FontWeight.w900),
|
||||
),
|
||||
highlightColor: Colors.white,
|
||||
)
|
||||
]),
|
||||
Divider(),
|
||||
RaisedButton(
|
||||
color: Colors.orange,
|
||||
textColor: Colors.white,
|
||||
child: InkWell(child: Text(AppLocalizations.of(context).translate("Next"))),
|
||||
onPressed: () => {
|
||||
//changingViewModel.saveCustomer(),
|
||||
changeBloc.add(CustomerSave()),
|
||||
Navigator.of(context).pop(),
|
||||
Navigator.of(context).pushNamed("customerFitnessPage", arguments: changeBloc.customerRepository)
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
));
|
||||
}),
|
||||
|
||||
@@ -41,7 +41,6 @@ class EvaluationPage extends StatelessWidget with Trans {
|
||||
resultType = ResultType.running;
|
||||
imageUrl = 'asset/image/WT_Results_for_runners.png';
|
||||
}
|
||||
print("ResultType: " + resultType.toString());
|
||||
setContext(context);
|
||||
return Scaffold(
|
||||
appBar: AppBarMin(
|
||||
@@ -489,7 +488,7 @@ class EvaluationPage extends StatelessWidget with Trans {
|
||||
width: 10,
|
||||
),
|
||||
Text(
|
||||
element.data,
|
||||
element.data.toStringAsFixed(0),
|
||||
style: GoogleFonts.archivoBlack(fontSize: 28, color: blur ? Colors.white30 : Colors.white),
|
||||
),
|
||||
Text(
|
||||
|
||||
@@ -175,59 +175,12 @@ class _ExerciseExecuteAddPage extends State<ExerciseExecutePlanAddPage> with Tra
|
||||
),
|
||||
Text(t("repeat")),
|
||||
]),
|
||||
|
||||
/*TextFieldBlocBuilder(
|
||||
readOnly: exerciseBloc.step != i+1,
|
||||
textFieldBloc: exerciseBloc.unitQuantity1Field,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
color: Colors.black54,
|
||||
fontWeight: FontWeight.bold),
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp(r"[\d.]"))
|
||||
],
|
||||
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 14, color: Colors.black54, fontWeight: FontWeight.w100),
|
||||
labelStyle: TextStyle(fontSize: 14, color: Colors.deepOrange, fontWeight: FontWeight.normal),
|
||||
labelText: exerciseBloc.exerciseRepository.exerciseType.unitQuantityUnit,
|
||||
),
|
||||
),*/
|
||||
/*TextFieldBlocBuilder(
|
||||
readOnly: exerciseBloc.step != i+1,
|
||||
textFieldBloc: exerciseBloc.quantity1Field,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
color: Colors.deepOrange,
|
||||
fontWeight: FontWeight.bold),
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(RegExp(r"[\d.]"))
|
||||
],
|
||||
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.white,
|
||||
filled: false,
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 14, color: Colors.black54, fontWeight: FontWeight.w100),
|
||||
hintText: t("The number of the exercise"),
|
||||
labelStyle: TextStyle(fontSize: 14, color: Colors.deepOrange, fontWeight: FontWeight.normal),
|
||||
labelText: t("Please repeat with") + " "+ exerciseBloc.unitQuantity1Field.value + " " +
|
||||
exerciseBloc.exerciseRepository.exerciseType.unitQuantityUnit + " " +
|
||||
exerciseBloc.exercisePlanRepository.getActualPlanDetail().repeats.toString() + " " + t("times!"),
|
||||
),
|
||||
),*/
|
||||
RaisedButton(
|
||||
padding: EdgeInsets.all(0),
|
||||
textColor: Colors.white,
|
||||
color: exerciseBloc.step == i + 1 ? Colors.blue : Colors.black26,
|
||||
focusColor: Colors.blueAccent,
|
||||
onPressed: () => {
|
||||
print("Submit step " + exerciseBloc.step.toString() + " (i) " + i.toString()),
|
||||
if (exerciseBloc.step == i + 1) {exerciseBloc.add(ExerciseExecutePlanAddSubmit())},
|
||||
if (i + 1 == exerciseBloc.countSteps) {Navigator.of(context).pop()}
|
||||
},
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import 'dart:collection';
|
||||
import 'package:aitrainer_app/bloc/exercise_log/exercise_log_bloc.dart';
|
||||
import 'package:aitrainer_app/library/custom_icon_icons.dart';
|
||||
import 'package:aitrainer_app/widgets/app_bar.dart';
|
||||
import 'package:aitrainer_app/widgets/bottom_nav.dart';
|
||||
import 'package:aitrainer_app/widgets/dialog_premium.dart';
|
||||
import 'package:aitrainer_app/widgets/splash.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
@@ -34,7 +36,7 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
|
||||
create: (context) => ExerciseLogBloc(exerciseRepository: ExerciseRepository())..add(ExerciseLogLoad()),
|
||||
child: BlocConsumer<ExerciseLogBloc, ExerciseLogState>(listener: (context, state) {
|
||||
if (state is ExerciseLogLoading) {
|
||||
//LoadingDialog.show(context);
|
||||
return LoadingDialog();
|
||||
} else if (state is ExerciseLogError) {
|
||||
//LoadingDialog.hide(context);
|
||||
Scaffold.of(context).showSnackBar(
|
||||
@@ -45,7 +47,10 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
|
||||
if (state is ExerciseLogReady) {
|
||||
//LoadingDialog.hide(context);
|
||||
return getExerciseLog(customerId, exerciseBloc);
|
||||
} else if (state is ExerciseLogLoading) {
|
||||
return LoadingDialog();
|
||||
} else {
|
||||
//LoadingDialog.hide(context);
|
||||
return getExerciseLog(customerId, exerciseBloc);
|
||||
}
|
||||
}));
|
||||
@@ -59,8 +64,8 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: customerId == Cache().userLoggedIn.customerId
|
||||
? AssetImage('asset/image/WT_light_background.png')
|
||||
: AssetImage('asset/image/WT_menu_dark.png'),
|
||||
? AssetImage('asset/image/WT_black_background.png')
|
||||
: AssetImage('asset/image/WT_light_background.png'),
|
||||
fit: BoxFit.cover,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
@@ -123,7 +128,7 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
|
||||
|
||||
List<Exercise> listExercises = List();
|
||||
String origDate = "";
|
||||
exerciseRepository.exerciseList.forEach((exercise) {
|
||||
exerciseRepository.exerciseLogList.forEach((exercise) {
|
||||
String exerciseDate = DateFormat("yyyy-MM-dd", AppLanguage().appLocal.toString()).format(exercise.dateAdd);
|
||||
|
||||
if (origDate != exerciseDate) {
|
||||
@@ -168,25 +173,16 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
|
||||
ExerciseType exerciseType = exerciseRepository.getExerciseTypeById(exercise.exerciseTypeId);
|
||||
String exerciseName = isEnglish ? exerciseType.name : exerciseType.nameTranslation;
|
||||
|
||||
String unitQuantity =
|
||||
exerciseType.unitQuantity == "1" ? exercise.unitQuantity.toStringAsFixed(0) + " " + t(exerciseType.unitQuantityUnit) + " " : "";
|
||||
|
||||
String labelExercise = unitQuantity + exercise.quantity.toStringAsFixed(0) + " " + t(exercise.unit);
|
||||
|
||||
list.add(
|
||||
Card(
|
||||
margin: EdgeInsets.only(left: 10, top: 5),
|
||||
color: Colors.white54,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(left: 5, top: 0, right: 5, bottom: 0),
|
||||
padding: const EdgeInsets.only(left: 15, top: 0, right: 5, bottom: 0),
|
||||
child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [
|
||||
Icon(Icons.accessibility, color: Colors.black12),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Flexible(
|
||||
fit: FlexFit.tight,
|
||||
flex: 8,
|
||||
flex: 20,
|
||||
child: Text(
|
||||
exerciseName,
|
||||
style: TextStyle(fontSize: 12, color: Colors.black),
|
||||
@@ -195,17 +191,35 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
|
||||
Flexible(
|
||||
fit: FlexFit.tight,
|
||||
child: SizedBox(
|
||||
width: 10,
|
||||
width: 5,
|
||||
)),
|
||||
Text(
|
||||
labelExercise,
|
||||
style: TextStyle(fontSize: 9, color: Colors.blueAccent.shade700),
|
||||
),
|
||||
Flexible(
|
||||
fit: FlexFit.tight,
|
||||
child: SizedBox(
|
||||
width: 10,
|
||||
flex: 20,
|
||||
child: Text(
|
||||
exercise.summary == null ? "" : exercise.summary,
|
||||
style: TextStyle(fontSize: 12, color: Colors.blue[800]),
|
||||
)),
|
||||
Stack(
|
||||
children: [
|
||||
IconButton(
|
||||
iconSize: 36,
|
||||
icon: Icon(CustomIcon.heart_1, color: Colors.blue[800]),
|
||||
onPressed: () {
|
||||
evaluation();
|
||||
},
|
||||
),
|
||||
GestureDetector(
|
||||
child: Image.asset(
|
||||
'asset/image/lock.png',
|
||||
height: 25,
|
||||
width: 25,
|
||||
),
|
||||
onTap: () {
|
||||
evaluation();
|
||||
}),
|
||||
],
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(Icons.delete, color: Colors.black12),
|
||||
onPressed: () {
|
||||
@@ -220,6 +234,19 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
|
||||
return list;
|
||||
}
|
||||
|
||||
void evaluation() {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return DialogPremium(
|
||||
title: "Go Premium",
|
||||
descriptions: "Unleash your potential with WorkoutTest Premium!",
|
||||
description2: "Enjoy also this premium fetaure to show all old evaluation data of your successful exercises.",
|
||||
text: "OK",
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
void confirmationDialog(ExerciseLogBloc bloc, Exercise exercise) {
|
||||
ExerciseType exerciseType = bloc.exerciseRepository.getExerciseTypeById(exercise.exerciseTypeId);
|
||||
String exerciseName = AppLanguage().appLocal == Locale("en") ? exerciseType.name : exerciseType.nameTranslation;
|
||||
@@ -260,11 +287,7 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
|
||||
),
|
||||
FlatButton(
|
||||
child: Text(t("Yes")),
|
||||
onPressed: () => {
|
||||
print("delete exercise: " + exercise.toJson().toString()),
|
||||
bloc.add(ExerciseLogDelete(exercise: exercise)),
|
||||
Navigator.pop(context)
|
||||
},
|
||||
onPressed: () => {bloc.add(ExerciseLogDelete(exercise: exercise)), Navigator.pop(context)},
|
||||
)
|
||||
],
|
||||
));
|
||||
|
||||
@@ -9,6 +9,7 @@ import 'package:aitrainer_app/model/exercise_ability.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/service/logging.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:aitrainer_app/widgets/app_bar.dart';
|
||||
import 'package:aitrainer_app/widgets/bmi_widget.dart';
|
||||
@@ -27,7 +28,7 @@ class ExerciseNewPage extends StatefulWidget {
|
||||
_ExerciseNewPageState createState() => _ExerciseNewPageState();
|
||||
}
|
||||
|
||||
class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans {
|
||||
class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans, Logging {
|
||||
final FocusNode _nodeText1 = FocusNode();
|
||||
final FocusNode _nodeText2 = FocusNode();
|
||||
|
||||
@@ -123,7 +124,7 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans {
|
||||
exerciseDescription = "";
|
||||
}
|
||||
|
||||
//print(exerciseBloc.exerciseRepository.exerciseType.name);
|
||||
//log(exerciseBloc.exerciseRepository.exerciseType.name);
|
||||
|
||||
if (exerciseBloc.exerciseRepository.exerciseType.name == "BMR") {
|
||||
return BMR(exerciseBloc: exerciseBloc);
|
||||
@@ -409,7 +410,6 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans {
|
||||
|
||||
void confirmationDialog(ExerciseNewBloc bloc, MenuBloc menuBloc) {
|
||||
LinkedHashMap args = LinkedHashMap();
|
||||
print("exercise validated " + bloc.exerciseRepository.exercise.quantity.toString());
|
||||
if (bloc.exerciseRepository.exercise.quantity == null) {
|
||||
return;
|
||||
}
|
||||
@@ -459,7 +459,7 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans {
|
||||
bloc.add(ExerciseNewSubmit()),
|
||||
Navigator.pop(context),
|
||||
Navigator.pop(context),
|
||||
print("Ability " +
|
||||
log("Ability " +
|
||||
menuBloc.ability.toString() +
|
||||
" exerciseType 1rm " +
|
||||
bloc.exerciseRepository.exerciseType.is1RM().toString()),
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import 'dart:async';
|
||||
import 'dart:collection';
|
||||
import 'package:aitrainer_app/library/radar_chart.dart';
|
||||
import 'package:aitrainer_app/widgets/app_bar.dart';
|
||||
import 'package:aitrainer_app/widgets/bottom_nav.dart';
|
||||
import 'package:aitrainer_app/widgets/dialog_premium.dart';
|
||||
import 'package:aitrainer_app/widgets/splash.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
@@ -17,12 +19,30 @@ class MyDevelopmentBodyPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _MyDevelopmentBodyPage extends State<MyDevelopmentBodyPage> with Trans, Common {
|
||||
bool isStart = false;
|
||||
// ignore: close_sinks
|
||||
BodyDevelopmentBloc bloc;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
Timer(
|
||||
Duration(milliseconds: 2000),
|
||||
() => {
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (BuildContext context) {
|
||||
return DialogPremium(
|
||||
title: "Go Premium",
|
||||
descriptions: "Unleash your potential with WorkoutTest Premium!",
|
||||
description2: "The Body Development feature is reachable if you finished the second 100% test-circles",
|
||||
text: "OK",
|
||||
onTap: () => {Navigator.of(context).pop(), Navigator.of(context).pop()},
|
||||
onCancel: () => {Navigator.of(context).pop(), Navigator.of(context).pop()},
|
||||
);
|
||||
})
|
||||
});
|
||||
|
||||
/// We require the initializers to run after the loading screen is rendered
|
||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||
@@ -38,13 +58,14 @@ class _MyDevelopmentBodyPage extends State<MyDevelopmentBodyPage> with Trans, Co
|
||||
setContext(context);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBarNav(depth: 1),
|
||||
body: Container(
|
||||
appBar: AppBarNav(depth: 1),
|
||||
body: Container(
|
||||
padding: EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: customerId == Cache().userLoggedIn.customerId ? AssetImage('asset/image/WT_light_background.png'):
|
||||
AssetImage('asset/image/WT_menu_dark.png'),
|
||||
image: customerId == Cache().userLoggedIn.customerId
|
||||
? AssetImage('asset/image/WT_light_background.png')
|
||||
: AssetImage('asset/image/WT_menu_dark.png'),
|
||||
fit: BoxFit.cover,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
@@ -56,29 +77,24 @@ class _MyDevelopmentBodyPage extends State<MyDevelopmentBodyPage> with Trans, Co
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
if ( state is BodyDevelopmentInitial) {
|
||||
if (state is BodyDevelopmentInitial) {
|
||||
return Container();
|
||||
} else {
|
||||
return developmentWidget(customerId);
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
),
|
||||
bottomNavigationBar: BottomNavigator(bottomNavIndex: 1),
|
||||
)),
|
||||
bottomNavigationBar: BottomNavigator(bottomNavIndex: 1),
|
||||
);
|
||||
}
|
||||
|
||||
Widget developmentWidget(int customerId) {
|
||||
return Column(
|
||||
children: [
|
||||
explanationWidget(),
|
||||
Expanded(
|
||||
child: exerciseWidget(customerId),
|
||||
),
|
||||
|
||||
]
|
||||
);
|
||||
return Column(children: [
|
||||
explanationWidget(),
|
||||
Expanded(
|
||||
child: exerciseWidget(customerId),
|
||||
),
|
||||
]);
|
||||
}
|
||||
|
||||
Widget exerciseWidget(int customerId) {
|
||||
@@ -91,39 +107,33 @@ class _MyDevelopmentBodyPage extends State<MyDevelopmentBodyPage> with Trans, Co
|
||||
|
||||
Widget explanationWidget() {
|
||||
return Card(
|
||||
color: Colors.white60,
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 10, right: 5, top: 12, bottom: 8),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Row(
|
||||
color: Colors.white60,
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 10, right: 5, top: 12, bottom: 8),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.info,
|
||||
color: Colors.orangeAccent,
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.info,
|
||||
color: Colors.orangeAccent,
|
||||
),
|
||||
Text(" "),
|
||||
Text(
|
||||
t("My Body Development"),
|
||||
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(
|
||||
color: Colors.transparent,
|
||||
),
|
||||
Text(" "),
|
||||
Text(
|
||||
t("My Body Development"),
|
||||
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||
t("You see here your whole body development by muscle groups."),
|
||||
style: TextStyle(fontSize: 12, fontWeight: FontWeight.normal),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(
|
||||
color: Colors.transparent,
|
||||
),
|
||||
Text(
|
||||
t("You see here your whole body development by muscle groups."),
|
||||
style: TextStyle(fontSize: 12, fontWeight: FontWeight.normal),
|
||||
),
|
||||
|
||||
],
|
||||
)
|
||||
)
|
||||
);
|
||||
)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import 'dart:async';
|
||||
import 'dart:collection';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:aitrainer_app/widgets/app_bar.dart';
|
||||
import 'package:aitrainer_app/widgets/dialog_premium.dart';
|
||||
import 'package:aitrainer_app/widgets/treeview_parent_widget.dart';
|
||||
import 'package:fl_chart/fl_chart.dart';
|
||||
import 'package:aitrainer_app/util/common.dart';
|
||||
@@ -8,7 +10,6 @@ import 'package:aitrainer_app/bloc/development_by_muscle/development_by_muscle_b
|
||||
import 'package:aitrainer_app/model/workout_menu_tree.dart';
|
||||
import 'package:aitrainer_app/library/tree_view.dart';
|
||||
import 'package:aitrainer_app/widgets/bottom_nav.dart';
|
||||
import 'package:aitrainer_app/widgets/splash.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
@@ -29,6 +30,23 @@ class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Comm
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
Timer(
|
||||
Duration(milliseconds: 2000),
|
||||
() => {
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (BuildContext context) {
|
||||
return DialogPremium(
|
||||
title: "Go Premium",
|
||||
descriptions: "Unleash your potential with WorkoutTest Premium!",
|
||||
description2: "The Muscle Development feature is reachable if you finished the first 100% test-circles",
|
||||
text: "OK",
|
||||
onTap: () => {Navigator.of(context).pop(), Navigator.of(context).pop()},
|
||||
onCancel: () => {Navigator.of(context).pop(), Navigator.of(context).pop()},
|
||||
);
|
||||
})
|
||||
});
|
||||
|
||||
/// We require the initializers to run after the loading screen is rendered
|
||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||
|
||||
@@ -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/widgets/dialog_premium.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:aitrainer_app/widgets/app_bar.dart';
|
||||
@@ -25,7 +26,6 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> with Trans {
|
||||
setContext(context);
|
||||
double mediaWidth = MediaQuery.of(context).size.width;
|
||||
double imageWidth = (mediaWidth - 45) / 2;
|
||||
print("Media: " + mediaWidth.toString() + " imageWidth: " + imageWidth.toString());
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBarNav(depth: 0),
|
||||
@@ -46,13 +46,11 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> with Trans {
|
||||
textAlignment: Alignment.topCenter,
|
||||
text: t("My Exercise Logs"),
|
||||
style: GoogleFonts.robotoMono(
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.orange,
|
||||
fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4)
|
||||
)
|
||||
),
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.orange,
|
||||
fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
image: "asset/image/edzesnaplom400400.jpg",
|
||||
left: 5,
|
||||
onTap: () => this.callBackExerciseLog(exerciseRepository, customerRepository),
|
||||
@@ -64,10 +62,10 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> with Trans {
|
||||
text: t("My Whole Body Development"),
|
||||
style: GoogleFonts.robotoMono(
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.orange,
|
||||
fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4)),
|
||||
fontSize: 14,
|
||||
color: Colors.orange,
|
||||
fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4)),
|
||||
),
|
||||
image: "asset/image/testemfejl400x400.jpg",
|
||||
left: 5,
|
||||
@@ -82,11 +80,11 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> with Trans {
|
||||
textAlignment: Alignment.topLeft,
|
||||
text: t("Development Of Muscles"),
|
||||
style: GoogleFonts.robotoMono(
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.orange,
|
||||
fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.orange,
|
||||
fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
image: "asset/image/izomcsop400400.jpg",
|
||||
left: 5,
|
||||
onTap: () => {Navigator.of(context).pushNamed('mydevelopmentMusclePage', arguments: args)},
|
||||
@@ -98,13 +96,26 @@ class _MyDevelopmentPage extends State<MyDevelopmentPage> with Trans {
|
||||
textAlignment: Alignment.topLeft,
|
||||
text: t("Predictions"),
|
||||
style: GoogleFonts.robotoMono(
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.orange,
|
||||
fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.orange,
|
||||
fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
image: "asset/image/predictions.jpg",
|
||||
onTap: () => {},
|
||||
onTap: () => {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return DialogPremium(
|
||||
title: "Go Premium",
|
||||
descriptions: "Unleash your potential with WorkoutTest Premium!",
|
||||
description2: "The Predictions feature is reachable if you finished the second 100% test-circles",
|
||||
text: "OK",
|
||||
onTap: () => {Navigator.of(context).pop()},
|
||||
onCancel: () => {Navigator.of(context).pop()},
|
||||
);
|
||||
})
|
||||
},
|
||||
isLocked: true,
|
||||
),
|
||||
hiddenWidget(customerRepository, exerciseRepository),
|
||||
|
||||
+170
-143
@@ -1,9 +1,11 @@
|
||||
import 'dart:collection';
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||
import 'package:aitrainer_app/service/logging.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:aitrainer_app/widgets/app_bar.dart';
|
||||
import 'package:aitrainer_app/widgets/bottom_nav.dart';
|
||||
import 'package:aitrainer_app/widgets/dialog_premium.dart';
|
||||
import 'package:aitrainer_app/widgets/image_button.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -14,7 +16,7 @@ class MyExercisePlanPage extends StatefulWidget {
|
||||
_MyExercisePlanPage createState() => _MyExercisePlanPage();
|
||||
}
|
||||
|
||||
class _MyExercisePlanPage extends State<MyExercisePlanPage> with Trans {
|
||||
class _MyExercisePlanPage extends State<MyExercisePlanPage> with Trans, Logging {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ExerciseRepository exerciseRepository = ExerciseRepository();
|
||||
@@ -23,114 +25,146 @@ class _MyExercisePlanPage extends State<MyExercisePlanPage> with Trans {
|
||||
|
||||
double mediaWidth = MediaQuery.of(context).size.width;
|
||||
double imageWidth = (mediaWidth - 45) / 2;
|
||||
print("Media: " + mediaWidth.toString() + " imageWidth: " + imageWidth.toString());
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBarNav(depth: 0),
|
||||
body: Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('asset/image/WT_menu_dark.png'),
|
||||
fit: BoxFit.cover,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
),
|
||||
child: CustomScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
slivers:
|
||||
[
|
||||
SliverGrid(
|
||||
delegate: SliverChildListDelegate(
|
||||
[
|
||||
ImageButton(
|
||||
width: imageWidth,
|
||||
textAlignment: Alignment.topLeft,
|
||||
text: t("Execute My Selected Training Plan"),
|
||||
style: GoogleFonts.robotoMono(
|
||||
textStyle: TextStyle(fontSize: 14, color: Colors.orange, fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
image: "asset/image/exercise_plan_execute.jpg",
|
||||
top: 130,
|
||||
left: 5,
|
||||
onTap:() => {
|
||||
args['customerId'] = Cache().userLoggedIn.customerId,
|
||||
Navigator.of(context).pushNamed('exerciseExecutePlanPage',
|
||||
arguments: args)
|
||||
},
|
||||
isLocked: false,
|
||||
),
|
||||
|
||||
ImageButton(
|
||||
width: imageWidth,
|
||||
textAlignment: Alignment.topLeft,
|
||||
text: t("Edit My Custom Plan"),
|
||||
style: GoogleFonts.robotoMono(
|
||||
textStyle: TextStyle(fontSize: 14, color: Colors.orange, fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
image: "asset/image/exercise_plan_custom.jpg",
|
||||
left: 5,
|
||||
onTap:() => {
|
||||
args['exerciseRepository'] = exerciseRepository,
|
||||
args['customerId'] = Cache().userLoggedIn.customerId,
|
||||
Navigator.of(context).pushNamed('exercisePlanCustomPage',
|
||||
arguments: args)
|
||||
},
|
||||
isLocked: false,
|
||||
),
|
||||
|
||||
ImageButton(
|
||||
width: imageWidth,
|
||||
textAlignment: Alignment.topLeft,
|
||||
text: t("Suggested Training Plan"),
|
||||
style: GoogleFonts.robotoMono(
|
||||
textStyle: TextStyle(fontSize: 14, color: Colors.orange, fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
image: "asset/image/exercise_plan_suggested.jpg",
|
||||
left: 5,
|
||||
onTap:() => {
|
||||
|
||||
},
|
||||
isLocked: true,
|
||||
),
|
||||
|
||||
ImageButton(
|
||||
width: imageWidth,
|
||||
textAlignment: Alignment.topLeft,
|
||||
text: t("My Special Plan"),
|
||||
style: GoogleFonts.robotoMono(
|
||||
textStyle: TextStyle(fontSize: 14, color: Colors.orange, fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
image: "asset/image/exercise_plan_special.jpg",
|
||||
left: 5,
|
||||
onTap:() => {
|
||||
|
||||
},
|
||||
isLocked: true,
|
||||
),
|
||||
|
||||
ImageButton(
|
||||
width: imageWidth,
|
||||
textAlignment: Alignment.topLeft,
|
||||
text: t("My Arnold's Plan"),
|
||||
style: GoogleFonts.robotoMono(
|
||||
textStyle: TextStyle(fontSize: 14, color: Colors.orange, fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
image: "asset/image/exercise_plan_stars.jpg",
|
||||
left: 5,
|
||||
onTap:() => {
|
||||
|
||||
},
|
||||
isLocked: true,
|
||||
),
|
||||
|
||||
|
||||
hiddenPlanWidget(exerciseRepository),
|
||||
hiddenTrainingWidget(),
|
||||
|
||||
|
||||
]
|
||||
appBar: AppBarNav(depth: 0),
|
||||
body: Container(
|
||||
padding: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('asset/image/WT_menu_dark.png'),
|
||||
fit: BoxFit.cover,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
),
|
||||
child: CustomScrollView(scrollDirection: Axis.vertical, slivers: [
|
||||
SliverGrid(
|
||||
delegate: SliverChildListDelegate([
|
||||
ImageButton(
|
||||
width: imageWidth,
|
||||
textAlignment: Alignment.topLeft,
|
||||
text: t("Execute My Selected Training Plan"),
|
||||
style: GoogleFonts.robotoMono(
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.orange,
|
||||
fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
image: "asset/image/exercise_plan_execute.jpg",
|
||||
top: 130,
|
||||
left: 5,
|
||||
onTap: () => {
|
||||
args['customerId'] = Cache().userLoggedIn.customerId,
|
||||
Navigator.of(context).pushNamed('exerciseExecutePlanPage', arguments: args)
|
||||
},
|
||||
isLocked: false,
|
||||
),
|
||||
ImageButton(
|
||||
width: imageWidth,
|
||||
textAlignment: Alignment.topLeft,
|
||||
text: t("Edit My Custom Plan"),
|
||||
style: GoogleFonts.robotoMono(
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.orange,
|
||||
fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
image: "asset/image/exercise_plan_custom.jpg",
|
||||
left: 5,
|
||||
onTap: () => {
|
||||
args['exerciseRepository'] = exerciseRepository,
|
||||
args['customerId'] = Cache().userLoggedIn.customerId,
|
||||
Navigator.of(context).pushNamed('exercisePlanCustomPage', arguments: args)
|
||||
},
|
||||
isLocked: false,
|
||||
),
|
||||
ImageButton(
|
||||
width: imageWidth,
|
||||
textAlignment: Alignment.topLeft,
|
||||
text: t("Suggested Training Plan"),
|
||||
style: GoogleFonts.robotoMono(
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.orange,
|
||||
fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
image: "asset/image/exercise_plan_suggested.jpg",
|
||||
left: 5,
|
||||
onTap: () => {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return DialogPremium(
|
||||
title: "Go Premium",
|
||||
descriptions: "Unleash your potential with WorkoutTest Premium!",
|
||||
description2: "The Suggested Training Plan is reachable if you finished the first 100% test-circles",
|
||||
text: "OK",
|
||||
onTap: () => {Navigator.of(context).pop()},
|
||||
onCancel: () => {Navigator.of(context).pop()},
|
||||
);
|
||||
})
|
||||
},
|
||||
isLocked: true,
|
||||
),
|
||||
ImageButton(
|
||||
width: imageWidth,
|
||||
textAlignment: Alignment.topLeft,
|
||||
text: t("My Special Plan"),
|
||||
style: GoogleFonts.robotoMono(
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.orange,
|
||||
fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
image: "asset/image/exercise_plan_special.jpg",
|
||||
left: 5,
|
||||
onTap: () => {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return DialogPremium(
|
||||
title: "Go Premium",
|
||||
descriptions: "Unleash your potential with WorkoutTest Premium!",
|
||||
description2: "The Special Plan is reachable if you finished the first 100% test-circles",
|
||||
text: "OK",
|
||||
onTap: () => {Navigator.of(context).pop()},
|
||||
onCancel: () => {Navigator.of(context).pop()},
|
||||
);
|
||||
})
|
||||
},
|
||||
isLocked: true,
|
||||
),
|
||||
ImageButton(
|
||||
width: imageWidth,
|
||||
textAlignment: Alignment.topLeft,
|
||||
text: t("Star's Exercise Plan"),
|
||||
style: GoogleFonts.robotoMono(
|
||||
textStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.orange,
|
||||
fontWeight: FontWeight.bold,
|
||||
backgroundColor: Colors.black54.withOpacity(0.4))),
|
||||
image: "asset/image/exercise_plan_stars.jpg",
|
||||
left: 5,
|
||||
onTap: () => {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return DialogPremium(
|
||||
title: "Go Premium",
|
||||
descriptions: "Unleash your potential with WorkoutTest Premium!",
|
||||
description2: "The Star's Exericise Plan is reachable if you finished the second 100% test-circles",
|
||||
text: "OK",
|
||||
onTap: () => {Navigator.of(context).pop()},
|
||||
onCancel: () => {Navigator.of(context).pop()},
|
||||
);
|
||||
})
|
||||
},
|
||||
isLocked: true,
|
||||
),
|
||||
hiddenPlanWidget(exerciseRepository),
|
||||
hiddenTrainingWidget(),
|
||||
]),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
mainAxisSpacing: 15.0,
|
||||
@@ -138,30 +172,27 @@ class _MyExercisePlanPage extends State<MyExercisePlanPage> with Trans {
|
||||
childAspectRatio: 1.0,
|
||||
),
|
||||
)
|
||||
]
|
||||
)
|
||||
),
|
||||
bottomNavigationBar: BottomNavigator(bottomNavIndex: 2));
|
||||
])),
|
||||
bottomNavigationBar: BottomNavigator(bottomNavIndex: 2));
|
||||
}
|
||||
|
||||
Widget hiddenPlanWidget(ExerciseRepository exerciseRepository) {
|
||||
final LinkedHashMap args = LinkedHashMap();
|
||||
if ( Cache().getTrainee() != null ) {
|
||||
if (Cache().getTrainee() != null) {
|
||||
return FlatButton(
|
||||
padding: EdgeInsets.all(20),
|
||||
textColor: Colors.white,
|
||||
color: Colors.black12,
|
||||
focusColor: Colors.blueAccent,
|
||||
onPressed: () =>
|
||||
{
|
||||
args['exerciseRepository'] = exerciseRepository,
|
||||
args['customerId'] = Cache().getTrainee().customerId,
|
||||
Navigator.of(context).pushNamed('exercisePlanCustomPage',
|
||||
arguments: args)
|
||||
},
|
||||
child: Text(t("My Trainee's Plan"),
|
||||
style: TextStyle(fontSize: 18),)
|
||||
);
|
||||
padding: EdgeInsets.all(20),
|
||||
textColor: Colors.white,
|
||||
color: Colors.black12,
|
||||
focusColor: Colors.blueAccent,
|
||||
onPressed: () => {
|
||||
args['exerciseRepository'] = exerciseRepository,
|
||||
args['customerId'] = Cache().getTrainee().customerId,
|
||||
Navigator.of(context).pushNamed('exercisePlanCustomPage', arguments: args)
|
||||
},
|
||||
child: Text(
|
||||
t("My Trainee's Plan"),
|
||||
style: TextStyle(fontSize: 18),
|
||||
));
|
||||
} else {
|
||||
return Container();
|
||||
}
|
||||
@@ -169,27 +200,23 @@ class _MyExercisePlanPage extends State<MyExercisePlanPage> with Trans {
|
||||
|
||||
Widget hiddenTrainingWidget() {
|
||||
final LinkedHashMap args = LinkedHashMap();
|
||||
if ( Cache().getTrainee() != null ) {
|
||||
print ("!!Trainee: " + Cache().getTrainee().firstname + " " + Cache().getTrainee().name);
|
||||
if (Cache().getTrainee() != null) {
|
||||
log("!!Trainee: " + Cache().getTrainee().firstname + " " + Cache().getTrainee().name);
|
||||
return FlatButton(
|
||||
padding: EdgeInsets.all(20),
|
||||
textColor: Colors.white,
|
||||
color: Colors.black12,
|
||||
focusColor: Colors.blueAccent,
|
||||
onPressed: () =>
|
||||
{
|
||||
args['customerId'] = Cache().getTrainee().customerId,
|
||||
Navigator.of(context).pushNamed('exerciseExecutePlanPage',
|
||||
arguments: args)
|
||||
},
|
||||
child: Text(t("Execute My Trainee's Training Plan"),
|
||||
style: TextStyle(fontSize: 18),)
|
||||
);
|
||||
padding: EdgeInsets.all(20),
|
||||
textColor: Colors.white,
|
||||
color: Colors.black12,
|
||||
focusColor: Colors.blueAccent,
|
||||
onPressed: () => {
|
||||
args['customerId'] = Cache().getTrainee().customerId,
|
||||
Navigator.of(context).pushNamed('exerciseExecutePlanPage', arguments: args)
|
||||
},
|
||||
child: Text(
|
||||
t("Execute My Trainee's Training Plan"),
|
||||
style: TextStyle(fontSize: 18),
|
||||
));
|
||||
} else {
|
||||
return Container();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,199 @@
|
||||
import 'package:aitrainer_app/bloc/sales/sales_bloc.dart';
|
||||
import 'package:aitrainer_app/util/trans.dart';
|
||||
import 'package:aitrainer_app/widgets/app_bar_min.dart';
|
||||
import 'package:aitrainer_app/widgets/sales_button.dart';
|
||||
import 'package:aitrainer_app/widgets/splash.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class SalesPage extends StatelessWidget with Trans {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
setContext(context);
|
||||
return BlocProvider(
|
||||
create: (context) => SalesBloc()..add(SalesLoad()),
|
||||
child: BlocConsumer<SalesBloc, SalesState>(listener: (context, state) {
|
||||
if (state is SalesError) {
|
||||
Scaffold.of(context).showSnackBar(
|
||||
SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white))));
|
||||
} else if (state is SalesLoading) {
|
||||
return LoadingDialog();
|
||||
}
|
||||
}, builder: (context, state) {
|
||||
final salesBloc = BlocProvider.of<SalesBloc>(context);
|
||||
return salesWidget(salesBloc);
|
||||
}));
|
||||
}
|
||||
|
||||
Widget salesWidget(SalesBloc bloc) {
|
||||
final double mediaWidth = MediaQuery.of(context).size.width;
|
||||
final double imageWidth = (mediaWidth - 5) / 2;
|
||||
return Scaffold(
|
||||
appBar: AppBarMin(
|
||||
back: true,
|
||||
),
|
||||
body: Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('asset/image/WT_black_background.png'),
|
||||
fit: BoxFit.cover,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
),
|
||||
child: CustomScrollView(scrollDirection: Axis.vertical, slivers: [
|
||||
SliverList(
|
||||
delegate: SliverChildListDelegate([
|
||||
Divider(),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 65, right: 65),
|
||||
child: Text("Unleash Your Development Now!",
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 4,
|
||||
softWrap: true,
|
||||
style: GoogleFonts.archivoBlack(
|
||||
fontSize: 30,
|
||||
color: Colors.white,
|
||||
shadows: <Shadow>[
|
||||
Shadow(
|
||||
offset: Offset(5.0, 5.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
Shadow(
|
||||
offset: Offset(-3.0, 3.0),
|
||||
blurRadius: 12.0,
|
||||
color: Colors.black54,
|
||||
),
|
||||
],
|
||||
))),
|
||||
Divider(),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 45, right: 45),
|
||||
child: Text("Learn about your development, enjoy AI-driven predictions of all of your skills and bodyparts.",
|
||||
textAlign: TextAlign.left,
|
||||
maxLines: 4,
|
||||
softWrap: true,
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 16,
|
||||
color: Colors.white,
|
||||
))),
|
||||
SizedBox(
|
||||
height: 50,
|
||||
),
|
||||
])),
|
||||
SliverGrid(
|
||||
delegate: SliverChildListDelegate(getButtons(bloc)
|
||||
/* [
|
||||
SalesButton(
|
||||
title: "Annual",
|
||||
price: "9970 Ft / év",
|
||||
desc1: "Development programs",
|
||||
desc2: "Suggestions based on your actual status",
|
||||
desc3: "Special customized training plans",
|
||||
descStyle: GoogleFonts.inter(fontSize: 10, color: Colors.blue[800]),
|
||||
badgeText: "2 months free",
|
||||
badgeColor: Colors.orange,
|
||||
style: GoogleFonts.archivoBlack(fontSize: 14, color: Colors.blue[800]),
|
||||
onTap: () {
|
||||
print("1");
|
||||
//bloc.sessionBloc.add(event)
|
||||
},
|
||||
),
|
||||
SalesButton(
|
||||
title: "Annual",
|
||||
price: "10970 Ft / év",
|
||||
desc1: "Development programs",
|
||||
desc2: "Suggestions based on your actual status",
|
||||
desc3: "Special customized training plans",
|
||||
desc4: "AI driven predictions",
|
||||
descStyle: GoogleFonts.inter(fontSize: 10, color: Colors.blue[800]),
|
||||
badgeText: "one month free",
|
||||
badgeColor: Colors.orange,
|
||||
style: GoogleFonts.archivoBlack(fontSize: 14, color: Colors.blue[800]),
|
||||
onTap: () => {print("2")},
|
||||
),
|
||||
SalesButton(
|
||||
title: "Monthly",
|
||||
price: "970 Ft / hó",
|
||||
desc1: "Development programs",
|
||||
desc2: "Suggestions based on your actual status",
|
||||
desc3: "Special customized training plans",
|
||||
desc4: "AI driven predictions",
|
||||
descStyle: GoogleFonts.inter(fontSize: 10, color: Colors.blue[800]),
|
||||
badgeColor: Colors.transparent,
|
||||
style: GoogleFonts.archivoBlack(fontSize: 14, color: Colors.blue[800]),
|
||||
onTap: () => {print("3")},
|
||||
),
|
||||
] */
|
||||
),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 3,
|
||||
mainAxisSpacing: 10.0,
|
||||
crossAxisSpacing: 10.0,
|
||||
childAspectRatio: 0.55,
|
||||
),
|
||||
),
|
||||
SliverList(
|
||||
delegate: SliverChildListDelegate([
|
||||
SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 55, right: 55),
|
||||
child: Text(
|
||||
"Subscription Conditions",
|
||||
style: GoogleFonts.inter(fontSize: 14, fontWeight: FontWeight.bold, color: Colors.white),
|
||||
)),
|
||||
Divider(),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 55, right: 55),
|
||||
child: Text(
|
||||
"Payment will be charged to your account. Subscription automatically renews unless auto-renew is turned off at least 24 hourse before the end of the current period",
|
||||
style: GoogleFonts.inter(fontSize: 12, color: Colors.white),
|
||||
)),
|
||||
Divider(),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 55, right: 55),
|
||||
child: Text(
|
||||
"Account will be charged for renewal within 24 hours prior to the end of the current period",
|
||||
style: GoogleFonts.inter(fontSize: 12, color: Colors.white),
|
||||
)),
|
||||
])),
|
||||
])));
|
||||
;
|
||||
}
|
||||
|
||||
List<Widget> getButtons(SalesBloc bloc) {
|
||||
List<Widget> buttons = List();
|
||||
|
||||
bloc.product2Display.forEach((element) {
|
||||
final String title = element.sort == 3 ? "Montly" : "Annual";
|
||||
final String interval = element.sort == 3 ? " / month" : " / year";
|
||||
final String desc4 = element.sort == 1 ? "" : "AI driven predictions";
|
||||
String badge;
|
||||
if (element.sort == 2) {
|
||||
badge = "14% discount";
|
||||
} else if (element.sort == 1) {
|
||||
badge = "2 months free";
|
||||
}
|
||||
Widget button = SalesButton(
|
||||
title: title,
|
||||
price: element.description + interval,
|
||||
desc1: "Development programs",
|
||||
desc2: "Suggestions based on your actual status",
|
||||
desc3: "Special customized training plans",
|
||||
desc4: desc4,
|
||||
descStyle: GoogleFonts.inter(fontSize: 10, color: Colors.blue[800]),
|
||||
badgeText: badge,
|
||||
badgeColor: element.sort == 3 ? Colors.transparent : Colors.orange,
|
||||
style: GoogleFonts.archivoBlack(fontSize: 14, color: Colors.blue[800]),
|
||||
onTap: () => {bloc.add(SalesPurchase(productId: element.productId))},
|
||||
);
|
||||
buttons.add(button);
|
||||
});
|
||||
|
||||
return buttons;
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,8 @@ class SettingsPage extends StatelessWidget with Trans {
|
||||
child: Form(
|
||||
child: BlocConsumer<SettingsBloc, SettingsState>(listener: (context, state) {
|
||||
if (state is SettingsError) {
|
||||
Scaffold.of(context).showSnackBar(
|
||||
SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white))));
|
||||
} else if (state is SettingsReady) {
|
||||
menuBloc.add(MenuRecreateTree());
|
||||
} else if (state is SettingsLoading) {
|
||||
|
||||
Reference in New Issue
Block a user