|
|
@ -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,
|
|
|
|