Dropdown Changed

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

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

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

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

@ -32,15 +32,15 @@ class _BodyFatState extends State<BodyFat> {
double _waistValue = 0; double _waistValue = 0;
double _hipValue = 0; double _hipValue = 0;
TextEditingController _heightController = new TextEditingController(); TextEditingController _heightController = TextEditingController();
TextEditingController _neckController = TextEditingController(); TextEditingController _neckController = TextEditingController();
TextEditingController _waistController = TextEditingController(); TextEditingController _waistController = TextEditingController();
TextEditingController _hipController = TextEditingController(); TextEditingController _hipController = TextEditingController();
List<PopupMenuItem> _heightPopupList =[]; List<PopupMenuItem> _heightPopupList = [];
List<PopupMenuItem> _neckPopupList =[]; List<PopupMenuItem> _neckPopupList = [];
List<PopupMenuItem> _waistPopupList =[]; List<PopupMenuItem> _waistPopupList = [];
List<PopupMenuItem> _hipPopupList =[]; List<PopupMenuItem> _hipPopupList = [];
bool isMale = false; bool isMale = false;
@ -211,11 +211,51 @@ class _BodyFatState extends State<BodyFat> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
_neckPopupList = <PopupMenuItem>[PopupMenuItem(child: Text(TranslationBase.of(context).kg), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).lb), value: false)]; _neckPopupList = <PopupMenuItem>[
_heightPopupList = <PopupMenuItem>[PopupMenuItem(child: Text(TranslationBase.of(context).cm), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).ft), value: false)]; 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)]; _waistPopupList = <PopupMenuItem>[
_hipPopupList = <PopupMenuItem>[PopupMenuItem(child: Text(TranslationBase.of(context).cm), value: true), PopupMenuItem(child: Text(TranslationBase.of(context).ft), value: false)]; 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( return AppScaffold(
isShowAppBar: true, isShowAppBar: true,
@ -628,12 +668,25 @@ class _BodyFatState extends State<BodyFat> {
Expanded( Expanded(
flex: 1, flex: 1,
child: PopupMenuButton( child: PopupMenuButton(
child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, (){}), child: CommonDropDownView(
onSelected: (value) { TranslationBase.of(context).unit,
print("Changed By Aamir"); unitTitle,
// onUnitTap(value); (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; ).withBorderedContainer;
@ -644,15 +697,15 @@ class _BodyFatState extends State<BodyFat> {
class CommonDropDownView extends StatelessWidget { class CommonDropDownView extends StatelessWidget {
final String title; final String title;
final String value; final String value;
final VoidCallback callback; void Function(TapDownDetails details) callback;
final IconData? iconData; 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return InkWell( return GestureDetector(
onTap: callback, onTapDown: (val) => callback(val),
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(

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

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

@ -283,7 +283,6 @@ class _IdealBodyState extends State<IdealBody> {
); );
} }
void openDropdown(GlobalKey key) { void openDropdown(GlobalKey key) {
GestureDetector? detector; GestureDetector? detector;
@ -476,12 +475,22 @@ class _IdealBodyState extends State<IdealBody> {
Expanded( Expanded(
flex: 1, flex: 1,
child: PopupMenuButton( child: PopupMenuButton(
child: CommonDropDownView(TranslationBase.of(context).unit, unitTitle, (){}), child: CommonDropDownView(
onSelected: (value) { TranslationBase.of(context).unit,
unitTitle,
print("Changed By Aamir"); (val) async {
// onUnitTap(value); 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),
) )
], ],
@ -493,7 +502,7 @@ class _IdealBodyState extends State<IdealBody> {
class CommonDropDownView extends StatelessWidget { class CommonDropDownView extends StatelessWidget {
final String title; final String title;
final String value; final String value;
final VoidCallback callback; void Function(TapDownDetails details) callback;
final IconData? iconData; 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);
@ -501,7 +510,7 @@ class CommonDropDownView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return InkWell( return InkWell(
onTap: callback, onTapDown: (val) => callback(val),
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(

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

Loading…
Cancel
Save