From 3b4e7910171b3b53da48b7acb6561275f5e4ca10 Mon Sep 17 00:00:00 2001 From: Sikander Saleem Date: Mon, 1 Feb 2021 17:18:05 +0300 Subject: [PATCH] H2O feature improvement --- lib/config/localized_values.dart | 2 + .../all_habib_medical_service_page.dart | 156 ++++++++---------- .../h2o/Dialog/confirm_add_amount_dialog.dart | 26 ++- .../AlHabibMedicalService/h2o/h2o_page.dart | 62 ++++--- .../AlHabibMedicalService/h2o/month_page.dart | 39 ++++- .../AlHabibMedicalService/h2o/today_page.dart | 78 +++------ .../AlHabibMedicalService/h2o/week_page.dart | 38 ++++- .../widgets/h20_floating_action_button.dart | 66 ++++---- lib/uitl/translations_delegate_base.dart | 2 + lib/widgets/charts/app_bar_chart.dart | 36 ++-- lib/widgets/others/app_scaffold_widget.dart | 1 + 11 files changed, 256 insertions(+), 250 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 5658469e..20b81d43 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -610,6 +610,8 @@ const Map localizedValues = { "DepositorName": {"en": "Depositor Name", "ar": "اسم المودع *"}, "MobileNumber": {"en": "Mobile Number", "ar": "رقم الجوال"}, "Ok": {"en": "Ok", "ar": "حسنا"}, + "WaterConsumedInWeek": {"en": "Water consumed in a week", "ar": "معدل شرب الماء خلال الاسبوع"}, + "WaterConsumedInMonth": {"en": "Water consumed in a month", "ar": "معدل شرب الماء خلال الشهر"}, "TheVerificationCodeExpiresIn": { "en": "The Verification Code Expires In", "ar": "تنتهي صلاحية رمز التحقق في" diff --git a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart index 3c3c18c1..dfb53471 100644 --- a/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart +++ b/lib/pages/AlHabibMedicalService/all_habib_medical_service_page.dart @@ -37,6 +37,8 @@ import 'package:geolocator/geolocator.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; +import 'h2o/h2o_page.dart'; + class AllHabibMedicalService extends StatefulWidget { //TODO final Function goToMyProfile; @@ -56,12 +58,8 @@ class _AllHabibMedicalServiceState extends State { @override void initState() { WidgetsBinding.instance.addPostFrameCallback((timeStamp) { - locationUtils = - new LocationUtils(isShowConfirmDialog: true, context: context); - WidgetsBinding.instance.addPostFrameCallback((_) => { - Geolocator.getLastKnownPosition() - .then((value) => setLocation(value)) - }); + locationUtils = new LocationUtils(isShowConfirmDialog: true, context: context); + WidgetsBinding.instance.addPostFrameCallback((_) => {Geolocator.getLastKnownPosition().then((value) => setLocation(value))}); }); super.initState(); } @@ -100,8 +98,7 @@ class _AllHabibMedicalServiceState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Texts( - TranslationBase.of(context) - .healthWeatherIndicators, + TranslationBase.of(context).healthWeatherIndicators, color: Colors.white, fontWeight: FontWeight.w600, ), @@ -134,11 +131,7 @@ class _AllHabibMedicalServiceState extends State { width: 60, height: 60, ), - Directionality( - textDirection: TextDirection.ltr, - child: AppText(weather, - fontSize: 22, - color: Colors.white)) + Directionality(textDirection: TextDirection.ltr, child: AppText(weather, fontSize: 22, color: Colors.white)) ], ), Texts( @@ -158,8 +151,7 @@ class _AllHabibMedicalServiceState extends State { Navigator.pop(context); widget.goToMyProfile(); }, - imageLocation: - 'assets/images/new-design/my_file_bottom_bar.png', + imageLocation: 'assets/images/new-design/my_file_bottom_bar.png', title: TranslationBase.of(context).myMedicalFile, ), ServicesContainer( @@ -181,8 +173,7 @@ class _AllHabibMedicalServiceState extends State { ), ), ), - imageLocation: - 'assets/images/new-design/booking_icon_active.png', + imageLocation: 'assets/images/new-design/booking_icon_active.png', title: TranslationBase.of(context).bookAppo, ), ServicesContainer( @@ -192,8 +183,7 @@ class _AllHabibMedicalServiceState extends State { page: PaymentService(), ), ), - imageLocation: - 'assets/images/al-habib_online_payment_service_icon.png', + imageLocation: 'assets/images/al-habib_online_payment_service_icon.png', title: TranslationBase.of(context).onlinePaymentService, ), ServicesContainer( @@ -201,8 +191,7 @@ class _AllHabibMedicalServiceState extends State { context, FadePage(), ), - imageLocation: - 'assets/images/al-habib_online_payment_service_icon.png', + imageLocation: 'assets/images/al-habib_online_payment_service_icon.png', title: TranslationBase.of(context).covid19_driveThrueTest, ), ServicesContainer( @@ -235,17 +224,13 @@ class _AllHabibMedicalServiceState extends State { page: InsuranceUpdate(), ), ), - imageLocation: - 'assets/images/medical/insurance_card_icon.png', + imageLocation: 'assets/images/medical/insurance_card_icon.png', title: TranslationBase.of(context).updateInsurance, ), ServicesContainer( onTap: () => Navigator.push( context, - FadePage( - page: authUser.patientID == null - ? EReferralIndexPage() - : EReferralPage()), + FadePage(page: authUser.patientID == null ? EReferralIndexPage() : EReferralPage()), ), imageLocation: 'assets/images/ereferral_service_icon.png', title: TranslationBase.of(context).ereferral, @@ -257,20 +242,18 @@ class _AllHabibMedicalServiceState extends State { page: MyFamily(), ), ), - imageLocation: - 'assets/images/new-design/family_menu_icon_red.png', + imageLocation: 'assets/images/new-design/family_menu_icon_red.png', title: TranslationBase.of(context).myFamily, ), - if(projectViewModel.havePrivilege(35)) - ServicesContainer( - onTap: () => Navigator.push( - context, - FadePage(page: ChildVaccinesPage()), + if (projectViewModel.havePrivilege(35)) + ServicesContainer( + onTap: () => Navigator.push( + context, + FadePage(page: ChildVaccinesPage()), + ), + imageLocation: 'assets/images/new-design/children_vaccines_icon.png', + title: TranslationBase.of(context).childVaccine, ), - imageLocation: - 'assets/images/new-design/children_vaccines_icon.png', - title: TranslationBase.of(context).childVaccine, - ), ServicesContainer( onTap: () => Navigator.push( context, @@ -278,27 +261,26 @@ class _AllHabibMedicalServiceState extends State { page: ToDo(isShowAppBar: true), ), ), - imageLocation: - 'assets/images/new-design/upcoming_icon_bottom_bar.png', + imageLocation: 'assets/images/new-design/upcoming_icon_bottom_bar.png', title: TranslationBase.of(context).todoList, ), - if(projectViewModel.havePrivilege(42)) - ServicesContainer( - onTap: () => Navigator.push( - context, - FadePage(page: SymptomInfo()), - ), - imageLocation: 'assets/images/new-design/body_icon.png', - title: TranslationBase.of(context).symptomCheckerTitle), - if(projectViewModel.havePrivilege(36)) + if (projectViewModel.havePrivilege(42)) ServicesContainer( - onTap: () => Navigator.push( - context, - FadePage(page: BloodDonationPage()), + onTap: () => Navigator.push( + context, + FadePage(page: SymptomInfo()), + ), + imageLocation: 'assets/images/new-design/body_icon.png', + title: TranslationBase.of(context).symptomCheckerTitle), + if (projectViewModel.havePrivilege(36)) + ServicesContainer( + onTap: () => Navigator.push( + context, + FadePage(page: BloodDonationPage()), + ), + imageLocation: 'assets/images/new-design/blood_icon.png', + title: TranslationBase.of(context).bloodD, ), - imageLocation: 'assets/images/new-design/blood_icon.png', - title: TranslationBase.of(context).bloodD, - ), ServicesContainer( onTap: () => Navigator.push( context, @@ -306,8 +288,7 @@ class _AllHabibMedicalServiceState extends State { page: (HealthCalculators()), ), ), - imageLocation: - 'assets/images/new-design/health_calculator_icon.png', + imageLocation: 'assets/images/new-design/health_calculator_icon.png', title: TranslationBase.of(context).calculators, ), ServicesContainer( @@ -317,30 +298,30 @@ class _AllHabibMedicalServiceState extends State { page: HealthConverter(), ), ), - imageLocation: - 'assets/images/new-design/health_convertor_icon.png', + imageLocation: 'assets/images/new-design/health_convertor_icon.png', title: TranslationBase.of(context).converters, ), - if(projectViewModel.havePrivilege(38)) - ServicesContainer( - onTap: () => Navigator.push( - context, - FadePage( - page: H2OPageIndexPage(), - ), + if (projectViewModel.havePrivilege(38)) + ServicesContainer( + onTap: () => Navigator.push(context, FadePage(page: H2OPage())), + // Navigator.push( + // context, + // FadePage( + // page: H2OPageIndexPage(), + // ), + // ), + imageLocation: 'assets/images/new-design/water_icon.png', + title: 'H2O', ), - imageLocation: 'assets/images/new-design/water_icon.png', - title: 'H2O', - ), - if(projectViewModel.havePrivilege(41)) - ServicesContainer( - onTap: () => Navigator.push( - context, - FadePage(), + if (projectViewModel.havePrivilege(41)) + ServicesContainer( + onTap: () => Navigator.push( + context, + FadePage(), + ), + imageLocation: 'assets/images/new-design/smartwatch_icon.png', + title: TranslationBase.of(context).smartWatches, ), - imageLocation: 'assets/images/new-design/smartwatch_icon.png', - title: TranslationBase.of(context).smartWatches, - ), ServicesContainer( onTap: () => Navigator.push( context, @@ -348,15 +329,12 @@ class _AllHabibMedicalServiceState extends State { page: ParkingPage(), ), ), - imageLocation: - 'assets/images/new-design/parking_system_icon.png', + imageLocation: 'assets/images/new-design/parking_system_icon.png', title: TranslationBase.of(context).parking, ), ServicesContainer( - onTap: () => launch( - "https://hmgwebservices.com/vt_mobile/html/index.html"), - imageLocation: - 'assets/images/new-design/virtual_tour_icon.png', + onTap: () => launch("https://hmgwebservices.com/vt_mobile/html/index.html"), + imageLocation: 'assets/images/new-design/virtual_tour_icon.png', title: TranslationBase.of(context).vTour, ), ServicesContainer( @@ -364,12 +342,10 @@ class _AllHabibMedicalServiceState extends State { Navigator.of(context).push(MaterialPageRoute( builder: (BuildContext context) => MyWebView( title: "HMG News", - selectedUrl: - "https://twitter.com/hashtag/مجموعة_د_سليمان_الحبيب_الطبية?src=hashtag_click&f=live", + selectedUrl: "https://twitter.com/hashtag/مجموعة_د_سليمان_الحبيب_الطبية?src=hashtag_click&f=live", ))); }, - imageLocation: - 'assets/images/new-design/twitter_dashboard_icon.png', + imageLocation: 'assets/images/new-design/twitter_dashboard_icon.png', title: TranslationBase.of(context).latestNews, ), ServicesContainer( @@ -392,8 +368,7 @@ class _AllHabibMedicalServiceState extends State { getAuthUser() async { if (await this.sharedPref.getObject(USER_PROFILE) != null) { - var data = AuthenticatedUser.fromJson( - await this.sharedPref.getObject(USER_PROFILE)); + var data = AuthenticatedUser.fromJson(await this.sharedPref.getObject(USER_PROFILE)); setState(() { authUser = data; }); @@ -407,8 +382,7 @@ class _AllHabibMedicalServiceState extends State { }); } else { setState(() { - weather = - data != null ? data['Temperature'].toString() + '\u2103' : '--'; + weather = data != null ? data['Temperature'].toString() + '\u2103' : '--'; }); } } diff --git a/lib/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart b/lib/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart index 90386827..9ca557af 100644 --- a/lib/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart +++ b/lib/pages/AlHabibMedicalService/h2o/Dialog/confirm_add_amount_dialog.dart @@ -12,9 +12,7 @@ class ConfirmAddAmountDialog extends StatefulWidget { final String unit; final H2OViewModel model; - - ConfirmAddAmountDialog( - {Key key, this.model,this.amount,this.unit ="ml"}); + ConfirmAddAmountDialog({Key key, this.model, this.amount, this.unit = "ml"}); @override _ConfirmAddAmountDialogState createState() => _ConfirmAddAmountDialogState(); @@ -29,10 +27,12 @@ class _ConfirmAddAmountDialogState extends State { @override Widget build(BuildContext context) { return SimpleDialog( - contentPadding: EdgeInsets.fromLTRB(28.0, 24.0, 28.0, 0.0), + contentPadding: EdgeInsets.fromLTRB(24.0, 0.0, 24.0, 8.0), + titlePadding: EdgeInsets.fromLTRB(24.0, 16.0, 24.0, 8.0), title: Center( child: Texts( "Confirm", + textAlign: TextAlign.center, color: Colors.black, ), ), @@ -43,11 +43,12 @@ class _ConfirmAddAmountDialogState extends State { Center( child: Texts( "Are you sure you want to Add ${widget.amount} ${widget.unit} ?", + textAlign: TextAlign.center, color: Colors.grey, ), ), SizedBox( - height: 5.0, + height: 16.0, ), Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -79,8 +80,8 @@ class _ConfirmAddAmountDialogState extends State { Expanded( flex: 1, child: InkWell( - onTap: () async{ - InsertUserActivityRequestModel insertUserActivityRequestModel= InsertUserActivityRequestModel(quantityIntake:widget.amount ); + onTap: () async { + InsertUserActivityRequestModel insertUserActivityRequestModel = InsertUserActivityRequestModel(quantityIntake: widget.amount); await widget.model.insertUserActivity(insertUserActivityRequestModel); Navigator.pop(context); }, @@ -88,20 +89,17 @@ class _ConfirmAddAmountDialogState extends State { padding: const EdgeInsets.all(8.0), child: Center( child: Texts( - TranslationBase.of(context).ok, - fontWeight: FontWeight.w400, - )), + TranslationBase.of(context).ok.toUpperCase(), + fontWeight: FontWeight.w400, + )), ), ), ), ], - ) + ), ], ) ], ); } } - - - diff --git a/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart b/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart index 8ac7b437..89e4b774 100644 --- a/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/h2o_page.dart @@ -60,48 +60,46 @@ class _H2OPageState extends State Center( child: Container( height: 60.0, - margin: EdgeInsets.only(top: 10.0), - width: MediaQuery.of(context).size.width * 0.9, + alignment: Alignment.center, + // margin: EdgeInsets.only(top: 10.0), + // width: MediaQuery.of(context).size.width * 0.9, - child: Center( - 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( - "Today"), - ), + 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("Today"), ), - Container( - width: MediaQuery.of(context).size.width * 0.28, - child: Center( - child: Texts("Week"), - ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.28, + child: Center( + child: Texts("Week"), ), - Container( - width: MediaQuery.of(context).size.width * 0.28, - child: Center( - child: Texts("Month"), - ), + ), + Container( + width: MediaQuery.of(context).size.width * 0.28, + child: Center( + child: Texts("Month"), ), - ], - ), + ), + ], ), ), ), ], ), ), + backgroundColor: Colors.white, body: Column( children: [ Expanded( diff --git a/lib/pages/AlHabibMedicalService/h2o/month_page.dart b/lib/pages/AlHabibMedicalService/h2o/month_page.dart index f0baf34d..9b255d9e 100644 --- a/lib/pages/AlHabibMedicalService/h2o/month_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/month_page.dart @@ -1,11 +1,13 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_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/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'; class MonthPage extends StatelessWidget { @override @@ -15,11 +17,38 @@ class MonthPage extends StatelessWidget { builder: (_, model, widget) => AppScaffold( isShowAppBar: false, appBarTitle: "Water Tracker", - baseViewModel:model , - body: SingleChildScrollView( - padding: EdgeInsets.symmetric(vertical: 12), - child: AppBarChart( - seriesList: model.userProgressForMonthDataSeries), + 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, + ), + SizedBox(width: 8), + Text( + TranslationBase.of(context).waterConsumedInMonth, + style: TextStyle(fontSize: 12.0), + ), + ], + ), + // SizedBox(height: 8), + AppBarChart(seriesList: model.userProgressForMonthDataSeries), + ], + ), ), ), ); diff --git a/lib/pages/AlHabibMedicalService/h2o/today_page.dart b/lib/pages/AlHabibMedicalService/h2o/today_page.dart index b92efc9e..8aacf15c 100644 --- a/lib/pages/AlHabibMedicalService/h2o/today_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/today_page.dart @@ -36,27 +36,21 @@ class TodayPage extends StatelessWidget { //, center: Center( child: Column( + mainAxisSize: MainAxisSize.min, children: [ - SizedBox( - height: 40, - ), + // SizedBox( + // height: 40, + // ), Text( "Consumed", - style: TextStyle(fontSize: 20.0), + style: TextStyle(fontSize: 16.0), ), SizedBox( height: 4, ), Text( - model.userProgressData == null - ? "0.0" - : model.userProgressData.quantityConsumed - .toString() + - 'ml', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20.0, - color: HexColor("#60BCF9")), + model.userProgressData == null ? "0.0" : model.userProgressData.quantityConsumed.toString() + 'ml', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14.0, color: HexColor("#60BCF9")), ), SizedBox( height: 4, @@ -71,7 +65,7 @@ class TodayPage extends StatelessWidget { ), Text( "Remaining", - style: TextStyle(fontSize: 20.0), + style: TextStyle(fontSize: 16.0), ), SizedBox( height: 4, @@ -79,18 +73,10 @@ class TodayPage extends StatelessWidget { Text( model.userProgressData == null ? "0.0" - : (model.userProgressData.quantityLimit - - model.userProgressData - .quantityConsumed) < - 0 + : (model.userProgressData.quantityLimit - model.userProgressData.quantityConsumed) < 0 ? "0 ml" - : (model.userProgressData.quantityLimit - - model.userProgressData - .quantityConsumed) - .toString() + - ' ml', - style: TextStyle( - fontWeight: FontWeight.bold, fontSize: 18.0), + : (model.userProgressData.quantityLimit - model.userProgressData.quantityConsumed).toString() + ' ml', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14.0), ), ], ), @@ -104,42 +90,32 @@ class TodayPage extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Center( - child: Container( - margin: EdgeInsets.only(left: 20), - height: 30, - width: 70, - decoration: BoxDecoration( - color: HexColor("#D1E3F6"), - borderRadius: - BorderRadius.all(Radius.circular(30))), - ), + Container( + margin: EdgeInsets.only(bottom: 16), + height: 30, + width: 70, + decoration: BoxDecoration(color: HexColor("#D1E3F6"), borderRadius: BorderRadius.all(Radius.circular(30))), ), Text( - "Remaining % ", - style: TextStyle(fontSize: 20.0), + "Remaining %", + style: TextStyle(fontSize: 16.0), ) ], ), Column( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Center( - child: Container( - margin: EdgeInsets.only(left: 20), - height: 30, - width: 70, - decoration: BoxDecoration( - color: HexColor("#60BCF9"), - borderRadius: - BorderRadius.all(Radius.circular(30))), - ), + Container( + margin: EdgeInsets.only(bottom: 16), + height: 30, + width: 70, + decoration: BoxDecoration(color: HexColor("#60BCF9"), borderRadius: BorderRadius.all(Radius.circular(30))), ), Text( - "Consumed % ", - style: TextStyle(fontSize: 20.0), + "Consumed %", + style: TextStyle(fontSize: 16.0), ) ], ) diff --git a/lib/pages/AlHabibMedicalService/h2o/week_page.dart b/lib/pages/AlHabibMedicalService/h2o/week_page.dart index e42eb19b..a9131199 100644 --- a/lib/pages/AlHabibMedicalService/h2o/week_page.dart +++ b/lib/pages/AlHabibMedicalService/h2o/week_page.dart @@ -1,6 +1,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_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/widgets/others/app_scaffold_widget.dart'; @@ -17,14 +18,39 @@ class WeekPage extends StatelessWidget { isShowAppBar: false, appBarTitle: "Water Tracker", baseViewModel: model, - body: SingleChildScrollView( - padding: EdgeInsets.symmetric(vertical: 12), - child: AppBarChart(seriesList: model.userProgressForWeekDataSeries), + 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, + ), + SizedBox(width: 8), + Text( + TranslationBase.of(context).waterConsumedInWeek, + style: TextStyle(fontSize: 12.0), + ), + ], + ), + // SizedBox(height: 8), + AppBarChart(seriesList: model.userProgressForWeekDataSeries), + ], + ), ), ), ); } } - - - diff --git a/lib/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart b/lib/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart index 7eaed1a8..bc19e6e9 100644 --- a/lib/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart +++ b/lib/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart @@ -12,13 +12,7 @@ import 'package:flutter/material.dart'; import '../add_custom_amount.dart'; class H20FloatingActionButton extends StatefulWidget { - const H20FloatingActionButton({ - Key key, - @required AnimationController controller, - @required this.model - - }) : - super(key: key); + const H20FloatingActionButton({Key key, @required AnimationController controller, @required this.model}) : super(key: key); final H2OViewModel model; @@ -26,7 +20,7 @@ class H20FloatingActionButton extends StatefulWidget { _H20FloatingActionButtonState createState() => _H20FloatingActionButtonState(); } -class _H20FloatingActionButtonState extends State with TickerProviderStateMixin { +class _H20FloatingActionButtonState extends State with TickerProviderStateMixin { AnimationController _controller; @override void initState() { @@ -39,9 +33,13 @@ class _H20FloatingActionButtonState extends State with @override Widget build(BuildContext context) { - void showConfirmMessage(int amount, H2OViewModel model) { - showDialog(context: context, child: ConfirmAddAmountDialog(model: model,amount:amount,)); + showDialog( + context: context, + child: ConfirmAddAmountDialog( + model: model, + amount: amount, + )); } return Container( @@ -87,11 +85,9 @@ class _H20FloatingActionButtonState extends State with animation: _controller, builder: (BuildContext context, Widget child) { return new Transform( - transform: new Matrix4.rotationZ( - _controller.value * 0.5 * math.pi), + transform: new Matrix4.rotationZ(_controller.value * 0.5 * math.pi), alignment: FractionalOffset.center, - child: new Icon( - _controller.isDismissed ? Icons.add : Icons.close), + child: new Icon(_controller.isDismissed ? Icons.add : Icons.close), ); }, ), @@ -104,21 +100,21 @@ class _H20FloatingActionButtonState extends State with }, ), new Container( + margin: EdgeInsets.only(left: 8, bottom: 4), alignment: FractionalOffset.topCenter, child: new ScaleTransition( scale: new CurvedAnimation( parent: _controller, - curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, - curve: Curves.easeOut), + curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, curve: Curves.easeOut), ), child: new FloatingActionButton( backgroundColor: Colors.white, heroTag: null, - mini: true, + // mini: true, child: Text( "Custom", textAlign: TextAlign.center, - style: TextStyle(fontSize: 14.0, color: Colors.grey), + style: TextStyle(fontSize: 12, color: Colors.grey), ), onPressed: () { Navigator.push( @@ -134,21 +130,21 @@ class _H20FloatingActionButtonState extends State with ), ), new Container( + margin: EdgeInsets.only(left: 8, bottom: 4), alignment: FractionalOffset.topCenter, child: new ScaleTransition( scale: new CurvedAnimation( parent: _controller, - curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, - curve: Curves.easeOut), + curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, curve: Curves.easeOut), ), child: new FloatingActionButton( backgroundColor: Colors.white, heroTag: null, - mini: true, + //mini: true, child: Text( "Undo", textAlign: TextAlign.center, - style: TextStyle(fontSize: 14.0, color: Colors.grey), + style: TextStyle(fontSize: 12.0, color: Colors.grey), ), onPressed: () {}, ), @@ -162,11 +158,7 @@ class _H20FloatingActionButtonState extends State with } class ActionButton extends StatelessWidget { - const ActionButton( - {Key key, - @required AnimationController controller, - @required this.text, - this.onTap}) + const ActionButton({Key key, @required AnimationController controller, @required this.text, this.onTap}) : _controller = controller, super(key: key); @@ -177,6 +169,7 @@ class ActionButton extends StatelessWidget { @override Widget build(BuildContext context) { return Container( + margin: EdgeInsets.only(left: 4, bottom: 8), alignment: FractionalOffset.topCenter, child: new ScaleTransition( scale: new CurvedAnimation( @@ -184,16 +177,15 @@ class ActionButton extends StatelessWidget { curve: new Interval(0.0, 1.0 - 0 / 6 / 2.0, curve: Curves.easeOut), ), child: new FloatingActionButton( - heroTag: null, - backgroundColor: Colors.white, - mini: true, - child: Text( - text, - textAlign: TextAlign.center, - style: TextStyle(fontSize: 14.0, color: Colors.grey), - ), - onPressed: onTap - ), + heroTag: null, + backgroundColor: Colors.white, + //mini: true, + child: Text( + text, + textAlign: TextAlign.center, + style: TextStyle(fontSize: 12.0, color: Colors.grey), + ), + onPressed: onTap), ), ); } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 82d3d5c4..48dcb8eb 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -658,6 +658,8 @@ class TranslationBase { String get mobileNumber => localizedValues['MobileNumber'][locale.languageCode]; String get ok => localizedValues['Ok'][locale.languageCode]; + String get waterConsumedInWeek => localizedValues['WaterConsumedInWeek'][locale.languageCode]; + String get waterConsumedInMonth => localizedValues['WaterConsumedInMonth'][locale.languageCode]; String get theVerificationCodeExpiresIn => localizedValues['TheVerificationCodeExpiresIn'][locale.languageCode]; String get pleaseEnterTheVerificationCode => diff --git a/lib/widgets/charts/app_bar_chart.dart b/lib/widgets/charts/app_bar_chart.dart index 98ef3cfa..439d5ae9 100644 --- a/lib/widgets/charts/app_bar_chart.dart +++ b/lib/widgets/charts/app_bar_chart.dart @@ -13,30 +13,38 @@ class AppBarChart extends StatelessWidget { Widget build(BuildContext context) { return Container( height: 400, - margin: EdgeInsets.only(top: 60), + //margin: EdgeInsets.only(top: 60), child: charts.BarChart( seriesList, // animate: animate, + domainAxis: charts.OrdinalAxisSpec( + renderSpec: charts.GridlineRendererSpec( + labelAnchor: charts.TickLabelAnchor.after, + labelRotation: -30, + labelOffsetFromAxisPx: 30, + labelOffsetFromTickPx: 15, + labelJustification: charts.TickLabelJustification.inside, + ), + ), /// Customize the primary measure axis using a small tick renderer. /// Use String instead of num for ordinal domain axis /// (typically bar charts). primaryMeasureAxis: new charts.NumericAxisSpec( renderSpec: new charts.GridlineRendererSpec( - // Display the measure axis labels below the gridline. - // - // 'Before' & 'after' follow the axis value direction. - // Vertical axes draw 'before' below & 'after' above the tick. - // Horizontal axes draw 'before' left & 'after' right the tick. - labelAnchor: charts.TickLabelAnchor.before, + // Display the measure axis labels below the gridline. + // + // 'Before' & 'after' follow the axis value direction. + // Vertical axes draw 'before' below & 'after' above the tick. + // Horizontal axes draw 'before' left & 'after' right the tick. + labelAnchor: charts.TickLabelAnchor.before, - // Left justify the text in the axis. - // - // Note: outside means that the secondary measure axis would right - // justify. - labelJustification: - charts.TickLabelJustification.outside, - )), + // Left justify the text in the axis. + // + // Note: outside means that the secondary measure axis would right + // justify. + labelJustification: charts.TickLabelJustification.outside, + )), ), ); } diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index 3fce4b51..8103f081 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -96,6 +96,7 @@ class AppScaffold extends StatelessWidget { baseViewModel: baseViewModel, ) : body, + floatingActionButton: floatingActionButton, ); }