diff --git a/images/addtankerblue.png b/images/addtankerblue.png new file mode 100644 index 0000000..cec0d00 Binary files /dev/null and b/images/addtankerblue.png differ diff --git a/images/appbg.png b/images/appbg.png deleted file mode 100644 index ead4a14..0000000 Binary files a/images/appbg.png and /dev/null differ diff --git a/images/appbgsuplier.png b/images/appbgsuplier.png index 7e58fa3..0a54516 100644 Binary files a/images/appbgsuplier.png and b/images/appbgsuplier.png differ diff --git a/images/connectionsblue.png b/images/connectionsblue.png new file mode 100644 index 0000000..b01c88e Binary files /dev/null and b/images/connectionsblue.png differ diff --git a/images/customercareblue.png b/images/customercareblue.png new file mode 100644 index 0000000..7fdc2d4 Binary files /dev/null and b/images/customercareblue.png differ diff --git a/images/final_splash_screen.png b/images/final_splash_screen.png deleted file mode 100644 index 04e34e4..0000000 Binary files a/images/final_splash_screen.png and /dev/null differ diff --git a/images/img.png b/images/img.png index b18c069..803da46 100644 Binary files a/images/img.png and b/images/img.png differ diff --git a/images/logoutblue.png b/images/logoutblue.png new file mode 100644 index 0000000..27bdaa7 Binary files /dev/null and b/images/logoutblue.png differ diff --git a/images/splashscreen.png b/images/splashscreen.png deleted file mode 100644 index 5302581..0000000 Binary files a/images/splashscreen.png and /dev/null differ diff --git a/lib/booking_requests.dart b/lib/booking_requests.dart index b836db1..06dc55e 100644 --- a/lib/booking_requests.dart +++ b/lib/booking_requests.dart @@ -187,16 +187,32 @@ class _BookingRequetsState extends State { SizedBox( height: 10, ), - Text( - BookingRequestsList[index] - .customer_address - .toUpperCase(), - style: valuesTextStyle()) + Container( + + width: MediaQuery.of(context).size.width * .50, + child: Text( + BookingRequestsList[index] + .customer_address + .toUpperCase(), + style: valuesTextStyle()), + ) ], ), ], )), ), + /*Row( + children: [ + Text('Tanker Name:', + style: labelTextStyle()), + Text( + BookingRequestsList[index] + .tanker_name + .toUpperCase(), + style: valuesTextStyle()), + + ], + ),*/ Visibility( visible:BookingRequestsList[index].orderStatus.toString().toLowerCase()=='pending', child: Column( diff --git a/lib/conect_request_customers.dart b/lib/conect_request_customers.dart new file mode 100644 index 0000000..331218b --- /dev/null +++ b/lib/conect_request_customers.dart @@ -0,0 +1,410 @@ +import 'dart:convert'; +import 'dart:io'; +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:geolocator/geolocator.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; +import 'package:watermanagement/models/connected_customers_model.dart'; +import 'package:watermanagement/models/pending_suppliers_model.dart'; +import 'package:watermanagement/settings.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:location/location.dart' as locationmap; +import 'google_maps_place_picker_mb/src/models/pick_result.dart'; +import 'google_maps_place_picker_mb/src/place_picker.dart'; +import 'package:watermanagement/google_maps_place_picker_mb/google_maps_place_picker.dart'; +import 'package:watermanagement/keys.dart'; + +class ConectedPendingCustomers extends StatefulWidget { + const ConectedPendingCustomers({Key? key}) : super(key: key); + + @override + State createState() => _ConectedPendingCustomersState(); +} + +class _ConectedPendingCustomersState extends State with TickerProviderStateMixin { + bool isSupplierDataLoading=false; + bool isSereverIssue = false; + bool isSereverIssueConnected = false; + bool isSereverIssuePending = false; + + List connectedCustomersList = []; + List pendingSuppliersList = []; + + + late TabController _controller; + bool isConnectedDataLoading=false; + bool isPendingDataLoading=false; + + + + final List topTabs = [ + Tab( + child: Column( + children: [Text('Conected Customers')], + ), + ), + Tab( + child: Column( + children: [Text('Pending Customers')], + ), + ), + ]; + + + + Future getConnectedSuppliersData() async { + isPendingDataLoading = true; + + try { + var response = await AppSettings.getConnectedCustomers(); + + setState(() { + connectedCustomersList = + ((jsonDecode(response)['data']) as List).map((dynamic model) { + return ConnectedCustomersModel.fromJson(model); + }).toList(); + isPendingDataLoading = false; + }); + + + } catch (e) { + setState(() { + isPendingDataLoading = false; + isSereverIssuePending = true; + }); + } + } + + + Future getPendingSuppliersData() async { + isPendingDataLoading = true; + + try { + var response = await AppSettings.getPendingSuppliers(); + + setState(() { + pendingSuppliersList = + ((jsonDecode(response)['data']) as List).map((dynamic model) { + return PendingSuppliersModel.fromJson(model); + }).toList(); + isPendingDataLoading = false; + }); + + + } catch (e) { + setState(() { + isPendingDataLoading = false; + isSereverIssuePending = true; + }); + } + } + + + + + + + + + @override + void initState() { + // TODO: implement initState + _controller = TabController(vsync: this, length: 2); + getConnectedSuppliersData(); + getPendingSuppliersData(); + super.initState(); + } + + + + + Widget connectedCustomers(){ + if(connectedCustomersList.length!=0){ + + return Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Expanded(child:ListView.builder( + padding: EdgeInsets.all(0), + itemCount: connectedCustomersList.length, + itemBuilder: (BuildContext context, int index) { + return Card( + child: Padding( + padding:EdgeInsets.all(8) , + child: Container( + //width: MediaQuery.of(context).size.width * .50, + child: Row( + children: [ + /* Column( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('username :', + style: labelTextStyle()), + + SizedBox(height: 10,), + Text('phone:', + style: labelTextStyle()), + SizedBox(height: 10,), + Text('buildingname:', + style: labelTextStyle()), + SizedBox(height: 10,), + Text('address:', + style: labelTextStyle()), + ], + ), + SizedBox(width: 10,),*/ + Expanded(child:Column( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + connectedCustomersList[index] + .customer_name + .toUpperCase(), + style: valuesTextStyle()), + SizedBox(height: 10,), + Text( + connectedCustomersList[index] + .customer_phone_number + .toUpperCase(), + style: valuesTextStyle()), + SizedBox(height: 10,), + Text( + connectedCustomersList[index] + .customer_building_name + .toUpperCase(), + style: valuesTextStyle()), + SizedBox(height: 10,), + Text(maxLines:3, + connectedCustomersList[index] + .customer_address + .toUpperCase(), + style: valuesTextStyle()) + ], + ),) + ], + ) + ), + ), + ); + }) ), + ]); + } + else{ + return Center( + child: Padding( + padding: EdgeInsets.fromLTRB(0, 40, 0, 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: MediaQuery.of(context).size.height * .25,), + Text('No Data Found'), + SizedBox( + height: 20, + ), + + ], + ), + ) + ); + } + } + + Widget pendingCustomers(){ + if(pendingSuppliersList.length!=0){ + + return Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Expanded(child:ListView.builder( + padding: EdgeInsets.all(0), + itemCount: pendingSuppliersList.length, + itemBuilder: (BuildContext context, int index) { + return Card( + child: Padding( + padding:EdgeInsets.all(8) , + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + width: MediaQuery.of(context).size.width * .50, + child: Row( + children: [ + /* Column( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('username :', + style: labelTextStyle()), + + SizedBox(height: 10,), + Text('contactNumber:', + style: labelTextStyle()), + SizedBox(height: 10,), + Text('address:', + style: labelTextStyle()), + ], + ), + SizedBox(width: 10,),*/ + Expanded(child:Column( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + pendingSuppliersList[index] + .customer_name + .toUpperCase(), + style: valuesTextStyle()), + SizedBox(height: 10,), + Text( + pendingSuppliersList[index] + .customer_phone_number + .toUpperCase(), + style: valuesTextStyle()), + SizedBox(height: 10,), + Text( + pendingSuppliersList[index] + .customer_address + .toUpperCase(), + style: valuesTextStyle()) + ], + ),) + ], + ) + ), + + + TextButton( + child: Text( + 'Accept', + style: TextStyle(fontSize: 15, + color:primaryColor/*FilteredList[index].text_color*/ ), + ), + onPressed: () async{ + var payload = new Map(); + payload["supplierId"] =AppSettings.supplierId; + payload["customerId"] = pendingSuppliersList[index].customer_id; + bool requestStatus = await AppSettings.acceptRequest(payload); + + if(requestStatus){ + AppSettings.longSuccessToast("Request Accepted Successfully"); + // await getConnectedSuppliersData(); + await getPendingSuppliersData(); + + } + else{ + } + + }, + ), + + TextButton( + child: Text( + 'Reject', + style: TextStyle(fontSize: 15, + color:primaryColor/*FilteredList[index].text_color*/ ), + ), + onPressed: () async{ + var payload = new Map(); + payload["supplierId"] =AppSettings.supplierId; + payload["customerId"] = pendingSuppliersList[index].customer_id; + + bool requestStatus = await AppSettings.rejectRequest(payload); + if(requestStatus){ + AppSettings.longSuccessToast("Request Sent Successfully"); + await getPendingSuppliersData(); + + } + else{ + + } + + + + + }, + ), + ], + + ), + ), + ); + }) ), + ]); + } + else{ + return Center( + child: Padding( + padding: EdgeInsets.fromLTRB(0, 40, 0, 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(height: MediaQuery.of(context).size.height * .25,), + Text('No Data Found'), + SizedBox( + height: 20, + ), + + ], + ), + ) + ); + } + } + + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Costumers'), + backgroundColor: primaryColor, + bottom: TabBar( + controller: _controller, + tabs: topTabs, + indicatorColor: Colors.blue, + unselectedLabelColor: Colors.white60, + indicatorWeight: 2, + ),), + /* body: */ + body: TabBarView(controller: _controller, children: [ + /*Container( + // color: Colors.lightGreenAccent, + child: isTankerDataLoading?Center( + child: CircularProgressIndicator( + color: primaryColor, + strokeWidth: 5.0, + ), + ):_tanker(), + ),*/ + Container( + //color: Colors.lightBlueAccent, + child: isConnectedDataLoading?Center( + child: CircularProgressIndicator( + color: primaryColor, + strokeWidth: 5.0, + ), + ):connectedCustomers(), + ), + Container( + //color: Colors.lightBlueAccent, + child: isPendingDataLoading?Center( + child: CircularProgressIndicator( + color: primaryColor, + strokeWidth: 5.0, + ), + ):pendingCustomers(), + ), + + ]), + ); + } + +} diff --git a/lib/conected_customers.dart b/lib/conected_customers.dart index 4113c8b..5663a3e 100644 --- a/lib/conected_customers.dart +++ b/lib/conected_customers.dart @@ -88,7 +88,7 @@ class _ConectedCustomersState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( - width: MediaQuery.of(context).size.width * .50, + child: Row( children: [ Column( diff --git a/lib/dashboard.dart b/lib/dashboard.dart index 4d7b403..afb4279 100644 --- a/lib/dashboard.dart +++ b/lib/dashboard.dart @@ -3,6 +3,7 @@ import 'package:flutter/services.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:watermanagement/adddeliveryboy.dart'; import 'package:watermanagement/addtankers.dart'; +import 'package:watermanagement/conect_request_customers.dart'; import 'package:watermanagement/conected_customers.dart'; import 'package:watermanagement/getdeliveryboydata.dart'; import 'package:watermanagement/login.dart'; @@ -93,23 +94,182 @@ class _DashboardState extends State { child: Column( children: [ Container( - height: MediaQuery.of(context).size.height * .330, - width: double.infinity, + height: MediaQuery.of(context).size.height * .330, + width: double.infinity, decoration: BoxDecoration( borderRadius: BorderRadius.circular(0), ), - //color: Colors.red, - child: FittedBox( - child:Image( - image: const AssetImage('images/appbgsuplier.png'), + //color: Colors.red, + child: FittedBox( + child:Image( + image: const AssetImage('images/appbgsuplier.png'), - ), - fit: BoxFit.fill, - ) + ), + fit: BoxFit.fill, + ) ), SizedBox( - height: 5 + height: 5 ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => TankersView()), + ); + }, + child: Container( + padding: EdgeInsets.all(05), + margin: EdgeInsets.only(left:15, top:10, right: 0, bottom:0), + //height: MediaQuery.of(context).size.height * .05, + //width: MediaQuery.of(context).size.width * .45, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12), + ), + // Change button text when light changes state. + + child: Column( + children: [ + Container( + padding: EdgeInsets.fromLTRB(35, 10,0,0), + child: new SvgPicture.asset("assets/images/tanklevels.svg") + ), + Text('Takers View',style: dashboardTextStyle(),), + + ], + ), + ), + )), + + + SizedBox( + width: MediaQuery.of(context).size.width * .03, + ), + + Expanded( + child: GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => GetDeliveryboyData()), + ); + }, + child: Container( + padding: EdgeInsets.all(05), + margin: EdgeInsets.only(left:0, top:10, right: 15, bottom:0), + // height: MediaQuery.of(context).size.height * .16, + // width: MediaQuery.of(context).size.width * .40, + //color: Colors.white, + //margin: const EdgeInsets.all(15.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12), + ), + // Change button text when light changes state. + child: Column( + children: [ + Container( + + padding: EdgeInsets.fromLTRB(0, 10,0,0), + child: new SvgPicture.asset("assets/images/watertanker.svg") + ), + Text('Deliveryboys View',style: dashboardTextStyle(),) + + ], + ), + ), + ), + ) + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => ConectedPendingCustomers()), + ); + }, + child: Container( + padding: EdgeInsets.all(05), + margin: EdgeInsets.only(left:15, top:10, right: 0, bottom:0), + //height: MediaQuery.of(context).size.height * .05, + //width: MediaQuery.of(context).size.width * .45, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12), + ), + // Change button text when light changes state. + + child: Column( + children: [ + Container( + padding: EdgeInsets.fromLTRB(35, 10,0,0), + child: new SvgPicture.asset("assets/images/resources.svg") + ), + Text('Customers',style: dashboardTextStyle(),), + + ], + ), + ), + )), + + + SizedBox( + width: MediaQuery.of(context).size.width * .03, + ), + + Expanded( + child: GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => BookingRequets()), + ); + }, + child: Container( + padding: EdgeInsets.all(05), + margin: EdgeInsets.only(left:0, top:10, right: 15, bottom:0), + // height: MediaQuery.of(context).size.height * .16, + // width: MediaQuery.of(context).size.width * .40, + //color: Colors.white, + //margin: const EdgeInsets.all(15.0), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12), + ), + // Change button text when light changes state. + child: Column( + children: [ + Container( + + padding: EdgeInsets.fromLTRB(0, 10,0,0), + child: new SvgPicture.asset("assets/images/consumption.svg") + ), + Text('Booking Requests',style: dashboardTextStyle(),) + + ], + ), + ), + ), + ) + ], + ), + //==============================list2 + + + + + + ], ), @@ -301,7 +461,7 @@ class _DashboardState extends State { title: Row( children: const [ - Image(image: const AssetImage('images/ic_launcher.png'),height: 25,width: 25,fit: BoxFit.fill), + Image(image: const AssetImage('images/editprofileblue.png'),height: 25,width: 25,fit: BoxFit.fill), const SizedBox( width: 10, ), @@ -327,7 +487,7 @@ class _DashboardState extends State { ListTile( title: Row( children: const [ - Image(image: const AssetImage('images/ic_launcher.png'),height: 25,width: 25,fit: BoxFit.fill), + Image(image: const AssetImage('images/addtankerblue.png'),height: 25,width: 25,fit: BoxFit.fill), const SizedBox( width: 10, ), @@ -348,7 +508,7 @@ class _DashboardState extends State { ListTile( title: Row( children: const [ - Image(image: const AssetImage('images/ic_launcher.png'),height: 25,width: 25,fit: BoxFit.fill), + Image(image: const AssetImage('images/connectionsblue.png'),height: 25,width: 25,fit: BoxFit.fill), const SizedBox( width: 10, ), @@ -362,124 +522,13 @@ class _DashboardState extends State { ); }, ), - Divider( - color: Colors.grey, - ), - // Add Tanks - ListTile( - title: Row( - children: const [ - Image(image: const AssetImage('images/ic_launcher.png'),height: 25,width: 25,fit: BoxFit.fill), - const SizedBox( - width: 10, - ), - Text('Deliveryboys View',style: TextStyle(color:primaryColor)), - ], - ), - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => GetDeliveryboyData()), - ); - }, - ), - - Divider( - color: Colors.grey, - ), - // Add Tanks - ListTile( - title: Row( - children: const [ - Image(image: const AssetImage('images/ic_launcher.png'),height: 25,width: 25,fit: BoxFit.fill), - const SizedBox( - width: 10, - ), - Text('Tankers View',style: TextStyle(color:primaryColor)), - ], - ), - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => TankersView()), - ); - }, - ), - Divider( - color: Colors.grey, - ), - ListTile( - title: Row( - children: const [ - Image(image: const AssetImage('images/ic_launcher.png'),height: 25,width: 25,fit: BoxFit.fill), - const SizedBox( - width: 10, - ), - Text('Pending Customers', style: TextStyle(color:primaryColor)), - ], - ), - onTap: () { - - Navigator.push( - context, - MaterialPageRoute(builder: (context) => PendingCustomers()), - ); - - }, - ), - - Divider( - color: Colors.grey, - ), - ListTile( - title: Row( - children: const [ - Image(image: const AssetImage('images/ic_launcher.png'),height: 25,width: 25,fit: BoxFit.fill), - const SizedBox( - width: 10, - ), - Text('Conected Customers', style: TextStyle(color:primaryColor)), - ], - ), - onTap: () { - - Navigator.push( - context, - MaterialPageRoute(builder: (context) => ConectedCustomers()), - ); - - }, - ), - - Divider( - color: Colors.grey, - ), - // Add Tanks - ListTile( - title: Row( - children: const [ - Image(image: const AssetImage('images/ic_launcher.png'),height: 25,width: 25,fit: BoxFit.fill), - const SizedBox( - width: 10, - ), - Text('Booking Requests',style: TextStyle(color:primaryColor)), - ], - ), - onTap: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => BookingRequets()), - ); - }, - ), - Divider( color: Colors.grey, ), ListTile( title: Row( children: const [ - Image(image: const AssetImage('images/ic_launcher.png'),height: 25,width: 25,fit: BoxFit.fill), + Image(image: const AssetImage('images/customercareblue.png'),height: 25,width: 25,fit: BoxFit.fill), const SizedBox( width: 10, ), @@ -494,7 +543,7 @@ class _DashboardState extends State { ListTile( title: Row( children: const [ - Image(image: const AssetImage('images/ic_launcher.png'),height: 25,width: 25,fit: BoxFit.fill), + Image(image: const AssetImage('images/logoutblue.png'),height: 25,width: 25,fit: BoxFit.fill), const SizedBox( width: 10, ), diff --git a/lib/getdeliveryboydata.dart b/lib/getdeliveryboydata.dart index 4a9daef..27855c1 100644 --- a/lib/getdeliveryboydata.dart +++ b/lib/getdeliveryboydata.dart @@ -232,7 +232,6 @@ class _GetDeliveryboyDataState extends State { Text('phone :',style: labelTextStyle()), Text('alternativeContactNumber :',style: labelTextStyle()), // Text('address :',style: labelTextStyle()), - Text('status :',style: labelTextStyle()), ], ), SizedBox(width: 5,), @@ -246,9 +245,6 @@ class _GetDeliveryboyDataState extends State { /*Text(modeldeliveryboyList[index].deliveryboy_address,style: valuesTextStyle(), overflow: TextOverflow.ellipsis, maxLines: 1),*/ - Text(modeldeliveryboyList[index].deliveryboy_status,style: valuesTextStyle()), - - ], ), ], diff --git a/lib/request_customers.dart b/lib/request_customers.dart index 6c5e796..dbfa4ae 100644 --- a/lib/request_customers.dart +++ b/lib/request_customers.dart @@ -165,22 +165,19 @@ class _PendingCustomersState extends State { color:primaryColor/*FilteredList[index].text_color*/ ), ), onPressed: () async{ - /* var payload = new Map(); - payload["customerId"] =AppSettings.customerId; - payload["supplierId"] = FilteredList[index].supplier_id; - - bool requestStatus = await AppSettings.connectRequest(payload); + var payload = new Map(); + payload["supplierId"] =AppSettings.supplierId; + payload["customerId"] = pendingSuppliersList[index].customer_id; + bool requestStatus = await AppSettings.rejectRequest(payload); if(requestStatus){ AppSettings.longSuccessToast("Request Sent Successfully"); - await getAllSuppliersData(); - await getConnectedSuppliersData(); await getPendingSuppliersData(); } else{ - }*/ + } diff --git a/lib/settings.dart b/lib/settings.dart index 4d4752b..783dcdb 100644 --- a/lib/settings.dart +++ b/lib/settings.dart @@ -90,20 +90,17 @@ class AppSettings { static String deleteTankerUrl = host + 'deleteTanker'; static String UpdateTankerUrl = host + 'updateTankers'; static String addDeliveryboyUrl = host + 'addDeliveryboys'; - static String getAllDeliverboyUrl = host + 'getActiveDeliveryboys'; + static String getAllDeliverboyUrl = host + 'getalldeliveryboys'; static String updateDeliveryboyUrl = host + 'updatedeliveryboy'; static String deleteDeliveryboyUrl = host + 'deletedeliveryboy'; static String pendingCustomersUrl = host + 'pendingCustomers'; static String connectedCustomersUrl = host + 'connectedCustomers'; static String bookingRequestsUrl = host + 'getAllTankersBookingdetails'; static String acceptBookingRequestsUrl = host + 'ordernow'; + static String acceptRequestUrl = host +"friend-request/accept"; + static String rejectRequestUrl = host +"friend-request/reject"; - String a=""; - String b=""; - - static String acceptRequestUrl = host +"friend-request/"+ supplierId+"/accept"; - @@ -705,7 +702,36 @@ class AppSettings { static Future acceptRequest( payload) async { var uri = Uri.parse(acceptRequestUrl ); try { - var response = await http.post(uri, + var response = await http.put(uri, + body: json.encode(payload), headers: await buildRequestHeaders()); + + if (response.statusCode == 200) { + return true; + } 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 true; + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } catch (e) { + print(e); + return false; + } + } + static Future rejectRequest( payload) async { + var uri = Uri.parse(rejectRequestUrl ); + try { + var response = await http.put(uri, body: json.encode(payload), headers: await buildRequestHeaders()); if (response.statusCode == 200) { diff --git a/lib/splash_screen.dart b/lib/splash_screen.dart index 634d4b8..5916aa7 100644 --- a/lib/splash_screen.dart +++ b/lib/splash_screen.dart @@ -69,7 +69,7 @@ class _SplashScreenState extends State { children: [ Container( decoration: const BoxDecoration( - image: DecorationImage(image: AssetImage("images/final_splash_screen.png"), fit: BoxFit.cover,), + image: DecorationImage(image: AssetImage("images/img.png"), fit: BoxFit.cover,), ), ), diff --git a/pubspec.yaml b/pubspec.yaml index 2eccc97..9211a9e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -66,4 +66,6 @@ flutter: uses-material-design: true assets: - images/ + - json/ + - assets/images/