|
|
@ -10,6 +10,7 @@ import 'package:healthcare_user/keys.dart';
|
|
|
|
import 'package:healthcare_user/models/pharmacies_model.dart';
|
|
|
|
import 'package:healthcare_user/models/pharmacies_model.dart';
|
|
|
|
import 'package:google_maps_flutter_android/google_maps_flutter_android.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:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart';
|
|
|
|
|
|
|
|
import 'package:healthcare_user/prescriptions/get_quotations_request_list.dart';
|
|
|
|
import 'package:location/location.dart' as locationmap;
|
|
|
|
import 'package:location/location.dart' as locationmap;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -29,6 +30,7 @@ class _OrderMedicinesState extends State<OrderMedicines> {
|
|
|
|
//String dropdownType = 'Tank';
|
|
|
|
//String dropdownType = 'Tank';
|
|
|
|
var AreaItems = ['2', '5', '10', '25', '50', '100'];
|
|
|
|
var AreaItems = ['2', '5', '10', '25', '50', '100'];
|
|
|
|
List pharmaciesCheckboxes = [];
|
|
|
|
List pharmaciesCheckboxes = [];
|
|
|
|
|
|
|
|
List pharmaciesCheckboxesInDialog = [];
|
|
|
|
List selectedPharmacies = [];
|
|
|
|
List selectedPharmacies = [];
|
|
|
|
bool isLoading = false;
|
|
|
|
bool isLoading = false;
|
|
|
|
bool isSereverIssue = false;
|
|
|
|
bool isSereverIssue = false;
|
|
|
@ -68,6 +70,7 @@ class _OrderMedicinesState extends State<OrderMedicines> {
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> getAllPharmaciesData(var distance) async {
|
|
|
|
Future<void> getAllPharmaciesData(var distance) async {
|
|
|
|
isLoading = true;
|
|
|
|
isLoading = true;
|
|
|
|
|
|
|
|
selectedPharmacies=[];
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
var pharmacyResponse = await AppSettings.getAllpharmacies();
|
|
|
|
var pharmacyResponse = await AppSettings.getAllpharmacies();
|
|
|
|
|
|
|
|
|
|
|
@ -110,74 +113,447 @@ class _OrderMedicinesState extends State<OrderMedicines> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
showListOfSelectedPharmacies() async {
|
|
|
|
|
|
|
|
|
|
|
|
showSelectedPharmaciesDialog(){
|
|
|
|
return showDialog(
|
|
|
|
return showDialog(
|
|
|
|
context: context,
|
|
|
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
|
|
|
context: context,
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
return StatefulBuilder(
|
|
|
|
return StatefulBuilder(builder: (context, setState) {
|
|
|
|
builder: (BuildContext context, StateSetter setState) {
|
|
|
|
return AlertDialog(
|
|
|
|
|
|
|
|
title: Text('Selected Pharmacies'),
|
|
|
|
return Container(
|
|
|
|
content: Container(
|
|
|
|
height: 300.0, // Change as per your requirement
|
|
|
|
height: MediaQuery.of(context).size.height * .50,
|
|
|
|
width: 300.0, // Change as per your requirement
|
|
|
|
width: MediaQuery.of(context).size.width * .70,
|
|
|
|
child: ListView.builder(
|
|
|
|
child:ListView.separated(
|
|
|
|
shrinkWrap: true,
|
|
|
|
separatorBuilder: (context, index) => const Divider(height: 4.0,color: Colors.black,),
|
|
|
|
itemCount: 5,
|
|
|
|
itemCount: selectedPharmacies.length,
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
return ListTile(
|
|
|
|
return ListTile(
|
|
|
|
title: Text('Gujarat, India'),
|
|
|
|
title: CheckboxListTile(
|
|
|
|
|
|
|
|
title: Padding(
|
|
|
|
|
|
|
|
padding: EdgeInsets.fromLTRB(0, 10, 0, 0),
|
|
|
|
|
|
|
|
child: Row(
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
/*Container(
|
|
|
|
|
|
|
|
width: MediaQuery.of(context).size.width * .18,
|
|
|
|
|
|
|
|
height: MediaQuery.of(context).size.height * .10,
|
|
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
|
|
shape: BoxShape.rectangle,
|
|
|
|
|
|
|
|
image: DecorationImage(
|
|
|
|
|
|
|
|
image: selectedPharmacies[index].picture == ''
|
|
|
|
|
|
|
|
? AssetImage("images/logo.png")
|
|
|
|
|
|
|
|
: NetworkImage(
|
|
|
|
|
|
|
|
selectedPharmacies[index].picture)
|
|
|
|
|
|
|
|
as ImageProvider, // picked file
|
|
|
|
|
|
|
|
fit: BoxFit.contain)),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
width: 5,
|
|
|
|
|
|
|
|
),*/
|
|
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
|
|
child: Container(
|
|
|
|
|
|
|
|
width: MediaQuery.of(context).size.width * .70,
|
|
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
|
|
|
MainAxisAlignment.spaceBetween,
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Text(
|
|
|
|
|
|
|
|
selectedPharmacies[index]
|
|
|
|
|
|
|
|
.pharmacy_name
|
|
|
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
|
|
|
style: wrapTextStyleBlack()),
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
height: 10,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Text(
|
|
|
|
|
|
|
|
selectedPharmacies[index]
|
|
|
|
|
|
|
|
.contact_number
|
|
|
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
|
|
|
style: wrapTextStyleBlack()),
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
height: 10,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Text(
|
|
|
|
|
|
|
|
selectedPharmacies[index]
|
|
|
|
|
|
|
|
.pharmacy_address
|
|
|
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
|
|
|
style: wrapTextStyleBlack()),
|
|
|
|
|
|
|
|
Visibility(
|
|
|
|
|
|
|
|
visible:
|
|
|
|
|
|
|
|
selectedPharmacies[index].description != '',
|
|
|
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
|
|
|
height: 10,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Visibility(
|
|
|
|
|
|
|
|
visible:
|
|
|
|
|
|
|
|
selectedPharmacies[index].description != '',
|
|
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
|
|
selectedPharmacies[index]
|
|
|
|
|
|
|
|
.description
|
|
|
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
|
|
|
style: wrapTextStyleBlack()),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
height: 10,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
checkColor: Colors.white,
|
|
|
|
|
|
|
|
activeColor: primaryColor,
|
|
|
|
|
|
|
|
value: selectedPharmacies[index].isPharmacyInDialogChecked,
|
|
|
|
|
|
|
|
onChanged: (val) {
|
|
|
|
|
|
|
|
setState(
|
|
|
|
|
|
|
|
() {
|
|
|
|
|
|
|
|
selectedPharmacies[index].isPharmacyInDialogChecked = val!;
|
|
|
|
|
|
|
|
},
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
if (selectedPharmacies[index].isPharmacyInDialogChecked) {
|
|
|
|
|
|
|
|
pharmaciesCheckboxesInDialog.add({
|
|
|
|
|
|
|
|
'pharmacyId': selectedPharmacies[index].pharmacy_id,
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
pharmaciesCheckboxesInDialog.removeWhere((e) =>
|
|
|
|
|
|
|
|
e['pharmacyId'].toString().toUpperCase() ==
|
|
|
|
|
|
|
|
selectedPharmacies[index]
|
|
|
|
|
|
|
|
.pharmacy_id
|
|
|
|
|
|
|
|
.toString()
|
|
|
|
|
|
|
|
.toUpperCase());
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
/*Padding(
|
|
|
|
/* return AlertDialog(
|
|
|
|
padding: EdgeInsets.fromLTRB(0, 0, 0, 0),
|
|
|
|
title: const Text('Selected pharmacies'),
|
|
|
|
child: Column(
|
|
|
|
content: SingleChildScrollView(
|
|
|
|
children: [
|
|
|
|
child: Expanded(
|
|
|
|
Row(
|
|
|
|
child: ListView.builder(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
itemCount: selectedPharmacies.length,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
children: [
|
|
|
|
return Card(
|
|
|
|
Container(
|
|
|
|
|
|
|
|
width: MediaQuery.of(context).size.width * .18,
|
|
|
|
|
|
|
|
height: MediaQuery.of(context).size.height * .10,
|
|
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
|
|
shape: BoxShape.rectangle,
|
|
|
|
|
|
|
|
image: DecorationImage(
|
|
|
|
|
|
|
|
image: selectedPharmacies[index].picture == ''
|
|
|
|
|
|
|
|
? AssetImage("images/logo.png")
|
|
|
|
|
|
|
|
: NetworkImage(
|
|
|
|
|
|
|
|
selectedPharmacies[index].picture)
|
|
|
|
|
|
|
|
as ImageProvider, // picked file
|
|
|
|
|
|
|
|
fit: BoxFit.contain)),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
width: 5,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
|
|
child: Container(
|
|
|
|
|
|
|
|
width: MediaQuery.of(context).size.width * .70,
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
|
|
|
MainAxisAlignment.spaceBetween,
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Text(selectedPharmacies[index].pharmacy_name)
|
|
|
|
Text(
|
|
|
|
|
|
|
|
selectedPharmacies[index]
|
|
|
|
|
|
|
|
.pharmacy_name
|
|
|
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
|
|
|
style: wrapTextStyleBlack()),
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
height: 10,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Text(
|
|
|
|
|
|
|
|
selectedPharmacies[index]
|
|
|
|
|
|
|
|
.contact_number
|
|
|
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
|
|
|
style: wrapTextStyleBlack()),
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
height: 10,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Text(
|
|
|
|
|
|
|
|
selectedPharmacies[index]
|
|
|
|
|
|
|
|
.pharmacy_address
|
|
|
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
|
|
|
style: wrapTextStyleBlack()),
|
|
|
|
|
|
|
|
Visibility(
|
|
|
|
|
|
|
|
visible:
|
|
|
|
|
|
|
|
selectedPharmacies[index].description != '',
|
|
|
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
|
|
|
height: 10,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Visibility(
|
|
|
|
|
|
|
|
visible:
|
|
|
|
|
|
|
|
selectedPharmacies[index].description != '',
|
|
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
|
|
selectedPharmacies[index]
|
|
|
|
|
|
|
|
.description
|
|
|
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
|
|
|
style: wrapTextStyleBlack()),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
height: 10,
|
|
|
|
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);},
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
Container(
|
|
|
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
|
|
|
height: MediaQuery.of(context).size.height * .06,
|
|
|
|
|
|
|
|
padding: const EdgeInsets.all(10),
|
|
|
|
|
|
|
|
child: Row(
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Visibility(
|
|
|
|
|
|
|
|
visible:selectedPharmacies[index].isPharmacyInDialogChecked==false,
|
|
|
|
|
|
|
|
child: ElevatedButton(
|
|
|
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
|
|
|
primary: primaryColor, // background
|
|
|
|
|
|
|
|
onPrimary: Colors.white, // foreground
|
|
|
|
),
|
|
|
|
),
|
|
|
|
actions: <Widget>[
|
|
|
|
onPressed: () async{
|
|
|
|
TextButton(
|
|
|
|
selectedPharmacies[index].isPharmacyInDialogChecked=true;
|
|
|
|
child: Text('Cancel', style: textButtonStyle()),
|
|
|
|
|
|
|
|
onPressed: () {
|
|
|
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
child: const Text('Select'),
|
|
|
|
|
|
|
|
),),
|
|
|
|
|
|
|
|
SizedBox(width: 10,),
|
|
|
|
|
|
|
|
Visibility(
|
|
|
|
|
|
|
|
visible: selectedPharmacies[index].isPharmacyInDialogChecked==true,
|
|
|
|
|
|
|
|
child: ElevatedButton(
|
|
|
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
|
|
|
primary: primaryColor, // background
|
|
|
|
|
|
|
|
onPrimary: Colors.white, // foreground
|
|
|
|
),
|
|
|
|
),
|
|
|
|
TextButton(
|
|
|
|
|
|
|
|
child: Text('Get quote', style: textButtonStyle()),
|
|
|
|
|
|
|
|
onPressed: () async{
|
|
|
|
onPressed: () async{
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
child: const Text('Deselect'),
|
|
|
|
|
|
|
|
))
|
|
|
|
],
|
|
|
|
],
|
|
|
|
);*/
|
|
|
|
)),
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
)),*/
|
|
|
|
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
actions: <Widget>[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
|
|
|
height: MediaQuery.of(context).size.height * .06,
|
|
|
|
|
|
|
|
padding: const EdgeInsets.all(10),
|
|
|
|
|
|
|
|
child: Row(
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
ElevatedButton(
|
|
|
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
|
|
|
primary: buttonColors, // background
|
|
|
|
|
|
|
|
onPrimary: Colors.black, // foreground
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
onPressed: () async{
|
|
|
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
child: const Text('Cancel'),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
SizedBox(width: 10,),
|
|
|
|
|
|
|
|
ElevatedButton(
|
|
|
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
|
|
|
primary: buttonColors, // background
|
|
|
|
|
|
|
|
onPrimary: Colors.black, // foreground
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
onPressed: () async{
|
|
|
|
|
|
|
|
if(pharmaciesCheckboxesInDialog.length==3){
|
|
|
|
|
|
|
|
AppSettings.preLoaderDialog(context);
|
|
|
|
|
|
|
|
var payload = new Map<String, dynamic>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
payload["picture"] = widget.prescriptionDetails.prescription_url.toString();
|
|
|
|
|
|
|
|
payload["pharmacies"] = pharmaciesCheckboxesInDialog;
|
|
|
|
|
|
|
|
payload["familyDetails"] = {
|
|
|
|
|
|
|
|
"patient_name": widget.prescriptionDetails.patient_name.toString(),
|
|
|
|
|
|
|
|
"patient_age": int.parse(widget.prescriptionDetails.age.toString()),
|
|
|
|
|
|
|
|
"patient_gender": widget.prescriptionDetails.gender,
|
|
|
|
|
|
|
|
"patient_address": userAddress
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
bool status = await AppSettings.getQuotation(payload);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(status){
|
|
|
|
|
|
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
|
|
|
|
|
|
AppSettings.longSuccessToast('Quotation request sent successfully');
|
|
|
|
|
|
|
|
pharmaciesCheckboxesInDialog.clear();
|
|
|
|
|
|
|
|
Navigator.push(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
|
|
|
builder: (context) => const GetQuotationRequestsList()),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
|
|
|
|
|
|
AppSettings.longFailedToast('Get quotation failed try after some time');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(pharmaciesCheckboxesInDialog.length>3){
|
|
|
|
|
|
|
|
AppSettings.longFailedToast('Please select only three pharmacies to get quotation');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
AppSettings.longFailedToast('Please select at least three pharmacies to get quotation');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
child: const Text('Get quote'),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Widget setupAlertDialoadContainer() {
|
|
|
|
Widget setupAlertDialoadContainer() {
|
|
|
|
return Container(
|
|
|
|
return Container(
|
|
|
|
height: 300.0, // Change as per your requirement
|
|
|
|
height: MediaQuery.of(context).size.height * .50,
|
|
|
|
width: 300.0, // Change as per your requirement
|
|
|
|
width: MediaQuery.of(context).size.width * .70,
|
|
|
|
child: ListView.builder(
|
|
|
|
child:ListView.separated(
|
|
|
|
shrinkWrap: true,
|
|
|
|
separatorBuilder: (context, index) => const Divider(height: 4.0,color: Colors.black,),
|
|
|
|
itemCount: 5,
|
|
|
|
itemCount: selectedPharmacies.length,
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
return ListTile(
|
|
|
|
return ListTile(
|
|
|
|
title: Text('Gujarat, India'),
|
|
|
|
title: Padding(
|
|
|
|
|
|
|
|
padding: EdgeInsets.fromLTRB(0, 0, 0, 0),
|
|
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Row(
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
|
|
|
width: MediaQuery.of(context).size.width * .18,
|
|
|
|
|
|
|
|
height: MediaQuery.of(context).size.height * .10,
|
|
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
|
|
shape: BoxShape.rectangle,
|
|
|
|
|
|
|
|
image: DecorationImage(
|
|
|
|
|
|
|
|
image: selectedPharmacies[index].picture == ''
|
|
|
|
|
|
|
|
? AssetImage("images/logo.png")
|
|
|
|
|
|
|
|
: NetworkImage(
|
|
|
|
|
|
|
|
selectedPharmacies[index].picture)
|
|
|
|
|
|
|
|
as ImageProvider, // picked file
|
|
|
|
|
|
|
|
fit: BoxFit.contain)),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
width: 5,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
|
|
child: Container(
|
|
|
|
|
|
|
|
width: MediaQuery.of(context).size.width * .70,
|
|
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
|
|
|
MainAxisAlignment.spaceBetween,
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Text(
|
|
|
|
|
|
|
|
selectedPharmacies[index]
|
|
|
|
|
|
|
|
.pharmacy_name
|
|
|
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
|
|
|
style: wrapTextStyleBlack()),
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
height: 10,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Text(
|
|
|
|
|
|
|
|
selectedPharmacies[index]
|
|
|
|
|
|
|
|
.contact_number
|
|
|
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
|
|
|
style: wrapTextStyleBlack()),
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
height: 10,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Text(
|
|
|
|
|
|
|
|
selectedPharmacies[index]
|
|
|
|
|
|
|
|
.pharmacy_address
|
|
|
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
|
|
|
style: wrapTextStyleBlack()),
|
|
|
|
|
|
|
|
Visibility(
|
|
|
|
|
|
|
|
visible:
|
|
|
|
|
|
|
|
selectedPharmacies[index].description != '',
|
|
|
|
|
|
|
|
child: SizedBox(
|
|
|
|
|
|
|
|
height: 10,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Visibility(
|
|
|
|
|
|
|
|
visible:
|
|
|
|
|
|
|
|
selectedPharmacies[index].description != '',
|
|
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
|
|
selectedPharmacies[index]
|
|
|
|
|
|
|
|
.description
|
|
|
|
|
|
|
|
.toUpperCase(),
|
|
|
|
|
|
|
|
style: wrapTextStyleBlack()),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
height: 10,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
|
|
|
height: MediaQuery.of(context).size.height * .06,
|
|
|
|
|
|
|
|
padding: const EdgeInsets.all(10),
|
|
|
|
|
|
|
|
child: Row(
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Visibility(
|
|
|
|
|
|
|
|
visible:selectedPharmacies[index].isPharmacyInDialogChecked==false,
|
|
|
|
|
|
|
|
child: ElevatedButton(
|
|
|
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
|
|
|
primary: primaryColor, // background
|
|
|
|
|
|
|
|
onPrimary: Colors.white, // foreground
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
onPressed: () async{
|
|
|
|
|
|
|
|
selectedPharmacies[index].isPharmacyInDialogChecked=true;
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
child: const Text('Select'),
|
|
|
|
|
|
|
|
),),
|
|
|
|
|
|
|
|
SizedBox(width: 10,),
|
|
|
|
|
|
|
|
Visibility(
|
|
|
|
|
|
|
|
visible: selectedPharmacies[index].isPharmacyInDialogChecked==true,
|
|
|
|
|
|
|
|
child: ElevatedButton(
|
|
|
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
|
|
|
primary: primaryColor, // background
|
|
|
|
|
|
|
|
onPrimary: Colors.white, // foreground
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
onPressed: () async{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
child: const Text('Deselect'),
|
|
|
|
|
|
|
|
))
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
)),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
@ -319,7 +695,7 @@ class _OrderMedicinesState extends State<OrderMedicines> {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(pharmaciesCheckboxes.length==3){
|
|
|
|
if(pharmaciesCheckboxes.length==3){
|
|
|
|
|
|
|
|
AppSettings.preLoaderDialog(context);
|
|
|
|
var payload = new Map<String, dynamic>();
|
|
|
|
var payload = new Map<String, dynamic>();
|
|
|
|
|
|
|
|
|
|
|
|
payload["picture"] = widget.prescriptionDetails.prescription_url.toString();
|
|
|
|
payload["picture"] = widget.prescriptionDetails.prescription_url.toString();
|
|
|
@ -327,22 +703,30 @@ class _OrderMedicinesState extends State<OrderMedicines> {
|
|
|
|
payload["familyDetails"] = {
|
|
|
|
payload["familyDetails"] = {
|
|
|
|
"patient_name": widget.prescriptionDetails.patient_name.toString(),
|
|
|
|
"patient_name": widget.prescriptionDetails.patient_name.toString(),
|
|
|
|
"patient_age": int.parse(widget.prescriptionDetails.age.toString()),
|
|
|
|
"patient_age": int.parse(widget.prescriptionDetails.age.toString()),
|
|
|
|
"patient_gender": widget.prescriptionDetails.gender,
|
|
|
|
"patient_gender": widget.prescriptionDetails.gender.toString().toLowerCase(),
|
|
|
|
"patient_address": userAddress
|
|
|
|
"patient_address": userAddress
|
|
|
|
};
|
|
|
|
};
|
|
|
|
bool status = await AppSettings.getQuotation(payload);
|
|
|
|
bool status = await AppSettings.getQuotation(payload);
|
|
|
|
|
|
|
|
|
|
|
|
if(status){
|
|
|
|
if(status){
|
|
|
|
|
|
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
|
|
AppSettings.longSuccessToast('Quotation request sent successfully');
|
|
|
|
AppSettings.longSuccessToast('Quotation request sent successfully');
|
|
|
|
|
|
|
|
pharmaciesCheckboxes.clear();
|
|
|
|
|
|
|
|
Navigator.push(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
|
|
|
builder: (context) => const GetQuotationRequestsList()),
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
else{
|
|
|
|
|
|
|
|
Navigator.of(context, rootNavigator: true).pop();
|
|
|
|
AppSettings.longFailedToast('Get quotation failed try after some time');
|
|
|
|
AppSettings.longFailedToast('Get quotation failed try after some time');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if(pharmaciesCheckboxes.length>3){
|
|
|
|
else if(pharmaciesCheckboxes.length>3){
|
|
|
|
|
|
|
|
|
|
|
|
showListOfSelectedPharmacies();
|
|
|
|
showSelectedPharmaciesDialog();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
else{
|
|
|
@ -488,7 +872,9 @@ class _OrderMedicinesState extends State<OrderMedicines> {
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
Padding(
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
child: TextButton(
|
|
|
|
child: Row(
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
TextButton(
|
|
|
|
onPressed: () {},
|
|
|
|
onPressed: () {},
|
|
|
|
child: const Text(
|
|
|
|
child: const Text(
|
|
|
|
'Want to order non prescribed items?',
|
|
|
|
'Want to order non prescribed items?',
|
|
|
@ -497,6 +883,24 @@ class _OrderMedicinesState extends State<OrderMedicines> {
|
|
|
|
decoration: TextDecoration.underline,
|
|
|
|
decoration: TextDecoration.underline,
|
|
|
|
color: primaryColor),
|
|
|
|
color: primaryColor),
|
|
|
|
)),
|
|
|
|
)),
|
|
|
|
|
|
|
|
SizedBox(width: 5,),
|
|
|
|
|
|
|
|
TextButton(
|
|
|
|
|
|
|
|
onPressed: () {
|
|
|
|
|
|
|
|
Navigator.push(
|
|
|
|
|
|
|
|
context,
|
|
|
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
|
|
|
builder: (context) => const GetQuotationRequestsList()),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
child: const Text(
|
|
|
|
|
|
|
|
'Requests',
|
|
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
|
|
fontSize: 15,
|
|
|
|
|
|
|
|
decoration: TextDecoration.underline,
|
|
|
|
|
|
|
|
color: primaryColor),
|
|
|
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
)
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
@ -659,7 +1063,7 @@ class _OrderMedicinesState extends State<OrderMedicines> {
|
|
|
|
isExpanded: true,
|
|
|
|
isExpanded: true,
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
prefixIcon: Icon(
|
|
|
|
prefixIcon: Icon(
|
|
|
|
Icons.area_chart,
|
|
|
|
Icons.location_on_outlined,
|
|
|
|
color: primaryColor,
|
|
|
|
color: primaryColor,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
border: OutlineInputBorder(
|
|
|
|