|
|
|
@ -1,12 +1,14 @@
|
|
|
|
import 'dart:math';
|
|
|
|
import 'dart:math';
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:autocomplete_textfield/autocomplete_textfield.dart';
|
|
|
|
import 'package:autocomplete_textfield/autocomplete_textfield.dart';
|
|
|
|
|
|
|
|
import 'package:doctor_app_flutter/config/config.dart';
|
|
|
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
|
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/model/search_drug/get_medication_response_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart';
|
|
|
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
|
|
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
|
|
|
import 'package:doctor_app_flutter/screens/medicine/pharmacies_list_screen.dart';
|
|
|
|
import 'package:doctor_app_flutter/screens/medicine/pharmacies_list_screen.dart';
|
|
|
|
import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart';
|
|
|
|
import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_header.dart';
|
|
|
|
|
|
|
|
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_title.dart';
|
|
|
|
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
|
|
|
|
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
|
|
|
|
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
|
|
|
|
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
|
|
|
|
import 'package:doctor_app_flutter/util/helpers.dart';
|
|
|
|
import 'package:doctor_app_flutter/util/helpers.dart';
|
|
|
|
@ -18,6 +20,7 @@ import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dar
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_field_custom_serach.dart';
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_field_custom_serach.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
import 'package:permission_handler/permission_handler.dart';
|
|
|
|
import 'package:permission_handler/permission_handler.dart';
|
|
|
|
import 'package:speech_to_text/speech_recognition_error.dart';
|
|
|
|
import 'package:speech_to_text/speech_recognition_error.dart';
|
|
|
|
import 'package:speech_to_text/speech_recognition_result.dart';
|
|
|
|
import 'package:speech_to_text/speech_recognition_result.dart';
|
|
|
|
@ -87,152 +90,140 @@ class _MedicineSearchState extends State<MedicineSearchScreen> {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
InputDecoration textFieldSelectorDecoration(
|
|
|
|
|
|
|
|
String hintText, String selectedText, bool isDropDown,
|
|
|
|
|
|
|
|
{IconData icon}) {
|
|
|
|
|
|
|
|
return InputDecoration(
|
|
|
|
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
|
|
|
|
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
|
|
|
|
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
disabledBorder: OutlineInputBorder(
|
|
|
|
|
|
|
|
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.circular(8),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
hintText: selectedText != null ? selectedText : hintText,
|
|
|
|
|
|
|
|
suffixIcon: isDropDown ? Icon(icon ?? Icons.arrow_drop_down) : null,
|
|
|
|
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
|
|
|
color: Colors.grey.shade600,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return BaseView<MedicineViewModel>(onModelReady: (model) async {
|
|
|
|
return BaseView<MedicineViewModel>(onModelReady: (model) async {
|
|
|
|
// if (model.allMedicationList.length == 0)
|
|
|
|
|
|
|
|
// await model.getMedicationList();
|
|
|
|
|
|
|
|
}, builder: (_, model, w) {
|
|
|
|
}, builder: (_, model, w) {
|
|
|
|
myController.text = model.searchText;
|
|
|
|
myController.text = model.searchText;
|
|
|
|
return AppScaffold(
|
|
|
|
return AppScaffold(
|
|
|
|
// baseViewModel: model,
|
|
|
|
// baseViewModel: model,
|
|
|
|
isShowAppBar: true,
|
|
|
|
isShowAppBar: true,
|
|
|
|
appBar: PatientSearchHeader(
|
|
|
|
appBar: BottomSheetTitle(
|
|
|
|
title: TranslationBase.of(context).searchMedicine,
|
|
|
|
title: TranslationBase.of(context).searchMedicine,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
//appBarTitle: TranslationBase.of(context).searchMedicine + "6",
|
|
|
|
//appBarTitle: TranslationBase.of(context).searchMedicine + "6",
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
child: Column(
|
|
|
|
widthFactor: 0.97,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
children: <Widget>[
|
|
|
|
child: Container(
|
|
|
|
SizedBox(
|
|
|
|
// height: SizeConfig.screenHeight,
|
|
|
|
height: 20,
|
|
|
|
child: Column(
|
|
|
|
),
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
AppTextFieldCustomSearch(
|
|
|
|
children: <Widget>[
|
|
|
|
hintText:
|
|
|
|
SizedBox(
|
|
|
|
TranslationBase.of(context).searchMedicineNameHere,
|
|
|
|
height: 20,
|
|
|
|
searchController: myController,
|
|
|
|
),
|
|
|
|
onFieldSubmitted: (value) {
|
|
|
|
FractionallySizedBox(
|
|
|
|
searchMedicine(context, model);
|
|
|
|
widthFactor: 0.9,
|
|
|
|
},
|
|
|
|
child: AppTextFieldCustomSearch(
|
|
|
|
marginTop: 5,
|
|
|
|
hintText:
|
|
|
|
),
|
|
|
|
TranslationBase.of(context).searchMedicineNameHere,
|
|
|
|
Container(
|
|
|
|
searchController: myController,
|
|
|
|
margin: EdgeInsets.only(left: 16, right: 16, bottom: 16, top: 0),
|
|
|
|
onFieldSubmitted: (value) {
|
|
|
|
|
|
|
|
searchMedicine(context, model);
|
|
|
|
child: Row(
|
|
|
|
},
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
marginTop: 5,
|
|
|
|
children: <Widget>[
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
),
|
|
|
|
child: AppText(
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
height: 20,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
FractionallySizedBox(
|
|
|
|
|
|
|
|
widthFactor: 0.9,
|
|
|
|
|
|
|
|
child: Container(
|
|
|
|
|
|
|
|
child: Wrap(
|
|
|
|
|
|
|
|
alignment: WrapAlignment.center,
|
|
|
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
|
|
|
// TODO change it secondary button and add loading
|
|
|
|
|
|
|
|
AppButton(
|
|
|
|
|
|
|
|
title: TranslationBase.of(context).search,
|
|
|
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
|
|
|
await searchMedicine(context, model);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
|
|
|
margin:
|
|
|
|
|
|
|
|
EdgeInsets.only(left: SizeConfig.heightMultiplier * 2),
|
|
|
|
|
|
|
|
child: Row(
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
|
|
|
AppText(
|
|
|
|
|
|
|
|
TranslationBase.of(context).youCanFind +
|
|
|
|
TranslationBase.of(context).youCanFind +
|
|
|
|
(myController.text != ''
|
|
|
|
(myController.text != ''
|
|
|
|
? model.pharmacyItemsList.length.toString()
|
|
|
|
? model.pharmacyItemsList.length.toString()
|
|
|
|
: '0') +
|
|
|
|
: '0') +
|
|
|
|
" " +
|
|
|
|
" " +
|
|
|
|
TranslationBase.of(context).itemsInSearch,
|
|
|
|
TranslationBase.of(context).medicineSearchResult +" '${myController.text}'",
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontHeight: 1.4,
|
|
|
|
|
|
|
|
color: AppGlobal.appTextColor,
|
|
|
|
|
|
|
|
textAlign: TextAlign.start,
|
|
|
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
|
|
|
letterSpacing: -0.9,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
),
|
|
|
|
height: 10,
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
height: 5,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
if (myController.text != '')
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
|
|
|
margin: EdgeInsets.only(left: 16, right: 16, bottom: 16, top: 0),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.6,
|
|
|
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
|
|
|
padding: const EdgeInsets.only(top: 20),
|
|
|
|
|
|
|
|
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"]),
|
|
|
|
|
|
|
|
settings: RouteSettings(
|
|
|
|
|
|
|
|
name: 'PharmaciesListScreen'),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
if (myController.text != '')
|
|
|
|
],
|
|
|
|
Container(
|
|
|
|
)),
|
|
|
|
height: MediaQuery.of(context).size.height * 0.6,
|
|
|
|
bottomSheet: Container(
|
|
|
|
child: ListView.builder(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
padding: const EdgeInsets.only(top: 20),
|
|
|
|
color: Colors.white,
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
|
|
|
|
Radius.circular(0.0),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
border: Border.all(color: HexColor('#707070'), width: 0),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.1,
|
|
|
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
height: 10,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
|
|
|
|
widthFactor: .80,
|
|
|
|
|
|
|
|
child: Center(
|
|
|
|
|
|
|
|
child: AppButton(
|
|
|
|
|
|
|
|
fontWeight: FontWeight.w700,
|
|
|
|
|
|
|
|
title: TranslationBase.of(context).search,
|
|
|
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
|
|
|
// onSubmitSearch();
|
|
|
|
|
|
|
|
await searchMedicine(context, model);
|
|
|
|
|
|
|
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
},
|
|
|
|
// shrinkWrap: true,
|
|
|
|
color: AppGlobal.appRedColor,
|
|
|
|
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"]),
|
|
|
|
|
|
|
|
settings: RouteSettings(
|
|
|
|
|
|
|
|
name: 'PharmaciesListScreen'),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
SizedBox(
|
|
|
|
|
|
|
|
height: 5,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|