|
|
|
|
@ -15,6 +15,7 @@ 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_text_form_field.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/network_base_view.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:permission_handler/permission_handler.dart';
|
|
|
|
|
@ -162,87 +163,86 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
|
|
|
|
|
// TODO change it secondary button and add loading
|
|
|
|
|
AppButton(
|
|
|
|
|
title: TranslationBase.of(context).search,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
searchMedicine(context, model);
|
|
|
|
|
onPressed: () async{
|
|
|
|
|
await searchMedicine(context, model);
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
NetworkBaseView(
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
|
left: SizeConfig.heightMultiplier * 2),
|
|
|
|
|
child: Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppText(
|
|
|
|
|
Column(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
|
left: SizeConfig.heightMultiplier * 2),
|
|
|
|
|
child: Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
AppText(
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.youCanFind +
|
|
|
|
|
model.pharmacyItemsList.length
|
|
|
|
|
.toString() +
|
|
|
|
|
" " +
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.youCanFind +
|
|
|
|
|
model.pharmacyItemsList.length
|
|
|
|
|
.toString() +
|
|
|
|
|
" " +
|
|
|
|
|
TranslationBase
|
|
|
|
|
.of(context)
|
|
|
|
|
.itemsInSearch,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
.itemsInSearch,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
height: MediaQuery
|
|
|
|
|
.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.height * 0.35,
|
|
|
|
|
child: Container(
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount:
|
|
|
|
|
model.pharmacyItemsList ==
|
|
|
|
|
null
|
|
|
|
|
? 0
|
|
|
|
|
: model
|
|
|
|
|
.pharmacyItemsList.length,
|
|
|
|
|
itemBuilder:
|
|
|
|
|
(BuildContext context, int index) {
|
|
|
|
|
return InkWell(
|
|
|
|
|
child: MedicineItemWidget(
|
|
|
|
|
label: model
|
|
|
|
|
.pharmacyItemsList[index]
|
|
|
|
|
["ItemDescription"],
|
|
|
|
|
url: model
|
|
|
|
|
.pharmacyItemsList[index]
|
|
|
|
|
["ImageSRCUrl"],
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
height: MediaQuery
|
|
|
|
|
.of(context)
|
|
|
|
|
.size
|
|
|
|
|
.height * 0.35,
|
|
|
|
|
child: Container(
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount:
|
|
|
|
|
model.pharmacyItemsList ==
|
|
|
|
|
null
|
|
|
|
|
? 0
|
|
|
|
|
: model
|
|
|
|
|
.pharmacyItemsList.length,
|
|
|
|
|
itemBuilder:
|
|
|
|
|
(BuildContext context, int index) {
|
|
|
|
|
return InkWell(
|
|
|
|
|
child: MedicineItemWidget(
|
|
|
|
|
label: model
|
|
|
|
|
.pharmacyItemsList[index]
|
|
|
|
|
["ItemDescription"],
|
|
|
|
|
url: model
|
|
|
|
|
.pharmacyItemsList[index]
|
|
|
|
|
["ImageSRCUrl"],
|
|
|
|
|
),
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) =>
|
|
|
|
|
PharmaciesListScreen(
|
|
|
|
|
itemID: model
|
|
|
|
|
.pharmacyItemsList[
|
|
|
|
|
index]["ItemID"],
|
|
|
|
|
url: model
|
|
|
|
|
.pharmacyItemsList[
|
|
|
|
|
index]["ImageSRCUrl"]),
|
|
|
|
|
),
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (context) =>
|
|
|
|
|
PharmaciesListScreen(
|
|
|
|
|
itemID: model
|
|
|
|
|
.pharmacyItemsList[
|
|
|
|
|
index]["ItemID"],
|
|
|
|
|
url: model
|
|
|
|
|
.pharmacyItemsList[
|
|
|
|
|
index]["ImageSRCUrl"]),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -252,7 +252,7 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
|
|
|
|
|
),),);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
searchMedicine(context, MedicineViewModel model) {
|
|
|
|
|
searchMedicine(context, MedicineViewModel model) async {
|
|
|
|
|
FocusScope.of(context).unfocus();
|
|
|
|
|
if (myController.text.isNullOrEmpty()) {
|
|
|
|
|
helpers.showErrorToast(TranslationBase
|
|
|
|
|
@ -267,7 +267,12 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
|
|
|
|
|
.moreThan3Letter);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
model.getMedicineItem(myController.text);
|
|
|
|
|
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
|
|
|
|
|
await model.getMedicineItem(myController.text);
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
startVoiceSearch() {
|
|
|
|
|
|