Compare commits

..

No commits in common. '1cc0689126117371028edcec30c99a2d7e45cd95' and '72f39f8eb22bbe2862b637a35cd74386254d4cf3' have entirely different histories.

@ -370,9 +370,9 @@ class _deliverboyState extends State<Deliverboy> {
AppSettings.longSuccessToast( AppSettings.longSuccessToast(
"Deliverboy Created Successfully"); "Deliverboy Created Successfully");
deliverNameController.text= ''; deliverNameController.text = '';
deliveryPhoneNumberController.text= ''; deliveryPhoneNumberController.text = '';
deliveryAlternativePhoneNumberController.text= ''; deliveryAlternativePhoneNumberController.text = '';
/* Navigator.pop(context); /* Navigator.pop(context);
await Navigator.push( await Navigator.push(
context, context,

@ -1,7 +1,7 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:flutter_svg/flutter_svg.dart';import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:geolocator/geolocator.dart'; import 'package:geolocator/geolocator.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:watermanagement/models/connected_customers_model.dart'; import 'package:watermanagement/models/connected_customers_model.dart';
@ -109,7 +109,6 @@ class _ConectedPendingCustomersState extends State<ConectedPendingCustomers> wit
getPendingSuppliersData(); getPendingSuppliersData();
super.initState(); super.initState();
} }
Widget connectedCustomers(){ Widget connectedCustomers(){
if(connectedCustomersList.length!=0){ if(connectedCustomersList.length!=0){
@ -261,6 +260,7 @@ class _ConectedPendingCustomersState extends State<ConectedPendingCustomers> wit
Widget pendingCustomers(){ Widget pendingCustomers(){
if(pendingSuppliersList.length!=0){ if(pendingSuppliersList.length!=0){
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [

@ -9,7 +9,6 @@ import 'package:watermanagement/login.dart';
import 'package:watermanagement/settings.dart'; import 'package:watermanagement/settings.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
import 'package:watermanagement/tankersview.dart'; import 'package:watermanagement/tankersview.dart';
import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'package:watermanagement/updateprofile.dart'; import 'package:watermanagement/updateprofile.dart';
import 'booking_requests.dart'; import 'booking_requests.dart';
@ -95,15 +94,13 @@ class _DashboardState extends State<Dashboard> {
final image = await _picker.pickImage(source: ImageSource.gallery); final image = await _picker.pickImage(source: ImageSource.gallery);
if (image == null) return; if (image == null) return;
final imageTemp = File(image.path); final imageTemp = File(image.path);
AppSettings.preLoaderDialog(context);
var res = await AppSettings.uploadImageHTTPNew(image);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
setState(() { setState(() {
AppSettings.profilePictureUrl = jsonDecode(res)['picture']; AppSettings.updatedImage = imageTemp;
}); });
AppSettings.saveData('profile', jsonDecode(res)['picture'], 'STRING'); uploadProfileApi(image.path);
AppSettings.saveProfile(image.path);
} on PlatformException catch (e) { } on PlatformException catch (e) {
print('Failed to pick image: $e'); print('Failed to pick image: $e');
} }
@ -114,14 +111,13 @@ class _DashboardState extends State<Dashboard> {
final image = await _picker.pickImage(source: ImageSource.camera); final image = await _picker.pickImage(source: ImageSource.camera);
if (image == null) return; if (image == null) return;
final imageTemp = File(image.path); final imageTemp = File(image.path);
AppSettings.preLoaderDialog(context);
var res = await AppSettings.uploadImageHTTPNew(image);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
setState(() { setState(() {
AppSettings.profilePictureUrl = jsonDecode(res)['picture']; AppSettings.updatedImage = imageTemp;
}); });
AppSettings.saveData('profile', jsonDecode(res)['picture'], 'STRING');
uploadProfileApi(image.path);
AppSettings.saveProfile(image.path);
} on PlatformException catch (e) { } on PlatformException catch (e) {
print('Failed to pick image: $e'); print('Failed to pick image: $e');
} }
@ -432,26 +428,15 @@ class _DashboardState extends State<Dashboard> {
children: [ children: [
Expanded( Expanded(child: GestureDetector(
child: GestureDetector(
child: Container( child: Container(
width: (MediaQuery.of(context).size.width > 600) width: MediaQuery.of(context).size.width * .20,
? MediaQuery.of(context).size.width * .30 height: MediaQuery.of(context).size.height * .15,
: MediaQuery.of(context).size.width * .60, // Adjusted width for tablet
height: (MediaQuery.of(context).size.width > 600)
? MediaQuery.of(context).size.height * .25
: MediaQuery.of(context).size.height * .50, // Adjusted height for tablet
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.rectangle, shape: BoxShape.circle,
border: Border.all(width: 2, color: Colors.blueGrey),
image: DecorationImage( image: DecorationImage(
image: (AppSettings.profilePictureUrl != '' && image: (AppSettings.updatedImage != null) ? FileImage(AppSettings.updatedImage!) as ImageProvider : AssetImage("images/profile_pic.png"), // picked file
AppSettings.profilePictureUrl != 'null') fit: BoxFit.cover)),
? NetworkImage(AppSettings.profilePictureUrl) as ImageProvider
: AssetImage(" images/profile_pic.png"), // picked file
fit: BoxFit.fitWidth,
),
),
), ),
onTap: () { onTap: () {
showModalBottomSheet<void>( showModalBottomSheet<void>(
@ -461,8 +446,7 @@ class _DashboardState extends State<Dashboard> {
height: 200, height: 200,
child: Center( child: Center(
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment: MainAxisAlignment.center,
MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
GestureDetector( GestureDetector(
child: Icon( child: Icon(
@ -476,10 +460,8 @@ class _DashboardState extends State<Dashboard> {
}, },
), ),
SizedBox( SizedBox(
width: MediaQuery.of(context) width:
.size MediaQuery.of(context).size.width * .20,
.width *
.20,
), ),
GestureDetector( GestureDetector(
child: Icon( child: Icon(
@ -498,10 +480,7 @@ class _DashboardState extends State<Dashboard> {
); );
}); });
}, },
), ),),
),
Text( Text(
AppSettings.suppliername, AppSettings.suppliername,

@ -92,6 +92,7 @@ class AppSettings {
static String latitude=''; static String latitude='';
static String longitude=''; static String longitude='';
static String supplierAddress = ''; static String supplierAddress = '';
static String profilepic = '';
static bool servicestatus = false; static bool servicestatus = false;
static bool haspermission = false; static bool haspermission = false;
static late LocationPermission permission; static late LocationPermission permission;
@ -123,9 +124,7 @@ class AppSettings {
static String acceptBookingRequestsUrl = host + 'ordernow'; static String acceptBookingRequestsUrl = host + 'ordernow';
static String acceptRequestUrl = host +"friend-request/accept"; static String acceptRequestUrl = host +"friend-request/accept";
static String rejectRequestUrl = host +"friend-request/reject"; static String rejectRequestUrl = host +"friend-request/reject";
static String profilePicUrl = host + 'supplier/profile-picture'; static String profilePicUrl = host + 'upload-image';
static String uploadPicUrl = host + 'uploads';
@ -137,8 +136,6 @@ class AppSettings {
static File? updatedImage; static File? updatedImage;
static String profilePictureUrl = '';
static String image=''; static String image='';
static var api = { static var api = {
'signIn': host + '/login', 'signIn': host + '/login',
@ -162,15 +159,7 @@ class AppSettings {
} }
static Future<String> uploadImageHTTPNew(file) async {
var request = http.MultipartRequest('POST', Uri.parse(uploadPicUrl + '/' + supplierId));
request.files.add(await http.MultipartFile.fromPath('picture', file.path));
var res = await request.send();
var response = await http.Response.fromStream(res);
return response.body;
}
////request headers with content type ////request headers with content type
static Future<Map<String, String>> buildRequestHeaders() async { static Future<Map<String, String>> buildRequestHeaders() async {
Map<String, String> _headers = new Map<String, String>(); Map<String, String> _headers = new Map<String, String>();
@ -906,6 +895,7 @@ class AppSettings {
await saveData('email', input['simplydata']['email'][0]['email'], 'STRING'); await saveData('email', input['simplydata']['email'][0]['email'], 'STRING');
await saveData('supplierId', input['simplydata']['supplierId'], 'STRING'); await saveData('supplierId', input['simplydata']['supplierId'], 'STRING');
await saveData('supplieraddress', input['simplydata']['office_address'], 'STRING'); await saveData('supplieraddress', input['simplydata']['office_address'], 'STRING');
await saveData('profile', input['simplydata']['picture'], 'STRING');
await loadDataFromMemory(); await loadDataFromMemory();
} }
@ -922,6 +912,7 @@ class AppSettings {
phoneNumber=await getData('phone', 'STRING'); phoneNumber=await getData('phone', 'STRING');
supplierId=await getData('supplierId', 'STRING'); supplierId=await getData('supplierId', 'STRING');
supplierAddress=await getData('supplieraddress', 'STRING'); supplierAddress=await getData('supplieraddress', 'STRING');
profilepic=await getData('profile', 'STRING');
} }
//assign saved values to variables //assign saved values to variables

@ -5,7 +5,6 @@ import 'package:flutter/services.dart';
import 'package:watermanagement/dashboard.dart'; import 'package:watermanagement/dashboard.dart';
import 'package:watermanagement/settings.dart'; import 'package:watermanagement/settings.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
import 'dart:convert';
import 'dart:io'; import 'dart:io';
import 'login.dart'; import 'login.dart';
@ -53,20 +52,17 @@ class _UpdateprofileState extends State<UpdateProfile> {
final ImagePicker _picker = ImagePicker(); final ImagePicker _picker = ImagePicker();
Future pickImageFromGallery() async { Future pickImageFromGallery() async {
try { try {
final image = await _picker.pickImage(source: ImageSource.gallery); final image = await _picker.pickImage(source: ImageSource.gallery);
if (image == null) return; if (image == null) return;
final imageTemp = File(image.path); final imageTemp = File(image.path);
AppSettings.preLoaderDialog(context);
var res = await AppSettings.uploadImageHTTPNew(image);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
setState(() { setState(() {
AppSettings.profilePictureUrl = jsonDecode(res)['picture']; AppSettings.updatedImage = imageTemp;
}); });
AppSettings.saveData('profile', jsonDecode(res)['picture'], 'STRING'); //uploadProfileApi(AppSettings.updatedImage);
AppSettings.saveProfile(image.path);
} on PlatformException catch (e) { } on PlatformException catch (e) {
print('Failed to pick image: $e'); print('Failed to pick image: $e');
} }
@ -77,14 +73,10 @@ class _UpdateprofileState extends State<UpdateProfile> {
final image = await _picker.pickImage(source: ImageSource.camera); final image = await _picker.pickImage(source: ImageSource.camera);
if (image == null) return; if (image == null) return;
final imageTemp = File(image.path); final imageTemp = File(image.path);
AppSettings.preLoaderDialog(context);
var res = await AppSettings.uploadImageHTTPNew(image);
print(jsonDecode(res));
Navigator.of(context, rootNavigator: true).pop();
setState(() { setState(() {
AppSettings.profilePictureUrl = jsonDecode(res)['picture']; AppSettings.updatedImage = imageTemp;
}); });
AppSettings.saveData('profile', jsonDecode(res)['picture'], 'STRING');
// uploadProfileApi(AppSettings.updatedImage); // uploadProfileApi(AppSettings.updatedImage);
AppSettings.saveProfile(image.path); AppSettings.saveProfile(image.path);
@ -123,17 +115,15 @@ class _UpdateprofileState extends State<UpdateProfile> {
image: AssetImage('images/logo.png'), image: AssetImage('images/logo.png'),
height: MediaQuery.of(context).size.height * .10, height: MediaQuery.of(context).size.height * .10,
)),*/ )),*/
Container(child: Container(child: GestureDetector(
GestureDetector(
child: Container( child: Container(
width: MediaQuery.of(context).size.width * .60, width: MediaQuery.of(context).size.width * .30,
height: MediaQuery.of(context).size.height * .15, height: MediaQuery.of(context).size.height * .20,
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.rectangle, shape: BoxShape.circle,
border: Border.all(width: 2, color: Colors.blueGrey),
image: DecorationImage( image: DecorationImage(
image: (AppSettings.profilePictureUrl != ''&& AppSettings.profilePictureUrl != 'null') ? NetworkImage(AppSettings.profilePictureUrl) as ImageProvider : AssetImage("images/mobilebg.png"), // picked file image: (AppSettings.updatedImage != null) ? FileImage(AppSettings.updatedImage!) as ImageProvider : AssetImage("images/profile_pic.png"), // picked file
fit: BoxFit.fitWidth)), fit: BoxFit.cover)),
), ),
onTap: () { onTap: () {
showModalBottomSheet<void>( showModalBottomSheet<void>(
@ -149,7 +139,7 @@ class _UpdateprofileState extends State<UpdateProfile> {
child: Icon( child: Icon(
Icons.camera_alt_outlined, Icons.camera_alt_outlined,
size: 100, size: 100,
color: primaryColor, color: greyColor,
), ),
onTap: () async { onTap: () async {
await takeImageFromCamera(); await takeImageFromCamera();
@ -164,7 +154,7 @@ class _UpdateprofileState extends State<UpdateProfile> {
child: Icon( child: Icon(
Icons.photo, Icons.photo,
size: 100, size: 100,
color: primaryColor, color: greyColor,
), ),
onTap: () async { onTap: () async {
await pickImageFromGallery(); await pickImageFromGallery();

Loading…
Cancel
Save