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.
99 lines
4.2 KiB
Dart
99 lines
4.2 KiB
Dart
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/product_detail_view_model.dart';
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:maps_launcher/maps_launcher.dart';
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
import 'package:map_launcher/map_launcher.dart';
|
|
|
|
class AvailabilityInfo extends StatelessWidget {
|
|
final ProductDetailViewModel previousModel;
|
|
|
|
const AvailabilityInfo({Key key, this.previousModel}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return previousModel.productLocationService.length == 0
|
|
? Container(
|
|
padding: EdgeInsets.all(15),
|
|
alignment: Alignment.center,
|
|
child: Text(
|
|
TranslationBase.of(context).noLocationAvailable,
|
|
),
|
|
)
|
|
: Container(
|
|
margin: EdgeInsets.only(bottom: 40),
|
|
child: ListView.builder(
|
|
physics: ScrollPhysics(),
|
|
scrollDirection: Axis.vertical,
|
|
shrinkWrap: true,
|
|
itemCount: previousModel.productLocationService.length,
|
|
itemBuilder: (BuildContext context, int index) {
|
|
return Padding(
|
|
padding: EdgeInsets.all(8),
|
|
child: Column(
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
Expanded(
|
|
flex: 1,
|
|
child: Image.network(previousModel.productLocationService[index].projectImageUrl),
|
|
),
|
|
SizedBox(
|
|
width: 10,
|
|
),
|
|
Expanded(
|
|
flex: 4,
|
|
child: Text(
|
|
previousModel.productLocationService[index].locationDescription + "\n" + previousModel.productLocationService[index].cityName.toString(),
|
|
style: TextStyle(fontSize: 12),
|
|
),
|
|
),
|
|
Expanded(
|
|
flex: 1,
|
|
child: IconButton(
|
|
icon: Icon(Icons.location_on),
|
|
color: Colors.red,
|
|
onPressed: () {
|
|
MapLauncher.showMarker(
|
|
mapType: MapType.google,
|
|
coords: Coords(double.parse(previousModel.productLocationService[index].latitude),
|
|
double.parse(previousModel.productLocationService[index].longitude)),
|
|
title: previousModel.productLocationService[index].locationDescription,
|
|
// description: location.locationName,
|
|
);
|
|
// MapsLauncher.launchCoordinates(double.parse(previousModel.productLocationService[index].latitude), double.parse(previousModel.productLocationService[index].longitude), previousModel.productLocationService[index].locationDescription);
|
|
},
|
|
),
|
|
),
|
|
Expanded(
|
|
flex: 1,
|
|
child: IconButton(
|
|
icon: Icon(Icons.phone),
|
|
color: Colors.red,
|
|
onPressed: () {
|
|
launch("tel://" + previousModel.productLocationService[index].phoneNumber);
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Divider(height: 1.2, color: Colors.grey)
|
|
],
|
|
),
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
convertCityName(txt) {
|
|
String stringTxt;
|
|
String newTxt;
|
|
stringTxt = txt.toString();
|
|
newTxt = stringTxt.split('.')[1];
|
|
|
|
return newTxt;
|
|
}
|
|
}
|