|
|
|
|
@ -32,15 +32,15 @@ class _BodyFatState extends State<BodyFat> {
|
|
|
|
|
double _waistValue = 0;
|
|
|
|
|
double _hipValue = 0;
|
|
|
|
|
|
|
|
|
|
TextEditingController _heightController = new TextEditingController();
|
|
|
|
|
TextEditingController _heightController = TextEditingController();
|
|
|
|
|
TextEditingController _neckController = TextEditingController();
|
|
|
|
|
TextEditingController _waistController = TextEditingController();
|
|
|
|
|
TextEditingController _hipController = TextEditingController();
|
|
|
|
|
|
|
|
|
|
List<PopupMenuItem> _heightPopupList =[];
|
|
|
|
|
List<PopupMenuItem> _neckPopupList =[];
|
|
|
|
|
List<PopupMenuItem> _waistPopupList =[];
|
|
|
|
|
List<PopupMenuItem> _hipPopupList =[];
|
|
|
|
|
List<PopupMenuItem> _heightPopupList = [];
|
|
|
|
|
List<PopupMenuItem> _neckPopupList = [];
|
|
|
|
|
List<PopupMenuItem> _waistPopupList = [];
|
|
|
|
|
List<PopupMenuItem> _hipPopupList = [];
|
|
|
|
|
|
|
|
|
|
bool isMale = false;
|
|
|
|
|
|
|
|
|
|
@ -211,11 +211,51 @@ class _BodyFatState extends State<BodyFat> {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
_neckPopupList = <PopupMenuItem>[PopupMenuItem(child: Text(TranslationBase.of(context).kg), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).lb), value: false)];
|
|
|
|
|
_heightPopupList = <PopupMenuItem>[PopupMenuItem(child: Text(TranslationBase.of(context).cm), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).ft), value: false)];
|
|
|
|
|
_neckPopupList = <PopupMenuItem>[
|
|
|
|
|
PopupMenuItem(
|
|
|
|
|
child: Text(TranslationBase.of(context).kg),
|
|
|
|
|
value: true,
|
|
|
|
|
),
|
|
|
|
|
PopupMenuItem(
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).lb,
|
|
|
|
|
),
|
|
|
|
|
value: false)
|
|
|
|
|
];
|
|
|
|
|
_heightPopupList = <PopupMenuItem>[
|
|
|
|
|
PopupMenuItem(
|
|
|
|
|
child: Text(TranslationBase.of(context).cm),
|
|
|
|
|
value: true,
|
|
|
|
|
),
|
|
|
|
|
PopupMenuItem(
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).ft,
|
|
|
|
|
),
|
|
|
|
|
value: false)
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
_waistPopupList = <PopupMenuItem>[PopupMenuItem(child: Text(TranslationBase.of(context).kg), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).lb), value: false)];
|
|
|
|
|
_hipPopupList = <PopupMenuItem>[PopupMenuItem(child: Text(TranslationBase.of(context).cm), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).ft), value: false)];
|
|
|
|
|
_waistPopupList = <PopupMenuItem>[
|
|
|
|
|
PopupMenuItem(
|
|
|
|
|
child: Text(TranslationBase.of(context).kg),
|
|
|
|
|
value: true,
|
|
|
|
|
),
|
|
|
|
|
PopupMenuItem(
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).lb,
|
|
|
|
|
),
|
|
|
|
|
value: false)
|
|
|
|
|
];
|
|
|
|
|
_hipPopupList = <PopupMenuItem>[
|
|
|
|
|
PopupMenuItem(
|
|
|
|
|
child: Text(TranslationBase.of(context).cm),
|
|
|
|
|
value: true,
|
|
|
|
|
),
|
|
|
|
|
PopupMenuItem(
|
|
|
|
|
child: Text(
|
|
|
|
|
TranslationBase.of(context).ft,
|
|
|
|
|
),
|
|
|
|
|
value: false)
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
return AppScaffold(
|
|
|
|
|
isShowAppBar: true,
|
|
|
|
|
@ -628,12 +668,25 @@ class _BodyFatState extends State<BodyFat> {
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 1,
|
|
|
|
|
child: PopupMenuButton(
|
|
|
|
|
child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, (){}),
|
|
|
|
|
onSelected: (value) {
|
|
|
|
|
print("Changed By Aamir");
|
|
|
|
|
// onUnitTap(value);
|
|
|
|
|
child: CommonDropDownView(
|
|
|
|
|
TranslationBase.of(context).unit,
|
|
|
|
|
unitTitle,
|
|
|
|
|
(val) async {
|
|
|
|
|
final RenderBox overlay = Overlay.of(context).context.findRenderObject() as RenderBox;
|
|
|
|
|
await showMenu(
|
|
|
|
|
context: context,
|
|
|
|
|
position: RelativeRect.fromRect(val.globalPosition & const Size(40, 40), Offset.zero & overlay.size),
|
|
|
|
|
items: _list,
|
|
|
|
|
elevation: 8.0,
|
|
|
|
|
).then((val) {
|
|
|
|
|
print(val);
|
|
|
|
|
onUnitTap(val);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
itemBuilder: (context) => _list),
|
|
|
|
|
),
|
|
|
|
|
itemBuilder: (context) => _list,
|
|
|
|
|
enabled: true,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
).withBorderedContainer;
|
|
|
|
|
@ -644,15 +697,15 @@ class _BodyFatState extends State<BodyFat> {
|
|
|
|
|
class CommonDropDownView extends StatelessWidget {
|
|
|
|
|
final String title;
|
|
|
|
|
final String value;
|
|
|
|
|
final VoidCallback callback;
|
|
|
|
|
void Function(TapDownDetails details) callback;
|
|
|
|
|
final IconData? iconData;
|
|
|
|
|
|
|
|
|
|
CommonDropDownView(this.title, this.value, this.callback, {Key? key, this.iconData}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return InkWell(
|
|
|
|
|
onTap: callback,
|
|
|
|
|
return GestureDetector(
|
|
|
|
|
onTapDown: (val) => callback(val),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
|