wt1.1c auth->cache, control page, animation base exercise percent
This commit is contained in:
@@ -7,7 +7,6 @@ import 'package:flutter/cupertino.dart';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class AccountPage extends StatelessWidget {
|
||||
// ignore: close_sinks
|
||||
AccountBloc accountBloc;
|
||||
|
||||
@override
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'dart:collection';
|
||||
|
||||
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';
|
||||
@@ -24,7 +26,6 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
create: (context) =>
|
||||
CustomExerciseFormBloc(exerciseRepository: ExerciseRepository()),
|
||||
child: Builder(builder: (context) {
|
||||
// ignore: close_sinks
|
||||
final exerciseBloc = BlocProvider.of<CustomExerciseFormBloc>(context);
|
||||
exerciseBloc.exerciseRepository.setExerciseType(exerciseType);
|
||||
|
||||
@@ -189,6 +190,7 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
}
|
||||
|
||||
SliverGrid gridCalculation(CustomExerciseFormBloc bloc) {
|
||||
LinkedHashMap args = LinkedHashMap();
|
||||
return SliverGrid(
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 3,
|
||||
@@ -201,7 +203,7 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
textFieldBloc: bloc.rmWendlerField,
|
||||
padding: EdgeInsets.only(left:30),
|
||||
padding: EdgeInsets.only(left:10),
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12),
|
||||
decoration: InputDecoration(
|
||||
border: InputBorder.none,
|
||||
@@ -211,7 +213,7 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:30),
|
||||
padding: EdgeInsets.only(left:10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rmWathenField,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12),
|
||||
@@ -223,7 +225,7 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:30),
|
||||
padding: EdgeInsets.only(left:10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rmOconnerField,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12),
|
||||
@@ -235,7 +237,7 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:30),
|
||||
padding: EdgeInsets.only(left:10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rmMayhewField,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12),
|
||||
@@ -247,7 +249,7 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:30),
|
||||
padding: EdgeInsets.only(left:10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rmAverageField,
|
||||
style: TextStyle(color: Colors.blueAccent, fontSize: 12),
|
||||
@@ -259,7 +261,7 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:30),
|
||||
padding: EdgeInsets.only(left:10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rm90Field,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12),
|
||||
@@ -272,7 +274,7 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:30),
|
||||
padding: EdgeInsets.only(left:10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rm75Field,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12, fontWeight: FontWeight.bold),
|
||||
@@ -284,7 +286,7 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:30),
|
||||
padding: EdgeInsets.only(left:10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rm75OconnorField,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12, fontWeight: FontWeight.bold),
|
||||
@@ -296,7 +298,7 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:30),
|
||||
padding: EdgeInsets.only(left:10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rm75WendlerField,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12, fontWeight: FontWeight.bold),
|
||||
@@ -308,7 +310,7 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:30),
|
||||
padding: EdgeInsets.only(left:10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rm80Field,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12),
|
||||
@@ -320,7 +322,7 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:30),
|
||||
padding: EdgeInsets.only(left:10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rm70Field,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12),
|
||||
@@ -332,7 +334,7 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:30),
|
||||
padding: EdgeInsets.only(left:10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rm60Field,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12),
|
||||
@@ -344,7 +346,7 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
)),
|
||||
TextFieldBlocBuilder(
|
||||
readOnly: true,
|
||||
padding: EdgeInsets.only(left:30),
|
||||
padding: EdgeInsets.only(left:10),
|
||||
maxLines: 1,
|
||||
textFieldBloc: bloc.rm50Field,
|
||||
style: TextStyle(color: Colors.deepOrange, fontSize: 12),
|
||||
@@ -353,8 +355,45 @@ class _CustomExerciseNewPageState extends State<CustomExercisePage> {
|
||||
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,
|
||||
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,
|
||||
Navigator.of(context).pushNamed('exerciseControlPage',
|
||||
arguments: args )
|
||||
},
|
||||
child: Text("Control with 50%",
|
||||
style: TextStyle(fontSize: 12),)
|
||||
),
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,4 +299,4 @@ class CustomerModifyPage extends StatelessWidget{
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,321 @@
|
||||
import 'dart:collection';
|
||||
|
||||
import 'package:aitrainer_app/bloc/exercise_control_form_bloc.dart';
|
||||
import 'package:aitrainer_app/localization/app_language.dart';
|
||||
import 'package:aitrainer_app/localization/app_localization.dart';
|
||||
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||
import 'package:aitrainer_app/widgets/splash.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_form_bloc/flutter_form_bloc.dart';
|
||||
|
||||
class ExerciseControlPage extends StatefulWidget{
|
||||
_ExerciseControlPage createState() => _ExerciseControlPage();
|
||||
}
|
||||
|
||||
class _ExerciseControlPage extends State<ExerciseControlPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
LinkedHashMap arguments = ModalRoute.of(context).settings.arguments;
|
||||
final ExerciseRepository exerciseRepository = arguments['exerciseRepository'];
|
||||
final double percent = arguments['percent'];
|
||||
|
||||
return BlocProvider(
|
||||
create: (context) =>
|
||||
ExerciseControlFormBloc(exerciseRepository: exerciseRepository, percentToCalculate: percent),
|
||||
child: BlocBuilder<ExerciseControlFormBloc, FormBlocState>(
|
||||
builder: (context, state) {
|
||||
// ignore: close_sinks
|
||||
final exerciseBloc = BlocProvider.of<ExerciseControlFormBloc>(context);
|
||||
if ( state is FormBlocLoading ) {
|
||||
return LoadingDialog();
|
||||
} 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;
|
||||
|
||||
return Form(
|
||||
autovalidate: true,
|
||||
child: Scaffold(
|
||||
resizeToAvoidBottomInset: true,
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Text("1RM Control"),
|
||||
Image.asset(
|
||||
'asset/image/WT_long_logo.png',
|
||||
fit: BoxFit.cover,
|
||||
height: 65.0,
|
||||
),
|
||||
],
|
||||
),
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back, color: Colors.white),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
),
|
||||
body: Container(
|
||||
width: MediaQuery
|
||||
.of(context)
|
||||
.size
|
||||
.width,
|
||||
height: MediaQuery
|
||||
.of(context)
|
||||
.size
|
||||
.height,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('asset/image/WT_light_background.png'),
|
||||
fit: BoxFit.fill,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
),
|
||||
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)),
|
||||
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.]"))
|
||||
],
|
||||
onChanged: (input) => {
|
||||
print("Quantity 1 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.unitQuantity1Field.value + " " + exerciseBloc.exerciseRepository.exerciseType.unitQuantityUnit + " 12 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");
|
||||
dynamic rc = (input != null && input.length > 0);
|
||||
if (!rc) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Pattern pattern = r'^\d+(?:\.\d+)?$';
|
||||
RegExp regex = new RegExp(pattern);
|
||||
if (!regex.hasMatch(input)) {
|
||||
return error;
|
||||
}
|
||||
|
||||
rc = double.tryParse(input);
|
||||
if (rc == null) {
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
if (!(double.parse(input) < 10000 && double.parse(input) > 0)) {
|
||||
return error;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:aitrainer_app/bloc/exercise_form_bloc.dart';
|
||||
import 'package:aitrainer_app/localization/app_language.dart';
|
||||
import 'package:aitrainer_app/localization/app_localization.dart';
|
||||
import 'package:aitrainer_app/model/auth.dart';
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
import 'package:aitrainer_app/model/exercise_type.dart';
|
||||
import 'package:aitrainer_app/repository/exercise_repository.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -283,7 +283,7 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> {
|
||||
FlatButton(
|
||||
child: Text(AppLocalizations.of(context).translate("Yes")),
|
||||
onPressed: () => {
|
||||
bloc.exerciseRepository.setCustomer(Auth().userLoggedIn),
|
||||
bloc.exerciseRepository.setCustomer(Cache().userLoggedIn),
|
||||
bloc.exerciseRepository.addExercise(),
|
||||
|
||||
Navigator.pop(context),
|
||||
|
||||
+2
-2
@@ -26,7 +26,7 @@ class LoginWidget extends StatefulWidget {
|
||||
State<StatefulWidget> createState() => _LoginWidget();
|
||||
}
|
||||
|
||||
class _LoginWidget extends State<LoginWidget> {
|
||||
class _LoginWidget extends State<LoginWidget> with Common {
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
|
||||
@@ -72,7 +72,7 @@ class _LoginWidget extends State<LoginWidget> {
|
||||
}
|
||||
|
||||
Widget buildLoginForm(LoginFormBloc formBloc, AccountBloc accountBloc) {
|
||||
final cWidth = Common.mediaSizeWidth(context);
|
||||
final cWidth = mediaSizeWidth(context);
|
||||
|
||||
return Form(
|
||||
key: _formKey,
|
||||
|
||||
+18
-25
@@ -1,5 +1,7 @@
|
||||
|
||||
import 'package:aitrainer_app/bloc/menu/menu_bloc.dart';
|
||||
import 'package:aitrainer_app/localization/app_localization.dart';
|
||||
|
||||
import 'package:aitrainer_app/widgets/app_bar.dart';
|
||||
import 'package:aitrainer_app/widgets/bottom_nav.dart';
|
||||
import 'package:aitrainer_app/widgets/menu_page_widget.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
@@ -9,39 +11,30 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class MenuPage extends StatelessWidget {
|
||||
class MenuPage extends StatefulWidget {
|
||||
static const routeName = '/menu_page';
|
||||
int parent;
|
||||
MenuBloc menuBloc;
|
||||
|
||||
MenuPage({this.parent});
|
||||
|
||||
_MenuPage createState() => _MenuPage();
|
||||
}
|
||||
|
||||
class _MenuPage extends State<MenuPage> {
|
||||
// ignore: close_sinks
|
||||
MenuBloc menuBloc;
|
||||
|
||||
|
||||
|
||||
void checkTest() {
|
||||
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
menuBloc = BlocProvider.of<MenuBloc>(context);
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Text(AppLocalizations.of(context).translate("Tests")),
|
||||
Image.asset(
|
||||
'asset/image/WT_long_logo.png',
|
||||
fit: BoxFit.cover,
|
||||
height: 65.0,
|
||||
),
|
||||
],
|
||||
),
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back, color: Colors.white),
|
||||
onPressed: () =>
|
||||
{
|
||||
menuBloc.add(MenuTreeUp(parent: 0))
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
appBar: AppBarNav(),
|
||||
body: Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
|
||||
@@ -34,13 +34,13 @@ class RegistrationWidget extends StatefulWidget {
|
||||
State<StatefulWidget> createState() => _RegistrationWidget();
|
||||
}
|
||||
|
||||
class _RegistrationWidget extends State<RegistrationWidget> {
|
||||
class _RegistrationWidget extends State<RegistrationWidget> with Common {
|
||||
final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cWidth = Common.mediaSizeWidth(context);
|
||||
final cWidth = mediaSizeWidth(context);
|
||||
// ignore: close_sinks
|
||||
final accountBloc = BlocProvider.of<AccountBloc>(context);
|
||||
return BlocProvider(
|
||||
|
||||
@@ -2,7 +2,7 @@ import 'package:aitrainer_app/bloc/menu/menu_bloc.dart';
|
||||
import 'package:aitrainer_app/bloc/settings/settings_bloc.dart';
|
||||
import 'package:aitrainer_app/localization/app_language.dart';
|
||||
import 'package:aitrainer_app/localization/app_localization.dart';
|
||||
import 'package:aitrainer_app/model/auth.dart';
|
||||
import 'package:aitrainer_app/model/cache.dart';
|
||||
import 'package:aitrainer_app/widgets/bottom_nav.dart';
|
||||
import 'package:aitrainer_app/widgets/splash.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
Reference in New Issue
Block a user