|
|
|
@ -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()),
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|