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.
165 lines
6.5 KiB
Dart
165 lines
6.5 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:doctor_app_flutter/core/enum/view_state.dart';
|
|
import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart';
|
|
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.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/patient_search/patient_search_header.dart';
|
|
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
|
|
import 'package:doctor_app_flutter/widgets/patients/patient_card/PatientCard.dart';
|
|
import 'package:doctor_app_flutter/widgets/shared/app_loader_widget.dart';
|
|
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
|
import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart';
|
|
import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_field_custom_serach.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
import '../../routes.dart';
|
|
|
|
class LiveCarePatientScreen extends StatefulWidget {
|
|
@override
|
|
_LiveCarePatientScreenState createState() => _LiveCarePatientScreenState();
|
|
}
|
|
|
|
class _LiveCarePatientScreenState extends State<LiveCarePatientScreen> {
|
|
final _controller = TextEditingController();
|
|
|
|
Timer timer;
|
|
LiveCarePatientViewModel _liveCareViewModel;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
timer = Timer.periodic(Duration(seconds: 10), (Timer t) {
|
|
if (_liveCareViewModel != null) {
|
|
_liveCareViewModel.getPendingPatientERForDoctorApp(isFromTimer: true);
|
|
}
|
|
});
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_liveCareViewModel.isLogin(0);
|
|
_liveCareViewModel = null;
|
|
timer?.cancel();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BaseView<LiveCarePatientViewModel>(
|
|
onModelReady: (model) async {
|
|
_liveCareViewModel = model;
|
|
await model.getPendingPatientERForDoctorApp();
|
|
await model.isLogin(1);
|
|
},
|
|
builder: (_, model, w) => AppScaffold(
|
|
baseViewModel: model,
|
|
isShowAppBar: true,
|
|
appBar: PatientSearchHeader(
|
|
title: "LiveCare Patients",
|
|
),
|
|
body: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Container(
|
|
padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
),
|
|
child: Container(),
|
|
),
|
|
SizedBox(
|
|
height: 20,
|
|
),
|
|
AppTextFieldCustomSearch(
|
|
searchController: _controller,
|
|
onChangeFun: (value) {
|
|
model.searchData(value);
|
|
},
|
|
marginTop: 5,
|
|
suffixIcon: IconButton(
|
|
icon: Icon(
|
|
DoctorApp.filter_1,
|
|
color: Colors.black,
|
|
),
|
|
iconSize: 20,
|
|
),
|
|
),
|
|
model.state == ViewState.Idle
|
|
? Expanded(
|
|
child: Container(
|
|
child: model.filterData.isEmpty
|
|
? Center(
|
|
child: ErrorMessage(
|
|
error: TranslationBase.of(context)
|
|
.youDontHaveAnyPatient,
|
|
),
|
|
)
|
|
: ListView.builder(
|
|
scrollDirection: Axis.vertical,
|
|
shrinkWrap: true,
|
|
itemCount: model.filterData.length,
|
|
itemBuilder: (BuildContext ctxt, int index) {
|
|
return Padding(
|
|
padding: EdgeInsets.all(8.0),
|
|
child: PatientCard(
|
|
patientInfo: PatiantInformtion.fromJson(
|
|
model.filterData[index].toJson()),
|
|
patientType: "0",
|
|
arrivalType: "0",
|
|
isFromSearch: false,
|
|
isInpatient: false,
|
|
isFromLiveCare: true,
|
|
onTap: () {
|
|
// TODO change the parameter to daynamic
|
|
Navigator.of(context).pushNamed(
|
|
PATIENTS_PROFILE,
|
|
arguments: {
|
|
"patient":
|
|
PatiantInformtion.fromJson(
|
|
model.filterData[index]
|
|
.toJson()),
|
|
"patientType": "0",
|
|
"isSearch": false,
|
|
"isInpatient": false,
|
|
"arrivalType": "0",
|
|
"isSearchAndOut": false,
|
|
"isFromLiveCare": true,
|
|
});
|
|
},
|
|
// isFromSearch: widget.isSearch,
|
|
),
|
|
);
|
|
})),
|
|
)
|
|
: Expanded(
|
|
child: AppLoaderWidget(
|
|
containerColor: Colors.transparent,
|
|
)),
|
|
// AppButton(
|
|
// fontWeight: FontWeight.w700,
|
|
// color:AppGlobal.appGreenColor[600],
|
|
// title: TranslationBase.of(context).initiateCall,
|
|
// disabled: model.state == ViewState.BusyLocal,
|
|
// onPressed: () async {
|
|
// AppPermissionsUtils.requestVideoCallPermission(context: context,onTapGrant: (){
|
|
// locator<VideoCallService>().openVideo(model.startCallRes, PatiantInformtion(
|
|
// vcId: 454353,
|
|
// fullName: "test mosa"
|
|
// ), callConnected, callDisconnected);
|
|
// });
|
|
//
|
|
// },
|
|
// ),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
callConnected() {}
|
|
|
|
callDisconnected() {}
|
|
}
|