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.
219 lines
7.3 KiB
Dart
219 lines
7.3 KiB
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/vital_signs/data/vitals_benchmark.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
class VitalSignWidget extends StatelessWidget {
|
|
final String vitalSignName;
|
|
final String vitalSignValue;
|
|
final String vectorUrl;
|
|
final RangeConditionWithTitle condition;
|
|
final Color? textColor;
|
|
|
|
const VitalSignWidget({
|
|
Key? key,
|
|
required this.vitalSignName,
|
|
required this.vitalSignValue,
|
|
this.textColor,
|
|
required this.condition,
|
|
required this.vectorUrl,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Card(
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
color: Colors.white,
|
|
elevation: 2,
|
|
shadowColor: CustomColors.lightGreyColor,
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(12.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
SvgPicture.asset(vectorUrl, width: 36.0, height: 36.0),
|
|
SizedBox(
|
|
width: 16,
|
|
),
|
|
Text(
|
|
vitalSignName,
|
|
textAlign: TextAlign.start,
|
|
style: TextStyle(
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.w600,
|
|
color: textColor ?? Colors.white,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 8,
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
"$vitalSignValue ${condition.unit}",
|
|
style: TextStyle(
|
|
fontSize: 14,
|
|
color: textColor ?? Colors.white,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: 8,
|
|
),
|
|
|
|
Status(
|
|
status:
|
|
"${TranslationBase.of(context).getValue(condition.current?.quantitativeInterpretation ?? '')}")
|
|
// Text(
|
|
// "${TranslationBase.of(context).getValue(condition.current?.quantitativeInterpretation ?? '')}",
|
|
// style: TextStyle(
|
|
// fontSize: 14,
|
|
// color: textColor ?? Colors.white,
|
|
// fontWeight: FontWeight.w500,
|
|
// ),
|
|
// ),
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 8,
|
|
),
|
|
// SizedBox(
|
|
// height: 30,
|
|
// child: Row(mainAxisSize: MainAxisSize.max, children: [
|
|
// Expanded(
|
|
// flex: 1,
|
|
// child: ListView.separated(
|
|
// separatorBuilder: (_, __) => SizedBox(
|
|
// width: 8,
|
|
// ),
|
|
// scrollDirection: Axis.horizontal,
|
|
// shrinkWrap: true,
|
|
// itemCount: condition.condition?.length ?? 0,
|
|
// itemBuilder: (_, index) => RangeWidget(
|
|
// title: condition.condition?[index].title ?? 'test',
|
|
// isSelected: condition.condition?[index]
|
|
// .isInRange(vitalSignValue) ==
|
|
// true,
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ]),
|
|
// ),
|
|
SizedBox(
|
|
height: 8,
|
|
),
|
|
// Row(
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
// children: [
|
|
// Text(
|
|
// TranslationBase.of(context).getValue(
|
|
// condition.condition?.first.interpretation ?? ''),
|
|
// style: TextStyle(
|
|
// fontSize: 14,
|
|
// color: textColor ?? Colors.white,
|
|
// fontWeight: FontWeight.w500,
|
|
// ),
|
|
// ),
|
|
// Text(
|
|
// TranslationBase.of(context).getValue(
|
|
// condition.condition?.last.interpretation ?? ''),
|
|
// style: TextStyle(
|
|
// fontSize: 14,
|
|
// color: textColor ?? Colors.white,
|
|
// fontWeight: FontWeight.w500,
|
|
// ),
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// SizedBox(
|
|
// height: 8,
|
|
// ),
|
|
]),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class RangeWidget extends StatelessWidget {
|
|
final String title;
|
|
final bool isSelected;
|
|
|
|
const RangeWidget({super.key, required this.title, required this.isSelected});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SizedBox(
|
|
height: 30,
|
|
child: Material(
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(3),
|
|
),
|
|
// color: Color(0xFF359846),
|
|
color: (isSelected)
|
|
? CustomColors.accentColor
|
|
: CustomColors.lightGreyColor,
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Center(
|
|
child: Text(
|
|
title,
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
color: (isSelected) ? Colors.white : Colors.black,
|
|
fontSize: 12),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class Status extends StatelessWidget {
|
|
final String status;
|
|
|
|
const Status({super.key, required this.status});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Material(
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(3),
|
|
),
|
|
// color: Color(0xFF359846),
|
|
color: (status.toLowerCase() == 'good' ||
|
|
status.toLowerCase() == 'excellent' ||
|
|
status.toLowerCase() == 'normal')
|
|
? Color(0xFFD8E8DB)
|
|
: (status.toLowerCase() == 'poor' || status.toLowerCase() == 'low')
|
|
? Color(0xFFD3D37E)
|
|
: Color(0x98d02127),
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 6),
|
|
child: Text(status,
|
|
style: TextStyle(
|
|
color: (status.toLowerCase() == 'good' ||
|
|
status.toLowerCase() == 'excellent' ||
|
|
status.toLowerCase() == 'normal')
|
|
? Color(0xFF359846)
|
|
: (status.toLowerCase() == 'poor' ||
|
|
status.toLowerCase() == 'low')
|
|
? Colors.white
|
|
: Colors.white,
|
|
fontSize: 8,
|
|
fontWeight: FontWeight.w600,
|
|
)),
|
|
));
|
|
}
|
|
}
|