|
|
|
|
@ -15,7 +15,6 @@ import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:maps_launcher/maps_launcher.dart';
|
|
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DrAppSharedPreferances sharedPref = DrAppSharedPreferances();
|
|
|
|
|
|
|
|
|
|
class PharmaciesListScreen extends StatefulWidget {
|
|
|
|
|
@ -32,118 +31,139 @@ class _PharmaciesListState extends State<PharmaciesListScreen> {
|
|
|
|
|
var _data;
|
|
|
|
|
Helpers helpers = new Helpers();
|
|
|
|
|
MedicineProvider _medicineProvider;
|
|
|
|
|
|
|
|
|
|
bool _isInit = true;
|
|
|
|
|
//bool _isOutOfStuck = false;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void didChangeDependencies() {
|
|
|
|
|
super.didChangeDependencies();
|
|
|
|
|
if (_isInit) {
|
|
|
|
|
_medicineProvider = Provider.of<MedicineProvider>(context);
|
|
|
|
|
pharmaciesList();
|
|
|
|
|
}
|
|
|
|
|
_isInit = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
_medicineProvider = Provider.of(context);
|
|
|
|
|
pharmaciesList();
|
|
|
|
|
return AppScaffold(
|
|
|
|
|
appBarTitle: "Pharmacies List",
|
|
|
|
|
body: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
RoundedContainer(
|
|
|
|
|
child: !_medicineProvider.isFinished
|
|
|
|
|
? DrAppCircularProgressIndeicator()
|
|
|
|
|
: _medicineProvider.hasError
|
|
|
|
|
? Center(
|
|
|
|
|
child: Text(
|
|
|
|
|
_medicineProvider.errorMsg,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Theme.of(context).errorColor),
|
|
|
|
|
body: Column(children: <Widget>[
|
|
|
|
|
RoundedContainer(
|
|
|
|
|
child: !_medicineProvider.isFinished
|
|
|
|
|
? DrAppCircularProgressIndeicator()
|
|
|
|
|
: _medicineProvider.hasError
|
|
|
|
|
? Center(
|
|
|
|
|
child: Text(
|
|
|
|
|
_medicineProvider.errorMsg,
|
|
|
|
|
style:
|
|
|
|
|
TextStyle(color: Theme.of(context).errorColor),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppText(
|
|
|
|
|
"Description",
|
|
|
|
|
margin: 10,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppText(
|
|
|
|
|
"Description",
|
|
|
|
|
margin: 10,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
_data[0]["ItemDescription"],
|
|
|
|
|
marginLeft: 10,
|
|
|
|
|
marginTop: 0,
|
|
|
|
|
marginRight: 10,
|
|
|
|
|
marginBottom: 10,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
"Price",
|
|
|
|
|
margin: 10,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
_data[0]["SellingPrice"].toString(),
|
|
|
|
|
marginLeft: 10,
|
|
|
|
|
marginTop: 0,
|
|
|
|
|
marginRight: 10,
|
|
|
|
|
marginBottom: 10,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
|
|
|
|
|
child: Align(
|
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
|
child: AppText(
|
|
|
|
|
"You can Find it in",
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 3,
|
|
|
|
|
))),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
width: SizeConfig.screenWidth * 0.80,
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
AppText(
|
|
|
|
|
_data[0]["ItemDescription"],
|
|
|
|
|
marginLeft: 10,
|
|
|
|
|
marginTop: 0,
|
|
|
|
|
marginRight: 10,
|
|
|
|
|
marginBottom: 10,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
"Price",
|
|
|
|
|
margin: 10,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
_data[0]["SellingPrice"].toString(),
|
|
|
|
|
marginLeft: 10,
|
|
|
|
|
marginTop: 0,
|
|
|
|
|
marginRight: 10,
|
|
|
|
|
marginBottom: 10,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
|
|
|
|
|
child: Align(
|
|
|
|
|
alignment: Alignment.centerLeft,
|
|
|
|
|
child: AppText(
|
|
|
|
|
"You can Find it in",
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 3,
|
|
|
|
|
))),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
width: SizeConfig.screenWidth * 0.99,
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: _data == null ? 0 : _data.length,
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
return Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
MedicineItemWidget(
|
|
|
|
|
label: _data[index]["LocationDescription"],
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(bottom: 10),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(flex: 2, child: SizedBox()),
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 6,
|
|
|
|
|
child: AppButton(
|
|
|
|
|
title: "Call",
|
|
|
|
|
fontSize: 2,
|
|
|
|
|
color: Colors.brown[200],
|
|
|
|
|
padding: 0,
|
|
|
|
|
onPressed: () => launch("tel://"+_data[index]["PhoneNumber"])),
|
|
|
|
|
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: 1, child: SizedBox()),
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 6,
|
|
|
|
|
child: AppButton(
|
|
|
|
|
title: "Direction",
|
|
|
|
|
fontSize: 2,
|
|
|
|
|
color: Color(PRIMARY_COLOR),
|
|
|
|
|
padding: 0,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
MapsLauncher.launchCoordinates(double.parse(_data[index]["Latitude"]), double.parse( _data[index]["Longitude"]), _data[index]["LocationDescription"] );
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
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: 2, child: SizedBox()),
|
|
|
|
|
],
|
|
|
|
|
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"]);
|
|
|
|
|
},),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
));
|
|
|
|
|
)
|
|
|
|
|
]));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<bool> pharmaciesList() async {
|
|
|
|
|
|