|
|
|
|
@ -1,8 +1,11 @@
|
|
|
|
|
import 'dart:math';
|
|
|
|
|
|
|
|
|
|
import 'package:hmg_patient_app/app_state/app_state.dart';
|
|
|
|
|
import 'package:hmg_patient_app/core/viewModels/project_view_model.dart';
|
|
|
|
|
import 'package:hmg_patient_app/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:hmg_patient_app/uitl/utils.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
///@author
|
|
|
|
|
///
|
|
|
|
|
@ -11,7 +14,7 @@ enum ResultTypes { lowCriticalLow, criticalLow, low, normal, high, criticalHigh,
|
|
|
|
|
class ItemResultCardWidget extends StatelessWidget {
|
|
|
|
|
final Widget child;
|
|
|
|
|
|
|
|
|
|
const ItemResultCardWidget({
|
|
|
|
|
ItemResultCardWidget({
|
|
|
|
|
Key? key,
|
|
|
|
|
required this.child,
|
|
|
|
|
}) : super(key: key);
|
|
|
|
|
@ -54,17 +57,18 @@ class CustomResultProgressBar extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
OverlayEntry? overlayEntry;
|
|
|
|
|
|
|
|
|
|
late ProjectViewModel projectViewModel;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
projectViewModel = Provider.of(context);
|
|
|
|
|
return LayoutBuilder(builder: (context, constraints) {
|
|
|
|
|
final double totalWidth = constraints.maxWidth;
|
|
|
|
|
final double spacing = 2;
|
|
|
|
|
final int spacingCount = 4; // between 5 bars
|
|
|
|
|
final double flexWidth = totalWidth - 50;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final double tooltipPosition =
|
|
|
|
|
(flexWidth * (percentage / 100)).clamp(0, flexWidth);
|
|
|
|
|
final double tooltipPosition = (flexWidth * (percentage / 100)).clamp(0, flexWidth);
|
|
|
|
|
|
|
|
|
|
return Stack(
|
|
|
|
|
children: [
|
|
|
|
|
@ -115,22 +119,39 @@ class CustomResultProgressBar extends StatelessWidget {
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
if (!percentage.isNegative)
|
|
|
|
|
Positioned(
|
|
|
|
|
left: tooltipPosition,
|
|
|
|
|
top: 33,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
TextCloud(
|
|
|
|
|
text: "${value}",
|
|
|
|
|
color: getColorForResultType(type),
|
|
|
|
|
width: 75,
|
|
|
|
|
height: 20,
|
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
|
axisDirection: AxisDirection.up,
|
|
|
|
|
projectViewModel.isArabic
|
|
|
|
|
? Positioned(
|
|
|
|
|
right: tooltipPosition,
|
|
|
|
|
top: 33,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
TextCloud(
|
|
|
|
|
text: "${value}",
|
|
|
|
|
color: getColorForResultType(type),
|
|
|
|
|
width: 75,
|
|
|
|
|
height: 20,
|
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
|
axisDirection: AxisDirection.up,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Positioned(
|
|
|
|
|
left: tooltipPosition,
|
|
|
|
|
top: 33,
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
TextCloud(
|
|
|
|
|
text: "${value}",
|
|
|
|
|
color: getColorForResultType(type),
|
|
|
|
|
width: 75,
|
|
|
|
|
height: 20,
|
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
|
axisDirection: AxisDirection.up,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
@ -369,7 +390,7 @@ class ItemResultCardWidgetWithParams extends StatelessWidget {
|
|
|
|
|
// child: Utils.tableColumnValueWithUnderLine(TranslationBase.of(context).viewFlowChart, isLast: true, isCapitable: false),
|
|
|
|
|
// ),
|
|
|
|
|
Visibility(
|
|
|
|
|
visible: shouldShowResultBarAndGraph,
|
|
|
|
|
visible: true,
|
|
|
|
|
child: GestureDetector(
|
|
|
|
|
onTap: onButtonPressed,
|
|
|
|
|
child: Utils.tableColumnValueWithUnderLine(TranslationBase.of(context).viewFlowChart, isLast: true, isCapitable: false),
|
|
|
|
|
|