|
|
|
|
@ -1,10 +1,16 @@
|
|
|
|
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/core/viewModel/doctor_replay_view_model.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/screens/doctor/doctor_repaly_chat.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/helpers.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/doctor/doctor_reply_widget.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart';
|
|
|
|
|
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
@ -15,21 +21,27 @@ import 'package:flutter/material.dart';
|
|
|
|
|
*@return:
|
|
|
|
|
*@desc: Doctor Reply Screen display data from GtMyPatientsQuestions service
|
|
|
|
|
*/
|
|
|
|
|
class DoctorReplyScreen extends StatelessWidget {
|
|
|
|
|
|
|
|
|
|
class DoctorReplyScreen extends StatefulWidget {
|
|
|
|
|
final Function changeCurrentTab;
|
|
|
|
|
|
|
|
|
|
const DoctorReplyScreen({Key key, this.changeCurrentTab}) : super(key: key);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_DoctorReplyScreenState createState() => _DoctorReplyScreenState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _DoctorReplyScreenState extends State<DoctorReplyScreen> {
|
|
|
|
|
int pageIndex = 1;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return BaseView<DoctorReplayViewModel>(
|
|
|
|
|
onModelReady: (model) {
|
|
|
|
|
model.getDoctorReply();
|
|
|
|
|
model.getDoctorReply(isLocalBusy: false);
|
|
|
|
|
},
|
|
|
|
|
builder: (_, model, w) => WillPopScope(
|
|
|
|
|
onWillPop: ()async{
|
|
|
|
|
changeCurrentTab();
|
|
|
|
|
onWillPop: () async {
|
|
|
|
|
widget.changeCurrentTab();
|
|
|
|
|
return false;
|
|
|
|
|
},
|
|
|
|
|
child: AppScaffold(
|
|
|
|
|
@ -38,36 +50,63 @@ class DoctorReplyScreen extends StatelessWidget {
|
|
|
|
|
isShowAppBar: false,
|
|
|
|
|
body: model.listDoctorWorkingHoursTable.isEmpty
|
|
|
|
|
? DrAppEmbeddedError(error: TranslationBase.of(context).noItem)
|
|
|
|
|
: Container(
|
|
|
|
|
padding: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0),
|
|
|
|
|
child: ListView(
|
|
|
|
|
children: [
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children:
|
|
|
|
|
model.listDoctorWorkingHoursTable.map((reply) {
|
|
|
|
|
return InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (BuildContext context) =>
|
|
|
|
|
DoctorReplayChat(
|
|
|
|
|
reply: reply,
|
|
|
|
|
previousModel: model,
|
|
|
|
|
), settings: RouteSettings(name: 'DoctorReplayChat'),));
|
|
|
|
|
},
|
|
|
|
|
child: DoctorReplyWidget(reply: reply),
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
: Column(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Container(
|
|
|
|
|
padding: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0),
|
|
|
|
|
child: NotificationListener(
|
|
|
|
|
child: ListView.builder(
|
|
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
|
|
|
|
|
itemBuilder: (BuildContext ctxt, int index) {
|
|
|
|
|
return Column(
|
|
|
|
|
children: [
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
MaterialPageRoute(
|
|
|
|
|
builder: (BuildContext context) =>
|
|
|
|
|
DoctorReplayChat(
|
|
|
|
|
reply:
|
|
|
|
|
model.listDoctorWorkingHoursTable[
|
|
|
|
|
index],
|
|
|
|
|
previousModel: model,
|
|
|
|
|
),
|
|
|
|
|
settings: RouteSettings(
|
|
|
|
|
name: 'DoctorReplayChat'),
|
|
|
|
|
));
|
|
|
|
|
},
|
|
|
|
|
child: DoctorReplyWidget(
|
|
|
|
|
reply: model
|
|
|
|
|
.listDoctorWorkingHoursTable[index]),
|
|
|
|
|
),
|
|
|
|
|
if(model.state == ViewState.BusyLocal &&index ==model.listDoctorWorkingHoursTable.length-1)
|
|
|
|
|
DrAppCircularProgressIndeicator()
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
onNotification: (t) {
|
|
|
|
|
if (t is ScrollEndNotification &&
|
|
|
|
|
model.state != ViewState.BusyLocal) {
|
|
|
|
|
print("${model.state}");
|
|
|
|
|
setState(() {
|
|
|
|
|
pageIndex++;
|
|
|
|
|
});
|
|
|
|
|
model.getDoctorReply(pageIndex: pageIndex);
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|