|
|
|
|
@ -13,6 +13,7 @@ import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:maps_launcher/maps_launcher.dart';
|
|
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
|
|
|
|
|
|
|
|
DrAppSharedPreferances sharedPref = DrAppSharedPreferances();
|
|
|
|
|
|
|
|
|
|
@ -50,173 +51,185 @@ class _PharmaciesListState extends State<PharmaciesListScreen> {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return AppScaffold(
|
|
|
|
|
appBarTitle: "Pharmacies List",
|
|
|
|
|
appBarTitle: TranslationBase.of(context).pharmaciesList,
|
|
|
|
|
body: Container(
|
|
|
|
|
height: SizeConfig.screenHeight,
|
|
|
|
|
child: ListView(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
physics: const AlwaysScrollableScrollPhysics(),
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
RoundedContainer(
|
|
|
|
|
child: !_medicineProvider.isFinished
|
|
|
|
|
? DrAppCircularProgressIndeicator()
|
|
|
|
|
: _medicineProvider.hasError
|
|
|
|
|
? Center(
|
|
|
|
|
child: Text(
|
|
|
|
|
_medicineProvider.errorMsg,
|
|
|
|
|
style:
|
|
|
|
|
TextStyle(color: Theme.of(context).errorColor),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: StreamBuilder<Object>(
|
|
|
|
|
stream: null,
|
|
|
|
|
builder: (context, snapshot) {
|
|
|
|
|
return Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 1,
|
|
|
|
|
child: ClipRRect(
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.all(Radius.circular(7)),
|
|
|
|
|
child: Image.memory(
|
|
|
|
|
dataFromBase64String(widget.url),
|
|
|
|
|
height: SizeConfig.imageSizeMultiplier * 21,
|
|
|
|
|
width: SizeConfig.imageSizeMultiplier * 20,
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 3,
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.stretch,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppText(
|
|
|
|
|
"Description",
|
|
|
|
|
marginLeft: 10,
|
|
|
|
|
marginTop: 0,
|
|
|
|
|
marginRight: 10,
|
|
|
|
|
marginBottom: 2,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
_data[0]["ItemDescription"],
|
|
|
|
|
marginLeft: 10,
|
|
|
|
|
marginTop: 0,
|
|
|
|
|
marginRight: 10,
|
|
|
|
|
marginBottom: 10,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
"Price",
|
|
|
|
|
marginLeft: 10,
|
|
|
|
|
marginTop: 0,
|
|
|
|
|
marginRight: 10,
|
|
|
|
|
marginBottom: 2,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
physics: const AlwaysScrollableScrollPhysics(),
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
RoundedContainer(
|
|
|
|
|
child: !_medicineProvider.isFinished
|
|
|
|
|
? DrAppCircularProgressIndeicator()
|
|
|
|
|
: _medicineProvider.hasError
|
|
|
|
|
? Center(
|
|
|
|
|
child: Text(
|
|
|
|
|
_medicineProvider.errorMsg,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Theme.of(context).errorColor),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: StreamBuilder<Object>(
|
|
|
|
|
stream: null,
|
|
|
|
|
builder: (context, snapshot) {
|
|
|
|
|
return Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 1,
|
|
|
|
|
child: ClipRRect(
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
|
Radius.circular(7)),
|
|
|
|
|
child: Image.memory(
|
|
|
|
|
dataFromBase64String(widget.url),
|
|
|
|
|
height:
|
|
|
|
|
SizeConfig.imageSizeMultiplier *
|
|
|
|
|
21,
|
|
|
|
|
width:
|
|
|
|
|
SizeConfig.imageSizeMultiplier *
|
|
|
|
|
20,
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
_data[0]["SellingPrice"].toString(),
|
|
|
|
|
marginLeft: 10,
|
|
|
|
|
marginTop: 0,
|
|
|
|
|
marginRight: 10,
|
|
|
|
|
marginBottom: 10,
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 3,
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.stretch,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(context)
|
|
|
|
|
.description,
|
|
|
|
|
marginLeft: 10,
|
|
|
|
|
marginTop: 0,
|
|
|
|
|
marginRight: 10,
|
|
|
|
|
marginBottom: 2,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
_data[0]["ItemDescription"],
|
|
|
|
|
marginLeft: 10,
|
|
|
|
|
marginTop: 0,
|
|
|
|
|
marginRight: 10,
|
|
|
|
|
marginBottom: 10,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase.of(context).price,
|
|
|
|
|
marginLeft: 10,
|
|
|
|
|
marginTop: 0,
|
|
|
|
|
marginRight: 10,
|
|
|
|
|
marginBottom: 2,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
_data[0]["SellingPrice"]
|
|
|
|
|
.toString(),
|
|
|
|
|
marginLeft: 10,
|
|
|
|
|
marginTop: 0,
|
|
|
|
|
marginRight: 10,
|
|
|
|
|
marginBottom: 10,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
})),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
|
top: SizeConfig.widthMultiplier * 2,
|
|
|
|
|
bottom: SizeConfig.widthMultiplier * 2,
|
|
|
|
|
right: SizeConfig.widthMultiplier * 4,
|
|
|
|
|
left: SizeConfig.widthMultiplier * 4,
|
|
|
|
|
),
|
|
|
|
|
child: Align(
|
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
|
child: AppText(
|
|
|
|
|
TranslationBase.of(context).youCanFindItIn,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
))),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
width: SizeConfig.screenWidth * 0.99,
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
itemCount: _data == null ? 0 : _data.length,
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
return RoundedContainer(
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 1,
|
|
|
|
|
child: ClipRRect(
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.all(Radius.circular(7)),
|
|
|
|
|
child: Image.network(
|
|
|
|
|
_data[index]["ProjectImageURL"],
|
|
|
|
|
height:
|
|
|
|
|
SizeConfig.imageSizeMultiplier * 15,
|
|
|
|
|
width:
|
|
|
|
|
SizeConfig.imageSizeMultiplier * 15,
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
})),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(top:SizeConfig.widthMultiplier * 2,
|
|
|
|
|
bottom: SizeConfig.widthMultiplier * 2,
|
|
|
|
|
right: SizeConfig.widthMultiplier * 4,
|
|
|
|
|
left: SizeConfig.widthMultiplier * 4,),
|
|
|
|
|
child: Align(
|
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
|
child: AppText(
|
|
|
|
|
"You can Find it in",
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
))),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
width: SizeConfig.screenWidth * 0.99,
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
physics: const NeverScrollableScrollPhysics() ,
|
|
|
|
|
itemCount: _data == null ? 0 : _data.length,
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
return RoundedContainer(
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 1,
|
|
|
|
|
child: ClipRRect(
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.all(Radius.circular(7)),
|
|
|
|
|
child: Image.network(
|
|
|
|
|
_data[index]["ProjectImageURL"],
|
|
|
|
|
height: SizeConfig.imageSizeMultiplier * 15,
|
|
|
|
|
width: SizeConfig.imageSizeMultiplier * 15,
|
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 4,
|
|
|
|
|
child: AppText(
|
|
|
|
|
_data[index]["LocationDescription"],
|
|
|
|
|
margin: 10,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 2,
|
|
|
|
|
child: Wrap(
|
|
|
|
|
direction: Axis.horizontal,
|
|
|
|
|
alignment: WrapAlignment.end,
|
|
|
|
|
crossAxisAlignment: WrapCrossAlignment.end,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
|
|
child: InkWell(
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.call,
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
),
|
|
|
|
|
onTap: () => launch(
|
|
|
|
|
"tel://" + _data[index]["PhoneNumber"]),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 4,
|
|
|
|
|
child: AppText(
|
|
|
|
|
_data[index]["LocationDescription"],
|
|
|
|
|
margin: 10,
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
|
|
child: InkWell(
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.pin_drop,
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 2,
|
|
|
|
|
child: Wrap(
|
|
|
|
|
direction: Axis.horizontal,
|
|
|
|
|
alignment: WrapAlignment.end,
|
|
|
|
|
crossAxisAlignment: WrapCrossAlignment.end,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
|
|
child: InkWell(
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.call,
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
),
|
|
|
|
|
onTap: () => launch("tel://" +
|
|
|
|
|
_data[index]["PhoneNumber"]),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
onTap: () {
|
|
|
|
|
MapsLauncher.launchCoordinates(
|
|
|
|
|
double.parse(
|
|
|
|
|
_data[index]["Latitude"]),
|
|
|
|
|
double.parse(
|
|
|
|
|
_data[index]["Longitude"]),
|
|
|
|
|
_data[index]["LocationDescription"]);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
|
|
child: InkWell(
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.pin_drop,
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
),
|
|
|
|
|
onTap: () {
|
|
|
|
|
MapsLauncher.launchCoordinates(
|
|
|
|
|
double.parse(
|
|
|
|
|
_data[index]["Latitude"]),
|
|
|
|
|
double.parse(
|
|
|
|
|
_data[index]["Longitude"]),
|
|
|
|
|
_data[index]
|
|
|
|
|
["LocationDescription"]);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
]),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
]),
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|