From 0d8455faa7d878943b0c81ae7563ee5d68c1bea0 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Tue, 11 Aug 2020 15:10:15 +0300 Subject: [PATCH] Finish medicine search design --- ios/Podfile.lock | 2 +- lib/client/base_app_client.dart | 2 +- lib/config/config.dart | 4 +- lib/config/localized_values.dart | 10 +- lib/landing_page.dart | 2 +- lib/screens/dashboard_screen.dart | 21 +- .../medicine/medicine_search_screen.dart | 278 +++++++++--------- lib/widgets/shared/app_scaffold_widget.dart | 4 +- 8 files changed, 161 insertions(+), 162 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index cddfd571..0575cdb6 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -142,4 +142,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 649616dc336b3659ac6b2b25159d8e488e042b69 -COCOAPODS: 1.10.0.beta.1 +COCOAPODS: 1.9.3 diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart index 3ca3d40a..d497d8f7 100644 --- a/lib/client/base_app_client.dart +++ b/lib/client/base_app_client.dart @@ -59,7 +59,7 @@ class BaseAppClient { body['stamp'] = STAMP; body['IPAdress'] = IP_ADDRESS; body['VersionID'] = VERSION_ID; - if (body['Channel'] == null) body['Channel'] = CHANNEL; + body['Channel'] = CHANNEL; body['SessionID'] = SESSION_ID; body['IsLoginForDoctorApp'] = IS_LOGIN_FOR_DOCTOR_APP; body['PatientOutSA'] = 0; // PATIENT_OUT_SA; diff --git a/lib/config/config.dart b/lib/config/config.dart index e5b948ec..6549ada5 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -2,8 +2,8 @@ const MAX_SMALL_SCREEN = 660; const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; -const BASE_URL = 'https://hmgwebservices.com/'; -//const BASE_URL = 'https://uat.hmgwebservices.com/'; +//const BASE_URL = 'https://hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PATIENT_PROGRESS_NOTE_URL = diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index b96540d7..15d68f32 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -57,7 +57,7 @@ const Map> localizedValues = { 'ar': 'المريض الذي حضر للموعد' }, 'searchMedicineNameHere': {'en': 'Search Medicine ', 'ar': 'ابحث هنا'}, - 'youCanFind': {'en': 'You Can Find', 'ar': 'تستطيع ان تجد '}, + 'youCanFind': {'en': 'You Can Find ', 'ar': 'تستطيع ان تجد '}, 'itemsInSearch': {'en': 'items in search', 'ar': 'عناصر في البحث'}, 'qrReader': {'en': 'QR Reader', 'ar': 'قارىء رمز الQR'}, 'startScanning': {'en': 'Start Scanning', 'ar': 'بدء المسح'}, @@ -218,11 +218,11 @@ const Map> localizedValues = { 'endcall': {'en': 'End Call', 'ar': 'إنهاء المكالمة'}, 'transfertoadmin': {'en': 'Transfer to admin', 'ar': 'نقل إلى المسؤول'}, "searchMedicineImageCaption": { - 'en': 'Type the medicine name to search', - 'ar': 'اكتب اسم الدواء الذي تبحت عنه ' + 'en': 'Type or speak the medicine name to search', + 'ar': ' اكتب أو انطق اسم الدواء للبحث' }, "type": { - 'en': 'Type', - 'ar': 'اكتب اسم الدواء ' + 'en': 'Type or Speak', + 'ar': 'اكتب أو تحدث ' } }; diff --git a/lib/landing_page.dart b/lib/landing_page.dart index 5febcf56..dc3c5d3c 100644 --- a/lib/landing_page.dart +++ b/lib/landing_page.dart @@ -41,7 +41,7 @@ class _LandingPageState extends State { backgroundColor: Hexcolor('#515B5D'), textTheme: TextTheme( headline6: - TextStyle(color: Colors.white, fontWeight: FontWeight.bold)), + TextStyle(color: Colors.white)), title: Text(getText(currentTab).toUpperCase()), leading: Builder( builder: (BuildContext context) { diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index 4e2dbfc6..df4853f1 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -85,7 +85,7 @@ class _DashboardScreenState extends State { Column( children: [ Container( - height: 150, + height: 140, color: Hexcolor('#515B5D'), width: double.infinity, child: FractionallySizedBox( @@ -101,7 +101,7 @@ class _DashboardScreenState extends State { children: [ AppText( "Welcome", - fontSize: SizeConfig.textMultiplier * 2, + fontSize: SizeConfig.textMultiplier * 1.7, color: Colors.white, ) ], @@ -130,7 +130,7 @@ class _DashboardScreenState extends State { : authProvider.doctorProfile .clinicDescription, fontSize: - SizeConfig.textMultiplier * 2, + SizeConfig.textMultiplier * 1.7, color: Colors.white, ), alignment: projectsProvider.isArabic @@ -201,14 +201,14 @@ class _DashboardScreenState extends State { ), Container( color: Colors.white, - height: 150, + height: 90, ), ], ), Positioned( - right: 0.0, - left: 0, - bottom: 40, + right: 9.0, + left: 9, + bottom: 19, child: Container( decoration: BoxDecoration( color: Hexcolor("#DED8CF"), @@ -376,10 +376,11 @@ class _DashboardScreenState extends State { ) ]), FractionallySizedBox( - widthFactor: 0.95, + widthFactor: 0.90, child: Container( color: Colors.white, child: Column( + mainAxisAlignment: MainAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -544,7 +545,7 @@ class _DashboardScreenState extends State { width: MediaQuery .of(context) .size - .width * 0.45, + .width * 0.44, height: MediaQuery .of(context) .orientation == Orientation.portrait @@ -598,7 +599,7 @@ class _DashboardScreenState extends State { width: MediaQuery .of(context) .size - .width * 0.45, + .width * 0.44, height: MediaQuery .of(context) .orientation == Orientation.portrait diff --git a/lib/screens/medicine/medicine_search_screen.dart b/lib/screens/medicine/medicine_search_screen.dart index a24a6093..cdfaefb2 100644 --- a/lib/screens/medicine/medicine_search_screen.dart +++ b/lib/screens/medicine/medicine_search_screen.dart @@ -90,156 +90,154 @@ class _MedicineSearchState extends State { Widget build(BuildContext context) { return AppScaffold( appBarTitle: TranslationBase.of(context).searchMedicine, - body: Column( - children: [ - Column( - children: [ - 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: [ + Column( children: [ - 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: [ - 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: [ + 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: [ + AppButton( + title: TranslationBase + .of(context) + .search, + onPressed: () { + searchMedicine(context); + }, + ), + ], + ), + ), + Container( + margin: EdgeInsets.only(left: SizeConfig.heightMultiplier * 2), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + 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"]), - ), - ); - }, ); }, - ), + ); + }, + ), + ), + ], + ), ), - ), - ], + + ], + ), )); } diff --git a/lib/widgets/shared/app_scaffold_widget.dart b/lib/widgets/shared/app_scaffold_widget.dart index 60828f71..1dc27114 100644 --- a/lib/widgets/shared/app_scaffold_widget.dart +++ b/lib/widgets/shared/app_scaffold_widget.dart @@ -25,14 +25,14 @@ class AppScaffold extends StatelessWidget { AppGlobal.CONTEX = context; ProjectProvider projectProvider = Provider.of(context); return Scaffold( - backgroundColor: Hexcolor('#F5F5F5'), + backgroundColor: Colors.white, appBar: isShowAppBar ? AppBar( elevation: 0, backgroundColor: Hexcolor('#515B5D'), textTheme: TextTheme( headline6: TextStyle( - color: Colors.white, fontWeight: FontWeight.bold)), + color: Colors.white)), title: Text(appBarTitle.toUpperCase()), leading: Builder(builder: (BuildContext context) { return IconButton(