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.
108 lines
4.5 KiB
Dart
108 lines
4.5 KiB
Dart
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/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';
|
|
|
|
/*
|
|
*@author: Mohammad Aljammal
|
|
*@Date:28/4/2020
|
|
*@param:
|
|
*@return:
|
|
*@desc: Doctor Reply Screen display data from GtMyPatientsQuestions service
|
|
*/
|
|
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(isLocalBusy: false);
|
|
},
|
|
builder: (_, model, w) => WillPopScope(
|
|
onWillPop: () async {
|
|
widget.changeCurrentTab();
|
|
return false;
|
|
},
|
|
child: AppScaffold(
|
|
baseViewModel: model,
|
|
appBarTitle: TranslationBase.of(context).replay2,
|
|
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()
|
|
..add(InkWell(
|
|
onTap: () async {
|
|
setState(() {
|
|
pageIndex++;
|
|
});
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
await model.getDoctorReply(pageIndex: pageIndex);
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
Helpers.showErrorToast(model.error);
|
|
} else
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
},
|
|
child: Center(
|
|
child: Container(
|
|
padding: EdgeInsets.all(20),
|
|
child: AppText("${TranslationBase.of(context).seeMore}", fontSize: SizeConfig.getTextMultiplierBasedOnWidth()*4,),
|
|
),
|
|
),
|
|
)),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|