|
|
|
|
@ -1,11 +1,10 @@
|
|
|
|
|
import 'package:doctor_app_flutter/config/config.dart';
|
|
|
|
|
import 'dart:convert';
|
|
|
|
|
import 'dart:typed_data';
|
|
|
|
|
|
|
|
|
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/models/pharmacies_List_request_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/providers/medicine_provider.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/helpers.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/medicine/medicine_item_widget.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_buttons_widget.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart';
|
|
|
|
|
@ -20,8 +19,11 @@ DrAppSharedPreferances sharedPref = DrAppSharedPreferances();
|
|
|
|
|
class PharmaciesListScreen extends StatefulWidget {
|
|
|
|
|
final int itemID;
|
|
|
|
|
|
|
|
|
|
final String url;
|
|
|
|
|
|
|
|
|
|
// In the constructor, require a item id.
|
|
|
|
|
PharmaciesListScreen({Key key, @required this.itemID}) : super(key: key);
|
|
|
|
|
PharmaciesListScreen({Key key, @required this.itemID, this.url})
|
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_PharmaciesListState createState() => _PharmaciesListState();
|
|
|
|
|
@ -61,44 +63,77 @@ class _PharmaciesListState extends State<PharmaciesListScreen> {
|
|
|
|
|
TextStyle(color: Theme.of(context).errorColor),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: 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,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
: 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,
|
|
|
|
|
),
|
|
|
|
|
AppText(
|
|
|
|
|
_data[0]["SellingPrice"].toString(),
|
|
|
|
|
marginLeft: 10,
|
|
|
|
|
marginTop: 0,
|
|
|
|
|
marginRight: 10,
|
|
|
|
|
marginBottom: 10,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
})),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.all(SizeConfig.widthMultiplier * 5),
|
|
|
|
|
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,
|
|
|
|
|
fontSize: SizeConfig.textMultiplier * 3,
|
|
|
|
|
))),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
@ -114,7 +149,8 @@ class _PharmaciesListState extends State<PharmaciesListScreen> {
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 1,
|
|
|
|
|
child: ClipRRect(
|
|
|
|
|
borderRadius:BorderRadius.all(Radius.circular(7)),
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.all(Radius.circular(7)),
|
|
|
|
|
child: Image.network(
|
|
|
|
|
_data[index]["ProjectImageURL"],
|
|
|
|
|
height: SizeConfig.imageSizeMultiplier * 15,
|
|
|
|
|
@ -138,25 +174,36 @@ class _PharmaciesListState extends State<PharmaciesListScreen> {
|
|
|
|
|
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"]),),
|
|
|
|
|
),
|
|
|
|
|
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"]);
|
|
|
|
|
},),
|
|
|
|
|
),
|
|
|
|
|
padding: EdgeInsets.all(5),
|
|
|
|
|
child: InkWell(
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.call,
|
|
|
|
|
color: Colors.red,
|
|
|
|
|
),
|
|
|
|
|
onTap: () => launch(
|
|
|
|
|
"tel://" + _data[index]["PhoneNumber"]),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
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"]);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
@ -170,9 +217,20 @@ Padding(
|
|
|
|
|
_medicineProvider.getPharmaciesList(widget.itemID).then((result) {
|
|
|
|
|
this.setState(() {
|
|
|
|
|
_data = _medicineProvider.pharmaciesList;
|
|
|
|
|
//if(_data == null || _data.length == 0)
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Image imageFromBase64String(String base64String) {
|
|
|
|
|
return Image.memory(base64Decode(base64String));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Uint8List dataFromBase64String(String base64String) {
|
|
|
|
|
return base64Decode(base64String);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String base64String(Uint8List data) {
|
|
|
|
|
return base64Encode(data);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|