You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
275 lines
14 KiB
Dart
275 lines
14 KiB
Dart
import 'package:auto_size_text/auto_size_text.dart';
|
|
import 'package:diplomaticquarterapp/core/enum/patient_lookup.dart';
|
|
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
|
|
import 'package:diplomaticquarterapp/core/viewModels/medical/vital_sign_view_model.dart';
|
|
import 'package:diplomaticquarterapp/models/vital_sign.dart';
|
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
|
import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_item.dart';
|
|
import 'package:diplomaticquarterapp/pages/medical/vital_sign/vital_sign_item_details_screen.dart';
|
|
import 'package:diplomaticquarterapp/theme/colors.dart';
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
|
|
import 'package:flutter_svg/svg.dart';
|
|
|
|
import '../../../d_q_icons_icons.dart';
|
|
|
|
class VitalSignDetailsScreen extends StatelessWidget {
|
|
static const String url = "assets/images/";
|
|
|
|
int appointmentNo;
|
|
int projectID;
|
|
bool isNotOneAppointment;
|
|
|
|
VitalSignDetailsScreen({this.appointmentNo, this.projectID, this.isNotOneAppointment = true});
|
|
|
|
List<ImagesInfo> imagesInfo = List();
|
|
List<VitalSign> vitalSigns = [];
|
|
|
|
initList(BuildContext context, VitalSignViewModel mode) {
|
|
vitalSigns.clear();
|
|
vitalSigns.add(new VitalSign(TranslationBase.of(context).height, mode.heightCm, TranslationBase.of(context).cm, "assets/images/new/height.svg"));
|
|
vitalSigns.add(new VitalSign(TranslationBase.of(context).weight, mode.weightKg, TranslationBase.of(context).kg, "assets/images/new/weight.svg"));
|
|
// vitalSigns.add(new VitalSign(TranslationBase.of(context).body, mode.bodyMax, TranslationBase.of(context).mass, "assets/images/new/"));
|
|
vitalSigns.add(new VitalSign(TranslationBase.of(context).temperature, mode.temperatureCelcius, TranslationBase.of(context).tempC, "assets/images/new/temperature.svg"));
|
|
vitalSigns.add(new VitalSign(TranslationBase.of(context).heart, mode.hartRat, TranslationBase.of(context).bpm, "assets/images/new/heart_rate.svg"));
|
|
vitalSigns.add(new VitalSign(TranslationBase.of(context).respirationRate, mode.respirationBeatPerMinute, TranslationBase.of(context).bpm, "assets/images/new/respiration_rate.svg"));
|
|
vitalSigns.add(new VitalSign(TranslationBase.of(context).bloodPressure, mode.bloodPressure, TranslationBase.of(context).sysDias, "assets/images/new/blood_pressure.svg"));
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
imagesInfo.add(ImagesInfo(
|
|
imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vital-signs/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vital-signs/ar/0.png'));
|
|
imagesInfo.add(ImagesInfo(
|
|
imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vital-signs/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vital-signs/ar/1.png'));
|
|
return BaseView<VitalSignViewModel>(
|
|
onModelReady: appointmentNo != null && projectID != null ? (model) => model.getPatientVitalSign(appointmentNo: appointmentNo, projectID: projectID) : (model) => model.getPatientVitalSign(),
|
|
builder: (_, mode, widget) {
|
|
initList(context, mode);
|
|
return AppScaffold(
|
|
isShowAppBar: true,
|
|
appBarTitle: TranslationBase.of(context).vitalSigns,
|
|
baseViewModel: mode,
|
|
description: TranslationBase.of(context).infoSigns,
|
|
imagesInfo: imagesInfo,
|
|
showNewAppBar: true,
|
|
showNewAppBarTitle: true,
|
|
backgroundColor: Color(0xFFF7F7F7),
|
|
body: mode.vitalSignResModelList.length > 0
|
|
? Container(
|
|
width: double.infinity,
|
|
child: ListView(
|
|
children: [
|
|
Container(
|
|
child: Card(
|
|
margin: EdgeInsets.only(left: 20, right: 20, top: 20, bottom: 6),
|
|
shape: cardRadius(12),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(12.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
"Body Mass Index is: " + mode.bodyMax,
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
letterSpacing: -0.64,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
mHeight(20),
|
|
Container(
|
|
height: MediaQuery.of(context).size.width / 2.8,
|
|
child: Row(
|
|
children: [
|
|
showMass(context, "Underweight", "< 18.5", double.parse(mode.bodyMax) <= 18.5 ? Colors.red : Colors.black, 8),
|
|
mWidth(12),
|
|
showMass(context, "Normal", "18.5 - 24.9", (double.parse(mode.bodyMax) > 18.5 && double.parse(mode.bodyMax) < 25) ? Colors.red : Colors.black, 6),
|
|
mWidth(12),
|
|
showMass(context, "Overweight", "25 - 29.9", (double.parse(mode.bodyMax) >= 25 && double.parse(mode.bodyMax) < 30) ? Colors.red : Colors.black, 4),
|
|
mWidth(12),
|
|
showMass(context, "Obese", "30 - 34.9", (double.parse(mode.bodyMax) >= 30 && double.parse(mode.bodyMax) < 35) ? Colors.red : Colors.black, 2),
|
|
mWidth(12),
|
|
showMass(context, "Extreme Obese", "> 35", (double.parse(mode.bodyMax) >= 35) ? Colors.red : Colors.black, 0),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
mHeight(2),
|
|
Container(
|
|
padding: EdgeInsets.only(left: 16, right: 16, bottom: 16),
|
|
child: GridView.builder(
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 2 / 2, crossAxisSpacing: 12, mainAxisSpacing: 12),
|
|
itemCount: vitalSigns.length,
|
|
padding: EdgeInsets.all(4),
|
|
physics: NeverScrollableScrollPhysics(),
|
|
shrinkWrap: true,
|
|
itemBuilder: (BuildContext context, int index) {
|
|
return InkWell(
|
|
onTap: () {
|
|
if (index == 0) {
|
|
if (isNotOneAppointment) {
|
|
Navigator.push(
|
|
context,
|
|
FadePage(
|
|
page: VitalSignItemDetailsScreen(
|
|
pageKey: VitalSignDetails.Height,
|
|
pageTitle: TranslationBase.of(context).height,
|
|
vitalList: mode.vitalSignResModelList,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} else if (index == 1) {
|
|
if (isNotOneAppointment) {
|
|
Navigator.push(
|
|
context,
|
|
FadePage(
|
|
page: VitalSignItemDetailsScreen(
|
|
pageKey: VitalSignDetails.Weight,
|
|
pageTitle: TranslationBase.of(context).weight,
|
|
vitalList: mode.vitalSignResModelList,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} else if (index == 2) {
|
|
if (isNotOneAppointment) {
|
|
Navigator.push(
|
|
context,
|
|
FadePage(
|
|
page: VitalSignItemDetailsScreen(
|
|
pageKey: VitalSignDetails.Temperature,
|
|
pageTitle:
|
|
TranslationBase.of(context).temperature,
|
|
vitalList: mode.vitalSignResModelList,
|
|
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} else if (index == 3) {
|
|
if (isNotOneAppointment) {
|
|
Navigator.push(
|
|
context,
|
|
FadePage(
|
|
page: VitalSignItemDetailsScreen(
|
|
pageKey: VitalSignDetails.heart,
|
|
pageTitle: TranslationBase.of(context).heart,
|
|
vitalList: mode.vitalSignResModelList,
|
|
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} else if (index == 4) {
|
|
if (isNotOneAppointment) {
|
|
Navigator.push(
|
|
context,
|
|
FadePage(
|
|
page: VitalSignItemDetailsScreen(
|
|
pageKey: VitalSignDetails.Respiration,
|
|
pageTitle:
|
|
TranslationBase.of(context).respirationRate,
|
|
vitalList: mode.vitalSignResModelList,
|
|
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} else if (index == 5) {
|
|
if (isNotOneAppointment) {
|
|
Navigator.push(
|
|
context,
|
|
FadePage(
|
|
page: VitalSignItemDetailsScreen(
|
|
pageKey: VitalSignDetails.BloodPressure,
|
|
pageTitle: TranslationBase.of(context).bloodPressure,
|
|
vitalList: mode.vitalSignResModelList,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
},
|
|
child: VitalSignItem(
|
|
vitalSign: vitalSigns[index],
|
|
),
|
|
);
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
)
|
|
: Center(
|
|
child: Texts('No Data'),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
Widget showMass(BuildContext context, String title, String weight, Color color, int f) {
|
|
return Expanded(
|
|
flex: 1,
|
|
child: Container(
|
|
height: double.infinity,
|
|
width: double.infinity,
|
|
child: Column(
|
|
children: [
|
|
Flexible(
|
|
child: Row(
|
|
children: [
|
|
mFlex(f),
|
|
Flexible(
|
|
flex: 10,
|
|
child: SvgPicture.asset(
|
|
"assets/images/new/mass/health_BMI.svg",
|
|
height: double.infinity,
|
|
width: double.infinity,
|
|
fit: BoxFit.fill,
|
|
color: color,
|
|
),
|
|
),
|
|
mFlex(f),
|
|
],
|
|
),
|
|
),
|
|
mHeight(20),
|
|
AutoSizeText(
|
|
title,
|
|
maxLines: 1,
|
|
minFontSize: 6,
|
|
style: TextStyle(
|
|
color: color,
|
|
fontSize: 10,
|
|
letterSpacing: -0.6,
|
|
),
|
|
),
|
|
AutoSizeText(
|
|
weight,
|
|
maxLines: 1,
|
|
minFontSize: 6,
|
|
style: TextStyle(
|
|
color: color,
|
|
fontSize: 10,
|
|
letterSpacing: -0.6,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|