download water functionality completed

dev
Sneha 2 years ago
parent dc4765d232
commit cd565a1195

Binary file not shown.

Before

Width:  |  Height:  |  Size: 422 KiB

After

Width:  |  Height:  |  Size: 287 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 KiB

@ -1,15 +1,11 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:google_maps_flutter_android/google_maps_flutter_android.dart';
import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import 'package:watermanagement/model/getdeliveryboy_model.dart'; import 'package:watermanagement/model/getdeliveryboy_model.dart';
import 'package:watermanagement/settings.dart'; import 'package:watermanagement/settings.dart';
import 'package:intl/intl.dart';
import 'order_tracking_page.dart'; import 'order_tracking_page.dart';
@ -59,7 +55,9 @@ class _DelivryBookingDataState extends State<DelivryBookingData> with TickerProv
return GetDeliveryboyDetailsModel.fromJson(model); return GetDeliveryboyDetailsModel.fromJson(model);
}).toList(); }).toList();
activeOrdersList=bookingDataList.where((product) => product.orderStatus.toString().toLowerCase()!='delivered').toList(); activeOrdersList=bookingDataList.where((product) => product.orderStatus.toString().toLowerCase()!='delivered').toList();
activeOrdersList=activeOrdersList.reversed.toList();
completedOrdersList=bookingDataList.where((product) => product.orderStatus.toString().toLowerCase()=='delivered').toList(); completedOrdersList=bookingDataList.where((product) => product.orderStatus.toString().toLowerCase()=='delivered').toList();
completedOrdersList=completedOrdersList.reversed.toList();
isLoading = false; isLoading = false;
}); });
@ -229,10 +227,17 @@ class _DelivryBookingDataState extends State<DelivryBookingData> with TickerProv
if(int.parse(x)<=int.parse(obj.price)){ if(int.parse(x)<=int.parse(obj.price)){
var payload = new Map<String, dynamic>(); var payload = new Map<String, dynamic>();
final DateTime now = DateTime.now();
final DateFormat formatter = DateFormat('dd-MMM-yyyy - HH:mm');
final String formatted = formatter.format(now);
print(formatted);
payload["amount_paid"] = amountPaidController.text.toString(); payload["amount_paid"] = amountPaidController.text.toString();
payload["payment_mode"] = dropdownTypeOfPayment.toString().toLowerCase(); payload["payment_mode"] = dropdownTypeOfPayment.toString().toLowerCase();
payload["orderStatus"] = 'delivered'; payload["orderStatus"] = 'delivered';
payload["deliveredDate"] = formatted;
bool updateStatus = await AppSettings.deliveryboyFinishOrder(obj.bookingid,payload); bool updateStatus = await AppSettings.deliveryboyFinishOrder(obj.bookingid,payload);
@ -418,53 +423,56 @@ class _DelivryBookingDataState extends State<DelivryBookingData> with TickerProv
SizedBox( SizedBox(
width: 30, width: 30,
), ),
Column( Visibility(
children: [ visible: activeOrdersList[index].stopTime==''||activeOrdersList[index].stopTime=='null',
IconButton( child: Column(
iconSize: 30, children: [
icon: Icon( IconButton(
Icons.download, iconSize: 30,
color:activeOrdersList[index].tankerRunningStatus=='1'?Colors.red: Colors.green, icon: Icon(
Icons.download,
color:activeOrdersList[index].tankerRunningStatus=='1'?Colors.red: Colors.green,
),
onPressed: () async{
if(activeOrdersList[index].tankerRunningStatus!='0'){
var payload = new Map<String, dynamic>();
payload["action"] = 'stop';
payload["percentage"] = '';
var capacity = await AppSettings.startAndStop(activeOrdersList[index].bookingid,payload);
print(capacity);
//var modelTanksViewList = jsonDecode(capacity)['data'];
setState(() {
activeOrdersList[index].tankerRunningStatus='0';
activeOrdersList[index].stopTime=jsonDecode(capacity)['stop time'];
});
}
else{
var payload = new Map<String, dynamic>();
payload["action"] = 'start';
payload["percentage"] = '';
var capacity = await AppSettings.startAndStop(activeOrdersList[index].bookingid,payload);
print(capacity);
//var modelTanksViewList = jsonDecode(capacity)['data'];
setState(() {
activeOrdersList[index].tankerRunningStatus='1';
activeOrdersList[index].startTime=jsonDecode(capacity)['start time'];
});
}
},
), ),
onPressed: () async{ Text(
'Download Water',
if(activeOrdersList[index].tankerRunningStatus!='0'){ style: iconBelowTextStyle(),
var payload = new Map<String, dynamic>(); ),
payload["action"] = 'stop'; ],
payload["percentage"] = ''; ),
var capacity = await AppSettings.startAndStop(activeOrdersList[index].bookingid,payload);
print(capacity);
//var modelTanksViewList = jsonDecode(capacity)['data'];
setState(() {
activeOrdersList[index].tankerRunningStatus='0';
activeOrdersList[index].stopTime=jsonDecode(capacity)['stop time'];
});
}
else{
var payload = new Map<String, dynamic>();
payload["action"] = 'start';
payload["percentage"] = '';
var capacity = await AppSettings.startAndStop(activeOrdersList[index].bookingid,payload);
print(capacity);
//var modelTanksViewList = jsonDecode(capacity)['data'];
setState(() {
activeOrdersList[index].tankerRunningStatus='1';
activeOrdersList[index].startTime=jsonDecode(capacity)['start time'];
});
}
},
),
Text(
'Download Water',
style: iconBelowTextStyle(),
),
],
), ),
SizedBox(width: 10,), SizedBox(width: 10,),

Loading…
Cancel
Save