|
|
@ -27,14 +27,20 @@ class _TankersViewState extends State<TankersView> {
|
|
|
|
TextEditingController updateTankerPhoneNumberController = TextEditingController();
|
|
|
|
TextEditingController updateTankerPhoneNumberController = TextEditingController();
|
|
|
|
TextEditingController updateTankerAlternatePhoneNumberController = TextEditingController();
|
|
|
|
TextEditingController updateTankerAlternatePhoneNumberController = TextEditingController();
|
|
|
|
TextEditingController updateTankerCapacityController = TextEditingController();
|
|
|
|
TextEditingController updateTankerCapacityController = TextEditingController();
|
|
|
|
|
|
|
|
TextEditingController updateTankerpriceController = TextEditingController();
|
|
|
|
TextEditingController tankerBorePriceController = TextEditingController();
|
|
|
|
TextEditingController tankerBorePriceController = TextEditingController();
|
|
|
|
TextEditingController tankerDrinkingPriceController = TextEditingController();
|
|
|
|
TextEditingController tankerDrinkingPriceController = TextEditingController();
|
|
|
|
|
|
|
|
|
|
|
|
bool isLoading=false;
|
|
|
|
bool isLoading=false;
|
|
|
|
bool isDrinkingChecked = false;
|
|
|
|
/*bool isDrinkingChecked = false;
|
|
|
|
bool isBoreChecked = false;
|
|
|
|
bool isBoreChecked = false;
|
|
|
|
List waterTypes = [];
|
|
|
|
List waterTypes = [];
|
|
|
|
List waterPrice = [];
|
|
|
|
List waterPrice = [];*/
|
|
|
|
|
|
|
|
String dropdownTypeOfWater = 'bore water';
|
|
|
|
|
|
|
|
var typeOfWaterItems = [
|
|
|
|
|
|
|
|
'bore water',
|
|
|
|
|
|
|
|
'drinking water',
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
List updateWaterTypes = [];
|
|
|
|
List updateWaterTypes = [];
|
|
|
|
|
|
|
|
|
|
|
@ -62,8 +68,14 @@ class _TankersViewState extends State<TankersView> {
|
|
|
|
updateTankerDescriptionController.text = '';
|
|
|
|
updateTankerDescriptionController.text = '';
|
|
|
|
updateTankerPhoneNumberController.text = object.tanker_phone;
|
|
|
|
updateTankerPhoneNumberController.text = object.tanker_phone;
|
|
|
|
updateTankerCapacityController.text=object.capacity;
|
|
|
|
updateTankerCapacityController.text=object.capacity;
|
|
|
|
|
|
|
|
updateTankerpriceController.text=object.waterprice;
|
|
|
|
updateTankerAlternatePhoneNumberController.text = object.tanker_alterphone;
|
|
|
|
updateTankerAlternatePhoneNumberController.text = object.tanker_alterphone;
|
|
|
|
isDrinkingChecked=object.isDrinking;
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
dropdownTypeOfWater=object.type_of_water.toString().toLowerCase()??'';
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* isDrinkingChecked=object.isDrinking;
|
|
|
|
isBoreChecked = object.isBore;
|
|
|
|
isBoreChecked = object.isBore;
|
|
|
|
if(object.pricetype.length==2){
|
|
|
|
if(object.pricetype.length==2){
|
|
|
|
tankerDrinkingPriceController.text=object.pricetype[0].toString();
|
|
|
|
tankerDrinkingPriceController.text=object.pricetype[0].toString();
|
|
|
@ -72,7 +84,7 @@ class _TankersViewState extends State<TankersView> {
|
|
|
|
else{
|
|
|
|
else{
|
|
|
|
tankerDrinkingPriceController.text=object.pricetype[0].toString();
|
|
|
|
tankerDrinkingPriceController.text=object.pricetype[0].toString();
|
|
|
|
tankerBorePriceController.text='';
|
|
|
|
tankerBorePriceController.text='';
|
|
|
|
}
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return showDialog(
|
|
|
|
return showDialog(
|
|
|
@ -219,7 +231,97 @@ class _TankersViewState extends State<TankersView> {
|
|
|
|
const SizedBox(
|
|
|
|
const SizedBox(
|
|
|
|
height: 30,
|
|
|
|
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(
|
|
|
|
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),
|
|
|
|
padding: EdgeInsets.fromLTRB(20, 0, 20, 0),
|
|
|
|
child: Visibility(
|
|
|
|
child: Visibility(
|
|
|
|
visible: true,
|
|
|
|
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()),
|
|
|
|
child: Text('Update', style: textButtonStyle()),
|
|
|
|
onPressed: () async {
|
|
|
|
onPressed: () async {
|
|
|
|
if (updateTankerNameController.text != '' &&
|
|
|
|
if (updateTankerNameController.text != '' &&
|
|
|
|
updateTankerPhoneNumberController.text != '' &&
|
|
|
|
updateTankerPhoneNumberController.text != '') {
|
|
|
|
object.updatedWaterTypes.isNotEmpty ) {
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
|
|
waterPrice=[];
|
|
|
|
waterPrice=[];
|
|
|
|
if(isDrinkingChecked){
|
|
|
|
if(isDrinkingChecked){
|
|
|
|
waterPrice.add({'price': tankerDrinkingPriceController.text.toString()});
|
|
|
|
waterPrice.add({'price': tankerDrinkingPriceController.text.toString()});
|
|
|
@ -387,7 +488,7 @@ class _TankersViewState extends State<TankersView> {
|
|
|
|
|
|
|
|
|
|
|
|
if(isBoreChecked){
|
|
|
|
if(isBoreChecked){
|
|
|
|
waterPrice.add({'price': tankerBorePriceController.text.toString()});
|
|
|
|
waterPrice.add({'price': tankerBorePriceController.text.toString()});
|
|
|
|
}
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
AppSettings.preLoaderDialog(context);
|
|
|
|
AppSettings.preLoaderDialog(context);
|
|
|
|
|
|
|
|
|
|
|
@ -397,8 +498,9 @@ class _TankersViewState extends State<TankersView> {
|
|
|
|
payload["phoneNumber"] = updateTankerPhoneNumberController.text.toString();
|
|
|
|
payload["phoneNumber"] = updateTankerPhoneNumberController.text.toString();
|
|
|
|
payload["alternative_phoneNumber"] = updateTankerAlternatePhoneNumberController.text.toString();
|
|
|
|
payload["alternative_phoneNumber"] = updateTankerAlternatePhoneNumberController.text.toString();
|
|
|
|
payload["capacity"] = updateTankerCapacityController.text.toString();
|
|
|
|
payload["capacity"] = updateTankerCapacityController.text.toString();
|
|
|
|
payload["typeofwater"] = object.updatedWaterTypes;
|
|
|
|
// payload["typeofwater"] = object.updatedWaterTypes;
|
|
|
|
payload["price"] = waterPrice;
|
|
|
|
payload["typeofwater"] = dropdownTypeOfWater.toString();
|
|
|
|
|
|
|
|
payload["price"] = updateTankerpriceController.text.toString();
|
|
|
|
payload["supplier_address"] = AppSettings.supplierAddress;
|
|
|
|
payload["supplier_address"] = AppSettings.supplierAddress;
|
|
|
|
payload["supplier_name"] = AppSettings.suppliername;
|
|
|
|
payload["supplier_name"] = AppSettings.suppliername;
|
|
|
|
|
|
|
|
|
|
|
@ -413,6 +515,7 @@ class _TankersViewState extends State<TankersView> {
|
|
|
|
updateTankerPhoneNumberController.text = '';
|
|
|
|
updateTankerPhoneNumberController.text = '';
|
|
|
|
updateTankerAlternatePhoneNumberController.text='';
|
|
|
|
updateTankerAlternatePhoneNumberController.text='';
|
|
|
|
updateTankerCapacityController.text='';
|
|
|
|
updateTankerCapacityController.text='';
|
|
|
|
|
|
|
|
updateTankerpriceController.text='';
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
await readJson();
|
|
|
|
await readJson();
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
@ -490,8 +593,8 @@ class _TankersViewState extends State<TankersView> {
|
|
|
|
Text(modelTanksViewList[index].tanker_phone,style: valuesTextStyle()),
|
|
|
|
Text(modelTanksViewList[index].tanker_phone,style: valuesTextStyle()),
|
|
|
|
Text(modelTanksViewList[index].tanker_alterphone,style: valuesTextStyle()),
|
|
|
|
Text(modelTanksViewList[index].tanker_alterphone,style: valuesTextStyle()),
|
|
|
|
Text(modelTanksViewList[index].capacity+' Ltrs',style: valuesTextStyle()),
|
|
|
|
Text(modelTanksViewList[index].capacity+' Ltrs',style: valuesTextStyle()),
|
|
|
|
Text(modelTanksViewList[index].water_type,style: valuesTextStyle()),
|
|
|
|
Text(modelTanksViewList[index].type_of_water,style: valuesTextStyle()),
|
|
|
|
Text(modelTanksViewList[index].price_ui,style: valuesTextStyle()),
|
|
|
|
Text(modelTanksViewList[index].waterprice,style: valuesTextStyle()),
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|