download water functionality completed

dev
Sneha 2 years ago
parent c798e7bab8
commit ca2b402145

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

@ -199,17 +199,38 @@ class _DelivryBookingDataState extends State<DelivryBookingData> with TickerProv
children: [
IconButton(
iconSize: 30,
icon: const Icon(
icon: Icon(
Icons.download,
color: primaryColor,
color:connectedSuppliersList[index].isStart?Colors.grey: primaryColor,
),
onPressed: () {
onPressed: () async{
if(connectedSuppliersList[index].isStart){
var payload = new Map<String, dynamic>();
payload["action"] = 'stop';
payload["percentage"] = '';
/* Navigator.push(
context,
new MaterialPageRoute(
builder: (__) => new BookedTanerDetails(myObject:tankersList[index].tanker_name)));*/
var capacity = await AppSettings.startAndStop(connectedSuppliersList[index].bookingid,payload);
print(capacity);
//var modelTanksViewList = jsonDecode(capacity)['data'];
setState(() {
connectedSuppliersList[index].isStart=false;
});
}
else{
var payload = new Map<String, dynamic>();
payload["action"] = 'start';
payload["percentage"] = '';
var capacity = await AppSettings.startAndStop(connectedSuppliersList[index].bookingid,payload);
print(capacity);
setState(() {
connectedSuppliersList[index].isStart=true;
});
}
},
),

@ -12,6 +12,7 @@ class GetDeliveryboyDetailsModel {
String address='';
String price='';
String customerId='';
bool isStart=false;

@ -106,7 +106,7 @@ class AppSettings {
static String loginUrl = host + 'sendSms';
static String deliveryboyloginUrl = host + 'deliveryboylogin';
static String deliveryboybookingsUrl = host + 'getdeliveryboybookings';
static String deliveryboyStartAndStopUrl = host + 'deliveryboystartandstop';
static String verifyPhnUrl = host + 'phone';
static String updateProfileUrl = host + 'update/currentUser';
@ -315,7 +315,30 @@ class AppSettings {
}
}
static Future<String> startAndStop(var bookingId,payload) async {
//var uri = Uri.parse(deliveryboyStartAndStopUrl);
var uri = Uri.parse(deliveryboyStartAndStopUrl + '/' + bookingId);
var response = await http.put(uri,
body: json.encode(payload), headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else if (response.statusCode == 401) {
bool status = await AppSettings.resetToken();
if (status) {
response = await http.put(uri,
body: json.encode(payload), headers: await buildRequestHeaders());
if (response.statusCode == 200) {
return response.body;
} else {
return '';
}
} else {
return '';
}
} else {
return '';
}
}
static Future<bool> resetToken() async {

@ -66,6 +66,5 @@ flutter:
uses-material-design: true
assets:
- images/
- json/
- assets/images/

Loading…
Cancel
Save