updated the code

dev
suresh 2 years ago
parent feaccc2080
commit 5e7a14fd3e

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 KiB

After

Width:  |  Height:  |  Size: 412 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 237 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 670 B

After

Width:  |  Height:  |  Size: 834 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1000 B

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 10 KiB

@ -21,6 +21,8 @@ class _AddTankersState extends State<AddTankers> {
TextEditingController tankerDrinkingPriceController = TextEditingController();
TextEditingController tankerBorePriceController = TextEditingController();
TextEditingController tankerCapacityController = TextEditingController();
TextEditingController tankerPriceController = TextEditingController();
bool isCapacityText = false;
@ -48,16 +50,16 @@ class _AddTankersState extends State<AddTankers> {
bool isPriceDrinking = false;
bool isPriceBore = false;*/
List waterTypes = [];
List waterPrice = [];
List updateWaterTypes = [];
late TabController _controller;
String dropdownTypeOfWater = 'Bore water';
String dropdownTypeOfWaterForUpadetBore = 'Bore water';
String dropdownTypeOfWaterForTanker = 'Drinking';
String dropdownTypeOfWater = 'Bore water';
var typeOfWaterItems = [
'Bore water',
'Drinking Water',
@ -236,40 +238,94 @@ class _AddTankersState extends State<AddTankers> {
SizedBox(
height: 5,
),
Visibility(
visible: false, //isCapacityText
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
child: const Text(
'Add Capacity',
style: TextStyle(
fontSize: 15,
decoration: TextDecoration.underline,
color: primaryColor),
Container(
padding: const EdgeInsets.fromLTRB(10, 10, 10, 0),
child: DropdownButtonFormField(
// Initial Value
value: dropdownTypeOfWater,
isExpanded: true,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.water,
color: greyColor,
),
onPressed: () {
// showCapacityDialog();
},
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
/* Text('Add Capacity'),
IconButton(
iconSize: 20,
icon: const Icon(
Icons.add,
color: primaryColor,
labelText: 'Type of water storage',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
onPressed: () {
showCapacityDialog();
),
hint: Text('Select Type of water'),
// Down Arrow Icon
icon: const Icon(Icons.keyboard_arrow_down),
// Array list of items
items: typeOfWaterItems.map((String items) {
return DropdownMenuItem(
value: items,
child: Text(items),
);
}).toList(),
// After selecting the desired option,it will
// change button value to selected value
onChanged: (String? newValue) {
setState(() {
dropdownTypeOfWater = newValue!;
});
},
),*/
],
),
),
SizedBox(
const SizedBox(
height: 30,
),
Container(
padding: const EdgeInsets.all(10),
child: TextFormField(
cursorColor: greyColor,
controller:tankerPriceController,
keyboardType: TextInputType.number,
maxLength: 10,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.currency_rupee,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter Price',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
), //alternative phone number
const SizedBox(
height: 5,
),
/*
Container(
padding: EdgeInsets.fromLTRB(20, 0, 20, 0),
child: Visibility(
@ -322,9 +378,9 @@ class _AddTankersState extends State<AddTankers> {
cursorColor: greyColor,
controller: tankerDrinkingPriceController,
keyboardType: TextInputType.number,
/*onSaved: (v){
*//*onSaved: (v){
waterPrice.add({'price': v.toString()});
},*/
},*//*
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.currency_rupee,
@ -419,7 +475,7 @@ class _AddTankersState extends State<AddTankers> {
),
SizedBox(
height: 20,
),
),*/
Container(
width: MediaQuery.of(context).size.width * .99,
height: 50,
@ -435,30 +491,32 @@ class _AddTankersState extends State<AddTankers> {
tankerPhoneNumberController.text != '' &&
tankerAlternativePhoneNumberController.text != '' &&
tankerCapacityController.text != '' &&
waterTypes.isNotEmpty) {
waterPrice=[];
tankerPriceController.text != '') {
/* waterPrice=[];
if(isDrinkingChecked){
waterPrice.add({'price': tankerDrinkingPriceController.text.toString()});
}
/*else{
*//*else{
waterTypes.removeWhere((e) => e['price'].toString() == tankerDrinkingPriceController.text.toString());
}*/
}*//*
else if(isBoreChecked){
waterPrice.add({'price': tankerBorePriceController.text.toString()});
}
/*else{
*//*else{
waterTypes.removeWhere((e) => e['price'].toString() == tankerBorePriceController.text.toString());
}*/
}*//*
*/
var payload = new Map<String, dynamic>();
payload["tankerName"] = tankerNameController.text.toString();
payload["phoneNumber"] = tankerPhoneNumberController.text.toString();
payload["alternative_phoneNumber"] = tankerAlternativePhoneNumberController.text.toString();
payload["capacity"] = tankerCapacityController.text.toString();
payload["typeofwater"] = waterTypes;
payload["price"] = waterPrice;
// payload["typeofwater"] = waterTypes;
payload["typeofwater"] =dropdownTypeOfWater.toString();
//payload["price"] = waterPrice;
payload["price"] = tankerPriceController.text.toString();
payload["supplier_address"] = AppSettings.supplierAddress;
payload["supplier_name"] = AppSettings.suppliername;
@ -472,8 +530,9 @@ class _AddTankersState extends State<AddTankers> {
tankerPhoneNumberController.text = '';
tankerCapacityController.text = '';
tankerAlternativePhoneNumberController.text='';
tankerDrinkingPriceController.text='';
tankerBorePriceController.text='';
tankerPriceController.text='';
//tankerDrinkingPriceController.text='';
//tankerBorePriceController.text='';
waterPrice=[];
waterTypes=[];
isDrinkingChecked=false;

@ -6,8 +6,12 @@ class GetTanksDetailsModel {
String tanker_phone = '';
String tanker_alterphone = '';
String capacity='';
String waterprice='';
Color cardColor=Colors.white;
String type_of_water='';
List type_of_water=[];
/*List type_of_water=[];
List showTypeofWater=[];
String water_type='';
@ -20,7 +24,7 @@ class GetTanksDetailsModel {
bool isDrinking=false;
bool isBore=false;
List updatedWaterTypes=[];
List updatePrice=[];
List updatePrice=[];*/
GetTanksDetailsModel();
@ -31,15 +35,12 @@ class GetTanksDetailsModel {
rtvm.tanker_phone = json['phoneNumber'] ?? '';
rtvm.tanker_alterphone = json['alternative_phoneNumber'] ?? '';
rtvm.capacity = json['capacity'] ??'';
rtvm.waterprice = json['price'] ??'';
rtvm.type_of_water = json['typeofwater'] ??"";
rtvm.type_of_water = json['typeofwater'] ??[];
rtvm.type_of_water.forEach((element) {
/* rtvm.type_of_water.forEach((element) {
rtvm.showTypeofWater.add(element['typeofwater']);
rtvm.water_type=rtvm.showTypeofWater.join(",");
if(element['typeofwater'].toString().toLowerCase()=='drinking water'){
rtvm.isDrinking=true;
rtvm.updatedWaterTypes.add({'typeofwater': 'Drinking Water'});
@ -49,20 +50,16 @@ class GetTanksDetailsModel {
rtvm.updatedWaterTypes.add({'typeofwater': 'Bore Water'});
}
});*/
});
rtvm.price = json['price'] ?? [];
/* rtvm.price = json['price'] ?? [];
rtvm.price.forEach((element) {
rtvm.pricetype.add(element['price']);
rtvm.price_ui=rtvm.pricetype.join(",");
});
*/
return rtvm;
}

@ -61,6 +61,7 @@ class AppSettings {
static String suppliername = '';
static String email = '';
static String phoneNumber = '';
static String description = '';
static String accessToken = '';
static String customerId = '';
static String supplierId = '';
@ -324,6 +325,7 @@ class AppSettings {
suppliername = _response['suppliername'];
phoneNumber = _response['phone'];
email = _response['emails'][0]['email'];
description = _response['description'];
return true;
} else {

@ -27,14 +27,20 @@ class _TankersViewState extends State<TankersView> {
TextEditingController updateTankerPhoneNumberController = TextEditingController();
TextEditingController updateTankerAlternatePhoneNumberController = TextEditingController();
TextEditingController updateTankerCapacityController = TextEditingController();
TextEditingController updateTankerpriceController = TextEditingController();
TextEditingController tankerBorePriceController = TextEditingController();
TextEditingController tankerDrinkingPriceController = TextEditingController();
bool isLoading=false;
bool isDrinkingChecked = false;
/*bool isDrinkingChecked = false;
bool isBoreChecked = false;
List waterTypes = [];
List waterPrice = [];
List waterPrice = [];*/
String dropdownTypeOfWater = 'bore water';
var typeOfWaterItems = [
'bore water',
'drinking water',
];
List updateWaterTypes = [];
@ -62,8 +68,14 @@ class _TankersViewState extends State<TankersView> {
updateTankerDescriptionController.text = '';
updateTankerPhoneNumberController.text = object.tanker_phone;
updateTankerCapacityController.text=object.capacity;
updateTankerpriceController.text=object.waterprice;
updateTankerAlternatePhoneNumberController.text = object.tanker_alterphone;
isDrinkingChecked=object.isDrinking;
setState(() {
dropdownTypeOfWater=object.type_of_water.toString().toLowerCase()??'';
});
/* isDrinkingChecked=object.isDrinking;
isBoreChecked = object.isBore;
if(object.pricetype.length==2){
tankerDrinkingPriceController.text=object.pricetype[0].toString();
@ -72,7 +84,7 @@ class _TankersViewState extends State<TankersView> {
else{
tankerDrinkingPriceController.text=object.pricetype[0].toString();
tankerBorePriceController.text='';
}
}*/
return showDialog(
@ -219,7 +231,97 @@ class _TankersViewState extends State<TankersView> {
const SizedBox(
height: 30,
),
Container(
child: DropdownButtonFormField(
// Initial Value
value: dropdownTypeOfWater,
isExpanded: true,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.water,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Type of water storage',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
hint: Text('Select Type of water'),
// Down Arrow Icon
icon: const Icon(Icons.keyboard_arrow_down),
// Array list of items
items: typeOfWaterItems.map((String items) {
return DropdownMenuItem(
value: items,
child: Text(items),
);
}).toList(),
// After selecting the desired option,it will
// change button value to selected value
onChanged: (String? newValue) {
setState(() {
dropdownTypeOfWater = newValue!;
});
},
),
),
const SizedBox(
height: 30,
),
Container(
//padding: const EdgeInsets.fromLTRB(10, 10, 10, 0),
child: TextFormField(
cursorColor: greyColor,
controller: updateTankerpriceController,
textCapitalization: TextCapitalization.characters,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.currency_rupee,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter update price',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
), //tanker name
),
/*Container(
padding: EdgeInsets.fromLTRB(20, 0, 20, 0),
child: Visibility(
visible: true,
@ -362,7 +464,7 @@ class _TankersViewState extends State<TankersView> {
)
],
))
),
),*/
],
),
),
@ -377,9 +479,8 @@ class _TankersViewState extends State<TankersView> {
child: Text('Update', style: textButtonStyle()),
onPressed: () async {
if (updateTankerNameController.text != '' &&
updateTankerPhoneNumberController.text != '' &&
object.updatedWaterTypes.isNotEmpty ) {
updateTankerPhoneNumberController.text != '') {
/*
waterPrice=[];
if(isDrinkingChecked){
waterPrice.add({'price': tankerDrinkingPriceController.text.toString()});
@ -387,7 +488,7 @@ class _TankersViewState extends State<TankersView> {
if(isBoreChecked){
waterPrice.add({'price': tankerBorePriceController.text.toString()});
}
}*/
AppSettings.preLoaderDialog(context);
@ -397,8 +498,9 @@ class _TankersViewState extends State<TankersView> {
payload["phoneNumber"] = updateTankerPhoneNumberController.text.toString();
payload["alternative_phoneNumber"] = updateTankerAlternatePhoneNumberController.text.toString();
payload["capacity"] = updateTankerCapacityController.text.toString();
payload["typeofwater"] = object.updatedWaterTypes;
payload["price"] = waterPrice;
// payload["typeofwater"] = object.updatedWaterTypes;
payload["typeofwater"] = dropdownTypeOfWater.toString();
payload["price"] = updateTankerpriceController.text.toString();
payload["supplier_address"] = AppSettings.supplierAddress;
payload["supplier_name"] = AppSettings.suppliername;
@ -413,6 +515,7 @@ class _TankersViewState extends State<TankersView> {
updateTankerPhoneNumberController.text = '';
updateTankerAlternatePhoneNumberController.text='';
updateTankerCapacityController.text='';
updateTankerpriceController.text='';
Navigator.of(context).pop();
await readJson();
} else {
@ -490,8 +593,8 @@ class _TankersViewState extends State<TankersView> {
Text(modelTanksViewList[index].tanker_phone,style: valuesTextStyle()),
Text(modelTanksViewList[index].tanker_alterphone,style: valuesTextStyle()),
Text(modelTanksViewList[index].capacity+' Ltrs',style: valuesTextStyle()),
Text(modelTanksViewList[index].water_type,style: valuesTextStyle()),
Text(modelTanksViewList[index].price_ui,style: valuesTextStyle()),
Text(modelTanksViewList[index].type_of_water,style: valuesTextStyle()),
Text(modelTanksViewList[index].waterprice,style: valuesTextStyle()),
],
),

@ -35,6 +35,8 @@ class _UpdateprofileState extends State<UpdateProfile> {
nameController.text=AppSettings.suppliername;
mobileNumberController.text=AppSettings.phoneNumber;
emailController.text=AppSettings.email;
descriptionController.text=AppSettings.description;
// descriptionController.text=AppSettings.suppliername;
@ -296,6 +298,9 @@ class _UpdateprofileState extends State<UpdateProfile> {
payload["suppliername"] = nameController.text.toString();
payload["phone"] = mobileNumberController.text.toString();
payload["emails"] = [{"email":emailController.text.toString()}];
payload["description"] = descriptionController.text.toString();
payload["status"] = "active";
bool signUpStatus = await AppSettings.updateProfile(payload);
try{
if (signUpStatus) {

Loading…
Cancel
Save