From 9c7e8e3637c26283d8b52feeb5006aff461f012d Mon Sep 17 00:00:00 2001 From: "Mirza.Shafique" Date: Mon, 11 Oct 2021 16:27:14 +0300 Subject: [PATCH 1/7] Back Button on Landing Page 1 --- lib/config/config.dart | 4 +- lib/pages/landing/landing_page.dart | 25 ++++--- .../vital_sing_chart_and_detials.dart | 14 ++-- lib/widgets/charts/sync_fu_chart.dart | 69 +++++++++++++++++++ pubspec.yaml | 1 + 5 files changed, 96 insertions(+), 17 deletions(-) create mode 100644 lib/widgets/charts/sync_fu_chart.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 7840b97d..d7ffabcd 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -12,8 +12,8 @@ const PACKAGES_PRODUCTS = '/api/products'; const PACKAGES_CUSTOMER = '/api/customers'; const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_ORDERS = '/api/orders'; -// const BASE_URL = 'https://uat.hmgwebservices.com/'; -const BASE_URL = 'https://hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; +// const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs // const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index f96cf7f4..86c158ad 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -610,21 +610,28 @@ class _LandingPageState extends State with WidgetsBindingObserver { changeCurrentTab(1); }, ), - MedicalProfilePageNew(onTap: (){ - changeCurrentTab(0); - },), - Search(onBackClick: (){ - changeCurrentTab(0); - },), + MedicalProfilePageNew( + onTap: () { + changeCurrentTab(0); + }, + ), + Search( + onBackClick: () { + changeCurrentTab(0); + }, + ), MyFamily( isAppbarVisible: false, onBackClick: () { changeCurrentTab(0); }, ), - ToDo(isShowAppBar: true,onBackClick: (){ - changeCurrentTab(0); - },), + ToDo( + isShowAppBar: true, + onBackClick: () { + changeCurrentTab(0); + }, + ), ], // Please do not remove the BookingOptions from this array ), RobotIcon() diff --git a/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart b/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart index ea29909b..62498d51 100644 --- a/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart +++ b/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart @@ -6,6 +6,7 @@ import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import 'package:diplomaticquarterapp/widgets/charts/show_chart.dart'; +import 'package:diplomaticquarterapp/widgets/charts/sync_fu_chart.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -53,12 +54,13 @@ class _VitalSingChartAndDetialsState extends State { shape: cardRadius(12), elevation: 1, margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), - child: ShowChart( - title: widget.name, - timeSeries: timeSeriesData, - indexes: timeSeriesData.length ~/ 5.5, - horizontalInterval: 8, - ), + // child: ShowChart( + // title: widget.name, + // timeSeries: timeSeriesData, + // indexes: timeSeriesData.length ~/ 5.5, + // horizontalInterval: 8, + // ), + child: SyncFuChart(), ), Card( shape: cardRadius(12), diff --git a/lib/widgets/charts/sync_fu_chart.dart b/lib/widgets/charts/sync_fu_chart.dart new file mode 100644 index 00000000..ca0a626e --- /dev/null +++ b/lib/widgets/charts/sync_fu_chart.dart @@ -0,0 +1,69 @@ +import 'package:flutter/material.dart'; +import 'package:syncfusion_flutter_charts/charts.dart'; +import 'package:syncfusion_flutter_charts/sparkcharts.dart'; + +class SyncFuChart extends StatelessWidget { + + List<_SalesData> data = [ + _SalesData('Jan', 35), + _SalesData('Feb', 28), + _SalesData('Mar', 34), + _SalesData('Apr', 32), + _SalesData('May', 40), + ]; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Syncfusion Flutter chart'), + ), + body: Column( + children: [ + //Initialize the chart widget + SfCartesianChart( + primaryXAxis: CategoryAxis(), + // Chart title + title: ChartTitle(text: 'Half yearly sales analysis'), + // Enable legend + legend: Legend(isVisible: true), + // Enable tooltip + tooltipBehavior: TooltipBehavior(enable: true), + series: >[ + LineSeries<_SalesData, String>( + dataSource: data, + xValueMapper: (_SalesData sales, _) => sales.year, + yValueMapper: (_SalesData sales, _) => sales.sales, + name: 'Sales', + // Enable data label + dataLabelSettings: DataLabelSettings(isVisible: true)) + ]), + Expanded( + child: Padding( + padding: const EdgeInsets.all(8.0), + //Initialize the spark charts widget + child: SfSparkLineChart.custom( + //Enable the trackball + trackball: SparkChartTrackball(activationMode: SparkChartActivationMode.tap), + //Enable marker + marker: SparkChartMarker(displayMode: SparkChartMarkerDisplayMode.all), + //Enable data label + labelDisplayMode: SparkChartLabelDisplayMode.all, + xValueMapper: (int index) => data[index].year, + yValueMapper: (int index) => data[index].sales, + dataCount: 5, + ), + ), + ) + ], + ), + ); + } +} + +class _SalesData { + _SalesData(this.year, this.sales); + + final String year; + final double sales; +} diff --git a/pubspec.yaml b/pubspec.yaml index c5541181..e1732307 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -104,6 +104,7 @@ dependencies: # Calendar # table_calendar: ^2.3.0 syncfusion_flutter_calendar: ^18.4.49 + syncfusion_flutter_charts: any # SVG Images flutter_svg: ^0.18.0 From d664a216c6cfbc9495c0f52399124654165512bb Mon Sep 17 00:00:00 2001 From: "Mirza.Shafique" Date: Tue, 12 Oct 2021 11:27:05 +0300 Subject: [PATCH 2/7] Profile Page and Back Button Click --- lib/config/localized_values.dart | 2 + lib/pages/landing/landing_page.dart | 15 +- .../vital_sing_chart_and_detials.dart | 25 +- lib/pages/settings/profile_setting.dart | 477 +++++++++++------- lib/pages/settings/settings.dart | 78 +-- lib/uitl/translations_delegate_base.dart | 3 + lib/widgets/charts/sync_fu_chart.dart | 121 ++--- pubspec.yaml | 2 +- 8 files changed, 410 insertions(+), 313 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 608c67f0..e34982a1 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1497,4 +1497,6 @@ const Map localizedValues = { "years": {"en": "Years", "ar": "سنوات"}, "respirationBPM": { "en": "bpm", "ar": "نفس" }, "extremeObese": {"en": "Extreme Obese", "ar": "السمنة المفرطة"}, + "selectLanguage": { "en": "Please select any language:", "ar": ":الرجاء تحديد أي لغة" }, + "recAlert": { "en": "How do you want to receive alerts?", "ar": "كيف تريد تلقي التنبيهات؟" }, }; diff --git a/lib/pages/landing/landing_page.dart b/lib/pages/landing/landing_page.dart index 7c83c338..13cc2dce 100644 --- a/lib/pages/landing/landing_page.dart +++ b/lib/pages/landing/landing_page.dart @@ -102,13 +102,18 @@ class _LandingPageState extends State with WidgetsBindingObserver { LocationUtils locationUtils; Future onWillPop() { - DateTime now = DateTime.now(); - if (currentBackPressTime == null || now.difference(currentBackPressTime) > Duration(seconds: 2)) { - currentBackPressTime = now; - AppToast.showToast(message: TranslationBase.of(context).pressAgain); + if (currentTab != 0) { + changeCurrentTab(0); return Future.value(false); + } else { + DateTime now = DateTime.now(); + if (currentBackPressTime == null || now.difference(currentBackPressTime) > Duration(seconds: 2)) { + currentBackPressTime = now; + AppToast.showToast(message: TranslationBase.of(context).pressAgain); + return Future.value(false); + } + return Future.value(true); } - return Future.value(true); } changeCurrentTab(int tab) { diff --git a/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart b/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart index 62498d51..e98bcb72 100644 --- a/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart +++ b/lib/pages/medical/vital_sign/vital_sing_chart_and_detials.dart @@ -50,17 +50,20 @@ class _VitalSingChartAndDetialsState extends State { return SingleChildScrollView( child: Column( children: [ - Card( - shape: cardRadius(12), - elevation: 1, - margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), - // child: ShowChart( - // title: widget.name, - // timeSeries: timeSeriesData, - // indexes: timeSeriesData.length ~/ 5.5, - // horizontalInterval: 8, - // ), - child: SyncFuChart(), + Container( + height: 400, + child: Card( + shape: cardRadius(12), + elevation: 1, + margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8), + child: ShowChart( + title: widget.name, + timeSeries: timeSeriesData, + indexes: timeSeriesData.length ~/ 5.5, + horizontalInterval: 8, + ), + // child: SyncFuChart(), + ), ), Card( shape: cardRadius(12), diff --git a/lib/pages/settings/profile_setting.dart b/lib/pages/settings/profile_setting.dart index 838af5f9..1d2938cc 100644 --- a/lib/pages/settings/profile_setting.dart +++ b/lib/pages/settings/profile_setting.dart @@ -2,9 +2,11 @@ import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/services/authentication/auth_provider.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; @@ -16,8 +18,7 @@ class ProfileSettings extends StatefulWidget { _ProfileSettings createState() => _ProfileSettings(); } -class _ProfileSettings extends State - with TickerProviderStateMixin { +class _ProfileSettings extends State with TickerProviderStateMixin { bool smsAlert = true; bool emailAlert = true; int language = 1; @@ -25,6 +26,7 @@ class _ProfileSettings extends State TextEditingController emergencyContact = new TextEditingController(); TextEditingController emailController = new TextEditingController(); TextEditingController emergencyContactName = new TextEditingController(); + @override void initState() { Future.delayed(new Duration(seconds: 0), () { @@ -37,199 +39,300 @@ class _ProfileSettings extends State Widget build(BuildContext context) { return BaseView( - onModelReady: (model) => {}, - builder: (_, model, wi) => Container( - child: model.user != null - ? ListView(scrollDirection: Axis.vertical, children: [ - Container( - color: Theme.of(context).textTheme.headline2.color, - padding: EdgeInsets.all(15), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText( - TranslationBase.of(context).fileNo, - color: Colors.black, - ), - AppText( - model.user.patientID.toString(), - color: Colors.black, - ), - ], + onModelReady: (model) => {}, + builder: (_, model, wi) => Container( + child: model.user != null + ? Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Card( + shape: cardRadius(8), + margin: EdgeInsets.zero, + elevation: 3, + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Text( + TranslationBase.of(context).fileNo + ": ", + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + Text( + model.user.patientID.toString(), + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + ], + ), + ), + ), + mHeight(12), + Text( + TranslationBase.of(context).languageSetting, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + Text( + TranslationBase.of(context).selectLanguage, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + ), + Row( + children: [ + Expanded( + child: Row( + children: [ + new Radio( + value: 2, + groupValue: language, + onChanged: (value) { + setState(() { + language = value; + }); + }, + ), + Text( + TranslationBase.of(context).english, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), + ), + Expanded( + child: Row( + children: [ + Radio( + value: 1, + groupValue: language, + onChanged: (value) { + setState(() { + language = value; + }); + }, + ), + Text( + TranslationBase.of(context).arabic, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), + ), + ], + ), + mHeight(12), + Text( + TranslationBase.of(context).alert, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + Text( + TranslationBase.of(context).recAlert, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + ), + Row( + children: [ + Checkbox( + value: emailAlert, + onChanged: (value) { + setState(() { + emailAlert = value; + }); + }, + activeColor: CustomColors.accentColor, + ), + Text( + TranslationBase.of(context).emailAlert, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), + Row( + children: [ + Checkbox( + value: smsAlert, + onChanged: (value) { + setState(() { + smsAlert = value; + }); + }, + activeColor: CustomColors.accentColor, + ), + Text( + TranslationBase.of(context).smsAlert, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), + mHeight(16), + Text( + TranslationBase.of(context).contactInfo, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + mHeight(12), + inputWidget(TranslationBase.of(context).email, "", emailController), + mHeight(8), + inputWidget(TranslationBase.of(context).emergencyName, "", emergencyContactName), + mHeight(8), + inputWidget(TranslationBase.of(context).emergencyContact, "", emergencyContact), + mHeight(8), + ], + ), ), ), - SizedBox( - height: 1, - width: MediaQuery.of(context).size.width, - child: Container( - color: Colors.grey[300], + ), + Container( + width: double.infinity, + child: Card( + margin: EdgeInsets.zero, + elevation: 20, + child: Padding( + padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16, top: 16), + child: DefaultButton( + TranslationBase.of(context).save, + () { + saveSettings(); + }, + ), ), ), - Padding( - child: AppText( - TranslationBase.of(context).languageSetting, - fontWeight: FontWeight.bold), - padding: EdgeInsets.all(10), + ), + ], + ) + : Center( + child: AppText(TranslationBase.of(context).loginToUseService), + ), + ), + ); + } + + Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String prefix, bool isEnable = true, bool hasSelection = false}) { + return Container( + padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: Colors.white, + border: Border.all( + color: Color(0xffefefef), + width: 1, + ), + ), + child: InkWell( + onTap: hasSelection ? () {} : null, + child: Row( + children: [ + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + _labelText, + style: TextStyle( + fontSize: 11, + fontWeight: FontWeight.w600, + color: Color(0xff2B353E), + letterSpacing: -0.44, ), - Container( - color: Theme.of(context).textTheme.headline2.color, - padding: EdgeInsets.only( - top: 0, left: 10, right: 10, bottom: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).english), - new Radio( - value: 2, - groupValue: language, - onChanged: (value) { - setState(() { - language = value; - }); - }, - ) - ], - )), - Container( - color: Theme.of(context).textTheme.headline2.color, - padding: EdgeInsets.only( - top: 0, left: 10, right: 10, bottom: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).arabic), - new Radio( - value: 1, - groupValue: language, - onChanged: (value) { - setState(() { - language = value; - }); - }, - ) - ], - )), - Padding( - child: AppText(TranslationBase.of(context).alert), - padding: EdgeInsets.all(10), + ), + TextField( + enabled: isEnable, + scrollPadding: EdgeInsets.zero, + keyboardType: TextInputType.number, + controller: _controller, + // onChanged: (value) => {validateForm()}, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff2B353E), + letterSpacing: -0.44, ), - Container( - color: Theme.of(context).textTheme.headline2.color, - padding: EdgeInsets.only( - top: 0, left: 10, right: 10, bottom: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).emailAlert), - Switch( - value: emailAlert, - onChanged: (value) { - setState(() { - emailAlert = value; - }); - }, - activeTrackColor: Colors.lightGreenAccent, - activeColor: Colors.green, - ) - ], - )), - Container( - color: Theme.of(context).textTheme.headline2.color, - padding: EdgeInsets.only( - top: 0, left: 10, right: 10, bottom: 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).smsAlert), - Switch( - value: smsAlert, - onChanged: (value) { - setState(() { - smsAlert = value; - }); - }, - activeTrackColor: Colors.lightGreenAccent, - activeColor: Colors.green, - ) - ], - )), - Padding( - child: AppText(TranslationBase.of(context).contactInfo), - padding: EdgeInsets.all(10), - ), - Container( - color: Theme.of(context).textTheme.headline2.color, - padding: EdgeInsets.only( - top: 0, left: 10, right: 10, bottom: 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText(TranslationBase.of(context).email), - TextField( - controller: emailController, - decoration: InputDecoration( - suffixIcon: Icon(Icons.edit), - )) - ], - )), - Container( - color: Theme.of(context).textTheme.headline2.color, - padding: EdgeInsets.only( - top: 0, left: 10, right: 10, bottom: 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText(TranslationBase.of(context).emergencyName), - TextField( - controller: emergencyContactName, - decoration: InputDecoration( - suffixIcon: Icon(Icons.edit), - )) - ], - )), - Container( - color: Theme.of(context).textTheme.headline2.color, - padding: EdgeInsets.only( - top: 0, left: 10, right: 10, bottom: 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - AppText( - TranslationBase.of(context).emergencyContact), - TextField( - controller: emergencyContact, - decoration: InputDecoration( - suffixIcon: Icon(Icons.edit), + decoration: InputDecoration( + isDense: true, + hintText: _hintText, + hintStyle: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w400, + color: Color(0xff575757), + letterSpacing: -0.56, + ), + prefixIconConstraints: BoxConstraints(minWidth: 50), + prefixIcon: prefix == null + ? null + : Text( + "+" + prefix, + style: TextStyle( + fontSize: 14, + height: 21 / 14, + fontWeight: FontWeight.w500, + color: Color(0xff2E303A), + letterSpacing: -0.56, ), - ) - ], - )), - Container( - padding: EdgeInsets.all(10), - child: Row( - children: [ - Expanded( - child: DefaultButton( - TranslationBase.of(context).save, - () { - saveSettings(); - }, - )), - ], - )) - ]) - : Center( - child: - AppText(TranslationBase.of(context).loginToUseService), - ))); + ), + contentPadding: EdgeInsets.zero, + border: InputBorder.none, + focusedBorder: InputBorder.none, + enabledBorder: InputBorder.none, + ), + ), + ], + ), + ), + if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), + ], + ), + ), + ); } getSettings(context) { GifLoaderDialogUtils.showMyDialog(context); - authService.getSettings().then((result) => { - GifLoaderDialogUtils.hideDialog(context), - setValue(result["PateintInfoForUpdateList"][0]) - }); + authService.getSettings().then((result) => {GifLoaderDialogUtils.hideDialog(context), setValue(result["PateintInfoForUpdateList"][0])}); } setValue(value) { @@ -252,10 +355,6 @@ class _ProfileSettings extends State request["IsEmailAlertRequired"] = this.emailAlert; request["IsSMSAlertRequired"] = this.smsAlert; request["PreferredLanguage"] = this.language.toString(); - authService.saveSettings(request).then((result) => { - AppToast.showSuccessToast( - message: TranslationBase.of(context).profileUpdate), - GifLoaderDialogUtils.hideDialog(context) - }); + authService.saveSettings(request).then((result) => {AppToast.showSuccessToast(message: TranslationBase.of(context).profileUpdate), GifLoaderDialogUtils.hideDialog(context)}); } } diff --git a/lib/pages/settings/settings.dart b/lib/pages/settings/settings.dart index 1282a636..32e4cf66 100644 --- a/lib/pages/settings/settings.dart +++ b/lib/pages/settings/settings.dart @@ -1,7 +1,9 @@ import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/pages/settings/general_setting.dart'; import 'package:diplomaticquarterapp/pages/settings/profile_setting.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/arrow_back.dart'; import 'package:flutter/material.dart'; @@ -9,6 +11,7 @@ class Settings extends StatefulWidget { final int type; Settings({this.type = 0}); + @override _Settings createState() => _Settings(); } @@ -18,8 +21,7 @@ class _Settings extends State with TickerProviderStateMixin { @override void initState() { - _tabController = - new TabController(length: 2, vsync: this, initialIndex: widget.type); + _tabController = new TabController(length: 2, vsync: this, initialIndex: widget.type); if (widget.type == 1) { _tabController.animateTo(1); @@ -31,45 +33,45 @@ class _Settings extends State with TickerProviderStateMixin { @override Widget build(BuildContext context) { AppGlobal.context = context; - return Scaffold( - appBar: AppBar( - actions: [ - IconButton( - icon: Icon(Icons.info, color: Colors.white), - onPressed: () { - //openInfoPage() - }, - ) - ], - bottom: TabBar( - // isScrollable: true, + return AppScaffold( + isShowAppBar: false, + isShowDecPage: false, + showNewAppBarTitle: true, + showNewAppBar: true, + appBarTitle: TranslationBase.of(context).settings, + backgroundColor: Color(0xFFF7F7F7), + body: Column( + children: [ + TabBar( + // isScrollable: true, - indicatorWeight: 5.0, - //indicatorSize: TabBarIndicatorSize.label, - // indicatorSize: TabBarIndicatorSize.tab, + indicatorWeight: 3.0, + //indicatorSize: TabBarIndicatorSize.label, + // indicatorSize: TabBarIndicatorSize.tab, - indicatorColor: Theme.of(context).primaryColor, - // labelColor: Theme.of(context).primaryColor, - tabs: [ - Tab(text: TranslationBase.of(context).general), - Tab( - text: TranslationBase.of(context).profile, - ) - ], - controller: _tabController, - ), - title: Text(TranslationBase.of(context).settings, - style: TextStyle(color: Colors.white)), - leading: Builder( - builder: (BuildContext context) { - return ArrowBack(); - }, - ), + indicatorColor: CustomColors.accentColor, + labelColor: Colors.black, + unselectedLabelColor: CustomColors.grey, + // labelColor: Theme.of(context).primaryColor, + tabs: [ + Tab(text: TranslationBase.of(context).general), + Tab( + text: TranslationBase.of(context).profile, + ) + ], + controller: _tabController, + ), + Expanded( + child: TabBarView( + physics: NeverScrollableScrollPhysics(), + children: [ + GeneralSettings(), + ProfileSettings(), + ], + controller: _tabController), + ), + ], ), - body: TabBarView( - physics: NeverScrollableScrollPhysics(), - children: [GeneralSettings(), ProfileSettings()], - controller: _tabController), ); } } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 0a3177e0..48e8b0bd 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2361,6 +2361,9 @@ class TranslationBase { String get selectSlot => localizedValues["selectSlot"][locale.languageCode]; + String get selectLanguage => localizedValues["selectLanguage"][locale.languageCode]; + + String get recAlert => localizedValues["recAlert"][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/charts/sync_fu_chart.dart b/lib/widgets/charts/sync_fu_chart.dart index ca0a626e..3119cc36 100644 --- a/lib/widgets/charts/sync_fu_chart.dart +++ b/lib/widgets/charts/sync_fu_chart.dart @@ -1,69 +1,52 @@ -import 'package:flutter/material.dart'; -import 'package:syncfusion_flutter_charts/charts.dart'; -import 'package:syncfusion_flutter_charts/sparkcharts.dart'; - -class SyncFuChart extends StatelessWidget { - - List<_SalesData> data = [ - _SalesData('Jan', 35), - _SalesData('Feb', 28), - _SalesData('Mar', 34), - _SalesData('Apr', 32), - _SalesData('May', 40), - ]; - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: const Text('Syncfusion Flutter chart'), - ), - body: Column( - children: [ - //Initialize the chart widget - SfCartesianChart( - primaryXAxis: CategoryAxis(), - // Chart title - title: ChartTitle(text: 'Half yearly sales analysis'), - // Enable legend - legend: Legend(isVisible: true), - // Enable tooltip - tooltipBehavior: TooltipBehavior(enable: true), - series: >[ - LineSeries<_SalesData, String>( - dataSource: data, - xValueMapper: (_SalesData sales, _) => sales.year, - yValueMapper: (_SalesData sales, _) => sales.sales, - name: 'Sales', - // Enable data label - dataLabelSettings: DataLabelSettings(isVisible: true)) - ]), - Expanded( - child: Padding( - padding: const EdgeInsets.all(8.0), - //Initialize the spark charts widget - child: SfSparkLineChart.custom( - //Enable the trackball - trackball: SparkChartTrackball(activationMode: SparkChartActivationMode.tap), - //Enable marker - marker: SparkChartMarker(displayMode: SparkChartMarkerDisplayMode.all), - //Enable data label - labelDisplayMode: SparkChartLabelDisplayMode.all, - xValueMapper: (int index) => data[index].year, - yValueMapper: (int index) => data[index].sales, - dataCount: 5, - ), - ), - ) - ], - ), - ); - } -} - -class _SalesData { - _SalesData(this.year, this.sales); - - final String year; - final double sales; -} +// import 'package:flutter/material.dart'; +// import 'package:syncfusion_flutter_charts/charts.dart'; +// import 'package:syncfusion_flutter_charts/sparkcharts.dart'; +// +// class SyncFuChart extends StatelessWidget { +// List<_SalesData> data = [ +// _SalesData('Jan', 35), +// _SalesData('Feb', 28), +// _SalesData('Mar', 34), +// _SalesData('Apr', 32), +// _SalesData('May', 40), +// ]; +// +// @override +// Widget build(BuildContext context) { +// return Scaffold( +// body: Column( +// children: [ +// //Initialize the chart widget +// SfCartesianChart( +// +// primaryXAxis: CategoryAxis(), +// primaryYAxis: CategoryAxis(minimum: 28), +// // Chart title +// title: ChartTitle(text: 'Half yearly sales analysis'), +// // Enable legend +// legend: Legend(isVisible: true), +// // Enable tooltip +// tooltipBehavior: TooltipBehavior(enable: true), +// series: >[ +// LineSeries<_SalesData, String>( +// dataSource: data, +// xValueMapper: (_SalesData sales, _) => sales.year, +// yValueMapper: (_SalesData sales, _) => sales.sales, +// name: 'Sales', +// // Enable data label +// dataLabelSettings: DataLabelSettings(isVisible: true), +// ), +// ], +// ), +// ], +// ), +// ); +// } +// } +// +// class _SalesData { +// _SalesData(this.year, this.sales); +// +// final String year; +// final double sales; +// } diff --git a/pubspec.yaml b/pubspec.yaml index e1732307..306513d4 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -104,7 +104,7 @@ dependencies: # Calendar # table_calendar: ^2.3.0 syncfusion_flutter_calendar: ^18.4.49 - syncfusion_flutter_charts: any +# syncfusion_flutter_charts: any # SVG Images flutter_svg: ^0.18.0 From 1223ab7a17137020ee70b2c562c0ea933a6920dd Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Wed, 13 Oct 2021 14:25:42 +0300 Subject: [PATCH 3/7] h20 week & month graph updated & improvements. --- lib/config/config.dart | 4 +- .../AlHabibMedicalService/H2O_view_model.dart | 31 ++- .../AlHabibMedicalService/h2o/h2o_page.dart | 184 ++++++------------ .../AlHabibMedicalService/h2o/month_page.dart | 63 +++--- .../AlHabibMedicalService/h2o/week_page.dart | 66 +++---- .../medical/vital_sign/vital_sign_item.dart | 3 +- lib/widgets/charts/custom_line_chart.dart | 148 ++++++++++++++ lib/widgets/others/app_scaffold_widget.dart | 8 +- 8 files changed, 311 insertions(+), 196 deletions(-) create mode 100644 lib/widgets/charts/custom_line_chart.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 7840b97d..d7ffabcd 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -12,8 +12,8 @@ const PACKAGES_PRODUCTS = '/api/products'; const PACKAGES_CUSTOMER = '/api/customers'; const PACKAGES_SHOPPING_CART = '/api/shopping_cart_items'; const PACKAGES_ORDERS = '/api/orders'; -// const BASE_URL = 'https://uat.hmgwebservices.com/'; -const BASE_URL = 'https://hmgwebservices.com/'; +const BASE_URL = 'https://uat.hmgwebservices.com/'; +// const BASE_URL = 'https://hmgwebservices.com/'; // Pharmacy UAT URLs // const BASE_PHARMACY_URL = 'https://uat.hmgwebservices.com/epharmacy/api/'; diff --git a/lib/core/viewModels/AlHabibMedicalService/H2O_view_model.dart b/lib/core/viewModels/AlHabibMedicalService/H2O_view_model.dart index 219103da..3e980071 100644 --- a/lib/core/viewModels/AlHabibMedicalService/H2O_view_model.dart +++ b/lib/core/viewModels/AlHabibMedicalService/H2O_view_model.dart @@ -9,14 +9,19 @@ import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_p import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_progress_for_week_data_model.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/H2O_service.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; +import 'package:diplomaticquarterapp/widgets/charts/custom_line_chart.dart'; import '../../../locator.dart'; class H2OViewModel extends BaseViewModel { H2OService _h2OService = locator(); - List userProgressForWeekDataSeries; - List userProgressForMonthDataSeries; + // + // List userProgressForWeekDataSeries; + List userProgressForWeekDataSeries; + List userProgressForMonthDataSeries; + + // List userProgressForMonthDataSeries; UserDetailModel get userDetail => _h2OService.userDetailModel; @@ -71,7 +76,8 @@ class H2OViewModel extends BaseViewModel { error = _h2OService.error; setState(ViewState.Error); } else { - userProgressForWeekDataSeries = createUserProgressForWeekDataSeries(); + // userProgressForWeekDataSeries = createUserProgressForWeekDataSeries(); + userProgressForWeekDataSeries = createUserProgressForWeekDataSeriesNew(); setState(ViewState.Idle); } } @@ -83,7 +89,7 @@ class H2OViewModel extends BaseViewModel { error = _h2OService.error; setState(ViewState.Error); } else { - userProgressForMonthDataSeries = createUserProgressForMonthDataSeries(); + userProgressForMonthDataSeries = createUserProgressForMonthDataSeriesNew(); setState(ViewState.Idle); } } @@ -113,6 +119,23 @@ class H2OViewModel extends BaseViewModel { ]; } + List createUserProgressForWeekDataSeriesNew() { + List list = []; + + _h2OService.userProgressForWeekDataList.forEach((UserProgressForWeekDataModel data) { + list.add(new LineChartModel(data.dayName, data.percentageConsumed)); + }); + return list; + } + + List createUserProgressForMonthDataSeriesNew() { + List list = []; + _h2OService.userProgressForMonthDataList.forEach((UserProgressForMonthDataModel data) { + list.add(new LineChartModel(data.monthName, data.percentageConsumed)); + }); + return list; + } + List> createUserProgressForMonthDataSeries() { List globalData = []; _h2OService.userProgressForMonthDataList.forEach((UserProgressForMonthDataModel data) { diff --git a/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart b/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart index 982b9044..69488bfe 100644 --- a/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart @@ -77,132 +77,70 @@ class _H2OPageState extends State with SingleTickerProviderStateMixin { }, ), ], - body: Scaffold( - // extendBodyBehindAppBar: true, - // appBar: PreferredSize( - // preferredSize: Size.fromHeight(65.0), - // child: Stack( - // children: [ - // Positioned( - // bottom: 1, - // left: 0, - // right: 0, - // child: BackdropFilter( - // filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), - // child: Container( - // color: Theme.of(context).scaffoldBackgroundColor.withOpacity(0.8), - // height: 70.0, - // ), - // ), - // ), - // Center( - // child: Container( - // height: 60.0, - // alignment: Alignment.center, - // // margin: EdgeInsets.only(top: 10.0), - // // width: MediaQuery.of(context).size.width * 0.9, - // - // child: TabBar( - // isScrollable: false, - // controller: _tabController, - // indicatorWeight: 5.0, - // indicatorSize: TabBarIndicatorSize.tab, - // indicatorColor: Colors.red[800], - // labelColor: Theme.of(context).primaryColor, - // labelPadding: EdgeInsets.only(top: 4.0, left: 10.0, right: 13.0), - // unselectedLabelColor: Colors.grey[800], - // tabs: [ - // Container( - // width: MediaQuery.of(context).size.width * 0.28, - // child: Center( - // child: Texts(TranslationBase.of(context).today), - // ), - // ), - // Container( - // width: MediaQuery.of(context).size.width * 0.28, - // child: Center( - // child: Texts(TranslationBase.of(context).week), - // ), - // ), - // Container( - // width: MediaQuery.of(context).size.width * 0.28, - // child: Center( - // child: Texts(TranslationBase.of(context).month), - // ), - // ), - // ], - // ), - // ), - // ), - // ], - // ), - // ), - // backgroundColor: Colors.white, - body: Column( - children: [ - TabBar( + body: Column( + children: [ + TabBar( + controller: _tabController, + indicatorWeight: 3.0, + indicatorSize: TabBarIndicatorSize.tab, + labelColor: Color(0xff2B353E), + unselectedLabelColor: Color(0xff575757), + labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), + labelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + unselectedLabelStyle: TextStyle( + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + tabs: [Text(TranslationBase.of(context).today), Text(TranslationBase.of(context).week), Text(TranslationBase.of(context).month.toLowerCase().capitalizeFirstofEach)], + ), + Expanded( + child: TabBarView( + physics: BouncingScrollPhysics(), controller: _tabController, - indicatorWeight: 3.0, - indicatorSize: TabBarIndicatorSize.tab, - labelColor: Color(0xff2B353E), - unselectedLabelColor: Color(0xff575757), - labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20), - labelStyle: TextStyle( - fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', - fontSize: 16, - fontWeight: FontWeight.w600, - letterSpacing: -0.48, - ), - unselectedLabelStyle: TextStyle( - fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins', - fontSize: 16, - fontWeight: FontWeight.w600, - letterSpacing: -0.48, - ), - tabs: [Text(TranslationBase.of(context).today), Text(TranslationBase.of(context).week), Text(TranslationBase.of(context).month.toLowerCase().capitalizeFirstofEach)], + children: [TodayPage(), WeekPage(), MonthPage()], ), - Expanded( - child: TabBarView( - physics: BouncingScrollPhysics(), - controller: _tabController, - children: [TodayPage(), WeekPage(), MonthPage()], - ), - ) - ], - ), - bottomNavigationBar: BottomNavBar( - changeIndex: (index) { - if (index == 0) { - IS_VOICE_COMMAND_CLOSED = false; - } else if (index == 1) { - Navigator.push( - context, - FadePage( - page: AppScaffold( - appBarTitle: TranslationBase.of(context).medicalProfile, - isShowAppBar: true, - showHomeAppBarIcon: false, - appBarIcons: [ - IconButton( - icon: Image.asset("assets/images/new-design/setting_gear_icon.png"), - color: Colors.white, - onPressed: () => Navigator.of(context).pushNamed( - SETTINGS, - ), + ) + ], + ), + bottomNavigationBar: BottomNavBar( + changeIndex: (index) { + if (index == 0) { + IS_VOICE_COMMAND_CLOSED = false; + } else if (index == 1) { + Navigator.push( + context, + FadePage( + page: AppScaffold( + appBarTitle: TranslationBase.of(context).medicalProfile, + isShowAppBar: true, + showHomeAppBarIcon: false, + appBarIcons: [ + IconButton( + icon: Image.asset("assets/images/new-design/setting_gear_icon.png"), + color: Colors.white, + onPressed: () => Navigator.of(context).pushNamed( + SETTINGS, ), - ], - body: MedicalProfilePageNew()))); - } else if (index == 2) { - Navigator.of(context).pushNamedAndRemoveUntil(HOME, (Route route) => false); - } else if (index == 3) { - Navigator.of(context).pushNamed(MY_FAMILIY); - } else if (index == 4) { - Navigator.push(context, FadePage(page: ToDo(isShowAppBar: false))); - } - }, - showHomeIcon: true, - index: 0, - ), + ), + ], + body: MedicalProfilePageNew()))); + } else if (index == 2) { + Navigator.of(context).pushNamedAndRemoveUntil(HOME, (Route route) => false); + } else if (index == 3) { + Navigator.of(context).pushNamed(MY_FAMILIY); + } else if (index == 4) { + Navigator.push(context, FadePage(page: ToDo(isShowAppBar: false))); + } + }, + showHomeIcon: true, + index: 0, ), ), ); diff --git a/lib/pages/AlHabibMedicalService/h2o/month_page.dart b/lib/pages/AlHabibMedicalService/h2o/month_page.dart index 8867fb77..daf91cb9 100644 --- a/lib/pages/AlHabibMedicalService/h2o/month_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/month_page.dart @@ -6,10 +6,11 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_bar_chart.dart'; import 'package:diplomaticquarterapp/widgets/errors/app_embedded_error.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:diplomaticquarterapp/widgets/charts/custom_line_chart.dart'; class MonthPage extends StatelessWidget { @override @@ -21,37 +22,39 @@ class MonthPage extends StatelessWidget { isShowAppBar: false, appBarTitle: TranslationBase.of(context).h2o, baseViewModel: model, - body: Padding( - padding: EdgeInsets.all(8.0), - child: ListView( - children: [ - Center( - child: Text( - TranslationBase.of(context).waterConsumedInMonth, - textAlign: TextAlign.center, - style: TextStyle(fontSize: 20.0, color: Colors.black87), - ), - ), - SizedBox(height: 16), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - height: 10, - width: 40, - color: Colors.blue, + body: SingleChildScrollView( + padding: EdgeInsets.all(21), + physics: BouncingScrollPhysics(), + child: (model.userProgressForMonthDataSeries ?? []).isEmpty + ? getNoDataWidget(context) + : Container( + padding: EdgeInsets.fromLTRB(16, 14, 16, 14), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], ), - SizedBox(width: 8), - Text( - TranslationBase.of(context).waterConsumedInMonth, - style: TextStyle(fontSize: 12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + TranslationBase.of(context).waterConsumedInMonth, + style: TextStyle(fontSize: 16.0, color: Color(0xff2E303A), fontWeight: FontWeight.w600, letterSpacing: -0.64), + ), + SizedBox(height: 24), + CustomLineChart(model.userProgressForMonthDataSeries, projectViewModel.isArabic), + ], ), - ], - ), - // SizedBox(height: 8), - AppBarChart(seriesList: model.userProgressForMonthDataSeries, isArabic: projectViewModel.isArabic), - ], - ), + ), ), ), ); diff --git a/lib/pages/AlHabibMedicalService/h2o/week_page.dart b/lib/pages/AlHabibMedicalService/h2o/week_page.dart index 6f4423b2..83529afd 100644 --- a/lib/pages/AlHabibMedicalService/h2o/week_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/week_page.dart @@ -1,12 +1,10 @@ -import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; -import 'package:diplomaticquarterapp/widgets/charts/app_bar_chart.dart'; -import 'package:diplomaticquarterapp/widgets/errors/app_embedded_error.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; +import 'package:diplomaticquarterapp/widgets/charts/custom_line_chart.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; -import 'package:diplomaticquarterapp/widgets/progress_indicator/app_circular_progress_Indeicator.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -21,37 +19,39 @@ class WeekPage extends StatelessWidget { isShowAppBar: false, appBarTitle: TranslationBase.of(context).h2o, baseViewModel: model, - body: Padding( - padding: EdgeInsets.all(8.0), - child: ListView( - children: [ - Center( - child: Text( - TranslationBase.of(context).waterConsumedInWeek, - textAlign: TextAlign.center, - style: TextStyle(fontSize: 20.0, color: Colors.black87), - ), - ), - SizedBox(height: 16), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Container( - height: 10, - width: 40, - color: Colors.blue, + body: SingleChildScrollView( + padding: EdgeInsets.all(21), + physics: BouncingScrollPhysics(), + child: (model.userProgressForWeekDataSeries ?? []).isEmpty + ? getNoDataWidget(context) + : Container( + padding: EdgeInsets.fromLTRB(16, 14, 16, 14), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all( + Radius.circular(10.0), + ), + boxShadow: [ + BoxShadow( + color: Color(0xff000000).withOpacity(.05), + blurRadius: 27, + offset: Offset(0, -3), + ), + ], ), - SizedBox(width: 8), - Text( - TranslationBase.of(context).waterConsumedInWeek, - style: TextStyle(fontSize: 12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + TranslationBase.of(context).waterConsumedInWeek, + style: TextStyle(fontSize: 16.0, color: Color(0xff2E303A), fontWeight: FontWeight.w600, letterSpacing: -0.64), + ), + SizedBox(height: 24), + CustomLineChart(model.userProgressForWeekDataSeries, projectViewModel.isArabic), + ], ), - ], - ), - // SizedBox(height: 8), - AppBarChart(seriesList: model.userProgressForWeekDataSeries,isArabic: projectViewModel.isArabic), - ], - ), + ), ), ), ); diff --git a/lib/pages/medical/vital_sign/vital_sign_item.dart b/lib/pages/medical/vital_sign/vital_sign_item.dart index 37cbbf27..1549db39 100644 --- a/lib/pages/medical/vital_sign/vital_sign_item.dart +++ b/lib/pages/medical/vital_sign/vital_sign_item.dart @@ -42,6 +42,7 @@ class VitalSignItem extends StatelessWidget { maxLines: 1, style: TextStyle( fontSize: 15, + color: Color(0xff2B353E), letterSpacing: -0.45, fontWeight: FontWeight.bold, ), @@ -64,7 +65,7 @@ class VitalSignItem extends StatelessWidget { height: MediaQuery.of(context).size.width / 16, child: SvgPicture.asset( vitalSign.icon, - color: Colors.black, + color: Color(0xff2E303A), ), ), ], diff --git a/lib/widgets/charts/custom_line_chart.dart b/lib/widgets/charts/custom_line_chart.dart new file mode 100644 index 00000000..cfd1e718 --- /dev/null +++ b/lib/widgets/charts/custom_line_chart.dart @@ -0,0 +1,148 @@ +import 'dart:math' as math; + +import 'package:fl_chart/fl_chart.dart'; +import 'package:flutter/material.dart'; + +class LineChartModel { + int value; + String title; + + LineChartModel(this.title, this.value); +} + +class CustomLineChart extends StatefulWidget { + final List list; + final bool isArabic; + CustomLineChart(this.list, this.isArabic); + + @override + _CustomLineChartState createState() => _CustomLineChartState(); +} + +class _CustomLineChartState extends State { + bool showAvg = false; + + final List myList = [ + LineChartModel("", 0), + LineChartModel("", 0), + // LineChartModel("", 0), + ]; + + List list = []; + + @override + void initState() { + super.initState(); + if (widget.list.isEmpty) { + list = myList; + } else { + list = widget.list; + } + } + + @override + Widget build(BuildContext context) { + return Stack( + children: [ + AspectRatio( + aspectRatio: 1.0, + child: LineChart( + mainData(), + ), + ), + SizedBox( + width: 60, + height: 34, + child: TextButton( + onPressed: () { + setState(() { + showAvg = !showAvg; + }); + }, + child: Text( + '', + style: TextStyle(fontSize: 12, color: showAvg ? Colors.white.withOpacity(0.5) : Colors.white), + ), + ), + ), + ], + ); + } + + LineChartData mainData() { + SideTitles right = SideTitles( + showTitles: true, + margin: 0, + reservedSize: 8, + getTitles: (value) { + return ''; + }, + ); + SideTitles left = SideTitles( + showTitles: true, + interval: 1, + getTextStyles: (value) => const TextStyle(color: Color(0xff2E303A), fontWeight: FontWeight.w600, fontSize: 12, letterSpacing: 0), + getTitles: (value) { + if (widget.list.isEmpty) { + return (value).toInt().toString(); + } + return (value * 20).toInt().toString(); + }, + reservedSize: 22, + margin: 12, + ); + return LineChartData( + lineTouchData: LineTouchData(enabled: false), + gridData: FlGridData( + show: true, + drawVerticalLine: false, + getDrawingHorizontalLine: (value) { + return FlLine( + color: const Color(0xffEFEFEF), + strokeWidth: 1, + ); + }, + ), + titlesData: FlTitlesData( + show: true, + topTitles: SideTitles(showTitles: false), + bottomTitles: SideTitles( + showTitles: true, + reservedSize: 22, + interval: 1, + getTextStyles: (value) => const TextStyle(color: Color(0xff2E303A), fontWeight: FontWeight.w600, fontSize: 12, letterSpacing: 0), + getTitles: (value) { + String _title = list[value.toInt()].title; + return (_title.length > 3 ? (widget.isArabic ? _title : _title.substring(0, 3)) : _title).toUpperCase(); + }, + margin: 12, + ), + rightTitles: widget.isArabic ? left : right, + leftTitles: widget.isArabic ? right : left), + borderData: FlBorderData( + show: true, + border: Border.symmetric( + horizontal: BorderSide(color: const Color(0xffEFEFEF), width: 1), + ), + ), + minX: 0, + maxX: widget.list.isEmpty ? 1 : widget.list.length - 1.0, + minY: widget.list.isEmpty ? -1 : 0, + maxY: widget.list.isEmpty ? 1 : 5, + lineBarsData: [ + LineChartBarData( + spots: [ + for (int i = 0; i < list.length; i++) FlSpot(i + 0.0, (list[i].value / 20) + 0.0), + ], + isCurved: true, + preventCurveOverShooting: true, + barWidth: 2, + isStrokeCapRound: true, + dotData: FlDotData( + show: false, + ), + ), + ], + ); + } +} diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index 5d4e3704..a0f95c1d 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -28,6 +28,7 @@ class AppScaffold extends StatelessWidget { final String appBarTitle; final Widget body; final Widget bottomSheet; + final Widget bottomNavigationBar; final bool isLoading; final bool isShowAppBar; final bool showNewAppBar; @@ -70,6 +71,7 @@ class AppScaffold extends StatelessWidget { this.showNewAppBarTitle = false, this.hasAppBarParam, this.bottomSheet, + this.bottomNavigationBar, this.baseViewModel, this.floatingActionButton, this.isPharmacy = false, @@ -118,7 +120,7 @@ class AppScaffold extends StatelessWidget { dropDownList: dropDownList ?? [], dropDownIndexChange: dropDownIndexChange, appBarIcons: appBarIcons, - onTap: onTap, + onTap: onTap, ) : (isShowAppBar ? appBar = AppBarWidget( @@ -151,6 +153,7 @@ class AppScaffold extends StatelessWidget { ) : buildBodyWidget(context), ), + bottomNavigationBar: bottomNavigationBar, floatingActionButton: floatingActionButton, ); } @@ -174,8 +177,7 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget { final List appBarIcons; Function onTap; - NewAppBarWidget( - {Key key, this.showTitle = false, this.showDropDown = false, this.title = "", this.dropDownList, this.appBarIcons, this.dropdownIndexValue, this.dropDownIndexChange, this.onTap}) + NewAppBarWidget({Key key, this.showTitle = false, this.showDropDown = false, this.title = "", this.dropDownList, this.appBarIcons, this.dropdownIndexValue, this.dropDownIndexChange, this.onTap}) : super(key: key); @override From 21863cfe06e777c68289415638ef68257de7ce4c Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Wed, 13 Oct 2021 14:51:22 +0300 Subject: [PATCH 4/7] improvements. --- .../AlHabibMedicalService/h2o/h2o_page.dart | 5 + .../medical/balance/advance_payment_page.dart | 396 +++++++++--------- 2 files changed, 208 insertions(+), 193 deletions(-) diff --git a/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart b/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart index ef2bc2e9..d216cd21 100644 --- a/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart @@ -1,5 +1,6 @@ import 'dart:ui'; +import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; @@ -8,8 +9,12 @@ import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h20_setting import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/month_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/today_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/week_page.dart'; +import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; +import 'package:diplomaticquarterapp/pages/medical/medical_profile_page_new.dart'; +import 'package:diplomaticquarterapp/routes.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/cupertino.dart'; diff --git a/lib/pages/medical/balance/advance_payment_page.dart b/lib/pages/medical/balance/advance_payment_page.dart index 9e587b7f..338aff23 100644 --- a/lib/pages/medical/balance/advance_payment_page.dart +++ b/lib/pages/medical/balance/advance_payment_page.dart @@ -67,70 +67,38 @@ class _AdvancePaymentPageState extends State { return BaseView( onModelReady: (model) => model.getHospitals(), builder: (_, model, w) => AppScaffold( - isShowAppBar: true, - imagesInfo: imagesInfo, - appBarTitle: TranslationBase.of(context).advancePayment, - description: TranslationBase.of(context).infoAdvancePayment, - showNewAppBarTitle: true, - showNewAppBar: true, - backgroundColor: CustomColors.appBackgroudGreyColor, - body: SingleChildScrollView( - physics: ScrollPhysics(), - child: Container( - margin: EdgeInsets.all(12), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context).advancePaymentLabel, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - letterSpacing: -0.46, - ), - ), - SizedBox( - height: 12, - ), - InkWell( - onTap: () => confirmSelectBeneficiaryDialog(model), - child: Container( - padding: EdgeInsets.all(8), - width: double.infinity, - height: 65, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - getBeneficiaryType(), - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - letterSpacing: -0.46, - ), - ), - Icon(Icons.arrow_drop_down) - ], + isShowAppBar: true, + imagesInfo: imagesInfo, + appBarTitle: TranslationBase.of(context).advancePayment, + description: TranslationBase.of(context).infoAdvancePayment, + showNewAppBarTitle: true, + showNewAppBar: true, + backgroundColor: CustomColors.appBackgroudGreyColor, + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + padding: EdgeInsets.all(21), + physics: BouncingScrollPhysics(), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + TranslationBase.of(context).advancePaymentLabel, + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, ), ), - ), - if (beneficiaryType == BeneficiaryType.MyFamilyFiles) SizedBox( height: 12, ), - if (beneficiaryType == BeneficiaryType.MyFamilyFiles) InkWell( - onTap: () { - GifLoaderDialogUtils.showMyDialog(context); - model.getFamilyFiles().then((value) { - GifLoaderDialogUtils.hideDialog(context); - confirmSelectFamilyDialog(model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList); - }); - }, + onTap: () => confirmSelectBeneficiaryDialog(model), child: Container( - padding: EdgeInsets.all(12), + padding: EdgeInsets.all(8), width: double.infinity, height: 65, decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), @@ -138,42 +106,102 @@ class _AdvancePaymentPageState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - getFamilyMembersName(), + getBeneficiaryType(), style: TextStyle( fontSize: 14, fontWeight: FontWeight.w600, letterSpacing: -0.46, ), ), - Icon(Icons.arrow_drop_down), + Icon(Icons.arrow_drop_down) ], ), ), ), - SizedBox( - height: 12, - ), - NewTextFields( - hintText: TranslationBase.of(context).fileNumber, - controller: _fileTextController, - readOnly: beneficiaryType == BeneficiaryType.OtherAccount ? false : true, - ), - if (beneficiaryType == BeneficiaryType.OtherAccount) + if (beneficiaryType == BeneficiaryType.MyFamilyFiles) + SizedBox( + height: 12, + ), + if (beneficiaryType == BeneficiaryType.MyFamilyFiles) + InkWell( + onTap: () { + GifLoaderDialogUtils.showMyDialog(context); + model.getFamilyFiles().then((value) { + GifLoaderDialogUtils.hideDialog(context); + confirmSelectFamilyDialog(model.getAllSharedRecordsByStatusResponse.getAllSharedRecordsByStatusList); + }); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + getFamilyMembersName(), + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), + ), + Icon(Icons.arrow_drop_down), + ], + ), + ), + ), + SizedBox( + height: 12, + ), + NewTextFields( + hintText: TranslationBase.of(context).fileNumber, + controller: _fileTextController, + readOnly: beneficiaryType == BeneficiaryType.OtherAccount ? false : true, + ), + if (beneficiaryType == BeneficiaryType.OtherAccount) + SizedBox( + height: 12, + ), + if (beneficiaryType == BeneficiaryType.OtherAccount) + InkWell( + onTap: () { + if (_fileTextController.text.isNotEmpty) { + GifLoaderDialogUtils.showMyDialog(context); + model.getPatientInfoByPatientID(id: _fileTextController.text).then((value) { + GifLoaderDialogUtils.hideDialog(context); + confirmSelectPatientDialog(model.patientInfoList); + }); + } else + AppToast.showErrorToast(message: 'Please Enter The File Number'); + }, + child: Container( + padding: EdgeInsets.all(12), + width: double.infinity, + height: 65, + decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + getPatientName(), + style: TextStyle( + fontSize: 14, + fontWeight: FontWeight.w600, + letterSpacing: -0.46, + ), + ), + Icon(Icons.arrow_drop_down), + ], + ), + ), + ), SizedBox( height: 12, ), - if (beneficiaryType == BeneficiaryType.OtherAccount) InkWell( - onTap: () { - if (_fileTextController.text.isNotEmpty) { - GifLoaderDialogUtils.showMyDialog(context); - model.getPatientInfoByPatientID(id: _fileTextController.text).then((value) { - GifLoaderDialogUtils.hideDialog(context); - confirmSelectPatientDialog(model.patientInfoList); - }); - } else - AppToast.showErrorToast(message: 'Please Enter The File Number'); - }, + onTap: () => confirmSelectHospitalDialog(model.hospitals), child: Container( padding: EdgeInsets.all(12), width: double.infinity, @@ -183,7 +211,7 @@ class _AdvancePaymentPageState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - getPatientName(), + getHospitalName(), style: TextStyle( fontSize: 14, fontWeight: FontWeight.w600, @@ -195,132 +223,114 @@ class _AdvancePaymentPageState extends State { ), ), ), - SizedBox( - height: 12, - ), - InkWell( - onTap: () => confirmSelectHospitalDialog(model.hospitals), - child: Container( - padding: EdgeInsets.all(12), - width: double.infinity, - height: 65, - decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - getHospitalName(), - style: TextStyle( - fontSize: 14, - fontWeight: FontWeight.w600, - letterSpacing: -0.46, - ), - ), - Icon(Icons.arrow_drop_down), - ], - ), + SizedBox( + height: 12, ), - ), - SizedBox( - height: 12, - ), - NewTextFields( - hintText: TranslationBase.of(context).amount, - keyboardType: TextInputType.numberWithOptions(signed: false, decimal: true), - onChanged: (value) { - setState(() { - amount = value; - }); - }, - ), - SizedBox( - height: 12, - ), - if (model.user != null) NewTextFields( - hintText: TranslationBase.of(context).depositorEmail, - initialValue: model.user.emailAddress, + hintText: TranslationBase.of(context).amount, + keyboardType: TextInputType.numberWithOptions(signed: false, decimal: true), onChanged: (value) { - email = value; + setState(() { + amount = value; + }); }, ), - SizedBox( - height: 12, - ), - NewTextFields( - hintText: TranslationBase.of(context).notes, - controller: _notesTextController, - ), - SizedBox( - height: MediaQuery.of(context).size.height * 0.15, - ) - ], + SizedBox( + height: 12, + ), + if (model.user != null) + NewTextFields( + hintText: TranslationBase.of(context).depositorEmail, + initialValue: model.user.emailAddress, + onChanged: (value) { + email = value; + }, + ), + SizedBox( + height: 12, + ), + NewTextFields( + hintText: TranslationBase.of(context).notes, + controller: _notesTextController, + ), + SizedBox( + height: MediaQuery.of(context).size.height * 0.15, + ) + ], + ), ), ), - ), - bottomSheet: Container( - width: double.infinity, - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(12), - child: DefaultButton( - TranslationBase.of(context).submit, - (amount.isEmpty || _fileTextController.text.isEmpty || _selectedHospital == null) ? null : - () { - var mobileNum; - var patientName; + Container( + color: Colors.white, + padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21), + child: DefaultButton( + TranslationBase.of(context).submit, + (amount.isEmpty || _fileTextController.text.isEmpty || _selectedHospital == null) + ? null + : () { + var mobileNum; + var patientName; - if (beneficiaryType == BeneficiaryType.MyFamilyFiles) { - mobileNum = selectedPatientFamily.mobileNumber; - patientName = selectedPatientFamily.patientName; - } - - if (beneficiaryType == BeneficiaryType.MyAccount) { - mobileNum = model.user.mobileNumber; - patientName = model.user.firstName; - } + if (beneficiaryType == BeneficiaryType.MyFamilyFiles) { + mobileNum = selectedPatientFamily.mobileNumber; + patientName = selectedPatientFamily.patientName; + } - if (beneficiaryType == BeneficiaryType.OtherAccount) { - mobileNum = _selectedPatientInfo.mobileNumber; - patientName = _selectedPatientInfo.fullName; - } + if (beneficiaryType == BeneficiaryType.MyAccount) { + mobileNum = model.user.mobileNumber; + patientName = model.user.firstName; + } - advanceModel.fileNumber = _fileTextController.text; - advanceModel.hospitalsModel = _selectedHospital; - advanceModel.note = _notesTextController.text; - advanceModel.email = email ?? model.user.emailAddress; - advanceModel.amount = amount; - advanceModel.mobileNumber = mobileNum; - advanceModel.patientName = patientName; - GifLoaderDialogUtils.showMyDialog(context); - model.getPatientInfoByPatientIDAndMobileNumber(advanceModel).then((value) { - GifLoaderDialogUtils.hideDialog(context); - if (model.state != ViewState.Error && model.state != ViewState.ErrorLocal) { - Utils.hideKeyboard(context); - Navigator.push(context, FadePage(page: PaymentMethod( - onSelectedMethod: (String metohd) { - setState(() {}); + if (beneficiaryType == BeneficiaryType.OtherAccount) { + mobileNum = _selectedPatientInfo.mobileNumber; + patientName = _selectedPatientInfo.fullName; } - ))).then( - (value) { - Navigator.push( - context, - FadePage( - page: ConfirmPaymentPage( - advanceModel: advanceModel, - selectedPaymentMethod: value, - patientInfoAndMobileNumber: model.patientInfoAndMobileNumber, - authenticatedUser: authUser, - ), - ), - ); + + advanceModel.fileNumber = _fileTextController.text; + advanceModel.hospitalsModel = _selectedHospital; + advanceModel.note = _notesTextController.text; + advanceModel.email = email ?? model.user.emailAddress; + advanceModel.amount = amount; + advanceModel.mobileNumber = mobileNum; + advanceModel.patientName = patientName; + GifLoaderDialogUtils.showMyDialog(context); + model.getPatientInfoByPatientIDAndMobileNumber(advanceModel).then((value) { + GifLoaderDialogUtils.hideDialog(context); + if (model.state != ViewState.Error && model.state != ViewState.ErrorLocal) { + Utils.hideKeyboard(context); + Navigator.push( + context, + FadePage( + page: PaymentMethod(onSelectedMethod: (String metohd) { + setState(() {}); + }), + ), + ).then( + (value) { + Navigator.push( + context, + FadePage( + page: ConfirmPaymentPage( + advanceModel: advanceModel, + selectedPaymentMethod: value, + patientInfoAndMobileNumber: model.patientInfoAndMobileNumber, + authenticatedUser: authUser, + ), + ), + ); + }, + ); + } + }); }, - ); - } - }); - }, - disabledColor: Colors.grey, + color: Color(0xffD02127), + textColor: Colors.white, + disabledColor: Color(0xffEAEAEA), + ), ), - )), + ], + ), + ), ); } From dde16a13fe3ec6f089bf5fd54f939bb5bc1de927 Mon Sep 17 00:00:00 2001 From: "Mirza.Shafique" Date: Wed, 13 Oct 2021 15:36:40 +0300 Subject: [PATCH 5/7] General page in profile --- lib/config/localized_values.dart | 3 + .../all_habib_medical_service_page.dart | 9 +- lib/pages/settings/general_setting.dart | 432 ++++++++++-------- lib/pages/settings/profile_setting.dart | 2 +- lib/uitl/translations_delegate_base.dart | 4 + 5 files changed, 245 insertions(+), 205 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index e34982a1..f16c395d 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -1499,4 +1499,7 @@ const Map localizedValues = { "extremeObese": {"en": "Extreme Obese", "ar": "السمنة المفرطة"}, "selectLanguage": { "en": "Please select any language:", "ar": ":الرجاء تحديد أي لغة" }, "recAlert": { "en": "How do you want to receive alerts?", "ar": "كيف تريد تلقي التنبيهات؟" }, + "modesBelow": { "en": "Please select the modes below:", "ar": ":الرجاء تحديد الأوضاع أدناه" }, + "prefferedMode": { "en": "Please select the preferred mode below:", "ar": ":الرجاء تحديد الوضع المفضل أدناه" }, + "permissionsBellow": { "en": "Please allow the permissions below:", "ar": ":الرجاء السماح الأذونات أدناه" }, }; diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart index b0b14f1d..ce3bde14 100644 --- a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart @@ -244,10 +244,7 @@ class _AllHabibMedicalServiceState extends State { imageLocation: 'assets/images/emergency_service_image.png', title: TranslationBase.of(context).emergencyService, ), - ServicesContainer( - onTap: () => getPharmacyToken(), - imageLocation: 'assets/images/pharmacy_logo.png', - title: TranslationBase.of(context).pharmacy), + ServicesContainer(onTap: () => getPharmacyToken(), imageLocation: 'assets/images/pharmacy_logo.png', title: TranslationBase.of(context).pharmacy), ServicesContainer( onTap: () => Navigator.push( context, @@ -332,9 +329,7 @@ class _AllHabibMedicalServiceState extends State { ServicesContainer( onTap: () => Navigator.push( context, - FadePage( - page: SmartWatchInstructions() - ), + FadePage(page: SmartWatchInstructions()), ), imageLocation: 'assets/images/new-design/smartwatch_icon.png', title: TranslationBase.of(context).smartWatches, diff --git a/lib/pages/settings/general_setting.dart b/lib/pages/settings/general_setting.dart index 049b9821..adbebfca 100644 --- a/lib/pages/settings/general_setting.dart +++ b/lib/pages/settings/general_setting.dart @@ -1,9 +1,11 @@ import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/services/permission/permission_service.dart'; +import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/theme/theme_notifier.dart'; import 'package:diplomaticquarterapp/theme/theme_value.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/text/app_texts_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -16,8 +18,7 @@ class GeneralSettings extends StatefulWidget { _GeneralSettings createState() => _GeneralSettings(); } -class _GeneralSettings extends State - with TickerProviderStateMixin { +class _GeneralSettings extends State with TickerProviderStateMixin { var themeNotifier; int blindValue = 0; bool vibration = false; @@ -28,6 +29,7 @@ class _GeneralSettings extends State var permission = new PermissionService(); LocationPermission locationPermission; var mediaQueryData; + @override void initState() { this.getValues(); @@ -38,196 +40,243 @@ class _GeneralSettings extends State mediaQueryData = MediaQuery.of(context); themeNotifier = Provider.of(context); return Container( - child: ListView(scrollDirection: Axis.vertical, children: [ - Container( - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(10), - child: AppText( - TranslationBase.of(context).modes, - fontWeight: FontWeight.bold, - ), - ), - Container( - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).vibration), - Switch( - value: vibration, - onChanged: (value) { - setState(() { - vibration = value; - }); - setVibration(value); - }, - activeTrackColor: Colors.lightGreenAccent, - activeColor: Colors.green, - ) - ], - )), - Container( - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).accessibility), - Switch( - value: accsibility, - onChanged: (value) { - setState(() { - accsibility = value; - }); - }, - activeTrackColor: Colors.lightGreenAccent, - activeColor: Colors.green, - ) - ], - )), - Container( - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(10), - child: AppText( - TranslationBase.of(context).blindMode, - fontWeight: FontWeight.bold, - ), - ), - new Container( - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(8.0), - child: new Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - new Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - new Text( - TranslationBase.of(context).offTheme, - style: new TextStyle(fontSize: 16.0), - ), - Radio( - value: 0, - groupValue: blindValue, - onChanged: (value) { - setState(() => {this.blindValue = value}); - setTheme(value); - }, - ), - ], + child: SingleChildScrollView( + child: Padding( + padding: const EdgeInsets.all(21.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + + Text( + TranslationBase.of(context).alert, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + Text( + TranslationBase.of(context).modesBelow, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + ), + Row( + children: [ + Checkbox( + value: vibration, + onChanged: (value) { + setState(() { + vibration = value; + }); + }, + activeColor: CustomColors.accentColor, + ), + Text( + TranslationBase.of(context).prefferedMode, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - new Text( - TranslationBase.of(context).invertTheme, - style: new TextStyle( - fontSize: 16.0, - ), - ), - new Radio( - value: 1, - groupValue: blindValue, - onChanged: (value) { - setState(() => {this.blindValue = value}); - setTheme(value); - }, - ) - ], + ), + ], + ), + Row( + children: [ + Checkbox( + value: accsibility, + onChanged: (value) { + setState(() { + accsibility = value; + }); + }, + activeColor: CustomColors.accentColor, + ), + Text( + TranslationBase.of(context).accessibility, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - new Text( - TranslationBase.of(context).dimTheme, - style: new TextStyle(fontSize: 16.0), + ), + ], + ), + mHeight(16), + mHeight(12), + Text( + TranslationBase.of(context).blindMode, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + Text( + TranslationBase.of(context).prefferedMode, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + ), + Column( + children: [ + Row( + children: [ + new Radio( + value: 0, + groupValue: blindValue, + onChanged: (value) { + setState(() { + blindValue = value; + setTheme(value); + }); + }, + ), + Text( + TranslationBase.of(context).offTheme, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, ), - new Radio( - value: 2, - groupValue: blindValue, - onChanged: (value) { - setState(() => {this.blindValue = value}); + ), + ], + ), + Row( + children: [ + Radio( + value: 1, + groupValue: blindValue, + onChanged: (value) { + setState(() { + blindValue = value; setTheme(value); - }, + }); + }, + ), + Text( + TranslationBase.of(context).invertTheme, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - new Text( - TranslationBase.of(context).bwTheme, - style: new TextStyle(fontSize: 16.0), + ), + ], + ), + Row( + children: [ + Radio( + value: 2, + groupValue: blindValue, + onChanged: (value) { + setState(() { + blindValue = value; + setTheme(value); + }); + }, + ), + Text( + TranslationBase.of(context).dimTheme, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, ), - new Radio( - value: 3, - groupValue: blindValue, - onChanged: (value) { - setState(() => {this.blindValue = value}); - + ), + ], + ), + Row( + children: [ + Radio( + value: 1, + groupValue: blindValue, + onChanged: (value) { + setState(() { + blindValue = value; setTheme(value); - }, + }); + }, + ), + Text( + TranslationBase.of(context).bwTheme, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, ), - ], + ), + ], + ), + ], + ), + mHeight(12), + mHeight(12), + Text( + TranslationBase.of(context).permissions, + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.w600, + letterSpacing: -0.64, + ), + ), + Text( + TranslationBase.of(context).permissionsBellow, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + letterSpacing: -0.48, + ), + ), + Row( + children: [ + Checkbox( + value: camera, + onChanged: (value) { + setState(() { + camera = value; + }); + this.permission.openSettings(); + }, + activeColor: CustomColors.accentColor, + ), + Text( + TranslationBase.of(context).cameraPermission, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, + ), + ), + ], + ), + Row( + children: [ + Checkbox( + value: location, + onChanged: (value) { + if (value == true) { + Navigator.pop(context); + this.setLocationPermission(); + } else { + Geolocator.openLocationSettings(); + } + }, + activeColor: CustomColors.accentColor, + ), + Text( + TranslationBase.of(context).locationPermission, + style: TextStyle( + fontSize: 12, + letterSpacing: -0.48, ), - ], - ) - ])), - Container( - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(10), - child: AppText( - TranslationBase.of(context).permissions, - fontWeight: FontWeight.bold, + ), + ], + ), + mHeight(16), + ], + ), ), ), - Container( - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).cameraPermission), - Switch( - value: camera, - onChanged: (value) { - setState(() { - camera = value; - }); - this.permission.openSettings(); - }, - activeTrackColor: Colors.lightGreenAccent, - activeColor: Colors.green, - ) - ], - )), - Container( - color: Theme.of(context).scaffoldBackgroundColor, - padding: EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - AppText(TranslationBase.of(context).locationPermission), - Switch( - value: location, - onChanged: (value) { - if (value == true) { - Navigator.pop(context); - this.setLocationPermission(); - } else { - Geolocator.openLocationSettings(); - } - }, - activeTrackColor: Colors.lightGreenAccent, - activeColor: Colors.green, - ) - ], - )) - ])); + ); } setLocationPermission() async { @@ -292,11 +341,8 @@ class _GeneralSettings extends State getValues() async { if (permission.isThemeEnabled() != null) { - blindValue = - permission.isThemeEnabled() == null ? 0 : permission.isThemeEnabled(); - vibration = permission.isVibrationEnabled() == null - ? false - : permission.isVibrationEnabled(); + blindValue = permission.isThemeEnabled() == null ? 0 : permission.isThemeEnabled(); + vibration = permission.isVibrationEnabled() == null ? false : permission.isVibrationEnabled(); // accsibility = mediaQueryData.accessibleNavigation; //setTheme(blindValue); } @@ -310,19 +356,11 @@ class _GeneralSettings extends State getTheme(value) async { if (value == 1) { - return invertThemes( - fontName: Provider.of(context, listen: false).isArabic ? 'Cairo' : 'Poppins' - ); + return invertThemes(fontName: Provider.of(context, listen: false).isArabic ? 'Cairo' : 'Poppins'); } else if (value == 3) { - return bwThemes( - fontName: Provider.of(context, listen: false).isArabic ? 'Cairo' : 'Poppins' - ); + return bwThemes(fontName: Provider.of(context, listen: false).isArabic ? 'Cairo' : 'Poppins'); } else { - return defaultTheme( - fontName: - Provider.of(context, listen: false).isArabic - ? 'Cairo' - : 'Poppins'); + return defaultTheme(fontName: Provider.of(context, listen: false).isArabic ? 'Cairo' : 'Poppins'); } } } diff --git a/lib/pages/settings/profile_setting.dart b/lib/pages/settings/profile_setting.dart index 1d2938cc..f55227d8 100644 --- a/lib/pages/settings/profile_setting.dart +++ b/lib/pages/settings/profile_setting.dart @@ -47,7 +47,7 @@ class _ProfileSettings extends State with TickerProviderStateMi Expanded( child: SingleChildScrollView( child: Padding( - padding: const EdgeInsets.all(12.0), + padding: const EdgeInsets.all(21.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 48e8b0bd..a971531e 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -2364,6 +2364,10 @@ class TranslationBase { String get selectLanguage => localizedValues["selectLanguage"][locale.languageCode]; String get recAlert => localizedValues["recAlert"][locale.languageCode]; + + String get modesBelow => localizedValues["modesBelow"][locale.languageCode]; + String get prefferedMode => localizedValues["prefferedMode"][locale.languageCode]; + String get permissionsBellow => localizedValues["permissionsBellow"][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { From 54c3beadf25d255e2cd8a7a8e8e5baa1db0513a0 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Wed, 13 Oct 2021 15:52:30 +0300 Subject: [PATCH 6/7] improvements. --- lib/config/localized_values.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index f63eeeb4..139ee7a6 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -911,14 +911,14 @@ const Map localizedValues = { "info-todo": { "en": "This service is designed to enable you to have a quick link to the list of tasks that need to be done", "ar": "هذه الخدمة تم تصميمها لتمكنك من الوصول الى رابط سريع لقائمة المهام التي يجب القيام بها" - + }, "family-info": { "en": "Through this service, you will be able to link your family medical files to your medical file so that you can manage their records by login to your medical file.", "ar": "هذه الخدمة تم تصميمها لتتمكن من ربط الملفات الطبية للعائلة بملفك الطبي حتى تتمكن من إدارة سجلاتهم عن طريق تسجيل الدخول إلى ملفك الطبي." }, "update-succ": {"en": "Successfully updated profile", "ar": "تم تحديث البيانات بنجاح"}, "dental-complains": {"en": "Symptoms", "ar": "الأعراض"}, - "empt},y-result": {"en": "There is no search results found", "ar": "لايوجد نتائج"}, + "empty-result": {"en": "There is no search results found", "ar": "لايوجد نتائج"}, "no-booked-appointment": {"en": "No booked appointments", "ar": "لا يوجد مواعيد محجوزة"}, "no-confirmed-appointment": {"en": "No confirmed appointments", "ar": "لا توجد مواعيد مؤكدة"}, "no-arrived-appointment": {"en": "No arrived appointments", "ar": "لا يوجد مواعيد"}, From e3a7c08e7c922b295b8b2e7c7dfe9b9b5cb79790 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Wed, 13 Oct 2021 15:55:18 +0300 Subject: [PATCH 7/7] blood type changes --- lib/core/viewModels/dashboard_view_model.dart | 1 + lib/pages/DrawerPages/family/my-family.dart | 4 ++-- lib/pages/login/confirm-login.dart | 3 +-- lib/pages/login/login.dart | 2 +- lib/services/authentication/auth_provider.dart | 2 +- lib/widgets/drawer/app_drawer_widget.dart | 3 ++- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/core/viewModels/dashboard_view_model.dart b/lib/core/viewModels/dashboard_view_model.dart index c2211993..fca76cbf 100644 --- a/lib/core/viewModels/dashboard_view_model.dart +++ b/lib/core/viewModels/dashboard_view_model.dart @@ -21,6 +21,7 @@ class DashboardViewModel extends BaseViewModel { if (isLogin && _vitalSignService.weightKg.isEmpty) { setState(ViewState.Busy); await _vitalSignService.getPatientRadOrders(); + if (_vitalSignService.hasError) { error = _vitalSignService.error; setState(ViewState.ErrorLocal); diff --git a/lib/pages/DrawerPages/family/my-family.dart b/lib/pages/DrawerPages/family/my-family.dart index 12f7d46d..c3e136a0 100644 --- a/lib/pages/DrawerPages/family/my-family.dart +++ b/lib/pages/DrawerPages/family/my-family.dart @@ -531,14 +531,14 @@ class _MyFamily extends State with TickerProviderStateMixin { result = list.CheckActivationCode.fromJson(result); var familyFile = await sharedPref.getObject(FAMILY_FILE); - + var bloodType = await sharedPref.getString(BLOOD_TYPE); var mainUser = await sharedPref.getObject(MAIN_USER); var loginType = await sharedPref.getInt(LAST_LOGIN); this.sharedPref.clear(); if (mainUser["PatientID"] != result.list.patientID) { result.list.isFamily = true; } - + this.sharedPref.setString(BLOOD_TYPE, bloodType); this.sharedPref.setString(APP_LANGUAGE, currentLang); this.sharedPref.setInt(LAST_LOGIN, loginType); this.sharedPref.setObject(MAIN_USER, mainUser); diff --git a/lib/pages/login/confirm-login.dart b/lib/pages/login/confirm-login.dart index ae2a4e33..58453550 100644 --- a/lib/pages/login/confirm-login.dart +++ b/lib/pages/login/confirm-login.dart @@ -536,8 +536,7 @@ class _ConfirmLogin extends State { sharedPref.remove(FAMILY_FILE), result.list.isFamily = false, userData = result.list, - // sharedPref.setString( - // BLOOD_TYPE, result['PatientBloodType']), + sharedPref.setString(BLOOD_TYPE, result.patientBloodType), authenticatedUserObject.user = result.list, projectViewModel.setPrivilege(privilegeList: res), sharedPref.setObject(MAIN_USER, result.list), diff --git a/lib/pages/login/login.dart b/lib/pages/login/login.dart index b448e1a4..9c245e01 100644 --- a/lib/pages/login/login.dart +++ b/lib/pages/login/login.dart @@ -308,7 +308,7 @@ class _Login extends State { projectViewModel.setPrivilege(privilegeList: result); result = CheckActivationCode.fromJson(result); result.list.isFamily = false; - // this.sharedPref.setString(BLOOD_TYPE, result['PatientBloodType']), + this.sharedPref.setString(BLOOD_TYPE, result.patientBloodType); this.sharedPref.setObject(USER_PROFILE, result.list); this.sharedPref.setObject(MAIN_USER, result.list); this.sharedPref.setObject(LOGIN_TOKEN_ID, result.logInTokenID); diff --git a/lib/services/authentication/auth_provider.dart b/lib/services/authentication/auth_provider.dart index fb32af8f..af1fd3f6 100644 --- a/lib/services/authentication/auth_provider.dart +++ b/lib/services/authentication/auth_provider.dart @@ -236,7 +236,7 @@ class AuthProvider with ChangeNotifier { return Future.value(error); // throw error; }, body: neRequest.toJson()); - sharedPref.setString(BLOOD_TYPE, localRes['PatientBloodType']); + // sharedPref.setString(BLOOD_TYPE, localRes['PatientBloodType']); return Future.value(localRes); } catch (error) { throw localRes; diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart index c790aeef..7817ce38 100644 --- a/lib/widgets/drawer/app_drawer_widget.dart +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -543,7 +543,7 @@ class _AppDrawerState extends State { Utils.hideProgressDialog(); Provider.of(context, listen: false).setPrivilege(privilegeList: result, isLoginChild: !isMainUser); result = CheckActivationCode.fromJson(result); - + var bloodType = await sharedPref.getString(BLOOD_TYPE); var familyFile = await sharedPref.getObject(FAMILY_FILE); var currentLang = await sharedPref.getString(APP_LANGUAGE); var mainUser = await sharedPref.getObject(MAIN_USER); @@ -556,6 +556,7 @@ class _AppDrawerState extends State { } // result.list.cRSVerificationStatus = result['CRSVerificationStatus']; this.sharedPref.setString(APP_LANGUAGE, currentLang); + this.sharedPref.setString(BLOOD_TYPE, bloodType); this.sharedPref.setInt(LAST_LOGIN, loginType); this.sharedPref.setObject(MAIN_USER, mainUser); this.sharedPref.setObject(USER_PROFILE, result.list);