Merge branch 'bug_fixing' into 'development'

H2O Bug fixing

See merge request Cloud_Solution/diplomatic-quarter!317
merge-requests/320/merge
Mohammad Aljammal 3 years ago
commit 07d603e52c

@ -1808,7 +1808,7 @@ const Map localizedValues = {
"drinking": {"en": "Drinkning", "ar": "الشرب"},
"remaining": {"en": "Remaining", "ar": "المتبقي"},
"taken": {"en": "Taken", "ar": " مأخوذ"},
"ml": {"en": "ml", "ar": "مل"},
"ml": {"en": "ML", "ar": "مل"},
"l": {"en": "L", "ar": "لتر"},
"custom-label": {"en": "Enter amount", "ar": "أدخل كمية الماء"},
"custom-label-in-litres": {

@ -29,3 +29,4 @@ const BLOOD_TYPE = 'blood-type';
const NOTIFICATION_COUNT = 'notification-count';
const PHARMACY_SELECTED_ADDRESS = 'selected-address';
const PHARMACY_AUTORZIE_TOKEN = 'PHARMACY_AUTORZIE_TOKEN';
const H2O_UNIT = 'H2O_UNIT';

@ -68,7 +68,7 @@ class BaseAppClient {
body['VersionID'] = VERSION_ID;
body['Channel'] = CHANNEL;
body['LanguageID'] = languageID == 'ar' ? 1 : 2;
body['LanguageID'] = (languageID == 'ar' ? 1 : 2);
body['IPAdress'] = IP_ADDRESS;
body['generalid'] = GENERAL_ID;

@ -9,6 +9,7 @@ import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart';
import 'package:charts_flutter/flutter.dart' as charts;
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import '../../../locator.dart';
import 'dart:math' as math;
class H2OViewModel extends BaseViewModel {
H2OService _h2OService = locator<H2OService>();
@ -91,11 +92,21 @@ class H2OViewModel extends BaseViewModel {
_h2OService.userProgressForWeekDataList.forEach((UserProgressForWeekDataModel data) {
globalData.add(new ChartSeries(data.dayName, data.percentageConsumed));
});
Iterable<int> minMaxList = globalData.map((e) => e.x).toList();
int maxValue = minMaxList.isEmpty ? 0 : minMaxList.reduce(math.max);
int minValue = minMaxList.isEmpty ? 0 : minMaxList.reduce(math.min);
if (maxValue == 0 && minValue == 0) {
maxValue = 1;
minValue = -1;
}
return [
new charts.Series<ChartSeries, String>(
id: 'Global Revenue',
domainFn: (ChartSeries sales, _) => sales.y,
measureFn: (ChartSeries sales, _) => sales.x,
measureLowerBoundFn: (ChartSeries sales, _) => minValue,
measureUpperBoundFn: (ChartSeries sales, _) => maxValue,
data: globalData,
),
];

@ -1,3 +1,4 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/AlHabibMedicalService/H2O/user_detail_model.dart';
import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/H2O_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart';
@ -13,6 +14,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/painting.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'Dialog/setting_page_radio_button_list_dialog.dart';
@ -31,7 +33,7 @@ class _H2oSettingState extends State<H2oSetting> {
TextEditingController _nameController = TextEditingController();
TextEditingController _heightController = TextEditingController();
TextEditingController _weightController = TextEditingController();
bool _isUnitML = false;
bool _isUnitML = true;
bool _isGenderMale = false;
bool _isHeightCM = false;
bool _isWeightKG = false;
@ -61,6 +63,14 @@ class _H2oSettingState extends State<H2oSetting> {
_isGenderMale = _userDetailModel.gender == "M" ? true : false;
_dobDate = DateUtil.convertStringToDate(_userDetailModel.dOB);
_selectedActiveLevel = _userDetailModel.activityID ?? 1;
readPrefs();
}
SharedPreferences prefs;
void readPrefs() async {
prefs = await SharedPreferences.getInstance();
_isUnitML = (prefs.getString(H2O_UNIT) ?? "ml") == "ml" ? true : false;
setState(() {});
}
@override
@ -68,19 +78,9 @@ class _H2oSettingState extends State<H2oSetting> {
// TODO: implement didChangeDependencies
super.didChangeDependencies();
_activityLevelListEng = [
TranslationBase.of(context).notActive,
TranslationBase.of(context).lightActive,
TranslationBase.of(context).modActive,
TranslationBase.of(context).active
];
_activityLevelListEng = [TranslationBase.of(context).notActive, TranslationBase.of(context).lightActive, TranslationBase.of(context).modActive, TranslationBase.of(context).active];
_remindedTimeListEng = [
"1 ${TranslationBase.of(context).time}",
"2 ${TranslationBase.of(context).times}",
"3 ${TranslationBase.of(context).times}",
"4 ${TranslationBase.of(context).times}"
];
_remindedTimeListEng = ["1 ${TranslationBase.of(context).time}", "2 ${TranslationBase.of(context).times}", "3 ${TranslationBase.of(context).times}", "4 ${TranslationBase.of(context).times}"];
}
@override
@ -339,8 +339,7 @@ class _H2oSettingState extends State<H2oSetting> {
]);
}
Widget _commonSlidersRow(
_controller, double _minValue, double _maxValue, double _valueOrg, Function(String) onTextValueChange, Function(double) onValueChange) {
Widget _commonSlidersRow(_controller, double _minValue, double _maxValue, double _valueOrg, Function(String) onTextValueChange, Function(double) onValueChange) {
return Container(
margin: EdgeInsets.only(top: 6),
padding: EdgeInsets.all(6),
@ -451,6 +450,7 @@ class _H2oSettingState extends State<H2oSetting> {
_userDetailModel.dOB = tempDate;
_userDetailModel.activityID = _selectedActiveLevel;
GifLoaderDialogUtils.showMyDialog(context);
await prefs.setString(H2O_UNIT, _isUnitML ? "ml" : "l");
await widget.viewModel.updateUserDetail(_userDetailModel, (tag) {
if (tag) {
AppToast.showSuccessToast(message: TranslationBase.of(context).success);

@ -1,5 +1,6 @@
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';
@ -8,15 +9,17 @@ 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';
class MonthPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<H2OViewModel>(
onModelReady: (model) => model.getUserProgressForMonthData(),
builder: (_, model, widget) => AppScaffold(
isShowAppBar: false,
appBarTitle: TranslationBase.of(context).h2o,
appBarTitle: TranslationBase.of(context).h2o,
baseViewModel: model,
body: Padding(
padding: EdgeInsets.all(8.0),
@ -46,7 +49,7 @@ class MonthPage extends StatelessWidget {
],
),
// SizedBox(height: 8),
AppBarChart(seriesList: model.userProgressForMonthDataSeries),
AppBarChart(seriesList: model.userProgressForMonthDataSeries, isArabic: projectViewModel.isArabic),
],
),
),

@ -1,3 +1,4 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/widgets/h20_floating_action_button.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
@ -7,8 +8,14 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:percent_indicator/circular_percent_indicator.dart';
import 'package:shared_preferences/shared_preferences.dart';
class TodayPage extends StatelessWidget {
Future<bool> readPrefs() async {
SharedPreferences prefs = await SharedPreferences.getInstance();
return (prefs.getString(H2O_UNIT) ?? "ml") == "ml" ? true : false;
}
@override
Widget build(BuildContext context) {
return BaseView<H2OViewModel>(
@ -34,55 +41,75 @@ class TodayPage extends StatelessWidget {
: (model.userProgressData.percentageConsumed / 100) >= 1
? 1
: (model.userProgressData.percentageConsumed / 100),
//,
center: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
// SizedBox(
// height: 40,
// ),
Text(
TranslationBase.of(context).consumed,
style: TextStyle(fontSize: 16.0),
),
SizedBox(
height: 4,
),
Text(
model.userProgressData == null
? "0.0"
: model.userProgressData.quantityConsumed.toString() + TranslationBase.of(context).ml,
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14.0, color: HexColor("#60BCF9")),
),
SizedBox(
height: 4,
),
SizedBox(
height: 5,
width: 50,
child: Container(),
),
SizedBox(
height: 4,
),
Text(
TranslationBase.of(context).remaining,
style: TextStyle(fontSize: 16.0),
),
SizedBox(
height: 4,
),
Text(
model.userProgressData == null
? "0.0"
: (model.userProgressData.quantityLimit - model.userProgressData.quantityConsumed) < 0
? "0 ${TranslationBase.of(context).ml}"
: (model.userProgressData.quantityLimit - model.userProgressData.quantityConsumed).toString() +
' ${TranslationBase.of(context).ml}',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14.0),
),
],
child: FutureBuilder<bool>(
future: readPrefs(),
builder: (context, data) {
var isUnitML = true;
String unit;
if (data.connectionState == ConnectionState.done) {
isUnitML = data.data;
}
if (isUnitML) {
unit = TranslationBase.of(context).ml;
} else {
unit = TranslationBase.of(context).l;
}
unit = unit.toLowerCase();
var totalH2O = model?.userProgressData?.quantityLimit ?? 0.0;
var consumedH2O = model?.userProgressData?.quantityConsumed ?? 0.0;
if (!isUnitML) {
totalH2O = totalH2O / 1000;
consumedH2O = consumedH2O / 1000;
}
var remainingH2O = totalH2O - consumedH2O;
return Column(
mainAxisSize: MainAxisSize.min,
children: [
// SizedBox(
// height: 40,
// ),
Text(
TranslationBase.of(context).consumed,
style: TextStyle(fontSize: 16.0),
),
SizedBox(
height: 4,
),
Text(
model.userProgressData == null ? "0.0" : "$consumedH2O $unit",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14.0, color: HexColor("#60BCF9")),
),
SizedBox(
height: 4,
),
SizedBox(
height: 5,
width: 50,
child: Container(),
),
SizedBox(
height: 4,
),
Text(
TranslationBase.of(context).remaining,
style: TextStyle(fontSize: 16.0),
),
SizedBox(
height: 4,
),
Text(
model.userProgressData == null
? "0.0"
: (remainingH2O) < 0
? "0 $unit"
: '$remainingH2O $unit',
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 14.0),
),
],
);
},
),
),
circularStrokeCap: CircularStrokeCap.butt,

@ -1,5 +1,6 @@
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';
@ -8,10 +9,12 @@ 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';
class WeekPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<H2OViewModel>(
onModelReady: (model) => model.getUserProgressForWeekData(),
builder: (_, model, widget) => AppScaffold(
@ -46,7 +49,7 @@ class WeekPage extends StatelessWidget {
],
),
// SizedBox(height: 8),
AppBarChart(seriesList: model.userProgressForWeekDataSeries),
AppBarChart(seriesList: model.userProgressForWeekDataSeries,isArabic: projectViewModel.isArabic),
],
),
),

@ -6,7 +6,7 @@ import 'package:diplomaticquarterapp/locator.dart';
import 'package:diplomaticquarterapp/pages/insurance/insurance_details.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/pages/insurance/insurance_update_screen.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
@ -33,26 +33,41 @@ class _InsuranceCardState extends State<InsuranceCard> {
@override
Widget build(BuildContext context) {
imagesInfo.add(ImagesInfo(
imageEn:
'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/en/0.png',
imageAr:
'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/ar/0.png'));
imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/insurance-card/ar/0.png'));
return BaseView<InsuranceViewModel>(
onModelReady: (model) => model.getInsurance(),
builder: (BuildContext context, InsuranceViewModel model, Widget child) =>
AppScaffold(
builder: (BuildContext context, InsuranceViewModel model, Widget child) => AppScaffold(
isShowAppBar: true,
baseViewModel: model,
showHomeAppBarIcon: false,
appBarTitle: TranslationBase.of(context).insuranceCards,
description: TranslationBase.of(context).infoInsuranceCards,
infoList: TranslationBase.of(context).infoInsuranceCardsPoints,
imagesInfo: imagesInfo,
appBarIcons: [
IconButton(
padding: EdgeInsets.zero,
icon: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
),
margin: EdgeInsets.only(right: 8),
padding: EdgeInsets.only(right: 4, left: 4),
child: Image.asset(
'assets/images/medical/insurance_update_icon_.png',
height: SizeConfig.heightMultiplier * 5,
width: SizeConfig.heightMultiplier * 5,
),
),
onPressed: () {
Navigator.push(context, FadePage(page: InsuranceUpdate()));
},
),
],
body: Container(
margin: EdgeInsets.only(
left: SizeConfig.screenWidth * 0.004,
right: SizeConfig.screenWidth * 0.004,
top: SizeConfig.screenWidth * 0.04),
margin: EdgeInsets.only(left: SizeConfig.screenWidth * 0.004, right: SizeConfig.screenWidth * 0.004, top: SizeConfig.screenWidth * 0.04),
child: ListView.builder(
itemCount: model.insurance == null ? 0 : model.insurance.length,
itemBuilder: (BuildContext context, int index) {
@ -82,23 +97,16 @@ class _InsuranceCardState extends State<InsuranceCard> {
Container(
padding: EdgeInsets.all(14),
width: double.infinity,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
border: Border.all(
color: Colors.grey, width: 0.2),
borderRadius:
BorderRadius.all(Radius.circular(2)),
boxShadow: [
BoxShadow(
color: Colors.white70,
),
]),
decoration: BoxDecoration(shape: BoxShape.rectangle, border: Border.all(color: Colors.grey, width: 0.2), borderRadius: BorderRadius.all(Radius.circular(2)), boxShadow: [
BoxShadow(
color: Colors.white70,
),
]),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
TranslationBase.of(context).companyName +
model.insurance[index].companyName,
TranslationBase.of(context).companyName + model.insurance[index].companyName,
fontSize: 20.0,
fontWeight: FontWeight.w700,
),
@ -108,93 +116,46 @@ class _InsuranceCardState extends State<InsuranceCard> {
thickness: 0.5,
),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context)
.category,
fontSize: 18.5),
Texts(
model.insurance[index]
.subCategoryDesc,
fontSize: 18.5)
],
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [Texts(TranslationBase.of(context).category, fontSize: 18.5), Texts(model.insurance[index].subCategoryDesc, fontSize: 18.5)],
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context)
.expirationDate,
fontSize: 18.5),
Texts(TranslationBase.of(context).expirationDate, fontSize: 18.5),
Texts(
convertDateFormat(
model.insurance[index]
.cardValidTo,
model.insurance[index].cardValidTo,
),
fontSize: 18.5),
],
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context)
.status +
": ",
fontSize: 18.5),
model.insurance[index].isActive ==
true
? Texts(
TranslationBase.of(context)
.activeInsurence,
color: Colors.green,
fontWeight: FontWeight.w900,
fontSize: 17.9)
: Texts(
TranslationBase.of(context)
.notActive,
color: Colors.red,
fontWeight: FontWeight.w900,
fontSize: 17.9)
Texts(TranslationBase.of(context).status + ": ", fontSize: 18.5),
model.insurance[index].isActive == true
? Texts(TranslationBase.of(context).activeInsurence, color: Colors.green, fontWeight: FontWeight.w900, fontSize: 17.9)
: Texts(TranslationBase.of(context).notActive, color: Colors.red, fontWeight: FontWeight.w900, fontSize: 17.9)
],
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context)
.patientCard,
fontSize: 18.5),
Texts(
model.insurance[index]
.patientCardID,
fontSize: 18.5)
],
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [Texts(TranslationBase.of(context).patientCard, fontSize: 18.5), Texts(model.insurance[index].patientCardID, fontSize: 18.5)],
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context)
.policyNumber,
fontSize: 18.5,
),
Texts(
model.insurance[index]
.insurancePolicyNumber,
fontSize: 18.5,
)
]),
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
Texts(
TranslationBase.of(context).policyNumber,
fontSize: 18.5,
),
Texts(
model.insurance[index].insurancePolicyNumber,
fontSize: 18.5,
)
]),
],
),
SizedBox(
@ -204,11 +165,8 @@ class _InsuranceCardState extends State<InsuranceCard> {
Container(
color: Colors.transparent,
child: SecondaryButton(
onTap: () => {
getDetails(model.insurance[index])
},
label: TranslationBase.of(context)
.seeDetails,
onTap: () => {getDetails(model.insurance[index])},
label: TranslationBase.of(context).seeDetails,
textColor: Colors.white,
),
width: double.infinity,
@ -235,23 +193,16 @@ class _InsuranceCardState extends State<InsuranceCard> {
final startIndex = exDate.indexOf(start);
final endIndex = exDate.indexOf(end, startIndex + start.length);
var date = new DateTime.fromMillisecondsSinceEpoch(
int.parse(exDate.substring(startIndex + start.length, endIndex)));
String newDate = date.year.toString() +
"-" +
date.month.toString().padLeft(2, '0') +
"-" +
date.day.toString().padLeft(2, '0');
var date = new DateTime.fromMillisecondsSinceEpoch(int.parse(exDate.substring(startIndex + start.length, endIndex)));
String newDate = date.year.toString() + "-" + date.month.toString().padLeft(2, '0') + "-" + date.day.toString().padLeft(2, '0');
return newDate.toString();
}
getDetails(data) {
GifLoaderDialogUtils.showMyDialog(context);
_insuranceCardService.getInsuranceDetails(data).then((value) => {
GifLoaderDialogUtils.hideDialog(context),
Navigator.push(context,
FadePage(page: InsuranceCardDetails(data: value[0]['CheckList'])))
});
_insuranceCardService
.getInsuranceDetails(data)
.then((value) => {GifLoaderDialogUtils.hideDialog(context), Navigator.push(context, FadePage(page: InsuranceCardDetails(data: value[0]['CheckList'])))});
}
}

@ -4,10 +4,12 @@ import 'package:charts_flutter/flutter.dart' as charts;
class AppBarChart extends StatelessWidget {
const AppBarChart({
Key key,
@required this.isArabic,
@required this.seriesList,
}) : super(key: key);
final List<charts.Series> seriesList;
final bool isArabic;
@override
Widget build(BuildContext context) {
@ -19,7 +21,7 @@ class AppBarChart extends StatelessWidget {
// animate: animate,
domainAxis: charts.OrdinalAxisSpec(
renderSpec: charts.GridlineRendererSpec(
labelAnchor: charts.TickLabelAnchor.after,
labelAnchor: isArabic ? charts.TickLabelAnchor.before : charts.TickLabelAnchor.after,
labelRotation: -30,
labelOffsetFromAxisPx: 30,
labelOffsetFromTickPx: 15,

@ -58,8 +58,7 @@ class AppScaffold extends StatelessWidget {
final List<Widget> appBarIcons;
final List<ImagesInfo> imagesInfo;
final bool isHelp;
AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>();
AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
AppBarWidget appBar;
AppScaffold(
@ -130,6 +129,7 @@ class AppScaffold extends StatelessWidget {
)
: buildBodyWidget(context),
),
floatingActionButton: floatingActionButton,
);
}

Loading…
Cancel
Save