|
|
|
|
@ -90,156 +90,154 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return AppScaffold(
|
|
|
|
|
appBarTitle: TranslationBase.of(context).searchMedicine,
|
|
|
|
|
body: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
child: Icon(
|
|
|
|
|
DoctorApp.medicinesearch,
|
|
|
|
|
size: 100,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
),
|
|
|
|
|
margin: EdgeInsets.only(top: 50),
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(top: 12.0),
|
|
|
|
|
child: AppText(
|
|
|
|
|
TranslationBase.of(context).type.toUpperCase(),
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontSize: SizeConfig.heightMultiplier * 2.5,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(top: 5.0),
|
|
|
|
|
child: AppText(
|
|
|
|
|
TranslationBase.of(context).searchMedicineImageCaption,
|
|
|
|
|
fontSize: SizeConfig.heightMultiplier * 2,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
|
bottom: SizeConfig.heightMultiplier * 1,
|
|
|
|
|
right: SizeConfig.heightMultiplier * 2,
|
|
|
|
|
left: SizeConfig.heightMultiplier * 2,
|
|
|
|
|
top: SizeConfig.heightMultiplier * 3),
|
|
|
|
|
child: AppTextFormField(
|
|
|
|
|
hintText: TranslationBase.of(context).searchMedicineNameHere,
|
|
|
|
|
controller: myController,
|
|
|
|
|
onSaved: (value) {},
|
|
|
|
|
onFieldSubmitted: (value) {
|
|
|
|
|
searchMedicine(context);
|
|
|
|
|
},
|
|
|
|
|
textInputAction: TextInputAction.search,
|
|
|
|
|
prefix: IconButton(
|
|
|
|
|
icon: Icon(Icons.mic),
|
|
|
|
|
color:
|
|
|
|
|
lastStatus == 'listening' ? Colors.red : Colors.grey,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
myController.text = '';
|
|
|
|
|
setState(() {
|
|
|
|
|
lastStatus = 'listening';
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
startVoiceSearch();
|
|
|
|
|
}),
|
|
|
|
|
inputFormatter: ONLY_LETTERS),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
|
bottom: SizeConfig.heightMultiplier * 1,
|
|
|
|
|
right: SizeConfig.heightMultiplier * 2,
|
|
|
|
|
left: SizeConfig.heightMultiplier * 2,
|
|
|
|
|
top: SizeConfig.heightMultiplier * 1),
|
|
|
|
|
child: Wrap(
|
|
|
|
|
alignment: WrapAlignment.center,
|
|
|
|
|
body: FractionallySizedBox(
|
|
|
|
|
widthFactor: 0.97,
|
|
|
|
|
child: ListView(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppButton(
|
|
|
|
|
title: TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.search,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
searchMedicine(context);
|
|
|
|
|
},
|
|
|
|
|
Container(
|
|
|
|
|
child: Icon(
|
|
|
|
|
DoctorApp.medicinesearch,
|
|
|
|
|
size: 100,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
),
|
|
|
|
|
margin: EdgeInsets.only(top: 50),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(left: SizeConfig.heightMultiplier * 2),
|
|
|
|
|
child: Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.youCanFind +
|
|
|
|
|
(_medicineProvider.pharmacyItemsList == null
|
|
|
|
|
? " 0 "
|
|
|
|
|
: _medicineProvider.pharmacyItemsList.length
|
|
|
|
|
.toString()) +
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.itemsInSearch,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
margin: 5,
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(top: 12.0),
|
|
|
|
|
child: AppText(
|
|
|
|
|
TranslationBase.of(context).type.toUpperCase(),
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontSize: SizeConfig.heightMultiplier * 2.5,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(top: 5.0),
|
|
|
|
|
child: AppText(
|
|
|
|
|
TranslationBase.of(context).searchMedicineImageCaption,
|
|
|
|
|
fontSize: SizeConfig.heightMultiplier * 2,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
width: SizeConfig.screenWidth * 0.90,
|
|
|
|
|
child: !_medicineProvider.isFinished
|
|
|
|
|
? DrAppCircularProgressIndeicator()
|
|
|
|
|
: _medicineProvider.hasError
|
|
|
|
|
? Center(
|
|
|
|
|
child: Text(
|
|
|
|
|
_medicineProvider.errorMsg,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Theme.of(context).errorColor),
|
|
|
|
|
SizedBox(height: 15,),
|
|
|
|
|
FractionallySizedBox(
|
|
|
|
|
widthFactor: 0.9,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
child: AppTextFormField(
|
|
|
|
|
hintText: TranslationBase.of(context).searchMedicineNameHere,
|
|
|
|
|
controller: myController,
|
|
|
|
|
onSaved: (value) {},
|
|
|
|
|
onFieldSubmitted: (value) {
|
|
|
|
|
searchMedicine(context);
|
|
|
|
|
},
|
|
|
|
|
textInputAction: TextInputAction.search,
|
|
|
|
|
prefix: IconButton(
|
|
|
|
|
icon: Icon(Icons.mic),
|
|
|
|
|
color:
|
|
|
|
|
lastStatus == 'listening' ? Colors.red : Colors.grey,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
myController.text = '';
|
|
|
|
|
setState(() {
|
|
|
|
|
lastStatus = 'listening';
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
startVoiceSearch();
|
|
|
|
|
}),
|
|
|
|
|
inputFormatter: ONLY_LETTERS),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 15,),
|
|
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
child: Wrap(
|
|
|
|
|
alignment: WrapAlignment.center,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppButton(
|
|
|
|
|
title: TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.search,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
searchMedicine(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(left: SizeConfig.heightMultiplier * 2),
|
|
|
|
|
child: Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.youCanFind +
|
|
|
|
|
_medicineProvider.pharmacyItemsList.length
|
|
|
|
|
.toString() +" "+
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.itemsInSearch,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
child: !_medicineProvider.isFinished
|
|
|
|
|
? DrAppCircularProgressIndeicator()
|
|
|
|
|
: _medicineProvider.hasError
|
|
|
|
|
? Center(
|
|
|
|
|
child: Text(
|
|
|
|
|
_medicineProvider.errorMsg,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Theme.of(context).errorColor),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: ListView.builder(
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: _medicineProvider.pharmacyItemsList ==
|
|
|
|
|
null
|
|
|
|
|
? 0
|
|
|
|
|
: _medicineProvider.pharmacyItemsList.length,
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
return InkWell(
|
|
|
|
|
child: MedicineItemWidget(
|
|
|
|
|
label:
|
|
|
|
|
_medicineProvider.pharmacyItemsList[index]
|
|
|
|
|
["ItemDescription"],
|
|
|
|
|
url:
|
|
|
|
|
_medicineProvider.pharmacyItemsList[index]
|
|
|
|
|
["ProductImageBase64"],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: ListView.builder(
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: _medicineProvider.pharmacyItemsList ==
|
|
|
|
|
null
|
|
|
|
|
? 0
|
|
|
|
|
: _medicineProvider.pharmacyItemsList.length,
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
return InkWell(
|
|
|
|
|
child: MedicineItemWidget(
|
|
|
|
|
label:
|
|
|
|
|
_medicineProvider.pharmacyItemsList[index]
|
|
|
|
|
["ItemDescription"],
|
|
|
|
|
url:
|
|
|
|
|
_medicineProvider.pharmacyItemsList[index]
|
|
|
|
|
["ProductImageBase64"],
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) =>
|
|
|
|
|
PharmaciesListScreen(
|
|
|
|
|
itemID: _medicineProvider
|
|
|
|
|
.pharmacyItemsList[index]
|
|
|
|
|
["ItemID"],
|
|
|
|
|
url: _medicineProvider
|
|
|
|
|
.pharmacyItemsList[index]
|
|
|
|
|
["ProductImageBase64"]),
|
|
|
|
|
),
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) =>
|
|
|
|
|
PharmaciesListScreen(
|
|
|
|
|
itemID: _medicineProvider
|
|
|
|
|
.pharmacyItemsList[index]
|
|
|
|
|
["ItemID"],
|
|
|
|
|
url: _medicineProvider
|
|
|
|
|
.pharmacyItemsList[index]
|
|
|
|
|
["ProductImageBase64"]),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|