WT1.1.0+3334 CustomerExerciseDevice fix, Badges fix

This commit is contained in:
bossanyit 2020-11-29 17:34:21 +01:00
parent b59db7c9db
commit 25c3a1d096
21 changed files with 522 additions and 549 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 KiB

View File

@ -362,7 +362,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 33; CURRENT_PROJECT_VERSION = 34;
DEVELOPMENT_TEAM = SFJJBDCU6Z; DEVELOPMENT_TEAM = SFJJBDCU6Z;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
@ -505,7 +505,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 33; CURRENT_PROJECT_VERSION = 34;
DEVELOPMENT_TEAM = SFJJBDCU6Z; DEVELOPMENT_TEAM = SFJJBDCU6Z;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (
@ -540,7 +540,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 33; CURRENT_PROJECT_VERSION = 34;
DEVELOPMENT_TEAM = SFJJBDCU6Z; DEVELOPMENT_TEAM = SFJJBDCU6Z;
ENABLE_BITCODE = NO; ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = ( FRAMEWORK_SEARCH_PATHS = (

View File

@ -30,6 +30,7 @@ class CustomerExerciseDeviceBloc extends Bloc<CustomerExerciseDeviceEvent, Custo
} else if (event is CustomerExerciseDeviceAdd) { } else if (event is CustomerExerciseDeviceAdd) {
yield CustomerExerciseDeviceLoading(); yield CustomerExerciseDeviceLoading();
print("Add device " + event.device.exerciseDeviceId.toString()); print("Add device " + event.device.exerciseDeviceId.toString());
//await Future.delayed(const Duration(seconds: 2), () => "2");
await repository.addDevice(event.device); await repository.addDevice(event.device);
Cache().initBadges(); Cache().initBadges();
yield CustomerExerciseDeviceReady(); yield CustomerExerciseDeviceReady();

View File

@ -335,31 +335,34 @@ class ExerciseNewBloc extends Bloc<ExerciseNewEvent, ExerciseNewState> {
if (this.bmi == 0) { if (this.bmi == 0) {
getBMI(); getBMI();
} }
//bmi = 15; final double distortionWidth = mediaWidth / baseWidth;
final double distortionHeight = mediaHeight / baseHeight;
print("W m " + mediaWidth.toString() + " b" + baseWidth.toString() + " d: " + distortionWidth.toString());
print("H m " + mediaHeight.toString() + " b" + baseHeight.toString() + " d: " + distortionHeight.toString());
this.bmiAngle = (bmi * 90 / 25) - 90; this.bmiAngle = (bmi * 90 / 25) - 90;
if (bmi < 18.5) { if (bmi < 18.5) {
goalBMI = 19; goalBMI = 19;
this.bmiTop = 99; this.bmiTop = 99 * distortionHeight;
this.bmiLeft = 72; this.bmiLeft = 77 * distortionWidth;
bmiAngle = -62; bmiAngle = -62;
} else if (bmi < 25 && 18.5 < bmi) { } else if (bmi < 25 && 18.5 < bmi) {
goalBMI = 27; goalBMI = 27;
this.bmiTop = 46; this.bmiTop = 48 * distortionHeight;
this.bmiLeft = 130; this.bmiLeft = 130 * distortionWidth;
bmiAngle = -23; bmiAngle = -23;
} else if (bmi < 30 && 24.9 < bmi) { } else if (bmi < 30 && 24.9 < bmi) {
goalBMI = 24; goalBMI = 24;
this.bmiTop = 38.0; this.bmiTop = 40.0 * distortionHeight;
this.bmiLeft = 186.0; this.bmiLeft = 184.0 * distortionWidth;
bmiAngle = 7.2; bmiAngle = 7.2;
} else if (bmi < 34.9 && 29.9 < bmi) { } else if (bmi < 34.9 && 29.9 < bmi) {
goalBMI = 29; goalBMI = 29;
bmiTop = 48; bmiTop = 48 * distortionHeight;
bmiLeft = 211; bmiLeft = 211 * distortionWidth;
} else if (bmi > 35) { } else if (bmi > 35) {
goalBMI = 34; goalBMI = 34;
bmiTop = 94; bmiTop = 94 * distortionHeight;
bmiLeft = 260; bmiLeft = 260 * distortionWidth;
bmiAngle = 59; bmiAngle = 59;
} }

View File

@ -27,6 +27,8 @@ class CustomerExerciseDeviceRepository {
found = element; found = element;
} }
}); });
} else {
_devices = List();
} }
if (found == null) { if (found == null) {
int customerId; int customerId;
@ -36,8 +38,8 @@ class CustomerExerciseDeviceRepository {
CustomerExerciseDevice newDevice = CustomerExerciseDevice newDevice =
CustomerExerciseDevice(customerId: customerId, exerciseDeviceId: device.exerciseDeviceId, favourite: false); CustomerExerciseDevice(customerId: customerId, exerciseDeviceId: device.exerciseDeviceId, favourite: false);
newDevice.change = ModelChange.add; newDevice.change = ModelChange.add;
await CustomerExerciseDeviceApi().addDevice(newDevice); CustomerExerciseDevice saved = await CustomerExerciseDeviceApi().addDevice(newDevice);
this._devices.add(newDevice); this._devices.add(saved);
Cache().setCustomerDevices(_devices); Cache().setCustomerDevices(_devices);
} }
} }
@ -55,9 +57,9 @@ class CustomerExerciseDeviceRepository {
} }
if (found != null) { if (found != null) {
this._devices.remove(found); this._devices.remove(found);
if (found.change != ModelChange.add) { //if (found.change != ModelChange.add) {
await CustomerExerciseDeviceApi().removeDevice(found.customerExerciseDeviceId); await CustomerExerciseDeviceApi().removeDevice(found.customerExerciseDeviceId);
} //}
Cache().setCustomerDevices(_devices); Cache().setCustomerDevices(_devices);
} }
} }

View File

@ -6,7 +6,7 @@ import 'package:aitrainer_app/repository/customer_exercise_device_repository.dar
import 'package:aitrainer_app/util/trans.dart'; import 'package:aitrainer_app/util/trans.dart';
import 'package:aitrainer_app/widgets/app_bar.dart'; import 'package:aitrainer_app/widgets/app_bar.dart';
import 'package:aitrainer_app/widgets/image_button.dart'; import 'package:aitrainer_app/widgets/image_button.dart';
import 'package:aitrainer_app/widgets/splash.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
@ -19,6 +19,7 @@ class CustomerExerciseDevicePage extends StatelessWidget with Trans {
Widget build(BuildContext context) { Widget build(BuildContext context) {
setContext(context); setContext(context);
double cWidth = MediaQuery.of(context).size.width; double cWidth = MediaQuery.of(context).size.width;
double cHeight = MediaQuery.of(context).size.height;
return Scaffold( return Scaffold(
appBar: AppBarNav(depth: 0), appBar: AppBarNav(depth: 0),
body: Container( body: Container(
@ -37,7 +38,10 @@ class CustomerExerciseDevicePage extends StatelessWidget with Trans {
child: BlocConsumer<CustomerExerciseDeviceBloc, CustomerExerciseDeviceState>( child: BlocConsumer<CustomerExerciseDeviceBloc, CustomerExerciseDeviceState>(
listener: (context, state) { listener: (context, state) {
if (state is CustomerExerciseDeviceLoading) { if (state is CustomerExerciseDeviceLoading) {
return LoadingDialog(); Scaffold.of(context).showSnackBar(SnackBar(
duration: Duration(milliseconds: 100),
backgroundColor: Colors.transparent,
content: Container(child: Center(child: CircularProgressIndicator()))));
} else if (state is CustomerExerciseDeviceError) { } else if (state is CustomerExerciseDeviceError) {
Scaffold.of(context).showSnackBar( Scaffold.of(context).showSnackBar(
SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white)))); SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white))));
@ -45,13 +49,13 @@ class CustomerExerciseDevicePage extends StatelessWidget with Trans {
}, },
builder: (context, state) { builder: (context, state) {
final bloc = BlocProvider.of<CustomerExerciseDeviceBloc>(context); final bloc = BlocProvider.of<CustomerExerciseDeviceBloc>(context);
return getPage(bloc, cWidth); return getPage(bloc, cWidth, cHeight);
}, },
)))); ))));
} }
Widget getPage(CustomerExerciseDeviceBloc bloc, double cWidth) { Widget getPage(CustomerExerciseDeviceBloc bloc, double cWidth, double cHeight) {
print("width" + cWidth.toString()); //print("width" + cWidth.toString());
return CustomScrollView(scrollDirection: Axis.vertical, slivers: [ return CustomScrollView(scrollDirection: Axis.vertical, slivers: [
SliverGrid( SliverGrid(
delegate: SliverChildListDelegate([ delegate: SliverChildListDelegate([
@ -104,12 +108,12 @@ class CustomerExerciseDevicePage extends StatelessWidget with Trans {
), ),
), ),
SliverGrid( SliverGrid(
delegate: SliverChildListDelegate(getDevicesPlace(bloc, cWidth)), delegate: SliverChildListDelegate(getDevicesPlace(bloc, cWidth, cHeight)),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 1, crossAxisCount: 1,
mainAxisSpacing: 15.0, mainAxisSpacing: 15.0,
crossAxisSpacing: 10.0, crossAxisSpacing: 5.0,
childAspectRatio: 3.0, childAspectRatio: 2.5,
), ),
), ),
SliverGrid( SliverGrid(
@ -164,7 +168,7 @@ class CustomerExerciseDevicePage extends StatelessWidget with Trans {
), ),
), ),
SliverGrid( SliverGrid(
delegate: SliverChildListDelegate(getDevices(bloc)), delegate: SliverChildListDelegate(getDevices(bloc, cWidth, cHeight)),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2, crossAxisCount: 2,
mainAxisSpacing: 15.0, mainAxisSpacing: 15.0,
@ -175,7 +179,8 @@ class CustomerExerciseDevicePage extends StatelessWidget with Trans {
]); ]);
} }
List<Widget> getDevices(CustomerExerciseDeviceBloc bloc) { List<Widget> getDevices(CustomerExerciseDeviceBloc bloc, double cWidth, double cHeight) {
print("height " + cHeight.toString());
final bool isEnglish = AppLanguage().appLocal.languageCode == "en"; final bool isEnglish = AppLanguage().appLocal.languageCode == "en";
this.listDevice = List(); this.listDevice = List();
final devices = bloc.devices; final devices = bloc.devices;
@ -185,8 +190,8 @@ class CustomerExerciseDevicePage extends StatelessWidget with Trans {
if (element.place == false) { if (element.place == false) {
final String url = "asset/image/" + element.imageUrl.substring(7); final String url = "asset/image/" + element.imageUrl.substring(7);
ImageButton button = ImageButton( ImageButton button = ImageButton(
width: 178, width: cWidth / 2 - 10,
height: 175, height: cWidth / 2 - 10,
textAlignment: Alignment.topCenter, textAlignment: Alignment.topCenter,
text: isEnglish ? element.name : element.nameTranslation, text: isEnglish ? element.name : element.nameTranslation,
style: GoogleFonts.archivoBlack(fontSize: 14, color: Colors.white, backgroundColor: Colors.black54.withOpacity(0.4)), style: GoogleFonts.archivoBlack(fontSize: 14, color: Colors.white, backgroundColor: Colors.black54.withOpacity(0.4)),
@ -205,7 +210,8 @@ class CustomerExerciseDevicePage extends StatelessWidget with Trans {
return listDevice; return listDevice;
} }
List<Widget> getDevicesPlace(CustomerExerciseDeviceBloc bloc, double cWidth) { List<Widget> getDevicesPlace(CustomerExerciseDeviceBloc bloc, double cWidth, cHeight) {
print("height " + cHeight.toString() + " width " + cWidth.toString());
final bool isEnglish = AppLanguage().appLocal.languageCode == "en"; final bool isEnglish = AppLanguage().appLocal.languageCode == "en";
this.listDevice = List(); this.listDevice = List();
final devices = bloc.devices; final devices = bloc.devices;
@ -213,15 +219,16 @@ class CustomerExerciseDevicePage extends StatelessWidget with Trans {
devices.sort((a, b) => a.sort.compareTo(b.sort)); devices.sort((a, b) => a.sort.compareTo(b.sort));
devices.forEach((element) { devices.forEach((element) {
if (element.place) { if (element.place) {
final String url = "asset/image/" + element.imageUrl.substring(7);
ImageButton button = ImageButton( ImageButton button = ImageButton(
width: cWidth - 80, width: cWidth - 60,
height: 125, height: cWidth / 2 - 40,
top: 10, top: 10,
textAlignment: Alignment.topCenter, textAlignment: Alignment.topCenter,
text: isEnglish ? element.name : element.nameTranslation, text: isEnglish ? element.name : element.nameTranslation,
style: GoogleFonts.archivoBlack(fontSize: 14, color: Colors.white, backgroundColor: Colors.black54.withOpacity(0.4)), style: GoogleFonts.archivoBlack(fontSize: 14, color: Colors.white, backgroundColor: Colors.black54.withOpacity(0.4)),
image: element.imageUrl, image: url,
left: 35, left: 5,
onTap: () => changeButtonShape(element, bloc), onTap: () => changeButtonShape(element, bloc),
isLocked: false, isLocked: false,
buttonIndex: element.exerciseDeviceId, buttonIndex: element.exerciseDeviceId,

View File

@ -45,8 +45,9 @@ class CustomerModifyPage extends StatelessWidget with Trans {
child: BlocConsumer<CustomerChangeBloc, CustomerChangeState>( child: BlocConsumer<CustomerChangeBloc, CustomerChangeState>(
listener: (context, state) { listener: (context, state) {
if (state is CustomerChangeLoading) { if (state is CustomerChangeLoading) {
LoadingDialog(); //LoadingDialog();
} else if (state is CustomerSaveError) { } else if (state is CustomerSaveError) {
//LoadingDialog.hide(context);
Scaffold.of(context).showSnackBar( Scaffold.of(context).showSnackBar(
SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white)))); SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white))));
} else if (state is CustomerSaveSuccess) { } else if (state is CustomerSaveSuccess) {

View File

@ -31,14 +31,16 @@ class _ExerciseControlPage extends State<ExerciseControlPage> with Trans {
..add(ExerciseControlLoad()), ..add(ExerciseControlLoad()),
child: BlocConsumer<ExerciseControlBloc, ExerciseControlState>(listener: (context, state) { child: BlocConsumer<ExerciseControlBloc, ExerciseControlState>(listener: (context, state) {
if (state is ExerciseControlError) { if (state is ExerciseControlError) {
//LoadingDialog.hide(context);
Scaffold.of(context).showSnackBar( Scaffold.of(context).showSnackBar(
SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white)))); SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white))));
} else if (state is ExerciseControlLoading) { } else if (state is ExerciseControlLoading) {
return LoadingDialog(); //LoadingDialog.show(context);
} }
}, builder: (context, state) { }, builder: (context, state) {
final exerciseBloc = BlocProvider.of<ExerciseControlBloc>(context); final exerciseBloc = BlocProvider.of<ExerciseControlBloc>(context);
if (state is ExerciseControlReady) { if (state is ExerciseControlReady) {
//LoadingDialog.hide(context);
return getControlForm(exerciseBloc); return getControlForm(exerciseBloc);
} else { } else {
return getControlForm(exerciseBloc); return getControlForm(exerciseBloc);

View File

@ -56,9 +56,9 @@ class _ExerciseExecutePage extends State<ExerciseExecutePage> with Trans {
alignment: Alignment.center, alignment: Alignment.center,
), ),
), ),
child: BlocConsumer<ExerciseExecutePlanBloc, ExerciseExecutePlanState>( child: BlocConsumer<ExerciseExecutePlanBloc, ExerciseExecutePlanState>(listener: (context, state) {
listener: (context, state) {
if (state is ExerciseByPlanError) { if (state is ExerciseByPlanError) {
//LoadingDialog.hide(context);
Scaffold.of(context).showSnackBar(SnackBar( Scaffold.of(context).showSnackBar(SnackBar(
content: Text( content: Text(
state.message, state.message,
@ -66,14 +66,13 @@ class _ExerciseExecutePage extends State<ExerciseExecutePage> with Trans {
backgroundColor: Colors.orange, backgroundColor: Colors.orange,
)); ));
} else if (state is ExerciseByPlanLoading) { } else if (state is ExerciseByPlanLoading) {
LoadingDialog(); //LoadingDialog.show(context);
} }
}, }, builder: (context, state) {
builder: (context, state) {
if (state is ExerciseByPlanStateInitial || state is ExerciseByPlanLoading) { if (state is ExerciseByPlanStateInitial || state is ExerciseByPlanLoading) {
return Container(); return Container();
} else if (state is ExerciseByPlanReady) { } else if (state is ExerciseByPlanReady) {
//LoadingDialog.hide(context);
return exerciseWidget(bloc); return exerciseWidget(bloc);
} else { } else {
return exerciseWidget(bloc); return exerciseWidget(bloc);
@ -107,14 +106,14 @@ class _ExerciseExecutePage extends State<ExerciseExecutePage> with Trans {
), ),
Text(" "), Text(" "),
Flexible( Flexible(
child: child: Text(
Text(
t("Execute your active Exercise Plan!"), t("Execute your active Exercise Plan!"),
style: GoogleFonts.archivoBlack(fontSize: 20,), style: GoogleFonts.archivoBlack(
fontSize: 20,
),
maxLines: 2, maxLines: 2,
), ),
), ),
], ],
), ),
Divider( Divider(
@ -130,8 +129,7 @@ class _ExerciseExecutePage extends State<ExerciseExecutePage> with Trans {
exerciseTypes.add(explanation); exerciseTypes.add(explanation);
bloc.menuTreeRepository.sortedTree.forEach((name, list) { bloc.menuTreeRepository.sortedTree.forEach((name, list) {
exerciseTypes.add( exerciseTypes.add(Container(
Container(
margin: const EdgeInsets.only(left: 4.0), margin: const EdgeInsets.only(left: 4.0),
child: TreeViewChild( child: TreeViewChild(
startExpanded: true, startExpanded: true,
@ -146,63 +144,47 @@ class _ExerciseExecutePage extends State<ExerciseExecutePage> with Trans {
List<Widget> _getChildList(List<WorkoutMenuTree> listWorkoutTree, ExerciseExecutePlanBloc bloc) { List<Widget> _getChildList(List<WorkoutMenuTree> listWorkoutTree, ExerciseExecutePlanBloc bloc) {
List<Widget> list = List(); List<Widget> list = List();
listWorkoutTree.forEach((element) { listWorkoutTree.forEach((element) {
if (element.selected) { if (element.selected) {
list.add( list.add(TreeViewChild(
TreeViewChild(
startExpanded: false, startExpanded: false,
parent: parent: Card(
Card(
margin: EdgeInsets.only(left: 10, top: 5), margin: EdgeInsets.only(left: 10, top: 5),
color: Colors.white54, color: Colors.white54,
child: Container( child: Container(
padding: const EdgeInsets.only(left: 5, top: 0, right: 5, bottom: 0), padding: const EdgeInsets.only(left: 5, top: 0, right: 5, bottom: 0),
child: Row( child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [
mainAxisAlignment: MainAxisAlignment.start,
children: [
IconButton( IconButton(
icon: element.executed ? Icon(Icons.check_box, color: Colors.green): icon: element.executed
Icon(Icons.indeterminate_check_box, color: Colors.blue.shade800,), ? Icon(Icons.check_box, color: Colors.green)
onPressed: () => { : Icon(
addExerciseByPlanEvent(bloc, element) Icons.indeterminate_check_box,
}, color: Colors.blue.shade800,
),
onPressed: () => {addExerciseByPlanEvent(bloc, element)},
), ),
SizedBox(width: 20), SizedBox(width: 20),
Flexible( Flexible(
fit: FlexFit.tight, fit: FlexFit.tight,
child: child: InkWell(
InkWell( child: Text(
child:
Text(
element.name, element.name,
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: GoogleFonts.inter( style: GoogleFonts.inter(fontSize: 17, color: Colors.black),
fontSize: 17,
color: Colors.black),
), ),
onTap: () => { onTap: () => {addExerciseByPlanEvent(bloc, element)},
addExerciseByPlanEvent(bloc, element)
},
), ),
), ),
IconButton( IconButton(
padding: EdgeInsets.all(0), padding: EdgeInsets.all(0),
icon: Icon(Icons.info, color: Colors.black12,), icon: Icon(
onPressed: () { Icons.info,
color: Colors.black12,
}, ),
onPressed: () {},
), ),
]), ]),
) )),
), children: []));
children: [
]
)
);
} }
}); });
return list; return list;

View File

@ -31,32 +31,24 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
setContext(context); setContext(context);
return BlocProvider( return BlocProvider(
create: (context) => ExerciseLogBloc(exerciseRepository: ExerciseRepository()).. create: (context) => ExerciseLogBloc(exerciseRepository: ExerciseRepository())..add(ExerciseLogLoad()),
add(ExerciseLogLoad()), child: BlocConsumer<ExerciseLogBloc, ExerciseLogState>(listener: (context, state) {
child: BlocConsumer<ExerciseLogBloc, ExerciseLogState>(
listener: (context, state) {
if (state is ExerciseLogLoading) { if (state is ExerciseLogLoading) {
return LoadingDialog(); //LoadingDialog.show(context);
} else if (state is ExerciseLogError) { } else if (state is ExerciseLogError) {
Scaffold.of(context).showSnackBar(SnackBar( //LoadingDialog.hide(context);
backgroundColor: Colors.orange, Scaffold.of(context).showSnackBar(
content: SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white))));
Text(state.message, style: TextStyle(color: Colors.white))));
} }
}, }, builder: (context, state) {
builder: (context, state) {
final exerciseBloc = BlocProvider.of<ExerciseLogBloc>(context); final exerciseBloc = BlocProvider.of<ExerciseLogBloc>(context);
if (state is ExerciseLogReady) { if (state is ExerciseLogReady) {
//LoadingDialog.hide(context);
return getExerciseLog(customerId, exerciseBloc); return getExerciseLog(customerId, exerciseBloc);
} else { } else {
return getExerciseLog(customerId, exerciseBloc); return getExerciseLog(customerId, exerciseBloc);
} }
} }));
)
);
} }
Widget getExerciseLog(int customerId, ExerciseLogBloc exerciseLogBloc) { Widget getExerciseLog(int customerId, ExerciseLogBloc exerciseLogBloc) {
@ -66,8 +58,9 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
padding: EdgeInsets.all(20), padding: EdgeInsets.all(20),
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: customerId == Cache().userLoggedIn.customerId ? AssetImage('asset/image/WT_light_background.png'): image: customerId == Cache().userLoggedIn.customerId
AssetImage('asset/image/WT_menu_dark.png'), ? AssetImage('asset/image/WT_light_background.png')
: AssetImage('asset/image/WT_menu_dark.png'),
fit: BoxFit.cover, fit: BoxFit.cover,
alignment: Alignment.center, alignment: Alignment.center,
), ),
@ -124,11 +117,8 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
t("In this list you will find all your executed exercises grouped by the date."), t("In this list you will find all your executed exercises grouped by the date."),
style: TextStyle(fontSize: 12, fontWeight: FontWeight.normal), style: TextStyle(fontSize: 12, fontWeight: FontWeight.normal),
), ),
], ],
) )));
)
);
listWidget.add(explanation); listWidget.add(explanation);
List<Exercise> listExercises = List(); List<Exercise> listExercises = List();
@ -141,39 +131,30 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
listExercises.add(exercise); listExercises.add(exercise);
origDate = exerciseDate; origDate = exerciseDate;
} else { } else {
listWidget.add( listWidget.add(Container(
Container(
margin: const EdgeInsets.only(left: 4.0), margin: const EdgeInsets.only(left: 4.0),
child: TreeViewChild( child: TreeViewChild(
startExpanded: false, startExpanded: false,
parent: TreeviewParentWidget(text: origDate), parent: TreeviewParentWidget(text: origDate),
children: _getChildList(listExercises, exerciseRepository, exerciseLogBloc), children: _getChildList(listExercises, exerciseRepository, exerciseLogBloc),
) )));
)
);
listExercises = List(); listExercises = List();
listExercises.add(exercise); listExercises.add(exercise);
origDate = exerciseDate; origDate = exerciseDate;
} }
} else { } else {
listExercises.add(exercise); listExercises.add(exercise);
origDate = exerciseDate; origDate = exerciseDate;
} }
}); });
if (listExercises.length > 0) { if (listExercises.length > 0) {
listWidget.add( listWidget.add(Container(
Container(
margin: const EdgeInsets.only(left: 4.0), margin: const EdgeInsets.only(left: 4.0),
child: TreeViewChild( child: TreeViewChild(
startExpanded: true, startExpanded: true,
parent: TreeviewParentWidget(text: origDate), parent: TreeviewParentWidget(text: origDate),
children: _getChildList(listExercises, exerciseRepository, exerciseLogBloc), children: _getChildList(listExercises, exerciseRepository, exerciseLogBloc),
) )));
)
);
} }
return listWidget; return listWidget;
@ -187,18 +168,10 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
ExerciseType exerciseType = exerciseRepository.getExerciseTypeById(exercise.exerciseTypeId); ExerciseType exerciseType = exerciseRepository.getExerciseTypeById(exercise.exerciseTypeId);
String exerciseName = isEnglish ? exerciseType.name : exerciseType.nameTranslation; String exerciseName = isEnglish ? exerciseType.name : exerciseType.nameTranslation;
String unitQuantity = exerciseType.unitQuantity == "1" String unitQuantity =
? exercise.unitQuantity.toStringAsFixed(0) + exerciseType.unitQuantity == "1" ? exercise.unitQuantity.toStringAsFixed(0) + " " + t(exerciseType.unitQuantityUnit) + " " : "";
" " +
t(exerciseType.unitQuantityUnit) +
" "
: "";
String labelExercise = String labelExercise = unitQuantity + exercise.quantity.toStringAsFixed(0) + " " + t(exercise.unit);
unitQuantity +
exercise.quantity.toStringAsFixed(0) +
" " +
t(exercise.unit);
list.add( list.add(
Card( Card(
@ -206,47 +179,50 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
color: Colors.white54, color: Colors.white54,
child: Container( child: Container(
padding: const EdgeInsets.only(left: 5, top: 0, right: 5, bottom: 0), padding: const EdgeInsets.only(left: 5, top: 0, right: 5, bottom: 0),
child: Row( child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [
mainAxisAlignment: MainAxisAlignment.start,
children: [
Icon(Icons.accessibility, color: Colors.black12), Icon(Icons.accessibility, color: Colors.black12),
SizedBox(width: 10,), SizedBox(
width: 10,
),
Flexible( Flexible(
fit: FlexFit.tight, fit: FlexFit.tight,
flex: 8, flex: 8,
child: Text( child: Text(
exerciseName, exerciseName,
style: TextStyle(fontSize: 12, color: Colors.black), style: TextStyle(fontSize: 12, color: Colors.black),
), ),
), ),
Flexible(fit: FlexFit.tight, child: SizedBox(width: 10,)), Flexible(
Text(labelExercise , style: TextStyle(fontSize: 9, color: Colors.blueAccent.shade700),) , fit: FlexFit.tight,
Flexible(fit: FlexFit.tight, child: SizedBox(width: 10,)), child: SizedBox(
width: 10,
)),
Text(
labelExercise,
style: TextStyle(fontSize: 9, color: Colors.blueAccent.shade700),
),
Flexible(
fit: FlexFit.tight,
child: SizedBox(
width: 10,
)),
IconButton( IconButton(
icon: Icon(Icons.delete, color: Colors.black12), icon: Icon(Icons.delete, color: Colors.black12),
onPressed: () { onPressed: () {
confirmationDialog(exerciseLogBloc, exercise); confirmationDialog(exerciseLogBloc, exercise);
}, },
), ),
]), ]),
) )),
),
); );
}); });
return list; return list;
} }
void confirmationDialog(ExerciseLogBloc bloc, Exercise exercise) { void confirmationDialog(ExerciseLogBloc bloc, Exercise exercise) {
ExerciseType exerciseType = bloc.exerciseRepository.getExerciseTypeById(exercise.exerciseTypeId); ExerciseType exerciseType = bloc.exerciseRepository.getExerciseTypeById(exercise.exerciseTypeId);
String exerciseName = AppLanguage().appLocal == Locale("en") String exerciseName = AppLanguage().appLocal == Locale("en") ? exerciseType.name : exerciseType.nameTranslation;
? exerciseType.name
: exerciseType.nameTranslation;
String strDate = AppLanguage().appLocal == Locale("en") String strDate = AppLanguage().appLocal == Locale("en")
? "on the " + DateFormat(DateFormat.YEAR_MONTH_DAY, AppLanguage().appLocal.toString()).format(exercise.dateAdd.toUtc()) ? "on the " + DateFormat(DateFormat.YEAR_MONTH_DAY, AppLanguage().appLocal.toString()).format(exercise.dateAdd.toUtc())
@ -258,21 +234,24 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
//barrierDismissible: false, //barrierDismissible: false,
builder: (_) => CupertinoAlertDialog( builder: (_) => CupertinoAlertDialog(
title: Text(t("Are you sure to delete this exercise?")), title: Text(t("Are you sure to delete this exercise?")),
content: Column( content: Column(children: [
children: [
Divider(), Divider(),
Text(t("Exercise") + ": " + exerciseName,
style: (TextStyle(color: Colors.blue)),),
Text( Text(
exercise.quantity.toStringAsFixed(0) + "x" + exercise.unitQuantity.toStringAsFixed(0) + " " + exerciseType.unitQuantityUnit, t("Exercise") + ": " + exerciseName,
style: (TextStyle(color: Colors.blue)),
),
Text(
exercise.quantity.toStringAsFixed(0) +
"x" +
exercise.unitQuantity.toStringAsFixed(0) +
" " +
exerciseType.unitQuantityUnit,
style: (TextStyle(color: Colors.deepOrange)), style: (TextStyle(color: Colors.deepOrange)),
), ),
Text( Text(
strDate, strDate,
style: (TextStyle(color: Colors.deepOrange)), style: (TextStyle(color: Colors.deepOrange)),
), ),
]), ]),
actions: [ actions: [
FlatButton( FlatButton(
@ -288,8 +267,6 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
}, },
) )
], ],
) ));
);
} }
} }

View File

@ -90,13 +90,17 @@ class _ExerciseNewPageState extends State<ExerciseNewPage> with Trans {
child: BlocConsumer<ExerciseNewBloc, ExerciseNewState>( child: BlocConsumer<ExerciseNewBloc, ExerciseNewState>(
listener: (context, state) { listener: (context, state) {
if (state is ExerciseNewLoading) { if (state is ExerciseNewLoading) {
return LoadingDialog(); //LoadingDialog.show(context);
} else if (state is ExerciseNewError) { } else if (state is ExerciseNewError) {
//LoadingDialog.hide(context);
Scaffold.of(context).showSnackBar( Scaffold.of(context).showSnackBar(
SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white)))); SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white))));
} }
}, },
builder: (context, state) { builder: (context, state) {
if (state is ExerciseNewReady) {
//LoadingDialog.hide(context);
}
final exerciseBloc = BlocProvider.of<ExerciseNewBloc>(context); final exerciseBloc = BlocProvider.of<ExerciseNewBloc>(context);
return getExerciseWidget(exerciseBloc, exerciseType); return getExerciseWidget(exerciseBloc, exerciseType);
}, },

View File

@ -106,13 +106,17 @@ class _ExercisePlanDetailAddPage extends State<ExercisePlanDetailAddPage> with T
child: BlocConsumer<ExercisePlanCustomAddBloc, ExercisePlanCustomAddState>( child: BlocConsumer<ExercisePlanCustomAddBloc, ExercisePlanCustomAddState>(
listener: (context, state) { listener: (context, state) {
if (state is ExercisePlanCustomAddLoading) { if (state is ExercisePlanCustomAddLoading) {
return LoadingDialog(); //LoadingDialog.show(context);
} else if (state is ExercisePlanCustomAddError) { } else if (state is ExercisePlanCustomAddError) {
//LoadingDialog.hide(context);
Scaffold.of(context).showSnackBar( Scaffold.of(context).showSnackBar(
SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white)))); SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white))));
} }
}, },
builder: (context, state) { builder: (context, state) {
if (state is ExercisePlanCustomAddReady) {
//LoadingDialog.hide(context);
}
// ignore: close_sinks // ignore: close_sinks
final bloc = BlocProvider.of<ExercisePlanCustomAddBloc>(context); final bloc = BlocProvider.of<ExercisePlanCustomAddBloc>(context);
return getForm(bloc, workoutMenuTree); return getForm(bloc, workoutMenuTree);

View File

@ -51,14 +51,14 @@ class _ExercisePlanCustomPage extends State<ExercisePlanCustomPage> with Trans {
padding: EdgeInsets.all(20), padding: EdgeInsets.all(20),
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: customerId == Cache().userLoggedIn.customerId ? AssetImage('asset/image/WT_menu_dark.png'): image: customerId == Cache().userLoggedIn.customerId
AssetImage('asset/image/WT_menu_dark.png'), ? AssetImage('asset/image/WT_menu_dark.png')
: AssetImage('asset/image/WT_menu_dark.png'),
fit: BoxFit.cover, fit: BoxFit.cover,
alignment: Alignment.center, alignment: Alignment.center,
), ),
), ),
child: BlocConsumer<ExercisePlanBloc, ExercisePlanState>( child: BlocConsumer<ExercisePlanBloc, ExercisePlanState>(listener: (context, state) {
listener: (context, state) {
if (state is ExercisePlanError) { if (state is ExercisePlanError) {
Scaffold.of(context).showSnackBar(SnackBar( Scaffold.of(context).showSnackBar(SnackBar(
content: Text( content: Text(
@ -67,19 +67,17 @@ class _ExercisePlanCustomPage extends State<ExercisePlanCustomPage> with Trans {
backgroundColor: Colors.orange, backgroundColor: Colors.orange,
)); ));
} else if (state is ExercisePlanLoading) { } else if (state is ExercisePlanLoading) {
LoadingDialog(); //LoadingDialog.show(context);
} }
}, },
// ignore: missing_return // ignore: missing_return
builder: (context, state) { builder: (context, state) {
if (state is ExercisePlanReady) { if (state is ExercisePlanReady) {
//LoadingDialog.hide(context);
return exerciseWidget(bloc); return exerciseWidget(bloc);
} }
return Container(); return Container();
})),
}
)
),
bottomNavigationBar: BottomNavigator(bottomNavIndex: 2), bottomNavigationBar: BottomNavigator(bottomNavIndex: 2),
); );
} }
@ -121,11 +119,8 @@ class _ExercisePlanCustomPage extends State<ExercisePlanCustomPage> with Trans {
t("Select manually the exercises what you would like to have in your plan. At the end don't forget to save."), t("Select manually the exercises what you would like to have in your plan. At the end don't forget to save."),
style: GoogleFonts.inter(fontSize: 12, fontWeight: FontWeight.normal), style: GoogleFonts.inter(fontSize: 12, fontWeight: FontWeight.normal),
), ),
], ],
) )));
)
);
exerciseTypes.add(explanation); exerciseTypes.add(explanation);
bloc.menuTreeRepository.sortedTree.forEach((name, list) { bloc.menuTreeRepository.sortedTree.forEach((name, list) {
@ -144,32 +139,32 @@ class _ExercisePlanCustomPage extends State<ExercisePlanCustomPage> with Trans {
List<Widget> _getChildList(List<WorkoutMenuTree> listWorkoutTree, ExercisePlanBloc bloc) { List<Widget> _getChildList(List<WorkoutMenuTree> listWorkoutTree, ExercisePlanBloc bloc) {
List<Widget> list = List(); List<Widget> list = List();
listWorkoutTree.forEach((element) { listWorkoutTree.forEach((element) {
list.add(TreeViewChild(
list.add(
TreeViewChild(
startExpanded: false, startExpanded: false,
parent: parent: Card(
Card(
margin: EdgeInsets.only(left: 10, top: 5), margin: EdgeInsets.only(left: 10, top: 5),
color: Colors.white54, color: Colors.white54,
child: Container( child: Container(
padding: const EdgeInsets.only(left: 5, top: 0, right: 5, bottom: 0), padding: const EdgeInsets.only(left: 5, top: 0, right: 5, bottom: 0),
child: Row( child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [
mainAxisAlignment: MainAxisAlignment.start,
children: [
IconButton( IconButton(
icon: element.selected ? Icon(Icons.check, color: Colors.green[600],) icon: element.selected
: Icon(Icons.add, color: Colors.indigo,), ? Icon(
Icons.check,
color: Colors.green[600],
)
: Icon(
Icons.add,
color: Colors.indigo,
),
onPressed: () => clickAddDetail(bloc, element), onPressed: () => clickAddDetail(bloc, element),
), ),
SizedBox(width: 10), SizedBox(width: 10),
Flexible( Flexible(
fit: FlexFit.tight, fit: FlexFit.tight,
flex: 8, flex: 8,
child: child: InkWell(
InkWell( child: Text(
child:
Text(
element.name, element.name,
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: GoogleFonts.inter(fontSize: 16, color: Colors.black), style: GoogleFonts.inter(fontSize: 16, color: Colors.black),
@ -178,31 +173,31 @@ class _ExercisePlanCustomPage extends State<ExercisePlanCustomPage> with Trans {
), ),
), ),
InkWell( InkWell(
child: child: !element.selected ||
!element.selected || bloc.exercisePlanRepository.exercisePlanDetails[element.exerciseTypeId] == null || bloc.exercisePlanRepository.exercisePlanDetails[element.exerciseTypeId] == null ||
bloc.exercisePlanRepository.exercisePlanDetails[element.exerciseTypeId].change == null ? Text("") : bloc.exercisePlanRepository.exercisePlanDetails[element.exerciseTypeId].change == null
Text(bloc.exercisePlanRepository.exercisePlanDetails[element.exerciseTypeId].repeats.toString() + ? Text("")
" x " + bloc.exercisePlanRepository.exercisePlanDetails[element.exerciseTypeId].weightEquation + : Text(
" " + element.exerciseType.unitQuantityUnit, style: TextStyle(fontSize: 9, color: Colors.green),), bloc.exercisePlanRepository.exercisePlanDetails[element.exerciseTypeId].repeats.toString() +
" x " +
bloc.exercisePlanRepository.exercisePlanDetails[element.exerciseTypeId].weightEquation +
" " +
element.exerciseType.unitQuantityUnit,
style: TextStyle(fontSize: 9, color: Colors.green),
),
onTap: () => clickAddDetail(bloc, element), onTap: () => clickAddDetail(bloc, element),
), ),
IconButton( IconButton(
padding: EdgeInsets.all(0), padding: EdgeInsets.all(0),
icon: Icon(Icons.info, color: Colors.black12,), icon: Icon(
onPressed: () { Icons.info,
color: Colors.black12,
}, ),
onPressed: () {},
), ),
]), ]),
) )),
), children: []));
children: [
]
)
);
}); });
return list; return list;
} }

View File

@ -10,6 +10,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_bloc/flutter_form_bloc.dart'; import 'package:flutter_form_bloc/flutter_form_bloc.dart';
import 'package:google_fonts/google_fonts.dart';
import '../library_keys.dart'; import '../library_keys.dart';
@ -133,27 +134,37 @@ class _LoginWidget extends State<LoginWidget> with Common, Trans {
color: Colors.transparent, color: Colors.transparent,
), ),
Row(mainAxisAlignment: MainAxisAlignment.end, children: <Widget>[ Row(mainAxisAlignment: MainAxisAlignment.end, children: <Widget>[
new FlatButton( FlatButton(
key: LibraryKeys.loginOKButton, key: LibraryKeys.loginOKButton,
child: Image.asset('asset/image/WT_OK.png', width: 100, height: 100), child: Stack(
alignment: Alignment.center,
children: [
Image.asset('asset/icon/gomb_zold_a.png', width: 140, height: 60),
Text(
t("OK"),
style: GoogleFonts.archivoBlack(fontSize: 20, color: Colors.white),
),
],
),
//Image.asset('asset/icon/gomb_zold_b-1.png', width: 100, height: 100),
onPressed: () => {formBloc.add(SubmitFormBloc())}), onPressed: () => {formBloc.add(SubmitFormBloc())}),
]), ]),
Divider( Divider(
color: Colors.transparent, color: Colors.transparent,
), ),
Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: <Widget>[ Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: <Widget>[
new InkWell( InkWell(
child: new Text(AppLocalizations.of(context).translate('SignUp')), child: Text(AppLocalizations.of(context).translate('SignUp')),
onTap: () => Navigator.of(context).pushNamed('registration'), onTap: () => Navigator.of(context).pushNamed('registration'),
), ),
Spacer(flex: 2), Spacer(flex: 2),
new InkWell( InkWell(
child: new Text(AppLocalizations.of(context).translate('I forgot the password')), child: Text(AppLocalizations.of(context).translate('I forgot the password')),
onTap: () => Navigator.of(context).pushNamed('resetPassword'), onTap: () => Navigator.of(context).pushNamed('resetPassword'),
), ),
Spacer(flex: 2), Spacer(flex: 2),
new InkWell( InkWell(
child: new Text(AppLocalizations.of(context).translate('Privacy')), child: Text(AppLocalizations.of(context).translate('Privacy')),
onTap: () => Navigator.of(context).pushNamed('gdpr'), onTap: () => Navigator.of(context).pushNamed('gdpr'),
), ),
]), ]),

View File

@ -63,13 +63,14 @@ class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Comm
backgroundColor: Colors.orange, backgroundColor: Colors.orange,
)); ));
} else if (state is DevelopmentByMuscleLoadingState) { } else if (state is DevelopmentByMuscleLoadingState) {
LoadingDialog(); //LoadingDialog.show(context);
} }
}, },
builder: (context, state) { builder: (context, state) {
if (state is DevelopmentByMuscleStateInitial) { if (state is DevelopmentByMuscleStateInitial) {
return Container(); return Container();
} else { } else {
//LoadingDialog.hide(context);
return TreeView( return TreeView(
startExpanded: false, startExpanded: false,
children: _getTreeChildren(bloc.workoutTreeRepository.sortedTree, bloc), children: _getTreeChildren(bloc.workoutTreeRepository.sortedTree, bloc),
@ -116,15 +117,14 @@ class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Comm
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
ChoiceChip( ChoiceChip(
avatar: Icon(Icons.bubble_chart,), avatar: Icon(
Icons.bubble_chart,
),
label: Text(t('Sum Of Mass')), label: Text(t('Sum Of Mass')),
labelStyle: TextStyle(fontSize: 9, color: Colors.black), labelStyle: TextStyle(fontSize: 9, color: Colors.black),
selectedColor: Colors.lightBlueAccent, selectedColor: Colors.lightBlueAccent,
selected: bloc.diagramType == DiagramType.sumMass, selected: bloc.diagramType == DiagramType.sumMass,
onSelected: (value) => { onSelected: (value) => {bloc.add(DevelopmentByMuscleDiagramTypeChange(diagramType: DiagramType.sumMass))},
bloc.add(DevelopmentByMuscleDiagramTypeChange(diagramType: DiagramType.sumMass))
},
), ),
ChoiceChip( ChoiceChip(
avatar: Icon(Icons.accessibility_new), avatar: Icon(Icons.accessibility_new),
@ -132,9 +132,7 @@ class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Comm
labelStyle: TextStyle(fontSize: 9, color: Colors.black), labelStyle: TextStyle(fontSize: 9, color: Colors.black),
selectedColor: Colors.lightBlueAccent, selectedColor: Colors.lightBlueAccent,
selected: bloc.diagramType == DiagramType.oneRepMax, selected: bloc.diagramType == DiagramType.oneRepMax,
onSelected: (value) => { onSelected: (value) => {bloc.add(DevelopmentByMuscleDiagramTypeChange(diagramType: DiagramType.oneRepMax))},
bloc.add(DevelopmentByMuscleDiagramTypeChange(diagramType: DiagramType.oneRepMax))
},
), ),
ChoiceChip( ChoiceChip(
avatar: Icon(Icons.perm_device_information), avatar: Icon(Icons.perm_device_information),
@ -142,9 +140,7 @@ class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Comm
labelStyle: TextStyle(fontSize: 9, color: Colors.black), labelStyle: TextStyle(fontSize: 9, color: Colors.black),
selectedColor: Colors.lightBlueAccent, selectedColor: Colors.lightBlueAccent,
selected: bloc.diagramType == DiagramType.percent, selected: bloc.diagramType == DiagramType.percent,
onSelected: (value) => { onSelected: (value) => {bloc.add(DevelopmentByMuscleDiagramTypeChange(diagramType: DiagramType.percent))},
bloc.add(DevelopmentByMuscleDiagramTypeChange(diagramType: DiagramType.percent))
},
), ),
], ],
), ),
@ -158,10 +154,7 @@ class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Comm
disabledColor: Colors.black26, disabledColor: Colors.black26,
selectedColor: Colors.greenAccent, selectedColor: Colors.greenAccent,
selected: bloc.dateRate == DateRate.daily, selected: bloc.dateRate == DateRate.daily,
onSelected: (value) => { onSelected: (value) => {bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.daily))},
bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.daily))
},
), ),
ChoiceChip( ChoiceChip(
avatar: Icon(Icons.timer), avatar: Icon(Icons.timer),
@ -171,10 +164,7 @@ class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Comm
disabledColor: Colors.white12, disabledColor: Colors.white12,
tooltip: "Heti bontás", tooltip: "Heti bontás",
selected: bloc.dateRate == DateRate.weekly, selected: bloc.dateRate == DateRate.weekly,
onSelected: (value) => { onSelected: (value) => {bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.weekly))},
bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.weekly))
},
), ),
ChoiceChip( ChoiceChip(
avatar: Icon(Icons.timer), avatar: Icon(Icons.timer),
@ -183,10 +173,7 @@ class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Comm
selectedColor: Colors.greenAccent, selectedColor: Colors.greenAccent,
disabledColor: Colors.black26, disabledColor: Colors.black26,
selected: bloc.dateRate == DateRate.monthly, selected: bloc.dateRate == DateRate.monthly,
onSelected: (value) => { onSelected: (value) => {bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.monthly))},
bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.monthly))
},
), ),
ChoiceChip( ChoiceChip(
avatar: Icon(Icons.timer), avatar: Icon(Icons.timer),
@ -195,16 +182,12 @@ class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Comm
selectedColor: Colors.greenAccent, selectedColor: Colors.greenAccent,
disabledColor: Colors.white70, disabledColor: Colors.white70,
selected: bloc.dateRate == DateRate.yearly, selected: bloc.dateRate == DateRate.yearly,
onSelected: (value) => { onSelected: (value) => {bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.yearly))},
bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.yearly))
},
), ),
], ],
) )
], ],
) )));
)
);
exerciseTypes.add(explanation); exerciseTypes.add(explanation);
tree.forEach((name, list) { tree.forEach((name, list) {
@ -291,8 +274,7 @@ class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Comm
), ),
gridData: FlGridData( gridData: FlGridData(
show: true, show: true,
checkToShowHorizontalLine: (value) => checkToShowHorizontalLine: (value) => value % bloc.listChartData[element.exerciseTypeId].gridInterval == 0,
value % bloc.listChartData[element.exerciseTypeId].gridInterval == 0,
getDrawingHorizontalLine: (value) { getDrawingHorizontalLine: (value) {
return FlLine( return FlLine(
color: Colors.black26, color: Colors.black26,
@ -301,9 +283,8 @@ class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Comm
}, },
), ),
groupsSpace: 2, groupsSpace: 2,
barGroups: bloc.listChartData[element.exerciseTypeId] == null barGroups:
? [] bloc.listChartData[element.exerciseTypeId] == null ? [] : bloc.listChartData[element.exerciseTypeId].data,
: bloc.listChartData[element.exerciseTypeId].data,
), ),
swapAnimationDuration: Duration(milliseconds: 1200), swapAnimationDuration: Duration(milliseconds: 1200),
), ),
@ -316,5 +297,3 @@ class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Comm
return list; return list;
} }
} }

View File

@ -12,6 +12,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
//import 'package:flutter_facebook_login/flutter_facebook_login.dart'; //import 'package:flutter_facebook_login/flutter_facebook_login.dart';
import 'package:flutter_form_bloc/flutter_form_bloc.dart'; import 'package:flutter_form_bloc/flutter_form_bloc.dart';
import 'package:google_fonts/google_fonts.dart';
import '../library_keys.dart'; import '../library_keys.dart';
@ -137,7 +138,17 @@ class _RegistrationWidget extends State<RegistrationWidget> with Common, Trans {
), ),
Row(mainAxisAlignment: MainAxisAlignment.end, children: <Widget>[ Row(mainAxisAlignment: MainAxisAlignment.end, children: <Widget>[
new FlatButton( new FlatButton(
child: Image.asset('asset/image/WT_OK.png', width: 100, height: 100), child: Stack(
alignment: Alignment.center,
children: [
Image.asset('asset/icon/gomb_zold_a.png', width: 140, height: 60),
Text(
t("OK"),
style: GoogleFonts.archivoBlack(fontSize: 20, color: Colors.white),
),
],
),
// Image.asset('asset/image/WT_OK.png', width: 100, height: 100),
onPressed: () => {registrationBloc.add(SubmitFormBloc())}), onPressed: () => {registrationBloc.add(SubmitFormBloc())}),
]), ]),
Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: <Widget>[ Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: <Widget>[

View File

@ -8,6 +8,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_form_bloc/flutter_form_bloc.dart'; import 'package:flutter_form_bloc/flutter_form_bloc.dart';
import 'package:google_fonts/google_fonts.dart';
import '../library_keys.dart'; import '../library_keys.dart';
@ -66,6 +67,9 @@ class ResetPasswordPage extends StatelessWidget with Trans {
child: Container( child: Container(
padding: const EdgeInsets.only(left: 25, right: 50), padding: const EdgeInsets.only(left: 25, right: 50),
child: ListView(shrinkWrap: false, padding: EdgeInsets.only(top: 150.0), children: <Widget>[ child: ListView(shrinkWrap: false, padding: EdgeInsets.only(top: 150.0), children: <Widget>[
Divider(
color: Colors.transparent,
),
Divider(), Divider(),
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
@ -95,7 +99,17 @@ class ResetPasswordPage extends StatelessWidget with Trans {
Row(mainAxisAlignment: MainAxisAlignment.end, children: <Widget>[ Row(mainAxisAlignment: MainAxisAlignment.end, children: <Widget>[
new FlatButton( new FlatButton(
key: LibraryKeys.loginOKButton, key: LibraryKeys.loginOKButton,
child: Image.asset('asset/image/WT_OK.png', width: 100, height: 100), child: Stack(
alignment: Alignment.center,
children: [
Image.asset('asset/icon/gomb_zold_a.png', width: 140, height: 60),
Text(
t("OK"),
style: GoogleFonts.archivoBlack(fontSize: 20, color: Colors.white),
),
],
),
//Image.asset('asset/image/WT_OK.png', width: 100, height: 100),
onPressed: () => {formBloc.add(SubmitFormBloc())}), onPressed: () => {formBloc.add(SubmitFormBloc())}),
]), ]),
Divider( Divider(

View File

@ -8,10 +8,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
class SettingsPage extends StatelessWidget { class SettingsPage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// ignore: close_sinks // ignore: close_sinks
@ -45,10 +42,8 @@ class SettingsPage extends StatelessWidget{
), ),
), ),
child: Form( child: Form(
child: BlocConsumer<SettingsBloc, SettingsState>( child: BlocConsumer<SettingsBloc, SettingsState>(listener: (context, state) {
listener: (context, state) {
if (state is SettingsError) { if (state is SettingsError) {
} else if (state is SettingsReady) { } else if (state is SettingsReady) {
menuBloc.add(MenuRecreateTree()); menuBloc.add(MenuRecreateTree());
} }
@ -56,59 +51,40 @@ class SettingsPage extends StatelessWidget{
// ignore: missing_return // ignore: missing_return
builder: (context, state) { builder: (context, state) {
if (state is SettingsLoading) { if (state is SettingsLoading) {
return LoadingDialog(); //LoadingDialog.show(context);
} else if (state is SettingsInitial) { } else if (state is SettingsInitial) {
return settingsUI(context, settingsBloc, menuBloc); return settingsUI(context, settingsBloc, menuBloc);
} else if (state is SettingsReady) { } else if (state is SettingsReady) {
//LoadingDialog.hide(context);
return settingsUI(context, settingsBloc, menuBloc); return settingsUI(context, settingsBloc, menuBloc);
} else { } else {
return Container(); return Container();
} }
} }),
), ),
), ),
), bottomNavigationBar: BottomNavigator(bottomNavIndex: 4));
bottomNavigationBar: BottomNavigator(bottomNavIndex: 4)
);
} }
ListView settingsUI(BuildContext context, SettingsBloc settingsBloc, MenuBloc menuBloc) { ListView settingsUI(BuildContext context, SettingsBloc settingsBloc, MenuBloc menuBloc) {
return ListView( return ListView(padding: EdgeInsets.only(top: 150), children: <Widget>[
padding: EdgeInsets.only(top: 150),
children: <Widget>[
ListTile( ListTile(
leading: Icon(Icons.language), leading: Icon(Icons.language),
subtitle: Text( subtitle: Text(AppLocalizations.of(context).translate("Change App Language")),
AppLocalizations.of(context).translate(
"Change App Language")),
title: DropdownButton( title: DropdownButton(
value: settingsBloc.getLocale() == Locale('en') value: settingsBloc.getLocale() == Locale('en')
? AppLocalizations.of(context).translate( ? AppLocalizations.of(context).translate("English")
"English") : AppLocalizations.of(context).translate("Hungarian"),
: AppLocalizations.of(context).translate( items: [AppLocalizations.of(context).translate("English"), AppLocalizations.of(context).translate("Hungarian")]
"Hungarian"),
items: [AppLocalizations.of(context).translate(
"English"), AppLocalizations.of(context)
.translate("Hungarian")
]
.map<DropdownMenuItem<String>>((String value) { .map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>( return DropdownMenuItem<String>(
value: value, value: value,
child: Text(value), child: Text(value),
); );
}).toList(), }).toList(),
onChanged: (String lang) => onChanged: (String lang) => {
{ settingsBloc.add(SettingsChangeLanguage(language: lang)),
settingsBloc.add( })),
SettingsChangeLanguage(language: lang) ]);
),
}
)
),
]
);
} }
} }

View File

@ -72,6 +72,10 @@ class _BMIState extends State<BMI> with Trans {
Widget build(BuildContext context) { Widget build(BuildContext context) {
setContext(context); setContext(context);
Flurry.logEvent("BMI"); Flurry.logEvent("BMI");
double mediaWidth = MediaQuery.of(context).size.width * .8;
double mediaHeight = MediaQuery.of(context).size.height * .8;
//print("w " + mediaWidth.toString() + "h " + mediaHeight.toString());
widget.exerciseBloc.setMediaDimensions(mediaWidth, mediaHeight);
widget.exerciseBloc.getBMI(); widget.exerciseBloc.getBMI();
return Form( return Form(
child: Scaffold( child: Scaffold(