WT1.1.0+24 CustomerExerciseDevice fix, Badges fix
This commit is contained in:
parent
b59db7c9db
commit
cdc750614a
BIN
asset/image/equipment_gym_place.jpg
Normal file
BIN
asset/image/equipment_gym_place.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 156 KiB |
BIN
asset/image/equipment_home_place.jpg
Normal file
BIN
asset/image/equipment_home_place.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 104 KiB |
BIN
asset/image/equipment_street_place.jpg
Normal file
BIN
asset/image/equipment_street_place.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 536 KiB |
@ -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 = (
|
||||||
|
@ -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();
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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,
|
||||||
|
@ -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) {
|
||||||
|
@ -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);
|
||||||
|
@ -56,28 +56,27 @@ 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,
|
||||||
),
|
),
|
||||||
backgroundColor: Colors.orange,
|
backgroundColor: Colors.orange,
|
||||||
));
|
));
|
||||||
} else if (state is ExerciseByPlanLoading) {
|
} else if (state is ExerciseByPlanLoading) {
|
||||||
LoadingDialog();
|
//LoadingDialog.show(context);
|
||||||
}
|
}
|
||||||
},
|
}, builder: (context, state) {
|
||||||
|
if (state is ExerciseByPlanStateInitial || state is ExerciseByPlanLoading) {
|
||||||
builder: (context, state) {
|
return Container();
|
||||||
if (state is ExerciseByPlanStateInitial || state is ExerciseByPlanLoading) {
|
} else if (state is ExerciseByPlanReady) {
|
||||||
return Container();
|
//LoadingDialog.hide(context);
|
||||||
} else if (state is ExerciseByPlanReady) {
|
return exerciseWidget(bloc);
|
||||||
return exerciseWidget(bloc);
|
} else {
|
||||||
} else {
|
return exerciseWidget(bloc);
|
||||||
return exerciseWidget(bloc);
|
}
|
||||||
}
|
|
||||||
})),
|
})),
|
||||||
bottomNavigationBar: BottomNavigator(bottomNavIndex: 2),
|
bottomNavigationBar: BottomNavigator(bottomNavIndex: 2),
|
||||||
);
|
);
|
||||||
@ -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(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,
|
IconButton(
|
||||||
children: [
|
icon: element.executed
|
||||||
IconButton(
|
? Icon(Icons.check_box, color: Colors.green)
|
||||||
icon: element.executed ? Icon(Icons.check_box, color: Colors.green):
|
: Icon(
|
||||||
Icon(Icons.indeterminate_check_box, color: Colors.blue.shade800,),
|
Icons.indeterminate_check_box,
|
||||||
onPressed: () => {
|
color: Colors.blue.shade800,
|
||||||
addExerciseByPlanEvent(bloc, element)
|
),
|
||||||
},
|
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:
|
element.name,
|
||||||
Text(
|
textAlign: TextAlign.start,
|
||||||
element.name,
|
style: GoogleFonts.inter(fontSize: 17, color: Colors.black),
|
||||||
textAlign: TextAlign.start,
|
|
||||||
style: GoogleFonts.inter(
|
|
||||||
fontSize: 17,
|
|
||||||
color: Colors.black),
|
|
||||||
|
|
||||||
),
|
|
||||||
onTap: () => {
|
|
||||||
addExerciseByPlanEvent(bloc, element)
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
onTap: () => {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;
|
||||||
|
@ -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>(
|
if (state is ExerciseLogLoading) {
|
||||||
listener: (context, state) {
|
//LoadingDialog.show(context);
|
||||||
if ( state is ExerciseLogLoading ) {
|
} else if (state is ExerciseLogError) {
|
||||||
return LoadingDialog();
|
//LoadingDialog.hide(context);
|
||||||
} else if ( state is ExerciseLogError ) {
|
Scaffold.of(context).showSnackBar(
|
||||||
Scaffold.of(context).showSnackBar(SnackBar(
|
SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white))));
|
||||||
backgroundColor: Colors.orange,
|
|
||||||
content:
|
|
||||||
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,
|
||||||
),
|
),
|
||||||
@ -88,9 +81,9 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
|
|||||||
List<Widget> _getTreeChildren(ExerciseLogBloc exerciseLogBloc, int customerId) {
|
List<Widget> _getTreeChildren(ExerciseLogBloc exerciseLogBloc, int customerId) {
|
||||||
final ExerciseRepository exerciseRepository = exerciseLogBloc.exerciseRepository;
|
final ExerciseRepository exerciseRepository = exerciseLogBloc.exerciseRepository;
|
||||||
|
|
||||||
if ( customerId == Cache().userLoggedIn.customerId ) {
|
if (customerId == Cache().userLoggedIn.customerId) {
|
||||||
exerciseRepository.exerciseList = exerciseRepository.getExerciseList();
|
exerciseRepository.exerciseList = exerciseRepository.getExerciseList();
|
||||||
} else if ( Cache().getTrainee() != null && customerId == Cache().getTrainee().customerId ) {
|
} else if (Cache().getTrainee() != null && customerId == Cache().getTrainee().customerId) {
|
||||||
exerciseRepository.exerciseList = exerciseRepository.getExerciseListTrainee();
|
exerciseRepository.exerciseList = exerciseRepository.getExerciseListTrainee();
|
||||||
}
|
}
|
||||||
exerciseRepository.sortByDate();
|
exerciseRepository.sortByDate();
|
||||||
@ -98,37 +91,34 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
|
|||||||
List<Widget> listWidget = List();
|
List<Widget> listWidget = List();
|
||||||
|
|
||||||
Card explanation = Card(
|
Card explanation = Card(
|
||||||
color: Colors.white60,
|
color: Colors.white60,
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.only(left: 10, right: 5, top: 12, bottom: 8),
|
padding: EdgeInsets.only(left: 10, right: 5, top: 12, bottom: 8),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Row(
|
||||||
Icons.info,
|
children: [
|
||||||
color: Colors.orangeAccent,
|
Icon(
|
||||||
|
Icons.info,
|
||||||
|
color: Colors.orangeAccent,
|
||||||
|
),
|
||||||
|
Text(" "),
|
||||||
|
Text(
|
||||||
|
t("My Exercise Logs"),
|
||||||
|
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Divider(
|
||||||
|
color: Colors.transparent,
|
||||||
),
|
),
|
||||||
Text(" "),
|
|
||||||
Text(
|
Text(
|
||||||
t("My Exercise Logs"),
|
t("In this list you will find all your executed exercises grouped by the date."),
|
||||||
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
style: TextStyle(fontSize: 12, fontWeight: FontWeight.normal),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
)));
|
||||||
Divider(
|
|
||||||
color: Colors.transparent,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
t("In this list you will find all your executed exercises grouped by the date."),
|
|
||||||
style: TextStyle(fontSize: 12, fontWeight: FontWeight.normal),
|
|
||||||
),
|
|
||||||
|
|
||||||
],
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
listWidget.add(explanation);
|
listWidget.add(explanation);
|
||||||
|
|
||||||
List<Exercise> listExercises = List();
|
List<Exercise> listExercises = List();
|
||||||
@ -136,44 +126,35 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
|
|||||||
exerciseRepository.exerciseList.forEach((exercise) {
|
exerciseRepository.exerciseList.forEach((exercise) {
|
||||||
String exerciseDate = DateFormat("yyyy-MM-dd", AppLanguage().appLocal.toString()).format(exercise.dateAdd);
|
String exerciseDate = DateFormat("yyyy-MM-dd", AppLanguage().appLocal.toString()).format(exercise.dateAdd);
|
||||||
|
|
||||||
if ( origDate != exerciseDate) {
|
if (origDate != exerciseDate) {
|
||||||
if ( origDate.length == 0 ) {
|
if (origDate.length == 0) {
|
||||||
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,109 +168,105 @@ 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(
|
||||||
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,
|
Icon(Icons.accessibility, color: Colors.black12),
|
||||||
children: [
|
SizedBox(
|
||||||
|
width: 10,
|
||||||
Icon(Icons.accessibility, color: Colors.black12),
|
),
|
||||||
SizedBox(width: 10,),
|
Flexible(
|
||||||
Flexible(
|
fit: FlexFit.tight,
|
||||||
|
flex: 8,
|
||||||
|
child: Text(
|
||||||
|
exerciseName,
|
||||||
|
style: TextStyle(fontSize: 12, color: Colors.black),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
fit: FlexFit.tight,
|
fit: FlexFit.tight,
|
||||||
flex: 8,
|
child: SizedBox(
|
||||||
child: Text(
|
width: 10,
|
||||||
exerciseName,
|
)),
|
||||||
|
Text(
|
||||||
style: TextStyle(fontSize: 12, color: Colors.black),
|
labelExercise,
|
||||||
),
|
style: TextStyle(fontSize: 9, color: Colors.blueAccent.shade700),
|
||||||
),
|
),
|
||||||
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(
|
||||||
IconButton(
|
width: 10,
|
||||||
icon: Icon(Icons.delete, color: Colors.black12),
|
)),
|
||||||
onPressed: () {
|
IconButton(
|
||||||
confirmationDialog(exerciseLogBloc, exercise);
|
icon: Icon(Icons.delete, color: Colors.black12),
|
||||||
},
|
onPressed: () {
|
||||||
),
|
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())
|
||||||
: DateFormat(DateFormat.YEAR_MONTH_DAY, AppLanguage().appLocal.toString()).format(exercise.dateAdd.toUtc()) + "-n";
|
: DateFormat(DateFormat.YEAR_MONTH_DAY, AppLanguage().appLocal.toString()).format(exercise.dateAdd.toUtc()) + "-n";
|
||||||
|
|
||||||
showCupertinoDialog(
|
showCupertinoDialog(
|
||||||
useRootNavigator: true,
|
useRootNavigator: true,
|
||||||
context: context,
|
context: context,
|
||||||
//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: [
|
||||||
|
Divider(),
|
||||||
children: [
|
Text(
|
||||||
Divider(),
|
t("Exercise") + ": " + exerciseName,
|
||||||
Text(t("Exercise") + ": " + exerciseName,
|
style: (TextStyle(color: Colors.blue)),
|
||||||
style: (TextStyle(color: Colors.blue)),),
|
),
|
||||||
Text(
|
Text(
|
||||||
exercise.quantity.toStringAsFixed(0) + "x" + exercise.unitQuantity.toStringAsFixed(0) + " " + exerciseType.unitQuantityUnit,
|
exercise.quantity.toStringAsFixed(0) +
|
||||||
style: (TextStyle(color: Colors.deepOrange)),
|
"x" +
|
||||||
),
|
exercise.unitQuantity.toStringAsFixed(0) +
|
||||||
Text(
|
" " +
|
||||||
strDate,
|
exerciseType.unitQuantityUnit,
|
||||||
style: (TextStyle(color: Colors.deepOrange)),
|
style: (TextStyle(color: Colors.deepOrange)),
|
||||||
),
|
),
|
||||||
|
Text(
|
||||||
]),
|
strDate,
|
||||||
actions: [
|
style: (TextStyle(color: Colors.deepOrange)),
|
||||||
FlatButton(
|
),
|
||||||
child: Text(t("No")),
|
]),
|
||||||
onPressed: () => Navigator.pop(context),
|
actions: [
|
||||||
),
|
FlatButton(
|
||||||
FlatButton(
|
child: Text(t("No")),
|
||||||
child: Text(t("Yes")),
|
onPressed: () => Navigator.pop(context),
|
||||||
onPressed: () => {
|
),
|
||||||
print("delete exercise: " + exercise.toJson().toString()),
|
FlatButton(
|
||||||
bloc.add(ExerciseLogDelete(exercise: exercise)),
|
child: Text(t("Yes")),
|
||||||
Navigator.pop(context)
|
onPressed: () => {
|
||||||
},
|
print("delete exercise: " + exercise.toJson().toString()),
|
||||||
)
|
bloc.add(ExerciseLogDelete(exercise: exercise)),
|
||||||
],
|
Navigator.pop(context)
|
||||||
)
|
},
|
||||||
);
|
)
|
||||||
|
],
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
},
|
},
|
||||||
|
@ -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);
|
||||||
|
@ -45,41 +45,39 @@ class _ExercisePlanCustomPage extends State<ExercisePlanCustomPage> with Trans {
|
|||||||
setContext(context);
|
setContext(context);
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
key: _scaffoldKey,
|
key: _scaffoldKey,
|
||||||
appBar: AppBarNav(depth: 1),
|
appBar: AppBarNav(depth: 1),
|
||||||
body: Container(
|
body: Container(
|
||||||
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')
|
||||||
fit: BoxFit.cover,
|
: AssetImage('asset/image/WT_menu_dark.png'),
|
||||||
alignment: Alignment.center,
|
fit: BoxFit.cover,
|
||||||
),
|
alignment: Alignment.center,
|
||||||
),
|
),
|
||||||
child: BlocConsumer<ExercisePlanBloc, ExercisePlanState>(
|
),
|
||||||
listener: (context, state) {
|
child: BlocConsumer<ExercisePlanBloc, ExercisePlanState>(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(
|
||||||
state.message,
|
state.message,
|
||||||
),
|
),
|
||||||
backgroundColor: Colors.orange,
|
backgroundColor: Colors.orange,
|
||||||
));
|
));
|
||||||
} else if (state is ExercisePlanLoading) {
|
} else if (state is ExercisePlanLoading) {
|
||||||
LoadingDialog();
|
//LoadingDialog.show(context);
|
||||||
}
|
|
||||||
},
|
|
||||||
// ignore: missing_return
|
|
||||||
builder: (context, state) {
|
|
||||||
if (state is ExercisePlanReady) {
|
|
||||||
return exerciseWidget(bloc);
|
|
||||||
}
|
|
||||||
return Container();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
)
|
},
|
||||||
),
|
// ignore: missing_return
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state is ExercisePlanReady) {
|
||||||
|
//LoadingDialog.hide(context);
|
||||||
|
return exerciseWidget(bloc);
|
||||||
|
}
|
||||||
|
return Container();
|
||||||
|
})),
|
||||||
bottomNavigationBar: BottomNavigator(bottomNavIndex: 2),
|
bottomNavigationBar: BottomNavigator(bottomNavIndex: 2),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -95,47 +93,44 @@ class _ExercisePlanCustomPage extends State<ExercisePlanCustomPage> with Trans {
|
|||||||
List<Widget> exerciseTypes = List();
|
List<Widget> exerciseTypes = List();
|
||||||
|
|
||||||
Card explanation = Card(
|
Card explanation = Card(
|
||||||
color: Colors.white60,
|
color: Colors.white60,
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.only(left: 10, right: 5, top: 12, bottom: 8),
|
padding: EdgeInsets.only(left: 10, right: 5, top: 12, bottom: 8),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
children: [
|
children: [
|
||||||
Icon(
|
Row(
|
||||||
Icons.info,
|
children: [
|
||||||
color: Colors.orangeAccent,
|
Icon(
|
||||||
|
Icons.info,
|
||||||
|
color: Colors.orangeAccent,
|
||||||
|
),
|
||||||
|
Text(" "),
|
||||||
|
Text(
|
||||||
|
t("Custom Exercise Plan"),
|
||||||
|
style: GoogleFonts.archivoBlack(fontSize: 20),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Divider(
|
||||||
|
color: Colors.transparent,
|
||||||
),
|
),
|
||||||
Text(" "),
|
|
||||||
Text(
|
Text(
|
||||||
t("Custom Exercise Plan"),
|
t("Select manually the exercises what you would like to have in your plan. At the end don't forget to save."),
|
||||||
style: GoogleFonts.archivoBlack(fontSize: 20),
|
style: GoogleFonts.inter(fontSize: 12, fontWeight: FontWeight.normal),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
)));
|
||||||
Divider(
|
|
||||||
color: Colors.transparent,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
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),
|
|
||||||
),
|
|
||||||
|
|
||||||
],
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
exerciseTypes.add(explanation);
|
exerciseTypes.add(explanation);
|
||||||
|
|
||||||
bloc.menuTreeRepository.sortedTree.forEach((name, list) {
|
bloc.menuTreeRepository.sortedTree.forEach((name, list) {
|
||||||
exerciseTypes.add(Container(
|
exerciseTypes.add(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: name),
|
parent: TreeviewParentWidget(text: name),
|
||||||
children: _getChildList(list, bloc),
|
children: _getChildList(list, bloc),
|
||||||
)));
|
)));
|
||||||
});
|
});
|
||||||
|
|
||||||
return exerciseTypes;
|
return exerciseTypes;
|
||||||
@ -144,65 +139,65 @@ 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(
|
startExpanded: false,
|
||||||
TreeViewChild(
|
parent: Card(
|
||||||
startExpanded: false,
|
|
||||||
parent:
|
|
||||||
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,
|
IconButton(
|
||||||
children: [
|
icon: element.selected
|
||||||
IconButton(
|
? Icon(
|
||||||
icon: element.selected ? Icon(Icons.check, color: Colors.green[600],)
|
Icons.check,
|
||||||
: Icon(Icons.add, color: Colors.indigo,),
|
color: Colors.green[600],
|
||||||
onPressed: () => clickAddDetail(bloc, element),
|
)
|
||||||
),
|
: Icon(
|
||||||
SizedBox(width: 10),
|
Icons.add,
|
||||||
Flexible(
|
color: Colors.indigo,
|
||||||
fit: FlexFit.tight,
|
),
|
||||||
flex: 8,
|
onPressed: () => clickAddDetail(bloc, element),
|
||||||
child:
|
),
|
||||||
InkWell(
|
SizedBox(width: 10),
|
||||||
child:
|
Flexible(
|
||||||
Text(
|
fit: FlexFit.tight,
|
||||||
element.name,
|
flex: 8,
|
||||||
textAlign: TextAlign.start,
|
child: InkWell(
|
||||||
style: GoogleFonts.inter(fontSize: 16, color: Colors.black),
|
child: Text(
|
||||||
),
|
element.name,
|
||||||
onTap: () => clickAddDetail(bloc, element),
|
textAlign: TextAlign.start,
|
||||||
|
style: GoogleFonts.inter(fontSize: 16, color: Colors.black),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
InkWell(
|
|
||||||
child:
|
|
||||||
!element.selected || bloc.exercisePlanRepository.exercisePlanDetails[element.exerciseTypeId] == null ||
|
|
||||||
bloc.exercisePlanRepository.exercisePlanDetails[element.exerciseTypeId].change == null ? Text("") :
|
|
||||||
Text(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(
|
),
|
||||||
|
InkWell(
|
||||||
padding: EdgeInsets.all(0),
|
child: !element.selected ||
|
||||||
icon: Icon(Icons.info, color: Colors.black12,),
|
bloc.exercisePlanRepository.exercisePlanDetails[element.exerciseTypeId] == null ||
|
||||||
onPressed: () {
|
bloc.exercisePlanRepository.exercisePlanDetails[element.exerciseTypeId].change == null
|
||||||
|
? Text("")
|
||||||
},
|
: Text(
|
||||||
|
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),
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
padding: EdgeInsets.all(0),
|
||||||
|
icon: Icon(
|
||||||
|
Icons.info,
|
||||||
|
color: Colors.black12,
|
||||||
),
|
),
|
||||||
|
onPressed: () {},
|
||||||
]),
|
),
|
||||||
)
|
]),
|
||||||
),
|
)),
|
||||||
children: [
|
children: []));
|
||||||
]
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
});
|
});
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -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'),
|
||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
|
@ -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,35 +117,30 @@ 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),
|
||||||
label: Text(t('One Max Rep')),
|
label: Text(t('One Max Rep')),
|
||||||
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),
|
||||||
label: Text(t('Percent')),
|
label: Text(t('Percent')),
|
||||||
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) {
|
||||||
@ -229,14 +212,14 @@ class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Comm
|
|||||||
listWorkoutTree.forEach((element) {
|
listWorkoutTree.forEach((element) {
|
||||||
bool hasNoData = (bloc.listChartData[element.exerciseTypeId] == null);
|
bool hasNoData = (bloc.listChartData[element.exerciseTypeId] == null);
|
||||||
String unit = " kg";
|
String unit = " kg";
|
||||||
if ( bloc.diagramType == DiagramType.percent) {
|
if (bloc.diagramType == DiagramType.percent) {
|
||||||
unit = " %";
|
unit = " %";
|
||||||
}
|
}
|
||||||
list.add(SizedBox(
|
list.add(SizedBox(
|
||||||
width: cWidth * 0.85,
|
width: cWidth * 0.85,
|
||||||
height: hasNoData ? 0 : 200,
|
height: hasNoData ? 0 : 200,
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.only(left:5, top:5, right:5, bottom: 5),
|
padding: const EdgeInsets.only(left: 5, top: 5, right: 5, bottom: 5),
|
||||||
color: Colors.white70,
|
color: Colors.white70,
|
||||||
child: Column(mainAxisSize: MainAxisSize.min, children: [
|
child: Column(mainAxisSize: MainAxisSize.min, children: [
|
||||||
hasNoData
|
hasNoData
|
||||||
@ -253,58 +236,56 @@ class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Comm
|
|||||||
//fit: FlexFit.loose,
|
//fit: FlexFit.loose,
|
||||||
child: BarChart(
|
child: BarChart(
|
||||||
BarChartData(
|
BarChartData(
|
||||||
alignment: BarChartAlignment.spaceAround,
|
alignment: BarChartAlignment.spaceAround,
|
||||||
barTouchData: BarTouchData(
|
barTouchData: BarTouchData(
|
||||||
touchTooltipData: BarTouchTooltipData(
|
touchTooltipData: BarTouchTooltipData(
|
||||||
tooltipBgColor: Colors.white70,
|
tooltipBgColor: Colors.white70,
|
||||||
getTooltipItem: (group, groupIndex, rod, rodIndex) {
|
getTooltipItem: (group, groupIndex, rod, rodIndex) {
|
||||||
return BarTooltipItem(
|
return BarTooltipItem(
|
||||||
rod.y.toStringAsFixed(0) + unit,
|
rod.y.toStringAsFixed(0) + unit,
|
||||||
TextStyle(color: Colors.black54, fontSize: 12, fontWeight: FontWeight.bold),
|
TextStyle(color: Colors.black54, fontSize: 12, fontWeight: FontWeight.bold),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
titlesData: FlTitlesData(
|
titlesData: FlTitlesData(
|
||||||
show: true,
|
show: true,
|
||||||
bottomTitles: SideTitles(
|
bottomTitles: SideTitles(
|
||||||
showTitles: true,
|
|
||||||
getTextStyles: (_) => TextStyle(fontSize: 8, color: Colors.blueGrey),
|
|
||||||
getTitles: (double value) {
|
|
||||||
var date = new DateTime.fromMillisecondsSinceEpoch(value.toInt());
|
|
||||||
//String strDate = DateFormat('MM.dd.', AppLanguage().appLocal.toString()).format(date);
|
|
||||||
String strDate = getDatePart(date, bloc.dateRate);
|
|
||||||
return strDate;
|
|
||||||
},
|
|
||||||
),
|
|
||||||
leftTitles: SideTitles(
|
|
||||||
showTitles: true,
|
showTitles: true,
|
||||||
getTextStyles: (_) => TextStyle(fontSize: 8, color: Colors.blueGrey),
|
getTextStyles: (_) => TextStyle(fontSize: 8, color: Colors.blueGrey),
|
||||||
interval: bloc.listChartData[element.exerciseTypeId] == null
|
|
||||||
? 100
|
|
||||||
: bloc.listChartData[element.exerciseTypeId].interval,
|
|
||||||
margin: 10,
|
|
||||||
getTitles: (double value) {
|
getTitles: (double value) {
|
||||||
return value.toStringAsFixed(0) + unit;
|
var date = new DateTime.fromMillisecondsSinceEpoch(value.toInt());
|
||||||
})),
|
//String strDate = DateFormat('MM.dd.', AppLanguage().appLocal.toString()).format(date);
|
||||||
borderData: FlBorderData(
|
String strDate = getDatePart(date, bloc.dateRate);
|
||||||
show: false,
|
return strDate;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
leftTitles: SideTitles(
|
||||||
|
showTitles: true,
|
||||||
|
getTextStyles: (_) => TextStyle(fontSize: 8, color: Colors.blueGrey),
|
||||||
|
interval: bloc.listChartData[element.exerciseTypeId] == null
|
||||||
|
? 100
|
||||||
|
: bloc.listChartData[element.exerciseTypeId].interval,
|
||||||
|
margin: 10,
|
||||||
|
getTitles: (double value) {
|
||||||
|
return value.toStringAsFixed(0) + unit;
|
||||||
|
})),
|
||||||
|
borderData: FlBorderData(
|
||||||
|
show: false,
|
||||||
|
),
|
||||||
|
gridData: FlGridData(
|
||||||
|
show: true,
|
||||||
|
checkToShowHorizontalLine: (value) => value % bloc.listChartData[element.exerciseTypeId].gridInterval == 0,
|
||||||
|
getDrawingHorizontalLine: (value) {
|
||||||
|
return FlLine(
|
||||||
|
color: Colors.black26,
|
||||||
|
strokeWidth: 0.5,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
groupsSpace: 2,
|
||||||
|
barGroups:
|
||||||
|
bloc.listChartData[element.exerciseTypeId] == null ? [] : bloc.listChartData[element.exerciseTypeId].data,
|
||||||
),
|
),
|
||||||
gridData: FlGridData(
|
|
||||||
show: true,
|
|
||||||
checkToShowHorizontalLine: (value) =>
|
|
||||||
value % bloc.listChartData[element.exerciseTypeId].gridInterval == 0,
|
|
||||||
getDrawingHorizontalLine: (value) {
|
|
||||||
return FlLine(
|
|
||||||
color: Colors.black26,
|
|
||||||
strokeWidth: 0.5,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
groupsSpace: 2,
|
|
||||||
barGroups: bloc.listChartData[element.exerciseTypeId] == null
|
|
||||||
? []
|
|
||||||
: 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -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>[
|
||||||
|
@ -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(
|
||||||
|
@ -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
|
||||||
@ -40,75 +37,54 @@ class SettingsPage extends StatelessWidget{
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
image: AssetImage('asset/image/WT_light_background.png'),
|
image: AssetImage('asset/image/WT_light_background.png'),
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Form(
|
|
||||||
child: BlocConsumer<SettingsBloc, SettingsState>(
|
|
||||||
listener: (context, state) {
|
|
||||||
if ( state is SettingsError ) {
|
|
||||||
|
|
||||||
} else if ( state is SettingsReady ) {
|
|
||||||
menuBloc.add(MenuRecreateTree());
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// ignore: missing_return
|
|
||||||
builder: (context, state) {
|
|
||||||
if ( state is SettingsLoading ) {
|
|
||||||
return LoadingDialog();
|
|
||||||
} else if ( state is SettingsInitial) {
|
|
||||||
return settingsUI(context, settingsBloc, menuBloc);
|
|
||||||
} else if ( state is SettingsReady ) {
|
|
||||||
return settingsUI(context, settingsBloc, menuBloc);
|
|
||||||
} else {
|
|
||||||
return Container();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
child: Form(
|
||||||
|
child: BlocConsumer<SettingsBloc, SettingsState>(listener: (context, state) {
|
||||||
|
if (state is SettingsError) {
|
||||||
|
} else if (state is SettingsReady) {
|
||||||
|
menuBloc.add(MenuRecreateTree());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// ignore: missing_return
|
||||||
|
builder: (context, state) {
|
||||||
|
if (state is SettingsLoading) {
|
||||||
|
//LoadingDialog.show(context);
|
||||||
|
} else if (state is SettingsInitial) {
|
||||||
|
return settingsUI(context, settingsBloc, menuBloc);
|
||||||
|
} else if (state is SettingsReady) {
|
||||||
|
//LoadingDialog.hide(context);
|
||||||
|
return settingsUI(context, settingsBloc, menuBloc);
|
||||||
|
} else {
|
||||||
|
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),
|
ListTile(
|
||||||
children: <Widget>[
|
|
||||||
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("English")
|
||||||
? AppLocalizations.of(context).translate(
|
: AppLocalizations.of(context).translate("Hungarian"),
|
||||||
"English")
|
items: [AppLocalizations.of(context).translate("English"), AppLocalizations.of(context).translate("Hungarian")]
|
||||||
: AppLocalizations.of(context).translate(
|
.map<DropdownMenuItem<String>>((String value) {
|
||||||
"Hungarian"),
|
return DropdownMenuItem<String>(
|
||||||
items: [AppLocalizations.of(context).translate(
|
value: value,
|
||||||
"English"), AppLocalizations.of(context)
|
child: Text(value),
|
||||||
.translate("Hungarian")
|
);
|
||||||
]
|
}).toList(),
|
||||||
.map<DropdownMenuItem<String>>((String value) {
|
onChanged: (String lang) => {
|
||||||
return DropdownMenuItem<String>(
|
settingsBloc.add(SettingsChangeLanguage(language: lang)),
|
||||||
value: value,
|
})),
|
||||||
child: Text(value),
|
]);
|
||||||
);
|
|
||||||
}).toList(),
|
|
||||||
onChanged: (String lang) =>
|
|
||||||
{
|
|
||||||
settingsBloc.add(
|
|
||||||
SettingsChangeLanguage(language: lang)
|
|
||||||
),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
),
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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(
|
||||||
|
Loading…
Reference in New Issue
Block a user