You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
PatientApp-KKUMC/lib/pages/medical/prescriptions/pharmacy_for_prescriptions_...

252 lines
12 KiB
Dart

import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_report.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/prescriptions_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:giffy_dialog/giffy_dialog.dart';
import 'package:maps_launcher/maps_launcher.dart';
import 'package:url_launcher/url_launcher.dart';
class PharmacyForPrescriptionsPage extends StatelessWidget {
final itemID;
final PrescriptionReport prescriptionReport;
PharmacyForPrescriptionsPage({Key key, this.itemID, this.prescriptionReport});
@override
Widget build(BuildContext context) {
return BaseView<PrescriptionsViewModel>(
onModelReady: (model) => model.getListPharmacyForPrescriptions(itemId: itemID),
builder: (_, model, widget) => AppScaffold(
isShowAppBar: true,
showNewAppBar: true,
showNewAppBarTitle: true,
appBarTitle: TranslationBase.of(context).availability,
baseViewModel: model,
body: Column(
children: [
Container(
width: double.infinity,
margin: EdgeInsets.only(top: 10, left: 10, right: 10),
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
border: Border.all(color: Colors.grey[200], width: 0.5),
),
child: Row(
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(5)),
child: Image.network(
prescriptionReport.imageSRCUrl,
fit: BoxFit.cover,
width: 60,
height: 70,
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: Texts(prescriptionReport.itemDescription.isNotEmpty ? prescriptionReport.itemDescription : prescriptionReport.itemDescriptionN ?? ''),
),
),
)
],
),
),
model.pharmacyPrescriptionsList.isNotEmpty == true
? Expanded(
child: ListView.builder(
scrollDirection: Axis.vertical,
physics: BouncingScrollPhysics(),
itemBuilder: (context, index) => Container(
margin: EdgeInsets.all(12.0),
padding: const EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 12),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
boxShadow: [
BoxShadow(
color: Color(0xff000000).withOpacity(.05),
//spreadRadius: 5,
blurRadius: 27,
offset: Offset(0, -3),
),
],
color: Colors.white),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
InkWell(
onTap: () {
showDialog(
context: context,
builder: (_) => AssetGiffyDialog(
title: Text(
model.pharmacyPrescriptionsList[index].locationDescription,
style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.w600),
),
image: Image.network(
model.pharmacyPrescriptionsList[index].projectImageURL.toString(),
fit: BoxFit.cover,
),
buttonCancelText: Text(TranslationBase.of(context).cancel),
buttonCancelColor: Colors.grey,
onlyCancelButton: true,
),
);
},
child: ClipRRect(
borderRadius: BorderRadius.circular(12),
child: Image.network(
model.pharmacyPrescriptionsList[index].projectImageURL.toString(),
width: 48,
height: 48,
fit: BoxFit.cover,
),
),
),
Expanded(
child: Padding(
padding: EdgeInsets.only(left: 12, right: 12),
child: Text(
model.pharmacyPrescriptionsList[index].locationDescription?.trim().toString() +
"\n" +
model.pharmacyPrescriptionsList[index].cityName.trim().toString() +
"\n" +
model.pharmacyPrescriptionsList[index].distanceInKilometers.toString() +
" " +
TranslationBase.of(context).km_ ??
"",
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
color: Color(0xff2E303A),
letterSpacing: -0.56,
),
),
),
), //model.cOCItemList[index].cOCTitl
IconButton(
icon: Icon(
Icons.location_on,
color: Color(0xff2B353E),
),
constraints: BoxConstraints(),
padding: EdgeInsets.all(8),
tooltip: '',
onPressed: () {
// setState(() {
MapsLauncher.launchCoordinates(double.parse(model.pharmacyPrescriptionsList[index].latitude), double.parse(model.pharmacyPrescriptionsList[index].longitude),
model.pharmacyPrescriptionsList[index].locationDescription);
// });
},
),
IconButton(
icon: Icon(
Icons.phone,
color: Color(0xff2B353E),
),
constraints: BoxConstraints(),
padding: EdgeInsets.all(8),
tooltip: '',
onPressed: () {
// setState(() {
launch("tel://" + model.pharmacyPrescriptionsList[index].phoneNumber);
// });
},
),
],
),
),
// Container(
// width: double.infinity,
// margin: EdgeInsets.only(top: 10, left: 10, right: 10),
// padding: EdgeInsets.all(8.0),
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.all(
// Radius.circular(10.0),
// ),
// border: Border.all(color: Colors.grey[200], width: 0.5),
// ),
// child: Row(
// children: <Widget>[
// ClipRRect(
// borderRadius: BorderRadius.all(Radius.circular(5)),
// child: Image.network(
// model.pharmacyPrescriptionsList[index].projectImageURL,
// fit: BoxFit.cover,
// width: 60,
// height: 70,
// ),
// ),
// Expanded(
// child: Padding(
// padding: const EdgeInsets.all(8.0),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: <Widget>[
// Texts(model.pharmacyPrescriptionsList[index].locationDescription),
// SizedBox(
// height: 5,
// ),
// Texts(model.pharmacyPrescriptionsList[index].cityName),
// ],
// ),
// ),
// ),
// InkWell(
// onTap: () {
// MapsLauncher.launchCoordinates(double.parse(model.pharmacyPrescriptionsList[index].latitude), double.parse(model.pharmacyPrescriptionsList[index].longitude));
// },
// child: Icon(
// Icons.pin_drop,
// size: 18,
// color: Colors.red[900],
// ),
// ),
// SizedBox(
// width: 15,
// ),
// InkWell(
// onTap: Feedback.wrapForTap(() {
// launch("tel://${model.pharmacyPrescriptionsList[index].phoneNumber}");
// }, context),
// child: Container(
// child: Icon(
// Icons.call,
// size: 18,
// color: Colors.red[900],
// ),
// ),
// )
// ],
// ),
// ),
itemCount: model.pharmacyPrescriptionsList.length,
),
)
: Padding(
padding: const EdgeInsets.only(top: 65.0),
child: Texts(
TranslationBase.of(context).thisItemIsNotAvailable,
textAlign: TextAlign.center,
),
),
],
),
),
);
}
}