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:maps_launcher/maps_launcher.dart'; import 'package:url_launcher/url_launcher.dart'; class PharmacyForPrescriptionsPage extends StatelessWidget { final itemID; PharmacyForPrescriptionsPage({Key key, this.itemID}); @override Widget build(BuildContext context) { return BaseView( onModelReady: (model) => model.getListPharmacyForPrescriptions(itemId: itemID), builder: (_, model, widget) => AppScaffold( isShowAppBar: true, appBarTitle: TranslationBase.of(context).availability, baseViewModel: model, body: ListView.builder( itemBuilder: (context, index) => 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: [ 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: [ 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, ), ), ); } }