WT1.1.0+3334 CustomerExerciseDevice fix, Badges fix
This commit is contained in:
parent
b59db7c9db
commit
25c3a1d096
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;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CURRENT_PROJECT_VERSION = 33;
|
||||
CURRENT_PROJECT_VERSION = 34;
|
||||
DEVELOPMENT_TEAM = SFJJBDCU6Z;
|
||||
ENABLE_BITCODE = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
@ -505,7 +505,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CURRENT_PROJECT_VERSION = 33;
|
||||
CURRENT_PROJECT_VERSION = 34;
|
||||
DEVELOPMENT_TEAM = SFJJBDCU6Z;
|
||||
ENABLE_BITCODE = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
@ -540,7 +540,7 @@
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CURRENT_PROJECT_VERSION = 33;
|
||||
CURRENT_PROJECT_VERSION = 34;
|
||||
DEVELOPMENT_TEAM = SFJJBDCU6Z;
|
||||
ENABLE_BITCODE = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
|
@ -30,6 +30,7 @@ class CustomerExerciseDeviceBloc extends Bloc<CustomerExerciseDeviceEvent, Custo
|
||||
} else if (event is CustomerExerciseDeviceAdd) {
|
||||
yield CustomerExerciseDeviceLoading();
|
||||
print("Add device " + event.device.exerciseDeviceId.toString());
|
||||
//await Future.delayed(const Duration(seconds: 2), () => "2");
|
||||
await repository.addDevice(event.device);
|
||||
Cache().initBadges();
|
||||
yield CustomerExerciseDeviceReady();
|
||||
|
@ -335,31 +335,34 @@ class ExerciseNewBloc extends Bloc<ExerciseNewEvent, ExerciseNewState> {
|
||||
if (this.bmi == 0) {
|
||||
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;
|
||||
if (bmi < 18.5) {
|
||||
goalBMI = 19;
|
||||
this.bmiTop = 99;
|
||||
this.bmiLeft = 72;
|
||||
this.bmiTop = 99 * distortionHeight;
|
||||
this.bmiLeft = 77 * distortionWidth;
|
||||
bmiAngle = -62;
|
||||
} else if (bmi < 25 && 18.5 < bmi) {
|
||||
goalBMI = 27;
|
||||
this.bmiTop = 46;
|
||||
this.bmiLeft = 130;
|
||||
this.bmiTop = 48 * distortionHeight;
|
||||
this.bmiLeft = 130 * distortionWidth;
|
||||
bmiAngle = -23;
|
||||
} else if (bmi < 30 && 24.9 < bmi) {
|
||||
goalBMI = 24;
|
||||
this.bmiTop = 38.0;
|
||||
this.bmiLeft = 186.0;
|
||||
this.bmiTop = 40.0 * distortionHeight;
|
||||
this.bmiLeft = 184.0 * distortionWidth;
|
||||
bmiAngle = 7.2;
|
||||
} else if (bmi < 34.9 && 29.9 < bmi) {
|
||||
goalBMI = 29;
|
||||
bmiTop = 48;
|
||||
bmiLeft = 211;
|
||||
bmiTop = 48 * distortionHeight;
|
||||
bmiLeft = 211 * distortionWidth;
|
||||
} else if (bmi > 35) {
|
||||
goalBMI = 34;
|
||||
bmiTop = 94;
|
||||
bmiLeft = 260;
|
||||
bmiTop = 94 * distortionHeight;
|
||||
bmiLeft = 260 * distortionWidth;
|
||||
bmiAngle = 59;
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,8 @@ class CustomerExerciseDeviceRepository {
|
||||
found = element;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
_devices = List();
|
||||
}
|
||||
if (found == null) {
|
||||
int customerId;
|
||||
@ -36,8 +38,8 @@ class CustomerExerciseDeviceRepository {
|
||||
CustomerExerciseDevice newDevice =
|
||||
CustomerExerciseDevice(customerId: customerId, exerciseDeviceId: device.exerciseDeviceId, favourite: false);
|
||||
newDevice.change = ModelChange.add;
|
||||
await CustomerExerciseDeviceApi().addDevice(newDevice);
|
||||
this._devices.add(newDevice);
|
||||
CustomerExerciseDevice saved = await CustomerExerciseDeviceApi().addDevice(newDevice);
|
||||
this._devices.add(saved);
|
||||
Cache().setCustomerDevices(_devices);
|
||||
}
|
||||
}
|
||||
@ -55,9 +57,9 @@ class CustomerExerciseDeviceRepository {
|
||||
}
|
||||
if (found != null) {
|
||||
this._devices.remove(found);
|
||||
if (found.change != ModelChange.add) {
|
||||
await CustomerExerciseDeviceApi().removeDevice(found.customerExerciseDeviceId);
|
||||
}
|
||||
//if (found.change != ModelChange.add) {
|
||||
await CustomerExerciseDeviceApi().removeDevice(found.customerExerciseDeviceId);
|
||||
//}
|
||||
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/widgets/app_bar.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_bloc/flutter_bloc.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
@ -19,6 +19,7 @@ class CustomerExerciseDevicePage extends StatelessWidget with Trans {
|
||||
Widget build(BuildContext context) {
|
||||
setContext(context);
|
||||
double cWidth = MediaQuery.of(context).size.width;
|
||||
double cHeight = MediaQuery.of(context).size.height;
|
||||
return Scaffold(
|
||||
appBar: AppBarNav(depth: 0),
|
||||
body: Container(
|
||||
@ -37,7 +38,10 @@ class CustomerExerciseDevicePage extends StatelessWidget with Trans {
|
||||
child: BlocConsumer<CustomerExerciseDeviceBloc, CustomerExerciseDeviceState>(
|
||||
listener: (context, state) {
|
||||
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) {
|
||||
Scaffold.of(context).showSnackBar(
|
||||
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) {
|
||||
final bloc = BlocProvider.of<CustomerExerciseDeviceBloc>(context);
|
||||
return getPage(bloc, cWidth);
|
||||
return getPage(bloc, cWidth, cHeight);
|
||||
},
|
||||
))));
|
||||
}
|
||||
|
||||
Widget getPage(CustomerExerciseDeviceBloc bloc, double cWidth) {
|
||||
print("width" + cWidth.toString());
|
||||
Widget getPage(CustomerExerciseDeviceBloc bloc, double cWidth, double cHeight) {
|
||||
//print("width" + cWidth.toString());
|
||||
return CustomScrollView(scrollDirection: Axis.vertical, slivers: [
|
||||
SliverGrid(
|
||||
delegate: SliverChildListDelegate([
|
||||
@ -104,12 +108,12 @@ class CustomerExerciseDevicePage extends StatelessWidget with Trans {
|
||||
),
|
||||
),
|
||||
SliverGrid(
|
||||
delegate: SliverChildListDelegate(getDevicesPlace(bloc, cWidth)),
|
||||
delegate: SliverChildListDelegate(getDevicesPlace(bloc, cWidth, cHeight)),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 1,
|
||||
mainAxisSpacing: 15.0,
|
||||
crossAxisSpacing: 10.0,
|
||||
childAspectRatio: 3.0,
|
||||
crossAxisSpacing: 5.0,
|
||||
childAspectRatio: 2.5,
|
||||
),
|
||||
),
|
||||
SliverGrid(
|
||||
@ -164,7 +168,7 @@ class CustomerExerciseDevicePage extends StatelessWidget with Trans {
|
||||
),
|
||||
),
|
||||
SliverGrid(
|
||||
delegate: SliverChildListDelegate(getDevices(bloc)),
|
||||
delegate: SliverChildListDelegate(getDevices(bloc, cWidth, cHeight)),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
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";
|
||||
this.listDevice = List();
|
||||
final devices = bloc.devices;
|
||||
@ -185,8 +190,8 @@ class CustomerExerciseDevicePage extends StatelessWidget with Trans {
|
||||
if (element.place == false) {
|
||||
final String url = "asset/image/" + element.imageUrl.substring(7);
|
||||
ImageButton button = ImageButton(
|
||||
width: 178,
|
||||
height: 175,
|
||||
width: cWidth / 2 - 10,
|
||||
height: cWidth / 2 - 10,
|
||||
textAlignment: Alignment.topCenter,
|
||||
text: isEnglish ? element.name : element.nameTranslation,
|
||||
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;
|
||||
}
|
||||
|
||||
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";
|
||||
this.listDevice = List();
|
||||
final devices = bloc.devices;
|
||||
@ -213,15 +219,16 @@ class CustomerExerciseDevicePage extends StatelessWidget with Trans {
|
||||
devices.sort((a, b) => a.sort.compareTo(b.sort));
|
||||
devices.forEach((element) {
|
||||
if (element.place) {
|
||||
final String url = "asset/image/" + element.imageUrl.substring(7);
|
||||
ImageButton button = ImageButton(
|
||||
width: cWidth - 80,
|
||||
height: 125,
|
||||
width: cWidth - 60,
|
||||
height: cWidth / 2 - 40,
|
||||
top: 10,
|
||||
textAlignment: Alignment.topCenter,
|
||||
text: isEnglish ? element.name : element.nameTranslation,
|
||||
style: GoogleFonts.archivoBlack(fontSize: 14, color: Colors.white, backgroundColor: Colors.black54.withOpacity(0.4)),
|
||||
image: element.imageUrl,
|
||||
left: 35,
|
||||
image: url,
|
||||
left: 5,
|
||||
onTap: () => changeButtonShape(element, bloc),
|
||||
isLocked: false,
|
||||
buttonIndex: element.exerciseDeviceId,
|
||||
|
@ -45,8 +45,9 @@ class CustomerModifyPage extends StatelessWidget with Trans {
|
||||
child: BlocConsumer<CustomerChangeBloc, CustomerChangeState>(
|
||||
listener: (context, state) {
|
||||
if (state is CustomerChangeLoading) {
|
||||
LoadingDialog();
|
||||
//LoadingDialog();
|
||||
} else if (state is CustomerSaveError) {
|
||||
//LoadingDialog.hide(context);
|
||||
Scaffold.of(context).showSnackBar(
|
||||
SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white))));
|
||||
} else if (state is CustomerSaveSuccess) {
|
||||
|
@ -31,14 +31,16 @@ class _ExerciseControlPage extends State<ExerciseControlPage> with Trans {
|
||||
..add(ExerciseControlLoad()),
|
||||
child: BlocConsumer<ExerciseControlBloc, ExerciseControlState>(listener: (context, state) {
|
||||
if (state is ExerciseControlError) {
|
||||
//LoadingDialog.hide(context);
|
||||
Scaffold.of(context).showSnackBar(
|
||||
SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white))));
|
||||
} else if (state is ExerciseControlLoading) {
|
||||
return LoadingDialog();
|
||||
//LoadingDialog.show(context);
|
||||
}
|
||||
}, builder: (context, state) {
|
||||
final exerciseBloc = BlocProvider.of<ExerciseControlBloc>(context);
|
||||
if (state is ExerciseControlReady) {
|
||||
//LoadingDialog.hide(context);
|
||||
return getControlForm(exerciseBloc);
|
||||
} else {
|
||||
return getControlForm(exerciseBloc);
|
||||
|
@ -56,28 +56,27 @@ class _ExerciseExecutePage extends State<ExerciseExecutePage> with Trans {
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
),
|
||||
child: BlocConsumer<ExerciseExecutePlanBloc, ExerciseExecutePlanState>(
|
||||
listener: (context, state) {
|
||||
if (state is ExerciseByPlanError) {
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
content: Text(
|
||||
state.message,
|
||||
),
|
||||
backgroundColor: Colors.orange,
|
||||
));
|
||||
} else if (state is ExerciseByPlanLoading) {
|
||||
LoadingDialog();
|
||||
}
|
||||
},
|
||||
|
||||
builder: (context, state) {
|
||||
if (state is ExerciseByPlanStateInitial || state is ExerciseByPlanLoading) {
|
||||
return Container();
|
||||
} else if (state is ExerciseByPlanReady) {
|
||||
return exerciseWidget(bloc);
|
||||
} else {
|
||||
return exerciseWidget(bloc);
|
||||
}
|
||||
child: BlocConsumer<ExerciseExecutePlanBloc, ExerciseExecutePlanState>(listener: (context, state) {
|
||||
if (state is ExerciseByPlanError) {
|
||||
//LoadingDialog.hide(context);
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
content: Text(
|
||||
state.message,
|
||||
),
|
||||
backgroundColor: Colors.orange,
|
||||
));
|
||||
} else if (state is ExerciseByPlanLoading) {
|
||||
//LoadingDialog.show(context);
|
||||
}
|
||||
}, builder: (context, state) {
|
||||
if (state is ExerciseByPlanStateInitial || state is ExerciseByPlanLoading) {
|
||||
return Container();
|
||||
} else if (state is ExerciseByPlanReady) {
|
||||
//LoadingDialog.hide(context);
|
||||
return exerciseWidget(bloc);
|
||||
} else {
|
||||
return exerciseWidget(bloc);
|
||||
}
|
||||
})),
|
||||
bottomNavigationBar: BottomNavigator(bottomNavIndex: 2),
|
||||
);
|
||||
@ -107,14 +106,14 @@ class _ExerciseExecutePage extends State<ExerciseExecutePage> with Trans {
|
||||
),
|
||||
Text(" "),
|
||||
Flexible(
|
||||
child:
|
||||
Text(
|
||||
child: Text(
|
||||
t("Execute your active Exercise Plan!"),
|
||||
style: GoogleFonts.archivoBlack(fontSize: 20,),
|
||||
style: GoogleFonts.archivoBlack(
|
||||
fontSize: 20,
|
||||
),
|
||||
maxLines: 2,
|
||||
),
|
||||
),
|
||||
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(
|
||||
@ -130,8 +129,7 @@ class _ExerciseExecutePage extends State<ExerciseExecutePage> with Trans {
|
||||
exerciseTypes.add(explanation);
|
||||
|
||||
bloc.menuTreeRepository.sortedTree.forEach((name, list) {
|
||||
exerciseTypes.add(
|
||||
Container(
|
||||
exerciseTypes.add(Container(
|
||||
margin: const EdgeInsets.only(left: 4.0),
|
||||
child: TreeViewChild(
|
||||
startExpanded: true,
|
||||
@ -146,63 +144,47 @@ class _ExerciseExecutePage extends State<ExerciseExecutePage> with Trans {
|
||||
List<Widget> _getChildList(List<WorkoutMenuTree> listWorkoutTree, ExerciseExecutePlanBloc bloc) {
|
||||
List<Widget> list = List();
|
||||
listWorkoutTree.forEach((element) {
|
||||
|
||||
if ( element.selected) {
|
||||
list.add(
|
||||
TreeViewChild(
|
||||
if (element.selected) {
|
||||
list.add(TreeViewChild(
|
||||
startExpanded: false,
|
||||
parent:
|
||||
Card(
|
||||
parent: Card(
|
||||
margin: EdgeInsets.only(left: 10, top: 5),
|
||||
color: Colors.white54,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(left: 5, top: 0, right: 5, bottom: 0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
IconButton(
|
||||
icon: element.executed ? Icon(Icons.check_box, color: Colors.green):
|
||||
Icon(Icons.indeterminate_check_box, color: Colors.blue.shade800,),
|
||||
onPressed: () => {
|
||||
addExerciseByPlanEvent(bloc, element)
|
||||
},
|
||||
),
|
||||
SizedBox(width: 20),
|
||||
Flexible(
|
||||
fit:FlexFit.tight,
|
||||
child:
|
||||
InkWell(
|
||||
child:
|
||||
Text(
|
||||
element.name,
|
||||
textAlign: TextAlign.start,
|
||||
style: GoogleFonts.inter(
|
||||
fontSize: 17,
|
||||
color: Colors.black),
|
||||
|
||||
),
|
||||
onTap: () => {
|
||||
addExerciseByPlanEvent(bloc, element)
|
||||
},
|
||||
child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [
|
||||
IconButton(
|
||||
icon: element.executed
|
||||
? Icon(Icons.check_box, color: Colors.green)
|
||||
: Icon(
|
||||
Icons.indeterminate_check_box,
|
||||
color: Colors.blue.shade800,
|
||||
),
|
||||
onPressed: () => {addExerciseByPlanEvent(bloc, element)},
|
||||
),
|
||||
SizedBox(width: 20),
|
||||
Flexible(
|
||||
fit: FlexFit.tight,
|
||||
child: InkWell(
|
||||
child: Text(
|
||||
element.name,
|
||||
textAlign: TextAlign.start,
|
||||
style: GoogleFonts.inter(fontSize: 17, color: Colors.black),
|
||||
),
|
||||
|
||||
onTap: () => {addExerciseByPlanEvent(bloc, element)},
|
||||
),
|
||||
IconButton(
|
||||
|
||||
padding: EdgeInsets.all(0),
|
||||
icon: Icon(Icons.info, color: Colors.black12,),
|
||||
onPressed: () {
|
||||
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
padding: EdgeInsets.all(0),
|
||||
icon: Icon(
|
||||
Icons.info,
|
||||
color: Colors.black12,
|
||||
),
|
||||
|
||||
]),
|
||||
)
|
||||
),
|
||||
children: [
|
||||
]
|
||||
)
|
||||
);
|
||||
onPressed: () {},
|
||||
),
|
||||
]),
|
||||
)),
|
||||
children: []));
|
||||
}
|
||||
});
|
||||
return list;
|
||||
|
@ -31,32 +31,24 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
|
||||
setContext(context);
|
||||
|
||||
return BlocProvider(
|
||||
create: (context) => ExerciseLogBloc(exerciseRepository: ExerciseRepository())..
|
||||
add(ExerciseLogLoad()),
|
||||
child: BlocConsumer<ExerciseLogBloc, ExerciseLogState>(
|
||||
listener: (context, state) {
|
||||
if ( state is ExerciseLogLoading ) {
|
||||
return LoadingDialog();
|
||||
} else if ( state is ExerciseLogError ) {
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
backgroundColor: Colors.orange,
|
||||
content:
|
||||
Text(state.message, style: TextStyle(color: Colors.white))));
|
||||
create: (context) => ExerciseLogBloc(exerciseRepository: ExerciseRepository())..add(ExerciseLogLoad()),
|
||||
child: BlocConsumer<ExerciseLogBloc, ExerciseLogState>(listener: (context, state) {
|
||||
if (state is ExerciseLogLoading) {
|
||||
//LoadingDialog.show(context);
|
||||
} else if (state is ExerciseLogError) {
|
||||
//LoadingDialog.hide(context);
|
||||
Scaffold.of(context).showSnackBar(
|
||||
SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white))));
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
}, builder: (context, state) {
|
||||
final exerciseBloc = BlocProvider.of<ExerciseLogBloc>(context);
|
||||
if ( state is ExerciseLogReady ) {
|
||||
if (state is ExerciseLogReady) {
|
||||
//LoadingDialog.hide(context);
|
||||
return getExerciseLog(customerId, exerciseBloc);
|
||||
} else {
|
||||
return getExerciseLog(customerId, exerciseBloc);
|
||||
}
|
||||
}
|
||||
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
}));
|
||||
}
|
||||
|
||||
Widget getExerciseLog(int customerId, ExerciseLogBloc exerciseLogBloc) {
|
||||
@ -66,8 +58,9 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
|
||||
padding: EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: customerId == Cache().userLoggedIn.customerId ? AssetImage('asset/image/WT_light_background.png'):
|
||||
AssetImage('asset/image/WT_menu_dark.png'),
|
||||
image: customerId == Cache().userLoggedIn.customerId
|
||||
? AssetImage('asset/image/WT_light_background.png')
|
||||
: AssetImage('asset/image/WT_menu_dark.png'),
|
||||
fit: BoxFit.cover,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
@ -88,9 +81,9 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
|
||||
List<Widget> _getTreeChildren(ExerciseLogBloc exerciseLogBloc, int customerId) {
|
||||
final ExerciseRepository exerciseRepository = exerciseLogBloc.exerciseRepository;
|
||||
|
||||
if ( customerId == Cache().userLoggedIn.customerId ) {
|
||||
if (customerId == Cache().userLoggedIn.customerId) {
|
||||
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.sortByDate();
|
||||
@ -98,37 +91,34 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
|
||||
List<Widget> listWidget = List();
|
||||
|
||||
Card explanation = Card(
|
||||
color: Colors.white60,
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 10, right: 5, top: 12, bottom: 8),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Row(
|
||||
color: Colors.white60,
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 10, right: 5, top: 12, bottom: 8),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.info,
|
||||
color: Colors.orangeAccent,
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.info,
|
||||
color: Colors.orangeAccent,
|
||||
),
|
||||
Text(" "),
|
||||
Text(
|
||||
t("My Exercise Logs"),
|
||||
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(
|
||||
color: Colors.transparent,
|
||||
),
|
||||
Text(" "),
|
||||
Text(
|
||||
t("My Exercise Logs"),
|
||||
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
|
||||
t("In this list you will find all your executed exercises grouped by the date."),
|
||||
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);
|
||||
|
||||
List<Exercise> listExercises = List();
|
||||
@ -136,44 +126,35 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
|
||||
exerciseRepository.exerciseList.forEach((exercise) {
|
||||
String exerciseDate = DateFormat("yyyy-MM-dd", AppLanguage().appLocal.toString()).format(exercise.dateAdd);
|
||||
|
||||
if ( origDate != exerciseDate) {
|
||||
if ( origDate.length == 0 ) {
|
||||
if (origDate != exerciseDate) {
|
||||
if (origDate.length == 0) {
|
||||
listExercises.add(exercise);
|
||||
origDate = exerciseDate;
|
||||
} else {
|
||||
listWidget.add(
|
||||
Container(
|
||||
listWidget.add(Container(
|
||||
margin: const EdgeInsets.only(left: 4.0),
|
||||
child: TreeViewChild(
|
||||
startExpanded: false,
|
||||
parent: TreeviewParentWidget(text: origDate),
|
||||
children: _getChildList(listExercises, exerciseRepository, exerciseLogBloc),
|
||||
)
|
||||
)
|
||||
);
|
||||
)));
|
||||
listExercises = List();
|
||||
listExercises.add(exercise);
|
||||
origDate = exerciseDate;
|
||||
}
|
||||
|
||||
} else {
|
||||
listExercises.add(exercise);
|
||||
origDate = exerciseDate;
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
if ( listExercises.length > 0) {
|
||||
listWidget.add(
|
||||
Container(
|
||||
if (listExercises.length > 0) {
|
||||
listWidget.add(Container(
|
||||
margin: const EdgeInsets.only(left: 4.0),
|
||||
child: TreeViewChild(
|
||||
startExpanded: true,
|
||||
parent: TreeviewParentWidget(text: origDate),
|
||||
children: _getChildList(listExercises, exerciseRepository, exerciseLogBloc),
|
||||
)
|
||||
)
|
||||
);
|
||||
)));
|
||||
}
|
||||
|
||||
return listWidget;
|
||||
@ -187,109 +168,105 @@ class _ExerciseLogPage extends State<ExerciseLogPage> with Trans, Common {
|
||||
ExerciseType exerciseType = exerciseRepository.getExerciseTypeById(exercise.exerciseTypeId);
|
||||
String exerciseName = isEnglish ? exerciseType.name : exerciseType.nameTranslation;
|
||||
|
||||
String unitQuantity = exerciseType.unitQuantity == "1"
|
||||
? exercise.unitQuantity.toStringAsFixed(0) +
|
||||
" " +
|
||||
t(exerciseType.unitQuantityUnit) +
|
||||
" "
|
||||
: "";
|
||||
String unitQuantity =
|
||||
exerciseType.unitQuantity == "1" ? exercise.unitQuantity.toStringAsFixed(0) + " " + t(exerciseType.unitQuantityUnit) + " " : "";
|
||||
|
||||
String labelExercise =
|
||||
unitQuantity +
|
||||
exercise.quantity.toStringAsFixed(0) +
|
||||
" " +
|
||||
t(exercise.unit);
|
||||
String labelExercise = unitQuantity + exercise.quantity.toStringAsFixed(0) + " " + t(exercise.unit);
|
||||
|
||||
list.add(
|
||||
Card(
|
||||
Card(
|
||||
margin: EdgeInsets.only(left: 10, top: 5),
|
||||
color: Colors.white54,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(left: 5, top: 0, right: 5, bottom: 0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
Icon(Icons.accessibility, color: Colors.black12),
|
||||
SizedBox(width: 10,),
|
||||
Flexible(
|
||||
child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [
|
||||
Icon(Icons.accessibility, color: Colors.black12),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Flexible(
|
||||
fit: FlexFit.tight,
|
||||
flex: 8,
|
||||
child: Text(
|
||||
exerciseName,
|
||||
style: TextStyle(fontSize: 12, color: Colors.black),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
fit: FlexFit.tight,
|
||||
flex: 8,
|
||||
child: Text(
|
||||
exerciseName,
|
||||
|
||||
style: TextStyle(fontSize: 12, color: Colors.black),
|
||||
),
|
||||
),
|
||||
Flexible(fit: FlexFit.tight, child: SizedBox(width: 10,)),
|
||||
Text(labelExercise , style: TextStyle(fontSize: 9, color: Colors.blueAccent.shade700),) ,
|
||||
Flexible(fit: FlexFit.tight, child: SizedBox(width: 10,)),
|
||||
IconButton(
|
||||
icon: Icon(Icons.delete, color: Colors.black12),
|
||||
onPressed: () {
|
||||
confirmationDialog(exerciseLogBloc, exercise);
|
||||
},
|
||||
),
|
||||
|
||||
]),
|
||||
)
|
||||
),
|
||||
child: SizedBox(
|
||||
width: 10,
|
||||
)),
|
||||
Text(
|
||||
labelExercise,
|
||||
style: TextStyle(fontSize: 9, color: Colors.blueAccent.shade700),
|
||||
),
|
||||
Flexible(
|
||||
fit: FlexFit.tight,
|
||||
child: SizedBox(
|
||||
width: 10,
|
||||
)),
|
||||
IconButton(
|
||||
icon: Icon(Icons.delete, color: Colors.black12),
|
||||
onPressed: () {
|
||||
confirmationDialog(exerciseLogBloc, exercise);
|
||||
},
|
||||
),
|
||||
]),
|
||||
)),
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
void confirmationDialog( ExerciseLogBloc bloc, Exercise exercise ) {
|
||||
|
||||
void confirmationDialog(ExerciseLogBloc bloc, Exercise exercise) {
|
||||
ExerciseType exerciseType = bloc.exerciseRepository.getExerciseTypeById(exercise.exerciseTypeId);
|
||||
String exerciseName = AppLanguage().appLocal == Locale("en")
|
||||
? exerciseType.name
|
||||
: exerciseType.nameTranslation;
|
||||
String exerciseName = AppLanguage().appLocal == Locale("en") ? exerciseType.name : exerciseType.nameTranslation;
|
||||
|
||||
String strDate = AppLanguage().appLocal == Locale("en")
|
||||
? "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";
|
||||
? "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";
|
||||
|
||||
showCupertinoDialog(
|
||||
useRootNavigator: true,
|
||||
context: context,
|
||||
//barrierDismissible: false,
|
||||
builder:(_) => CupertinoAlertDialog(
|
||||
title: Text(t("Are you sure to delete this exercise?")),
|
||||
content: Column(
|
||||
|
||||
children: [
|
||||
Divider(),
|
||||
Text(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)),
|
||||
),
|
||||
Text(
|
||||
strDate,
|
||||
style: (TextStyle(color: Colors.deepOrange)),
|
||||
),
|
||||
|
||||
]),
|
||||
actions: [
|
||||
FlatButton(
|
||||
child: Text(t("No")),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
FlatButton(
|
||||
child: Text(t("Yes")),
|
||||
onPressed: () => {
|
||||
print("delete exercise: " + exercise.toJson().toString()),
|
||||
bloc.add(ExerciseLogDelete(exercise: exercise)),
|
||||
Navigator.pop(context)
|
||||
},
|
||||
)
|
||||
],
|
||||
)
|
||||
);
|
||||
useRootNavigator: true,
|
||||
context: context,
|
||||
//barrierDismissible: false,
|
||||
builder: (_) => CupertinoAlertDialog(
|
||||
title: Text(t("Are you sure to delete this exercise?")),
|
||||
content: Column(children: [
|
||||
Divider(),
|
||||
Text(
|
||||
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)),
|
||||
),
|
||||
Text(
|
||||
strDate,
|
||||
style: (TextStyle(color: Colors.deepOrange)),
|
||||
),
|
||||
]),
|
||||
actions: [
|
||||
FlatButton(
|
||||
child: Text(t("No")),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
FlatButton(
|
||||
child: Text(t("Yes")),
|
||||
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>(
|
||||
listener: (context, state) {
|
||||
if (state is ExerciseNewLoading) {
|
||||
return LoadingDialog();
|
||||
//LoadingDialog.show(context);
|
||||
} else if (state is ExerciseNewError) {
|
||||
//LoadingDialog.hide(context);
|
||||
Scaffold.of(context).showSnackBar(
|
||||
SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white))));
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
if (state is ExerciseNewReady) {
|
||||
//LoadingDialog.hide(context);
|
||||
}
|
||||
final exerciseBloc = BlocProvider.of<ExerciseNewBloc>(context);
|
||||
return getExerciseWidget(exerciseBloc, exerciseType);
|
||||
},
|
||||
|
@ -106,13 +106,17 @@ class _ExercisePlanDetailAddPage extends State<ExercisePlanDetailAddPage> with T
|
||||
child: BlocConsumer<ExercisePlanCustomAddBloc, ExercisePlanCustomAddState>(
|
||||
listener: (context, state) {
|
||||
if (state is ExercisePlanCustomAddLoading) {
|
||||
return LoadingDialog();
|
||||
//LoadingDialog.show(context);
|
||||
} else if (state is ExercisePlanCustomAddError) {
|
||||
//LoadingDialog.hide(context);
|
||||
Scaffold.of(context).showSnackBar(
|
||||
SnackBar(backgroundColor: Colors.orange, content: Text(state.message, style: TextStyle(color: Colors.white))));
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
if (state is ExercisePlanCustomAddReady) {
|
||||
//LoadingDialog.hide(context);
|
||||
}
|
||||
// ignore: close_sinks
|
||||
final bloc = BlocProvider.of<ExercisePlanCustomAddBloc>(context);
|
||||
return getForm(bloc, workoutMenuTree);
|
||||
|
@ -45,41 +45,39 @@ class _ExercisePlanCustomPage extends State<ExercisePlanCustomPage> with Trans {
|
||||
setContext(context);
|
||||
|
||||
return Scaffold(
|
||||
key: _scaffoldKey,
|
||||
appBar: AppBarNav(depth: 1),
|
||||
body: Container(
|
||||
padding: EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: customerId == Cache().userLoggedIn.customerId ? AssetImage('asset/image/WT_menu_dark.png'):
|
||||
AssetImage('asset/image/WT_menu_dark.png'),
|
||||
fit: BoxFit.cover,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
key: _scaffoldKey,
|
||||
appBar: AppBarNav(depth: 1),
|
||||
body: Container(
|
||||
padding: EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: customerId == Cache().userLoggedIn.customerId
|
||||
? AssetImage('asset/image/WT_menu_dark.png')
|
||||
: AssetImage('asset/image/WT_menu_dark.png'),
|
||||
fit: BoxFit.cover,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
child: BlocConsumer<ExercisePlanBloc, ExercisePlanState>(
|
||||
listener: (context, state) {
|
||||
if (state is ExercisePlanError) {
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
content: Text(
|
||||
state.message,
|
||||
),
|
||||
backgroundColor: Colors.orange,
|
||||
));
|
||||
} else if (state is ExercisePlanLoading) {
|
||||
LoadingDialog();
|
||||
}
|
||||
},
|
||||
// ignore: missing_return
|
||||
builder: (context, state) {
|
||||
if (state is ExercisePlanReady) {
|
||||
return exerciseWidget(bloc);
|
||||
}
|
||||
return Container();
|
||||
|
||||
),
|
||||
child: BlocConsumer<ExercisePlanBloc, ExercisePlanState>(listener: (context, state) {
|
||||
if (state is ExercisePlanError) {
|
||||
Scaffold.of(context).showSnackBar(SnackBar(
|
||||
content: Text(
|
||||
state.message,
|
||||
),
|
||||
backgroundColor: Colors.orange,
|
||||
));
|
||||
} else if (state is ExercisePlanLoading) {
|
||||
//LoadingDialog.show(context);
|
||||
}
|
||||
)
|
||||
),
|
||||
},
|
||||
// ignore: missing_return
|
||||
builder: (context, state) {
|
||||
if (state is ExercisePlanReady) {
|
||||
//LoadingDialog.hide(context);
|
||||
return exerciseWidget(bloc);
|
||||
}
|
||||
return Container();
|
||||
})),
|
||||
bottomNavigationBar: BottomNavigator(bottomNavIndex: 2),
|
||||
);
|
||||
}
|
||||
@ -95,47 +93,44 @@ class _ExercisePlanCustomPage extends State<ExercisePlanCustomPage> with Trans {
|
||||
List<Widget> exerciseTypes = List();
|
||||
|
||||
Card explanation = Card(
|
||||
color: Colors.white60,
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 10, right: 5, top: 12, bottom: 8),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Row(
|
||||
color: Colors.white60,
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 10, right: 5, top: 12, bottom: 8),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.info,
|
||||
color: Colors.orangeAccent,
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.info,
|
||||
color: Colors.orangeAccent,
|
||||
),
|
||||
Text(" "),
|
||||
Text(
|
||||
t("Custom Exercise Plan"),
|
||||
style: GoogleFonts.archivoBlack(fontSize: 20),
|
||||
),
|
||||
],
|
||||
),
|
||||
Divider(
|
||||
color: Colors.transparent,
|
||||
),
|
||||
Text(" "),
|
||||
Text(
|
||||
t("Custom Exercise Plan"),
|
||||
style: GoogleFonts.archivoBlack(fontSize: 20),
|
||||
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),
|
||||
),
|
||||
],
|
||||
),
|
||||
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);
|
||||
|
||||
bloc.menuTreeRepository.sortedTree.forEach((name, list) {
|
||||
bloc.menuTreeRepository.sortedTree.forEach((name, list) {
|
||||
exerciseTypes.add(Container(
|
||||
margin: const EdgeInsets.only(left: 4.0),
|
||||
child: TreeViewChild(
|
||||
startExpanded: false,
|
||||
parent: TreeviewParentWidget(text: name),
|
||||
children: _getChildList(list, bloc),
|
||||
)));
|
||||
margin: const EdgeInsets.only(left: 4.0),
|
||||
child: TreeViewChild(
|
||||
startExpanded: false,
|
||||
parent: TreeviewParentWidget(text: name),
|
||||
children: _getChildList(list, bloc),
|
||||
)));
|
||||
});
|
||||
|
||||
return exerciseTypes;
|
||||
@ -144,65 +139,65 @@ class _ExercisePlanCustomPage extends State<ExercisePlanCustomPage> with Trans {
|
||||
List<Widget> _getChildList(List<WorkoutMenuTree> listWorkoutTree, ExercisePlanBloc bloc) {
|
||||
List<Widget> list = List();
|
||||
listWorkoutTree.forEach((element) {
|
||||
|
||||
list.add(
|
||||
TreeViewChild(
|
||||
startExpanded: false,
|
||||
parent:
|
||||
Card(
|
||||
list.add(TreeViewChild(
|
||||
startExpanded: false,
|
||||
parent: Card(
|
||||
margin: EdgeInsets.only(left: 10, top: 5),
|
||||
color: Colors.white54,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(left: 5, top: 0, right: 5, bottom: 0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
IconButton(
|
||||
icon: element.selected ? Icon(Icons.check, color: Colors.green[600],)
|
||||
: Icon(Icons.add, color: Colors.indigo,),
|
||||
onPressed: () => clickAddDetail(bloc, element),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
Flexible(
|
||||
fit: FlexFit.tight,
|
||||
flex: 8,
|
||||
child:
|
||||
InkWell(
|
||||
child:
|
||||
Text(
|
||||
element.name,
|
||||
textAlign: TextAlign.start,
|
||||
style: GoogleFonts.inter(fontSize: 16, color: Colors.black),
|
||||
),
|
||||
onTap: () => clickAddDetail(bloc, element),
|
||||
child: Row(mainAxisAlignment: MainAxisAlignment.start, children: [
|
||||
IconButton(
|
||||
icon: element.selected
|
||||
? Icon(
|
||||
Icons.check,
|
||||
color: Colors.green[600],
|
||||
)
|
||||
: Icon(
|
||||
Icons.add,
|
||||
color: Colors.indigo,
|
||||
),
|
||||
onPressed: () => clickAddDetail(bloc, element),
|
||||
),
|
||||
SizedBox(width: 10),
|
||||
Flexible(
|
||||
fit: FlexFit.tight,
|
||||
flex: 8,
|
||||
child: InkWell(
|
||||
child: Text(
|
||||
element.name,
|
||||
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),
|
||||
),
|
||||
IconButton(
|
||||
|
||||
padding: EdgeInsets.all(0),
|
||||
icon: Icon(Icons.info, color: Colors.black12,),
|
||||
onPressed: () {
|
||||
|
||||
},
|
||||
),
|
||||
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),
|
||||
),
|
||||
IconButton(
|
||||
padding: EdgeInsets.all(0),
|
||||
icon: Icon(
|
||||
Icons.info,
|
||||
color: Colors.black12,
|
||||
),
|
||||
|
||||
]),
|
||||
)
|
||||
),
|
||||
children: [
|
||||
]
|
||||
)
|
||||
);
|
||||
|
||||
onPressed: () {},
|
||||
),
|
||||
]),
|
||||
)),
|
||||
children: []));
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_form_bloc/flutter_form_bloc.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
import '../library_keys.dart';
|
||||
|
||||
@ -133,27 +134,37 @@ class _LoginWidget extends State<LoginWidget> with Common, Trans {
|
||||
color: Colors.transparent,
|
||||
),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.end, children: <Widget>[
|
||||
new FlatButton(
|
||||
FlatButton(
|
||||
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())}),
|
||||
]),
|
||||
Divider(
|
||||
color: Colors.transparent,
|
||||
),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: <Widget>[
|
||||
new InkWell(
|
||||
child: new Text(AppLocalizations.of(context).translate('SignUp')),
|
||||
InkWell(
|
||||
child: Text(AppLocalizations.of(context).translate('SignUp')),
|
||||
onTap: () => Navigator.of(context).pushNamed('registration'),
|
||||
),
|
||||
Spacer(flex: 2),
|
||||
new InkWell(
|
||||
child: new Text(AppLocalizations.of(context).translate('I forgot the password')),
|
||||
InkWell(
|
||||
child: Text(AppLocalizations.of(context).translate('I forgot the password')),
|
||||
onTap: () => Navigator.of(context).pushNamed('resetPassword'),
|
||||
),
|
||||
Spacer(flex: 2),
|
||||
new InkWell(
|
||||
child: new Text(AppLocalizations.of(context).translate('Privacy')),
|
||||
InkWell(
|
||||
child: Text(AppLocalizations.of(context).translate('Privacy')),
|
||||
onTap: () => Navigator.of(context).pushNamed('gdpr'),
|
||||
),
|
||||
]),
|
||||
|
@ -63,13 +63,14 @@ class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Comm
|
||||
backgroundColor: Colors.orange,
|
||||
));
|
||||
} else if (state is DevelopmentByMuscleLoadingState) {
|
||||
LoadingDialog();
|
||||
//LoadingDialog.show(context);
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
if (state is DevelopmentByMuscleStateInitial) {
|
||||
return Container();
|
||||
} else {
|
||||
//LoadingDialog.hide(context);
|
||||
return TreeView(
|
||||
startExpanded: false,
|
||||
children: _getTreeChildren(bloc.workoutTreeRepository.sortedTree, bloc),
|
||||
@ -116,35 +117,30 @@ class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Comm
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
ChoiceChip(
|
||||
avatar: Icon(Icons.bubble_chart,),
|
||||
avatar: Icon(
|
||||
Icons.bubble_chart,
|
||||
),
|
||||
label: Text(t('Sum Of Mass')),
|
||||
|
||||
labelStyle: TextStyle(fontSize: 9,color: Colors.black),
|
||||
labelStyle: TextStyle(fontSize: 9, color: Colors.black),
|
||||
selectedColor: Colors.lightBlueAccent,
|
||||
selected: bloc.diagramType == DiagramType.sumMass,
|
||||
onSelected: (value) => {
|
||||
bloc.add(DevelopmentByMuscleDiagramTypeChange(diagramType: DiagramType.sumMass))
|
||||
},
|
||||
onSelected: (value) => {bloc.add(DevelopmentByMuscleDiagramTypeChange(diagramType: DiagramType.sumMass))},
|
||||
),
|
||||
ChoiceChip(
|
||||
avatar: Icon(Icons.accessibility_new),
|
||||
label: Text(t('One Max Rep')),
|
||||
labelStyle: TextStyle(fontSize: 9,color: Colors.black),
|
||||
labelStyle: TextStyle(fontSize: 9, color: Colors.black),
|
||||
selectedColor: Colors.lightBlueAccent,
|
||||
selected: bloc.diagramType == DiagramType.oneRepMax,
|
||||
onSelected: (value) => {
|
||||
bloc.add(DevelopmentByMuscleDiagramTypeChange(diagramType: DiagramType.oneRepMax))
|
||||
},
|
||||
onSelected: (value) => {bloc.add(DevelopmentByMuscleDiagramTypeChange(diagramType: DiagramType.oneRepMax))},
|
||||
),
|
||||
ChoiceChip(
|
||||
avatar: Icon(Icons.perm_device_information),
|
||||
label: Text(t('Percent')),
|
||||
labelStyle: TextStyle(fontSize: 9,color: Colors.black),
|
||||
labelStyle: TextStyle(fontSize: 9, color: Colors.black),
|
||||
selectedColor: Colors.lightBlueAccent,
|
||||
selected: bloc.diagramType == DiagramType.percent,
|
||||
onSelected: (value) => {
|
||||
bloc.add(DevelopmentByMuscleDiagramTypeChange(diagramType: DiagramType.percent))
|
||||
},
|
||||
onSelected: (value) => {bloc.add(DevelopmentByMuscleDiagramTypeChange(diagramType: DiagramType.percent))},
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -158,10 +154,7 @@ class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Comm
|
||||
disabledColor: Colors.black26,
|
||||
selectedColor: Colors.greenAccent,
|
||||
selected: bloc.dateRate == DateRate.daily,
|
||||
onSelected: (value) => {
|
||||
bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.daily))
|
||||
},
|
||||
|
||||
onSelected: (value) => {bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.daily))},
|
||||
),
|
||||
ChoiceChip(
|
||||
avatar: Icon(Icons.timer),
|
||||
@ -171,10 +164,7 @@ class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Comm
|
||||
disabledColor: Colors.white12,
|
||||
tooltip: "Heti bontás",
|
||||
selected: bloc.dateRate == DateRate.weekly,
|
||||
onSelected: (value) => {
|
||||
bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.weekly))
|
||||
},
|
||||
|
||||
onSelected: (value) => {bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.weekly))},
|
||||
),
|
||||
ChoiceChip(
|
||||
avatar: Icon(Icons.timer),
|
||||
@ -183,10 +173,7 @@ class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Comm
|
||||
selectedColor: Colors.greenAccent,
|
||||
disabledColor: Colors.black26,
|
||||
selected: bloc.dateRate == DateRate.monthly,
|
||||
onSelected: (value) => {
|
||||
bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.monthly))
|
||||
},
|
||||
|
||||
onSelected: (value) => {bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.monthly))},
|
||||
),
|
||||
ChoiceChip(
|
||||
avatar: Icon(Icons.timer),
|
||||
@ -195,16 +182,12 @@ class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Comm
|
||||
selectedColor: Colors.greenAccent,
|
||||
disabledColor: Colors.white70,
|
||||
selected: bloc.dateRate == DateRate.yearly,
|
||||
onSelected: (value) => {
|
||||
bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.yearly))
|
||||
},
|
||||
onSelected: (value) => {bloc.add(DevelopmentByMuscleDateRateChange(dateRate: DateRate.yearly))},
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
)
|
||||
);
|
||||
)));
|
||||
exerciseTypes.add(explanation);
|
||||
|
||||
tree.forEach((name, list) {
|
||||
@ -229,14 +212,14 @@ class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Comm
|
||||
listWorkoutTree.forEach((element) {
|
||||
bool hasNoData = (bloc.listChartData[element.exerciseTypeId] == null);
|
||||
String unit = " kg";
|
||||
if ( bloc.diagramType == DiagramType.percent) {
|
||||
if (bloc.diagramType == DiagramType.percent) {
|
||||
unit = " %";
|
||||
}
|
||||
list.add(SizedBox(
|
||||
width: cWidth * 0.85,
|
||||
height: hasNoData ? 0 : 200,
|
||||
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,
|
||||
child: Column(mainAxisSize: MainAxisSize.min, children: [
|
||||
hasNoData
|
||||
@ -253,58 +236,56 @@ class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Comm
|
||||
//fit: FlexFit.loose,
|
||||
child: BarChart(
|
||||
BarChartData(
|
||||
alignment: BarChartAlignment.spaceAround,
|
||||
barTouchData: BarTouchData(
|
||||
touchTooltipData: BarTouchTooltipData(
|
||||
tooltipBgColor: Colors.white70,
|
||||
getTooltipItem: (group, groupIndex, rod, rodIndex) {
|
||||
return BarTooltipItem(
|
||||
rod.y.toStringAsFixed(0) + unit,
|
||||
TextStyle(color: Colors.black54, fontSize: 12, fontWeight: FontWeight.bold),
|
||||
);
|
||||
}),
|
||||
),
|
||||
titlesData: FlTitlesData(
|
||||
show: true,
|
||||
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(
|
||||
alignment: BarChartAlignment.spaceAround,
|
||||
barTouchData: BarTouchData(
|
||||
touchTooltipData: BarTouchTooltipData(
|
||||
tooltipBgColor: Colors.white70,
|
||||
getTooltipItem: (group, groupIndex, rod, rodIndex) {
|
||||
return BarTooltipItem(
|
||||
rod.y.toStringAsFixed(0) + unit,
|
||||
TextStyle(color: Colors.black54, fontSize: 12, fontWeight: FontWeight.bold),
|
||||
);
|
||||
}),
|
||||
),
|
||||
titlesData: FlTitlesData(
|
||||
show: true,
|
||||
bottomTitles: 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,
|
||||
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,
|
||||
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),
|
||||
),
|
||||
)
|
||||
@ -316,5 +297,3 @@ class _MyDevelopmentMuscleState extends State<MyDevelopmentMusclePage> with Comm
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -12,6 +12,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
//import 'package:flutter_facebook_login/flutter_facebook_login.dart';
|
||||
import 'package:flutter_form_bloc/flutter_form_bloc.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
import '../library_keys.dart';
|
||||
|
||||
@ -137,7 +138,17 @@ class _RegistrationWidget extends State<RegistrationWidget> with Common, Trans {
|
||||
),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.end, children: <Widget>[
|
||||
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())}),
|
||||
]),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: <Widget>[
|
||||
|
@ -8,6 +8,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_form_bloc/flutter_form_bloc.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
import '../library_keys.dart';
|
||||
|
||||
@ -66,6 +67,9 @@ class ResetPasswordPage extends StatelessWidget with Trans {
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(left: 25, right: 50),
|
||||
child: ListView(shrinkWrap: false, padding: EdgeInsets.only(top: 150.0), children: <Widget>[
|
||||
Divider(
|
||||
color: Colors.transparent,
|
||||
),
|
||||
Divider(),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
@ -95,7 +99,17 @@ class ResetPasswordPage extends StatelessWidget with Trans {
|
||||
Row(mainAxisAlignment: MainAxisAlignment.end, children: <Widget>[
|
||||
new FlatButton(
|
||||
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())}),
|
||||
]),
|
||||
Divider(
|
||||
|
@ -8,10 +8,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
|
||||
|
||||
class SettingsPage extends StatelessWidget{
|
||||
|
||||
class SettingsPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// ignore: close_sinks
|
||||
@ -40,75 +37,54 @@ class SettingsPage extends StatelessWidget{
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('asset/image/WT_light_background.png'),
|
||||
fit: BoxFit.cover,
|
||||
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();
|
||||
}
|
||||
}
|
||||
),
|
||||
fit: BoxFit.cover,
|
||||
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) {
|
||||
//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) {
|
||||
return ListView(
|
||||
padding: EdgeInsets.only(top: 150),
|
||||
children: <Widget>[
|
||||
ListTile(
|
||||
return ListView(padding: EdgeInsets.only(top: 150), children: <Widget>[
|
||||
ListTile(
|
||||
leading: Icon(Icons.language),
|
||||
subtitle: Text(
|
||||
AppLocalizations.of(context).translate(
|
||||
"Change App Language")),
|
||||
subtitle: Text(AppLocalizations.of(context).translate("Change App Language")),
|
||||
title: DropdownButton(
|
||||
|
||||
value: settingsBloc.getLocale() == Locale('en')
|
||||
? AppLocalizations.of(context).translate(
|
||||
"English")
|
||||
: AppLocalizations.of(context).translate(
|
||||
"Hungarian"),
|
||||
items: [AppLocalizations.of(context).translate(
|
||||
"English"), AppLocalizations.of(context)
|
||||
.translate("Hungarian")
|
||||
]
|
||||
.map<DropdownMenuItem<String>>((String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
value: value,
|
||||
child: Text(value),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (String lang) =>
|
||||
{
|
||||
settingsBloc.add(
|
||||
SettingsChangeLanguage(language: lang)
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
),
|
||||
]
|
||||
);
|
||||
value: settingsBloc.getLocale() == Locale('en')
|
||||
? AppLocalizations.of(context).translate("English")
|
||||
: AppLocalizations.of(context).translate("Hungarian"),
|
||||
items: [AppLocalizations.of(context).translate("English"), AppLocalizations.of(context).translate("Hungarian")]
|
||||
.map<DropdownMenuItem<String>>((String value) {
|
||||
return DropdownMenuItem<String>(
|
||||
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) {
|
||||
setContext(context);
|
||||
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();
|
||||
return Form(
|
||||
child: Scaffold(
|
||||
|
Loading…
Reference in New Issue
Block a user