|
|
|
|
@ -10,179 +10,160 @@ import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class HospitalsLiveChatPage extends StatefulWidget {
|
|
|
|
|
@override
|
|
|
|
|
_HospitalsLiveChatPageState createState() => _HospitalsLiveChatPageState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class _HospitalsLiveChatPageState extends State<HospitalsLiveChatPage> {
|
|
|
|
|
int tappedIndex;
|
|
|
|
|
String chat;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState()
|
|
|
|
|
{
|
|
|
|
|
super.initState();
|
|
|
|
|
tappedIndex=-1;
|
|
|
|
|
chat="";
|
|
|
|
|
}
|
|
|
|
|
int tappedIndex;
|
|
|
|
|
String chat;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
tappedIndex = -1;
|
|
|
|
|
chat = "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return BaseView<LiveChatViewModel>(
|
|
|
|
|
onModelReady: (model) => model.getLiveChatRequestOrders(),//getFindUsRequestOrders(),//model.getCOC(),
|
|
|
|
|
builder: (_, model, widget) => AppScaffold(
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
|
child: Container(
|
|
|
|
|
margin: EdgeInsets.only(left: 15,right: 15),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(height: 20,),
|
|
|
|
|
Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: 200,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
image: DecorationImage(
|
|
|
|
|
image: ExactAssetImage(
|
|
|
|
|
'assets/images/dashboard_top_bg.png'),
|
|
|
|
|
fit: BoxFit.cover),
|
|
|
|
|
),
|
|
|
|
|
child: Texts('You can now talk directly to the appointments department by chat or request a call back',color: Colors.white,textAlign: TextAlign.center,),
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return BaseView<LiveChatViewModel>(
|
|
|
|
|
onModelReady: (model) => model.getLiveChatRequestOrders(),
|
|
|
|
|
builder: (_, model, widget) => AppScaffold(
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
|
child: Container(
|
|
|
|
|
margin: EdgeInsets.only(left: 15, right: 15),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 20,
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: 200,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
image: DecorationImage(
|
|
|
|
|
image: ExactAssetImage(
|
|
|
|
|
'assets/images/dashboard_top_bg.png'),
|
|
|
|
|
fit: BoxFit.cover),
|
|
|
|
|
),
|
|
|
|
|
///////////
|
|
|
|
|
...List.generate(model.LiveChatModelList.length, (index) =>
|
|
|
|
|
Container(//FindusHospitalModelList.length
|
|
|
|
|
margin: EdgeInsets.only(left: 20, right: 20, bottom: 20),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
shape: BoxShape.rectangle,
|
|
|
|
|
border: Border.all(color: Colors.white, width: 0.5),
|
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(5)),
|
|
|
|
|
color: tappedIndex==index ? Colors.red:Colors.white ,
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
child: Padding(
|
|
|
|
|
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: Column(
|
|
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: (){
|
|
|
|
|
print(model.LiveChatModelList[index].value);
|
|
|
|
|
print(model.user.patientID);
|
|
|
|
|
print(model.user.firstName);
|
|
|
|
|
print(model.user.phoneOffice);
|
|
|
|
|
|
|
|
|
|
//changeStyle();
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
|
|
tappedIndex=index;
|
|
|
|
|
chat="http://chat.dshmg.com:7788/hmgchatapp/hmgchattest/Index.aspx?Name=${model.user.firstName}&PatientID=${model.user.patientID}&MobileNo=${model.user.mobileNumber}&Language=en&WorkGroup=${model.LiveChatModelList[index].value}";
|
|
|
|
|
});
|
|
|
|
|
// launch("http://chat.dshmg.com:7788/hmgchatapp/hmgchattest/Index.aspx?Name=TAMER&PatientID=1231755&MobileNo=537503378&Language=en&WorkGroup=Dubai_Eng_Chat");
|
|
|
|
|
// print("http://chat.dshmg.com:7788/hmgchatapp/hmgchattest/Index.aspx?Name=${model.user.firstName}&PatientID=${model.user.patientID}&MobileNo=${model.user.mobileNumber}&Language=en&WorkGroup=${model.LiveChatModelList[index].value}");
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.end,
|
|
|
|
|
|
|
|
|
|
child: Texts(
|
|
|
|
|
'You can now talk directly to the appointments department by chat or request a call back',
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
///////////
|
|
|
|
|
...List.generate(
|
|
|
|
|
model.LiveChatModelList.length,
|
|
|
|
|
(index) => Container(
|
|
|
|
|
margin:
|
|
|
|
|
EdgeInsets.only(left: 20, right: 20, bottom: 20),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
shape: BoxShape.rectangle,
|
|
|
|
|
border: Border.all(color: Colors.white, width: 0.5),
|
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(5)),
|
|
|
|
|
color: tappedIndex == index
|
|
|
|
|
? Colors.red
|
|
|
|
|
: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
|
|
|
|
|
Expanded(
|
|
|
|
|
InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
tappedIndex = index;
|
|
|
|
|
chat =
|
|
|
|
|
"http://chat.dshmg.com:7788/hmgchatapp/hmgchattest/Index.aspx?Name=${model.user.firstName}&PatientID=${model.user.patientID}&MobileNo=${model.user.mobileNumber}&Language=en&WorkGroup=${model.LiveChatModelList[index].value}";
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.center,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 4,
|
|
|
|
|
child: Container(
|
|
|
|
|
|
|
|
|
|
margin: EdgeInsets.only(left: 5,right: 5),
|
|
|
|
|
child: Texts('${model.LiveChatModelList[index].projectName}',color:tappedIndex==index ? Colors.white:Colors.black,textAlign: TextAlign.center,))),//model.cOCItemList[index].cOCTitl
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 1,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: Icon(Icons.arrow_forward_rounded,color: tappedIndex==index ? Colors.white:Colors.black,),
|
|
|
|
|
tooltip: '',
|
|
|
|
|
onPressed: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
// _volume += 10;
|
|
|
|
|
// launch("tel://" +model.FindusHospitalModelList[index].phoneNumber);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.spaceAround,
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.center,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 4,
|
|
|
|
|
child: Container(
|
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
|
left: 5, right: 5),
|
|
|
|
|
child: Texts(
|
|
|
|
|
'${model.LiveChatModelList[index].projectName}',
|
|
|
|
|
color:
|
|
|
|
|
tappedIndex == index
|
|
|
|
|
? Colors.white
|
|
|
|
|
: Colors.black,
|
|
|
|
|
textAlign:
|
|
|
|
|
TextAlign.center,
|
|
|
|
|
))), //model.cOCItemList[index].cOCTitl
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 1,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: Icon(
|
|
|
|
|
Icons
|
|
|
|
|
.arrow_forward_rounded,
|
|
|
|
|
color:
|
|
|
|
|
tappedIndex == index
|
|
|
|
|
? Colors.white
|
|
|
|
|
: Colors.black,
|
|
|
|
|
),
|
|
|
|
|
tooltip: '',
|
|
|
|
|
onPressed: () {
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
),
|
|
|
|
|
SizedBox(height: 100,),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 100,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
bottomSheet: Container(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.13,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
padding: EdgeInsets.all(8.0),
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Container(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.1,
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.8,
|
|
|
|
|
child: Button(
|
|
|
|
|
label: 'ٍStart',
|
|
|
|
|
loading: model.state == ViewState.BusyLocal,
|
|
|
|
|
onTap: () {
|
|
|
|
|
print("chat="+chat);
|
|
|
|
|
launch(chat);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
bottomSheet: Container(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.13,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
padding: EdgeInsets.all(8.0),
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Container(
|
|
|
|
|
height: MediaQuery.of(context).size.height * 0.1,
|
|
|
|
|
width: MediaQuery.of(context).size.width * 0.8,
|
|
|
|
|
child: Button(
|
|
|
|
|
label: 'ٍStart',
|
|
|
|
|
loading: model.state == ViewState.BusyLocal,
|
|
|
|
|
onTap: () {
|
|
|
|
|
print("chat=" + chat);
|
|
|
|
|
launch(chat);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|