import 'package:hmg_patient_app/core/model/labs/patient_lab_orders.dart'; import 'package:hmg_patient_app/core/viewModels/medical/labs_view_model.dart'; import 'package:hmg_patient_app/core/viewModels/project_view_model.dart'; import 'package:hmg_patient_app/pages/base/base_view.dart'; import 'package:hmg_patient_app/theme/colors.dart'; import 'package:hmg_patient_app/uitl/utils.dart'; import 'package:hmg_patient_app/uitl/utils_new.dart'; import 'package:hmg_patient_app/widgets/charts/show_chart.dart'; import 'package:hmg_patient_app/widgets/data_display/text.dart'; import 'package:hmg_patient_app/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import '../../../../core/enum/viewstate.dart'; import '../../../../uitl/translations_delegate_base.dart'; import '../../../Loader/gif_loader_container.dart'; import 'full_screen_lab_result_graph.dart'; import 'lab_result_chart_and_detials.dart'; import 'lab_result_graph.dart'; class FlowChartPage extends StatelessWidget { final PatientLabOrders? patientLabOrder; final String? filterName; FlowChartPage({this.patientLabOrder, this.filterName}); ProjectViewModel? projectViewModel; @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getPatientLabOrdersResults(patientLabOrder: patientLabOrder, procedure: filterName, isVidaPlus: Utils.isVidaPlusProject(projectViewModel!, int.parse(patientLabOrder!.projectID!))), builder: (context, model, w) { return SizedBox( height: MediaQuery.sizeOf(context).height * .75, child: (model.state == ViewState.Busy) ? Material( color: Colors.grey.withOpacity(0.6), shape: RoundedRectangleBorder(borderRadius: BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20))), child: Center( child: Container(child: GifLoaderContainer(), margin: EdgeInsets.only(bottom: MediaQuery.of(context).size.height * 0.09)), ), ) : SingleChildScrollView( child: model.labOrdersResultsList.isNotEmpty ? Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ Padding( padding: const EdgeInsets.only(top: 16.0, right: 16.0, bottom: 10, left: 16.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( filterName ?? "", style: TextStyle( fontSize: 21, fontWeight: FontWeight.w700, color: Colors.black, letterSpacing: -0.64, ), ), GestureDetector( onTap: () => Navigator.pop(context), child: Align( alignment: Alignment.centerRight, child: Icon( Icons.close, color: Colors.black, size: 28, ), ), ), ], ), ), Container( width: double.infinity, padding: EdgeInsets.only(left: 17, top: 12, right: 13, bottom: 12), margin: EdgeInsets.only(left: 21, right: 21, top: 21), decoration: BoxDecoration( shape: BoxShape.rectangle, color: Colors.white, borderRadius: BorderRadius.all( Radius.circular(10.0), ), boxShadow: [ BoxShadow( color: Color(0xff000000).withOpacity(.05), //spreadRadius: 5, blurRadius: 27, offset: Offset(0, -3), ), ], ), // child: LineChartCurved( // title: filterName, // labResult: model.labOrdersResultsList, // ), // child: ShowChart( // title: filterName!, // timeSeries: model.timeSeries, // indexes: model.timeSeries.length ~/ 5.5 ?? 0, // ), child: Column( children: [ SizedBox( height: MediaQuery.sizeOf(context).height / 4, child: DynamicResultChart( dataPoints: model.threePointGraphValue, thresholds: model.threshold, maxY: model.maxYForThreeDots, width: MediaQuery.sizeOf(context).width - 77, scrollDirection: Axis.horizontal, height: MediaQuery.sizeOf(context).height / 4, ), ), InkWell( onTap: () { model.createFullGraphDatPoints(() { Navigator.push(context, MaterialPageRoute(builder: (_) { return FullScreenGraph(completeeGraphValues: model.completeeGraphValues, threshold: model.threshold, maxY: model.maxYForCompleteGraph); })); }); }, // child: Text(TranslationBase.of(context) // .seeAllGraphValues), child: Utils.tableColumnValueWithUnderLine(TranslationBase.of(context).seeAllGraphValues, isLast: true, isCapitable: false), ) ], ), ), LabResultChartAndDetails( name: filterName!, // labResult: model.labOrdersResultsList, labResult: model.labOrdersResultsList.reversed.toList(), ), ], ) : Center( child: Container( padding: EdgeInsets.only(top: MediaQuery.of(context).size.height * 0.32), child: Center( child: getNoDataWidget(context), ), ), ), ), ); }); } }