WIP: start of vida plus soap index

update_flutter_3.24_vida_plus_episode_v2
taha.alam 1 year ago
parent 415b2174e7
commit 204d4531a5

@ -59,6 +59,7 @@ const String PATIENT_INSURANCE_APPROVALS_NEW = 'patients/patient_insurance_appro
const String VITAL_SIGN_DETAILS = 'patients/vital-sign-details';
const String CREATE_EPISODE = 'patients/create-episode';
const String UPDATE_EPISODE = 'patients/update-episode';
const String UPDATE_EPISODE_VIDA_PLUS = 'patients/update-episode-vida-plus';
const String PATIENT_ADMISSION_REQUEST = 'patients/admission-request';
const String PATIENT_ADMISSION_REQUEST_2 = 'patients/admission-request-second';
const String PATIENT_ADMISSION_REQUEST_3 = 'patients/admission-request-third';

@ -0,0 +1,270 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/view_state.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_allergy.dart';
import 'package:doctor_app_flutter/core/model/SOAP/selected_items/my_selected_history.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/subjective/update_subjective_page.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import 'assessment/update_assessment_page.dart';
import 'objective/update_objective_page.dart';
import 'plan/update_plan_page.dart';
class UpdateSoapIndex extends StatefulWidget {
final bool isUpdate;
const UpdateSoapIndex({Key? key, this.isUpdate = false}) : super(key: key);
@override
_UpdateSoapIndexState createState() => _UpdateSoapIndexState();
}
class _UpdateSoapIndexState extends State<UpdateSoapIndex> with TickerProviderStateMixin {
PageController? _controller;
int _currentIndex = 0;
List<MySelectedAllergy> myAllergiesList = [];
List<MySelectedHistory> myHistoryList = [];
changePageViewIndex(pageIndex, {isChangeState = true}) {
if (pageIndex != _currentIndex && isChangeState) changeLoadingState(true);
_controller!.jumpToPage(pageIndex);
setState(() {
_currentIndex = pageIndex;
});
}
bool _isLoading = true;
@override
void initState() {
_controller = new PageController();
super.initState();
}
void changeLoadingState(isLoading) {
setState(() {
_isLoading = isLoading;
});
}
void changeStateFun() {
setState(() {});
}
@override
Widget build(BuildContext context) {
final routeArgs = ModalRoute.of(context)!.settings.arguments as Map;
PatiantInformtion patient = routeArgs['patient'];
return BaseView<SOAPViewModel>(
builder: (_, model, w) => AppScaffold(
isLoading: _isLoading,
isShowAppBar: true,
appBar: PatientProfileAppBar(patient),
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
decoration: BoxDecoration(boxShadow: <BoxShadow>[], color: Theme.of(context).scaffoldBackgroundColor),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
color: Theme.of(context).scaffoldBackgroundColor,
height: MediaQuery.of(context).size.height * 0.73,
child: PageView(
physics: NeverScrollableScrollPhysics(),
controller: _controller,
onPageChanged: (index) {
setState(() {
_currentIndex = index;
});
},
scrollDirection: Axis.horizontal,
children: <Widget>[
//todo add widgets here
],
),
)
],
),
),
],
),
),
bottomSheet: _isLoading
? Container(
height: 0,
)
: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(
Radius.circular(0.0),
),
border: Border.all(color: HexColor('#707070'), width: 0),
),
height: SizeConfig.heightMultiplier! * (SizeConfig.isHeightVeryShort ? 12 : 10),
width: double.infinity,
child: Column(
children: [
SizedBox(
height: 10,
),
Container(
child: FractionallySizedBox(widthFactor: .80, child: getBottomSheet(model, patient)),
),
SizedBox(
height: 5,
),
],
),
),
),
);
}
Widget getBottomSheet(SOAPViewModel model, PatiantInformtion patient) {
switch (_currentIndex) {
case 0:
{
return Center(
child: AppButton(
title: TranslationBase.of(context).next,
fontWeight: FontWeight.w600,
color: Colors.red[700]!,
onPressed: () async {
model.nextOnSubjectPage(model);
},
),
);
}
break;
case 1:
{
return Center(
child: Row(
children: [
Expanded(
child: AppButton(
title: TranslationBase.of(context).previous,
color: Colors.grey[300]!,
// height: SizeConfig.heightMultiplier! *
// (SizeConfig.isHeightVeryShort ? 8 : 6),
// padding: 10,
fontColor: Colors.black,
fontWeight: FontWeight.w600,
onPressed: () {
changePageViewIndex(0);
},
),
),
SizedBox(
width: 5,
),
Expanded(
child: AppButton(
title: patient.admissionNo != null && patient.admissionNo!.isNotEmpty && !model.isAddExamInProgress ? TranslationBase.of(context).finish : TranslationBase.of(context).next,
fontWeight: FontWeight.w600,
color: Colors.red[700]!,
// height: SizeConfig.heightMultiplier! *
// (SizeConfig.isHeightVeryShort ? 8 : 6),
// padding: 10,
disabled: model.state == ViewState.BusyLocal,
onPressed: () async {
await model.nextOnObjectivePage(model);
},
),
),
],
),
);
}
break;
case 2:
{
return Center(
child: Row(
children: [
Expanded(
child: AppButton(
title: TranslationBase.of(context).previous,
color: Colors.grey[300]!,
fontColor: Colors.black,
fontWeight: FontWeight.w600,
disabled: model.state == ViewState.BusyLocal,
onPressed: () async {
changePageViewIndex(1);
},
),
),
SizedBox(
width: 5,
),
Expanded(
child: AppButton(
title: TranslationBase.of(context).next,
fontWeight: FontWeight.w600,
color: Colors.red[700]!,
disabled: model.state == ViewState.BusyLocal,
onPressed: () async {
model.nextOnAssessmentPage(model);
},
),
),
],
),
);
}
break;
case 3:
{
return Center(
child: Row(
children: [
Expanded(
child: AppButton(
title: TranslationBase.of(context).previous,
color: Colors.grey[300]!,
fontColor: Colors.black,
fontWeight: FontWeight.w600,
disabled: model.state == ViewState.BusyLocal,
onPressed: () async {
changePageViewIndex(2);
},
),
),
SizedBox(
width: 5,
),
Expanded(
child: AppButton(
title: model.isAddProgress ? TranslationBase.of(context).next : TranslationBase.of(context).finish,
fontWeight: FontWeight.w600,
color: Colors.red[700]!,
disabled: model.progressNoteText.isEmpty,
onPressed: () async {
model.nextOnPlanPage(model);
},
),
),
],
),
);
}
break;
}
return SizedBox();
}
}
Loading…
Cancel
Save