|
|
|
@ -35,7 +35,8 @@ TextStyle labelTextStyle() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TextStyle haveMotorTextStyle() {
|
|
|
|
|
return TextStyle(color: Colors.red, fontSize: 12,fontWeight: FontWeight.bold);
|
|
|
|
|
return TextStyle(
|
|
|
|
|
color: Colors.red, fontSize: 12, fontWeight: FontWeight.bold);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TextStyle textButtonStyle() {
|
|
|
|
@ -57,12 +58,14 @@ TextStyle startAndStopHeading() {
|
|
|
|
|
return TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Text capacitySuffixText() {
|
|
|
|
|
return Text('in Ltrs.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Text dimensionSuffixText() {
|
|
|
|
|
return Text('in fts');
|
|
|
|
|
}
|
|
|
|
@ -86,39 +89,60 @@ TextStyle serverIssueTextStyle() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TextStyle bottomSheetValuesTextStyle() {
|
|
|
|
|
return TextStyle(fontSize: 12,fontWeight: FontWeight.bold,overflow: TextOverflow.ellipsis,);
|
|
|
|
|
return TextStyle(
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TextStyle wrapTextStyle() {
|
|
|
|
|
return TextStyle(color:primaryColor,fontSize: 12,fontWeight: FontWeight.bold,overflow: TextOverflow.ellipsis,);
|
|
|
|
|
return TextStyle(
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TextStyle wrapTextStyleBlack() {
|
|
|
|
|
return TextStyle(color:Colors.black,fontSize: 12,fontWeight: FontWeight.bold,overflow: TextOverflow.ellipsis,);
|
|
|
|
|
return TextStyle(
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TextStyle withoutWrapTextStyle() {
|
|
|
|
|
return TextStyle(color:primaryColor,fontSize: 12,fontWeight: FontWeight.bold,);
|
|
|
|
|
return TextStyle(
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TextStyle bmiTextStyle() {
|
|
|
|
|
return TextStyle(color:primaryColor,fontSize: 16,fontWeight: FontWeight.bold,);
|
|
|
|
|
return TextStyle(
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TextStyle drawerListItemsTextStyle(){
|
|
|
|
|
TextStyle drawerListItemsTextStyle() {
|
|
|
|
|
return TextStyle(color: Colors.white);
|
|
|
|
|
}
|
|
|
|
|
TextStyle drawerHeaderTextStyle(){
|
|
|
|
|
|
|
|
|
|
TextStyle drawerHeaderTextStyle() {
|
|
|
|
|
return TextStyle(color: Colors.white, fontSize: 15);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TextStyle drawerHeaderTextStyleNew(){
|
|
|
|
|
TextStyle drawerHeaderTextStyleNew() {
|
|
|
|
|
return TextStyle(color: Colors.black, fontSize: 15);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
InputDecoration textFormFieldDecoration(IconData icon,var text){
|
|
|
|
|
InputDecoration textFormFieldDecoration(IconData icon, var text) {
|
|
|
|
|
return InputDecoration(
|
|
|
|
|
filled: true,
|
|
|
|
|
fillColor: Colors.white,
|
|
|
|
@ -134,8 +158,8 @@ InputDecoration textFormFieldDecoration(IconData icon,var text){
|
|
|
|
|
borderSide: BorderSide(color: primaryColor),
|
|
|
|
|
),
|
|
|
|
|
labelText: text,
|
|
|
|
|
labelStyle:
|
|
|
|
|
TextStyle(color: Colors.black, //<-- SEE HERE
|
|
|
|
|
labelStyle: TextStyle(
|
|
|
|
|
color: Colors.black, //<-- SEE HERE
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
@ -172,9 +196,9 @@ class AppSettings {
|
|
|
|
|
static late Position position;
|
|
|
|
|
static String long = "", lat = "";
|
|
|
|
|
late StreamSubscription<Position> positionStream;
|
|
|
|
|
static String fcmId='';
|
|
|
|
|
static String serverToken='AAAAA66BLaA:APA91bHcmbyiNN8hCL-t-M9oH-u7ZMOl74fcImMM2DQZLgdyY98Wu9XxME-CTPcjpjU6Yy48ouxISrOMb9lpa3PJofh8qciUKMNxV2al-bDvGvPP_VVaH0mrTHzR56hdkGy1Zl-0frDO';
|
|
|
|
|
|
|
|
|
|
static String fcmId = '';
|
|
|
|
|
static String serverToken =
|
|
|
|
|
'AAAAA66BLaA:APA91bHcmbyiNN8hCL-t-M9oH-u7ZMOl74fcImMM2DQZLgdyY98Wu9XxME-CTPcjpjU6Yy48ouxISrOMb9lpa3PJofh8qciUKMNxV2al-bDvGvPP_VVaH0mrTHzR56hdkGy1Zl-0frDO';
|
|
|
|
|
|
|
|
|
|
//api urls
|
|
|
|
|
static String host = 'http://35.200.129.165:4000/api/';
|
|
|
|
@ -197,21 +221,12 @@ class AppSettings {
|
|
|
|
|
static String getMedicineTimingsUrl = host + 'getmedicineztiming';
|
|
|
|
|
static String prescriptionUploadPicUrl = host + 'uploads-precription';
|
|
|
|
|
static String getAllpharmaciesDataUrl = host + 'getAllPharmacylist';
|
|
|
|
|
static String getAllQuotationRequestsUrl = host + 'userprecription';
|
|
|
|
|
static String getQuotationUrl = host + 'submitPicture';
|
|
|
|
|
static String addPrescriptionUrl = host + 'add-prescription-details';
|
|
|
|
|
static String reportMySelfVideoUploadUrl = host + 'reportProblemVideo';
|
|
|
|
|
static String getAllPrescriptionsDataUrl = host + 'usersinglerprecription';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static File? updatedImage;
|
|
|
|
|
static String image = '';
|
|
|
|
|
static String profilePictureUrl = '';
|
|
|
|
@ -234,8 +249,6 @@ class AppSettings {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Preloader */
|
|
|
|
|
static GlobalKey<State> preLoaderKey = new GlobalKey<State>();
|
|
|
|
|
static Future<void> preLoaderDialog(BuildContext context) async {
|
|
|
|
@ -260,7 +273,8 @@ class AppSettings {
|
|
|
|
|
return _headers;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Future<Map<String, String>> buildPutRequestHeadersForResetToken() async {
|
|
|
|
|
static Future<Map<String, String>>
|
|
|
|
|
buildPutRequestHeadersForResetToken() async {
|
|
|
|
|
Map<String, String> _headers = new Map<String, String>();
|
|
|
|
|
return _headers;
|
|
|
|
|
}
|
|
|
|
@ -369,28 +383,30 @@ class AppSettings {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Future<bool> sendSms(payload) async{
|
|
|
|
|
var response=await http.post(Uri.parse(sendSmsUrl),body: json.encode(payload), headers: {'Content-type': 'application/json'});
|
|
|
|
|
if(response.statusCode==200){
|
|
|
|
|
static Future<bool> sendSms(payload) async {
|
|
|
|
|
var response = await http.post(Uri.parse(sendSmsUrl),
|
|
|
|
|
body: json.encode(payload),
|
|
|
|
|
headers: {'Content-type': 'application/json'});
|
|
|
|
|
if (response.statusCode == 200) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Future<bool> phoneVerification(payload) async{
|
|
|
|
|
var response=await http.post(Uri.parse(phoneVerificationUrl),body: json.encode(payload), headers: {'Content-type': 'application/json'});
|
|
|
|
|
if(response.statusCode==200){
|
|
|
|
|
static Future<bool> phoneVerification(payload) async {
|
|
|
|
|
var response = await http.post(Uri.parse(phoneVerificationUrl),
|
|
|
|
|
body: json.encode(payload),
|
|
|
|
|
headers: {'Content-type': 'application/json'});
|
|
|
|
|
if (response.statusCode == 200) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Future<String> calculateBmi(payload) async {
|
|
|
|
|
var uri = Uri.parse(bmiCaluculateUrl+ '/'+customerId);
|
|
|
|
|
var uri = Uri.parse(bmiCaluculateUrl + '/' + customerId);
|
|
|
|
|
|
|
|
|
|
var response = await http.post(uri,
|
|
|
|
|
body: json.encode(payload), headers: await buildRequestHeaders());
|
|
|
|
@ -415,7 +431,7 @@ class AppSettings {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Future<String> calculateBP(payload) async {
|
|
|
|
|
var uri = Uri.parse(bpCaluculateUrl+ '/'+customerId);
|
|
|
|
|
var uri = Uri.parse(bpCaluculateUrl + '/' + customerId);
|
|
|
|
|
|
|
|
|
|
var response = await http.post(uri,
|
|
|
|
|
body: json.encode(payload), headers: await buildRequestHeaders());
|
|
|
|
@ -440,7 +456,7 @@ class AppSettings {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Future<String> calculateSugar(payload) async {
|
|
|
|
|
var uri = Uri.parse(sugarCaluculateUrl+ '/'+customerId);
|
|
|
|
|
var uri = Uri.parse(sugarCaluculateUrl + '/' + customerId);
|
|
|
|
|
|
|
|
|
|
var response = await http.post(uri,
|
|
|
|
|
body: json.encode(payload), headers: await buildRequestHeaders());
|
|
|
|
@ -524,9 +540,7 @@ class AppSettings {
|
|
|
|
|
// display error toast
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else if (response.statusCode == 401) {
|
|
|
|
|
} else if (response.statusCode == 401) {
|
|
|
|
|
bool status = await AppSettings.resetToken();
|
|
|
|
|
if (status) {
|
|
|
|
|
response = await http.post(uri,
|
|
|
|
@ -539,9 +553,7 @@ class AppSettings {
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -549,10 +561,8 @@ class AppSettings {
|
|
|
|
|
static Future<bool> updateProfile(payload) async {
|
|
|
|
|
var uri = Uri.parse(updateProfileUrl + '/' + customerId);
|
|
|
|
|
try {
|
|
|
|
|
var response = await http.put(
|
|
|
|
|
uri,
|
|
|
|
|
body: json.encode(payload),
|
|
|
|
|
headers: await buildRequestHeaders());
|
|
|
|
|
var response = await http.put(uri,
|
|
|
|
|
body: json.encode(payload), headers: await buildRequestHeaders());
|
|
|
|
|
|
|
|
|
|
if (response.statusCode == 200) {
|
|
|
|
|
var _response = json.decode(response.body);
|
|
|
|
@ -562,7 +572,7 @@ class AppSettings {
|
|
|
|
|
email = _response['emails'][0]['email'];
|
|
|
|
|
age = _response['age'].toString();
|
|
|
|
|
await saveData('phone', _response['phone'], 'STRING');
|
|
|
|
|
await saveData('email', _response['emails'][0]['email'], 'STRING');
|
|
|
|
|
await saveData('email', _response['emails'][0]['email'], 'STRING');
|
|
|
|
|
await saveData('username', _response['username'], 'STRING');
|
|
|
|
|
await saveData('age', _response['age'].toString(), 'STRING');
|
|
|
|
|
await loadDataFromMemory();
|
|
|
|
@ -577,7 +587,7 @@ class AppSettings {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Future<String> getBmiHistory() async {
|
|
|
|
|
var uri = Uri.parse(getBmiHistoryUrl+'/'+customerId);
|
|
|
|
|
var uri = Uri.parse(getBmiHistoryUrl + '/' + customerId);
|
|
|
|
|
|
|
|
|
|
var response = await http.get(uri, headers: await buildRequestHeaders());
|
|
|
|
|
if (response.statusCode == 200) {
|
|
|
|
@ -600,7 +610,7 @@ class AppSettings {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Future<String> getBPHistory() async {
|
|
|
|
|
var uri = Uri.parse(getBpHistoryUrl+'/'+customerId);
|
|
|
|
|
var uri = Uri.parse(getBpHistoryUrl + '/' + customerId);
|
|
|
|
|
|
|
|
|
|
var response = await http.get(uri, headers: await buildRequestHeaders());
|
|
|
|
|
if (response.statusCode == 200) {
|
|
|
|
@ -623,7 +633,7 @@ class AppSettings {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Future<String> getSugarHistory() async {
|
|
|
|
|
var uri = Uri.parse(getSugarHistoryUrl+'/'+customerId);
|
|
|
|
|
var uri = Uri.parse(getSugarHistoryUrl + '/' + customerId);
|
|
|
|
|
|
|
|
|
|
var response = await http.get(uri, headers: await buildRequestHeaders());
|
|
|
|
|
if (response.statusCode == 200) {
|
|
|
|
@ -645,7 +655,7 @@ class AppSettings {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* static Future upload() async{
|
|
|
|
|
/* static Future upload() async{
|
|
|
|
|
final uri = Uri.parse('https://myendpoint.com');
|
|
|
|
|
var request = new http.MultipartRequest('POST', uri);
|
|
|
|
|
final httpImage = http.MultipartFile.fromBytes('files.myimage', bytes,
|
|
|
|
@ -655,41 +665,38 @@ class AppSettings {
|
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
static Future<http.StreamedResponse> uploadImageHTTP(file) async {
|
|
|
|
|
|
|
|
|
|
var request = http.MultipartRequest('POST', Uri.parse(uploadPicUrl + '/' + customerId));
|
|
|
|
|
var request = http.MultipartRequest(
|
|
|
|
|
'POST', Uri.parse(uploadPicUrl + '/' + customerId));
|
|
|
|
|
request.files.add(await http.MultipartFile.fromPath('picture', file.path));
|
|
|
|
|
var res = await request.send();
|
|
|
|
|
return res;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
static Future<String> uploadImageHTTPNew(file) async {
|
|
|
|
|
|
|
|
|
|
var request = http.MultipartRequest('POST', Uri.parse(uploadPicUrl + '/' + customerId));
|
|
|
|
|
static Future<String> uploadImageHTTPNew(file) async {
|
|
|
|
|
var request = http.MultipartRequest(
|
|
|
|
|
'POST', Uri.parse(uploadPicUrl + '/' + customerId));
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Future<String> uploadImageHTTPForPrescriptions(file) async {
|
|
|
|
|
|
|
|
|
|
var request = http.MultipartRequest('POST', Uri.parse(prescriptionUploadPicUrl + '/' + customerId));
|
|
|
|
|
var request = http.MultipartRequest(
|
|
|
|
|
'POST', Uri.parse(prescriptionUploadPicUrl + '/' + customerId));
|
|
|
|
|
request.files.add(await http.MultipartFile.fromPath('picture', file.path));
|
|
|
|
|
var res = await request.send();
|
|
|
|
|
var response = await http.Response.fromStream(res);
|
|
|
|
|
var response = await http.Response.fromStream(res);
|
|
|
|
|
return response.body;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Future<String> uploadVideoInReportMySelf(file) async {
|
|
|
|
|
|
|
|
|
|
var request = http.MultipartRequest('POST', Uri.parse(reportMySelfVideoUploadUrl + '/' + customerId));
|
|
|
|
|
var request = http.MultipartRequest(
|
|
|
|
|
'POST', Uri.parse(reportMySelfVideoUploadUrl + '/' + customerId));
|
|
|
|
|
request.files.add(await http.MultipartFile.fromPath('video', file.path));
|
|
|
|
|
var res = await request.send();
|
|
|
|
|
var response = await http.Response.fromStream(res);
|
|
|
|
|
return response.body;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Future<String> getAllpharmacies() async {
|
|
|
|
@ -716,8 +723,32 @@ class AppSettings {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Future<String> getAllQuotationRequests() async {
|
|
|
|
|
var uri = Uri.parse(getAllQuotationRequestsUrl+'/'+customerId);
|
|
|
|
|
//uri = uri.replace(query: 'customerId=$customerId');
|
|
|
|
|
|
|
|
|
|
var response = await http.get(uri, 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.get(uri, headers: await buildRequestHeaders());
|
|
|
|
|
if (response.statusCode == 200) {
|
|
|
|
|
return response.body;
|
|
|
|
|
} else {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Future<String> addMedicineTimings(payload) async {
|
|
|
|
|
var uri = Uri.parse(addMedicineTimingsUrl+ '/'+customerId);
|
|
|
|
|
var uri = Uri.parse(addMedicineTimingsUrl + '/' + customerId);
|
|
|
|
|
|
|
|
|
|
var response = await http.post(uri,
|
|
|
|
|
body: json.encode(payload), headers: await buildRequestHeaders());
|
|
|
|
@ -742,7 +773,7 @@ class AppSettings {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Future<String> getMedicineTimings() async {
|
|
|
|
|
var uri = Uri.parse(getMedicineTimingsUrl+'/'+customerId);
|
|
|
|
|
var uri = Uri.parse(getMedicineTimingsUrl + '/' + customerId);
|
|
|
|
|
|
|
|
|
|
var response = await http.get(uri, headers: await buildRequestHeaders());
|
|
|
|
|
if (response.statusCode == 200) {
|
|
|
|
@ -766,10 +797,8 @@ class AppSettings {
|
|
|
|
|
|
|
|
|
|
static Future<bool> getQuotation(payload) async {
|
|
|
|
|
var uri = Uri.parse(getQuotationUrl + '/' + customerId);
|
|
|
|
|
var response = await http.post(
|
|
|
|
|
uri,
|
|
|
|
|
body: json.encode(payload),
|
|
|
|
|
headers: await buildRequestHeaders());
|
|
|
|
|
var response = await http.post(uri,
|
|
|
|
|
body: json.encode(payload), headers: await buildRequestHeaders());
|
|
|
|
|
|
|
|
|
|
if (response.statusCode == 200) {
|
|
|
|
|
try {
|
|
|
|
@ -783,10 +812,8 @@ class AppSettings {
|
|
|
|
|
} else if (response.statusCode == 401) {
|
|
|
|
|
bool status = await AppSettings.resetToken();
|
|
|
|
|
if (status) {
|
|
|
|
|
response = await http.post(
|
|
|
|
|
uri,
|
|
|
|
|
body: json.encode(payload),
|
|
|
|
|
headers: await buildRequestHeaders());
|
|
|
|
|
response = await http.post(uri,
|
|
|
|
|
body: json.encode(payload), headers: await buildRequestHeaders());
|
|
|
|
|
if (response.statusCode == 200) {
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
@ -802,10 +829,8 @@ class AppSettings {
|
|
|
|
|
|
|
|
|
|
static Future<bool> addPrescription(payload) async {
|
|
|
|
|
var uri = Uri.parse(addPrescriptionUrl + '/' + customerId);
|
|
|
|
|
var response = await http.post(
|
|
|
|
|
uri,
|
|
|
|
|
body: json.encode(payload),
|
|
|
|
|
headers: await buildRequestHeaders());
|
|
|
|
|
var response = await http.post(uri,
|
|
|
|
|
body: json.encode(payload), headers: await buildRequestHeaders());
|
|
|
|
|
|
|
|
|
|
if (response.statusCode == 200) {
|
|
|
|
|
try {
|
|
|
|
@ -819,10 +844,8 @@ class AppSettings {
|
|
|
|
|
} else if (response.statusCode == 401) {
|
|
|
|
|
bool status = await AppSettings.resetToken();
|
|
|
|
|
if (status) {
|
|
|
|
|
response = await http.post(
|
|
|
|
|
uri,
|
|
|
|
|
body: json.encode(payload),
|
|
|
|
|
headers: await buildRequestHeaders());
|
|
|
|
|
response = await http.post(uri,
|
|
|
|
|
body: json.encode(payload), headers: await buildRequestHeaders());
|
|
|
|
|
if (response.statusCode == 200) {
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
@ -837,7 +860,7 @@ class AppSettings {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Future<String> getAllPrescriptions() async {
|
|
|
|
|
var uri = Uri.parse(getAllPrescriptionsDataUrl+'/'+customerId);
|
|
|
|
|
var uri = Uri.parse(getAllPrescriptionsDataUrl + '/' + customerId);
|
|
|
|
|
//uri = uri.replace(query: 'customerId=$customerId');
|
|
|
|
|
|
|
|
|
|
var response = await http.get(uri, headers: await buildRequestHeaders());
|
|
|
|
@ -860,8 +883,6 @@ class AppSettings {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*Apis ends here*/
|
|
|
|
|
|
|
|
|
|
//save data local
|
|
|
|
@ -886,7 +907,7 @@ class AppSettings {
|
|
|
|
|
await loadDataFromMemory();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* static Future<void> saveProfile(dynamic image) async {
|
|
|
|
|
/* static Future<void> saveProfile(dynamic image) async {
|
|
|
|
|
// save login name information
|
|
|
|
|
await saveData('profile', image.toString(), 'STRING');
|
|
|
|
|
//await loadDataFromMemory();
|
|
|
|
@ -904,11 +925,11 @@ class AppSettings {
|
|
|
|
|
phoneNumber = await getData('phone', 'STRING');
|
|
|
|
|
customerId = await getData('customerId', 'STRING');
|
|
|
|
|
userLatitude = await getData('latitude', 'DOUBLE');
|
|
|
|
|
userLongitude =await getData('longitude', 'DOUBLE');
|
|
|
|
|
profilePictureUrl=await getData('profile', 'STRING');
|
|
|
|
|
fcmId =await getData('fcmId', 'STRING');
|
|
|
|
|
age=await getData('age', 'STRING');
|
|
|
|
|
gender=await getData('gender', 'STRING');
|
|
|
|
|
userLongitude = await getData('longitude', 'DOUBLE');
|
|
|
|
|
profilePictureUrl = await getData('profile', 'STRING');
|
|
|
|
|
fcmId = await getData('fcmId', 'STRING');
|
|
|
|
|
age = await getData('age', 'STRING');
|
|
|
|
|
gender = await getData('gender', 'STRING');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void longFailedStyledToast(String message, context) {
|
|
|
|
@ -936,6 +957,7 @@ class AppSettings {
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
fontSize: 16.0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void longSuccessToast1(String message) {
|
|
|
|
|
Fluttertoast.showToast(
|
|
|
|
|
msg: message,
|
|
|
|
@ -944,8 +966,7 @@ class AppSettings {
|
|
|
|
|
timeInSecForIosWeb: 1,
|
|
|
|
|
backgroundColor: Colors.green,
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
fontSize: 16.0
|
|
|
|
|
);
|
|
|
|
|
fontSize: 16.0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void longFailedToast(String message) {
|
|
|
|
|