Merge branch 'replay_taps' into 'development'
Replay taps See merge request Cloud_Solution/doctor_app_flutter!837merge-requests/838/merge
commit
57d34425ba
@ -0,0 +1,101 @@
|
|||||||
|
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/util/translations_delegate_base.dart';
|
||||||
|
import 'package:doctor_app_flutter/screens/doctor/doctor_replay/doctor_reply_widget.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_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/errors/error_message.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'doctor_repaly_chat.dart';
|
||||||
|
|
||||||
|
class AllDoctorQuestions extends StatefulWidget {
|
||||||
|
final Function changeCurrentTab;
|
||||||
|
|
||||||
|
const AllDoctorQuestions({Key key, this.changeCurrentTab}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_AllDoctorQuestionsState createState() => _AllDoctorQuestionsState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AllDoctorQuestionsState extends State<AllDoctorQuestions> {
|
||||||
|
|
||||||
|
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
|
||||||
|
?ErrorMessage(error: TranslationBase.of(context).noItem)// DrAppEmbeddedError(error: TranslationBase.of(context).noItem)
|
||||||
|
: Column(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0),
|
||||||
|
child: NotificationListener(
|
||||||
|
child: ListView.builder(
|
||||||
|
scrollDirection: Axis.vertical,
|
||||||
|
itemCount: model.listDoctorWorkingHoursTable.length,
|
||||||
|
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 ScrollUpdateNotification && t.metrics.pixels >= t.metrics.maxScrollExtent - 50 &&
|
||||||
|
model.state != ViewState.BusyLocal) {
|
||||||
|
setState(() {
|
||||||
|
pageIndex++;
|
||||||
|
});
|
||||||
|
model.getDoctorReply(pageIndex: pageIndex);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,185 @@
|
|||||||
|
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_replay/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/screens/doctor/doctor_replay/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:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'all_doctor_questions.dart';
|
||||||
|
import 'not_replaied_Doctor_Questions.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>
|
||||||
|
with SingleTickerProviderStateMixin {
|
||||||
|
TabController _tabController;
|
||||||
|
int _activeTab = 0;
|
||||||
|
int pageIndex = 1;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_tabController = TabController(length: 2, vsync: this);
|
||||||
|
_tabController.addListener(_handleTabSelection);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
_tabController.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
_handleTabSelection() {
|
||||||
|
setState(() {
|
||||||
|
_activeTab = _tabController.index;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final screenSize = MediaQuery.of(context).size;
|
||||||
|
|
||||||
|
return WillPopScope(
|
||||||
|
onWillPop: () async {
|
||||||
|
widget.changeCurrentTab();
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
child: AppScaffold(
|
||||||
|
appBarTitle: TranslationBase.of(context).replay2,
|
||||||
|
isShowAppBar: false,
|
||||||
|
body: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Scaffold(
|
||||||
|
extendBodyBehindAppBar: false,
|
||||||
|
appBar: PreferredSize(
|
||||||
|
preferredSize: Size.fromHeight(
|
||||||
|
MediaQuery.of(context).size.height * 0.070),
|
||||||
|
child: Container(
|
||||||
|
height: MediaQuery.of(context).size.height * 0.070,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border(
|
||||||
|
bottom: BorderSide(
|
||||||
|
color: Theme.of(context).dividerColor,
|
||||||
|
width: 0.5), //width: 0.7
|
||||||
|
),
|
||||||
|
color: Colors.white),
|
||||||
|
child: Center(
|
||||||
|
child: TabBar(
|
||||||
|
isScrollable: false,
|
||||||
|
controller: _tabController,
|
||||||
|
indicatorColor: Colors.transparent,
|
||||||
|
indicatorWeight: 1.0,
|
||||||
|
indicatorSize: TabBarIndicatorSize.tab,
|
||||||
|
labelColor: Theme.of(context).primaryColor,
|
||||||
|
labelPadding: EdgeInsets.only(
|
||||||
|
top: 0, left: 0, right: 0, bottom: 0),
|
||||||
|
unselectedLabelColor: Colors.grey[800],
|
||||||
|
tabs: [
|
||||||
|
tabWidget(
|
||||||
|
screenSize,
|
||||||
|
_activeTab == 0,
|
||||||
|
"Not Replied",
|
||||||
|
),
|
||||||
|
tabWidget(
|
||||||
|
screenSize,
|
||||||
|
_activeTab == 1,
|
||||||
|
TranslationBase.of(context).all,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: TabBarView(
|
||||||
|
physics: BouncingScrollPhysics(),
|
||||||
|
controller: _tabController,
|
||||||
|
children: [
|
||||||
|
NotRepliedDoctorQuestions(),
|
||||||
|
AllDoctorQuestions(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget tabWidget(Size screenSize, bool isActive, String title,
|
||||||
|
{int counter = -1}) {
|
||||||
|
return Center(
|
||||||
|
child: Container(
|
||||||
|
height: screenSize.height * 0.070,
|
||||||
|
decoration: TextFieldsUtils.containerBorderDecoration(
|
||||||
|
isActive ? Color(0xFFD02127 /*B8382B*/) : Color(0xFFEAEAEA),
|
||||||
|
isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA),
|
||||||
|
borderRadius: 4,
|
||||||
|
borderWidth: 0),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
AppText(
|
||||||
|
title,
|
||||||
|
fontSize: SizeConfig.textMultiplier * 1.5,
|
||||||
|
color: isActive ? Colors.white : Color(0xFF2B353E),
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
|
if (counter != -1)
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.all(4),
|
||||||
|
width: 15,
|
||||||
|
height: 15,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: isActive ? Colors.white : Color(0xFFD02127),
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: FittedBox(
|
||||||
|
child: AppText(
|
||||||
|
"$counter",
|
||||||
|
fontSize: SizeConfig.textMultiplier * 1.5,
|
||||||
|
color: !isActive ? Colors.white : Color(0xFFD02127),
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue