Dropdown Changed

dev_v3.13.6_voipcall
devamirsaleemahmad 2 years ago
parent 413535ef0b
commit 9d1b153739

@ -1,5 +1,6 @@
import 'dart:math';
import 'package:diplomaticquarterapp/main.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
@ -20,7 +21,7 @@ class BMICalculator extends StatefulWidget {
}
class _BMICalculatorState extends State<BMICalculator> {
TextEditingController textController = new TextEditingController();
TextEditingController textController = TextEditingController();
String? textResult;
String? msg;
double? bmiResult;
@ -28,8 +29,8 @@ class _BMICalculatorState extends State<BMICalculator> {
TextEditingController _heightController = TextEditingController();
TextEditingController _weightController = TextEditingController();
List<PopupMenuItem> _weightPopupList =[];
List<PopupMenuItem> _heightPopupList =[];
List<PopupMenuItem> _weightPopupList = [];
List<PopupMenuItem> _heightPopupList = [];
bool _isHeightCM = true;
bool _isWeightKG = true;
@ -267,13 +268,24 @@ class _BMICalculatorState extends State<BMICalculator> {
Expanded(
flex: 1,
child: PopupMenuButton(
child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, (){}),
onSelected: (value) {
// Changed By Aamir
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,
),
)
],
).withBorderedContainer;
@ -281,24 +293,31 @@ class _BMICalculatorState extends State<BMICalculator> {
}
// todo 'sikander' move these to separate file once usability known
class CommonDropDownView extends StatelessWidget {
class CommonDropDownView extends StatefulWidget {
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);
CommonDropDownView(this.title, this.value, this.callback, {Key? key, this.iconData}) : super(key: key);
@override
State<CommonDropDownView> createState() => _CommonDropDownViewState();
}
class _CommonDropDownViewState extends State<CommonDropDownView> {
@override
Widget build(BuildContext context) {
return InkWell(
onTap: callback,
return GestureDetector(
onTapDown: (val) {
widget.callback(val);
},
child: Row(
children: [
Expanded(
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Text(
title,
widget.title,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
@ -307,7 +326,7 @@ class CommonDropDownView extends StatelessWidget {
),
),
Text(
value,
widget.value,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w400,
@ -318,7 +337,7 @@ class CommonDropDownView extends StatelessWidget {
]),
),
Icon(
iconData ?? Icons.keyboard_arrow_down_sharp,
widget.iconData ?? Icons.keyboard_arrow_down_sharp,
color: Color(0xff2E303A),
)
],

@ -607,12 +607,22 @@ class _BmrCalculatorState extends State<BmrCalculator> {
Expanded(
flex: 1,
child: PopupMenuButton(
child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, (){}),
onSelected: (value) {
//Changed By Aamir
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),
)
],
@ -624,7 +634,7 @@ class _BmrCalculatorState extends State<BmrCalculator> {
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);
@ -632,7 +642,7 @@ class CommonDropDownView extends StatelessWidget {
@override
Widget build(BuildContext context) {
return InkWell(
onTap: callback,
onTapDown: (val) => callback(val),
child: Row(
children: [
Expanded(

@ -31,7 +31,7 @@ class BmrResultPage extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Padding(
padding: const EdgeInsets.all(20.0),
padding: const EdgeInsets.only(right: 20.0,left: 20,top: 20,bottom: 20),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
@ -47,7 +47,7 @@ class BmrResultPage extends StatelessWidget {
mHeight(20),
Center(
child: CircularPercentIndicator(
radius: 220.0,
radius: 120.0,
lineWidth: 3.0,
percent: ((this.bmrResult > 3500) ? 100 : this.bmrResult / 3500),
center: Column(
@ -78,7 +78,7 @@ class BmrResultPage extends StatelessWidget {
backgroundColor: Colors.white,
),
),
mHeight(20),
mHeight(50),
Text(
TranslationBase.of(context).bodyWillBurn+' ( ${bmrResult.toStringAsFixed(1)} )'+TranslationBase.of(context).caloriesEachDay+'( ${calories.toStringAsFixed(1)} ) '+TranslationBase.of(context).maintainWeight,
style: TextStyle(

@ -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(

@ -33,8 +33,8 @@ class _CalorieCalculatorState extends State<CalorieCalculator> {
double _heightValue = 150;
double _weightValue = 40;
TextEditingController ageController = new TextEditingController();
TextEditingController _heightController = new TextEditingController();
TextEditingController ageController = TextEditingController();
TextEditingController _heightController = TextEditingController();
TextEditingController _weightController = TextEditingController();
List<PopupMenuItem> _heightPopupList = [];
@ -48,10 +48,9 @@ class _CalorieCalculatorState extends State<CalorieCalculator> {
@override
void initState() {
super.initState();
}
void updateColor(int type) {
//MG/DLT card
if (type == 1) {
@ -80,14 +79,12 @@ class _CalorieCalculatorState extends State<CalorieCalculator> {
}
}
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
_weightPopupList = <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)];
dropdownValue= TranslationBase.of(context).almostInactive;
dropdownValue = TranslationBase.of(context).almostInactive;
return AppScaffold(
isShowAppBar: true,
isShowDecPage: false,
@ -296,7 +293,7 @@ class _CalorieCalculatorState extends State<CalorieCalculator> {
height: 18,
child: DropdownButtonHideUnderline(
child: DropdownButton<String>(
value:dropdownValue,
value: dropdownValue,
key: clinicDropdownKey,
icon: Icon(Icons.arrow_downward),
iconSize: 0,
@ -563,11 +560,22 @@ class _CalorieCalculatorState extends State<CalorieCalculator> {
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),
)
],
@ -579,7 +587,7 @@ class _CalorieCalculatorState extends State<CalorieCalculator> {
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);
@ -587,7 +595,7 @@ class CommonDropDownView extends StatelessWidget {
@override
Widget build(BuildContext context) {
return InkWell(
onTap: callback,
onTapDown: (val) => callback(val),
child: Row(
children: [
Expanded(

@ -47,7 +47,7 @@ class CalorieResultPage extends StatelessWidget {
mHeight(20),
Center(
child: CircularPercentIndicator(
radius: 220.0,
radius: 120.0,
lineWidth: 3.0,
percent: ((this.calorie > 3500) ? 100 : this.calorie / 3500),
center: Column(

@ -283,7 +283,6 @@ class _IdealBodyState extends State<IdealBody> {
);
}
void openDropdown(GlobalKey key) {
GestureDetector? detector;
@ -305,7 +304,7 @@ class _IdealBodyState extends State<IdealBody> {
detector!.onTap!();
}
// void openDropdown(GlobalKey key) {
// GestureDetector detector;
// void searchForGestureDetector(BuildContext element) {
@ -476,12 +475,22 @@ class _IdealBodyState extends State<IdealBody> {
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),
)
],
@ -493,7 +502,7 @@ class _IdealBodyState extends State<IdealBody> {
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);
@ -501,7 +510,7 @@ class CommonDropDownView extends StatelessWidget {
@override
Widget build(BuildContext context) {
return InkWell(
onTap: callback,
onTapDown: (val) => callback(val),
child: Row(
children: [
Expanded(

@ -128,8 +128,8 @@ class LocationUtils {
heading: 0.0,
speed: 0.0,
speedAccuracy: 1,
// altitudeAccuracy: 0,
// headingAccuracy: 0,
altitudeAccuracy: 0,
headingAccuracy: 0,
// Added by Aamir
),
);

Loading…
Cancel
Save