|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/LiveCare/ClinicsServiceTimingsResponse.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/models/LiveCare/LiveCareClinicsListResponse.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/services/livecare_services/livecare_provider.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/theme/colors.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_svg/svg.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
import 'ClinicTimingsDialog.dart';
|
|
|
|
|
|
|
|
|
|
// ignore: must_be_immutable
|
|
|
|
|
class ClinicCard extends StatefulWidget {
|
|
|
|
|
bool isSelected;
|
|
|
|
|
final PatientERGetClinicsList patientERGetClinicsList;
|
|
|
|
|
var languageID;
|
|
|
|
|
int isOnline;
|
|
|
|
|
|
|
|
|
|
ClinicCard({this.isSelected, this.languageID, this.isOnline, @required this.patientERGetClinicsList});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_State createState() => _State();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _State extends State<ClinicCard> {
|
|
|
|
|
ClinicsServiceTimingsResponse clinicsServiceTimingsResponse;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
clinicsServiceTimingsResponse = new ClinicsServiceTimingsResponse();
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
|
|
|
return Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
margin: EdgeInsets.fromLTRB(15.0, 0.0, 15.0, 8.0),
|
|
|
|
|
clipBehavior: Clip.antiAlias,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
|
Radius.circular(10.0),
|
|
|
|
|
),
|
|
|
|
|
border: Border.all(width: widget.isSelected ? 3 : 0, color: widget.isSelected ? CustomColors.green : Colors.transparent),
|
|
|
|
|
boxShadow: [
|
|
|
|
|
BoxShadow(
|
|
|
|
|
color: Color(0xff000000).withOpacity(.05),
|
|
|
|
|
blurRadius: 27,
|
|
|
|
|
offset: Offset(0, -3),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
color: Colors.transparent,
|
|
|
|
|
),
|
|
|
|
|
child: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: widget.patientERGetClinicsList.isOnline == 1 ? CustomColors.green : CustomColors.accentColor,
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
|
Radius.circular(6.0),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: Container(
|
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
|
left: projectViewModel.isArabic
|
|
|
|
|
? 0
|
|
|
|
|
: widget.isSelected
|
|
|
|
|
? 4
|
|
|
|
|
: 6,
|
|
|
|
|
right: projectViewModel.isArabic ? widget.isSelected
|
|
|
|
|
? 4
|
|
|
|
|
: 6: 0),
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 12),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
border: Border.all(color: Colors.white, width: 1),
|
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
|
bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0),
|
|
|
|
|
topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0),
|
|
|
|
|
bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0),
|
|
|
|
|
topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Text(
|
|
|
|
|
widget.languageID == 'ar' ? widget.patientERGetClinicsList.serviceNameN : widget.patientERGetClinicsList.serviceName,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: Color(0xff2B353E),
|
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: 4,
|
|
|
|
|
height: 4,
|
|
|
|
|
decoration: containerRadius(
|
|
|
|
|
widget.patientERGetClinicsList.isOnline == 1 ? CustomColors.green : CustomColors.accentColor,
|
|
|
|
|
100,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
mWidth(4),
|
|
|
|
|
Text(
|
|
|
|
|
widget.patientERGetClinicsList.isOnline == 1 ? "Online" : "Offline",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 10,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
color: widget.patientERGetClinicsList.isOnline == 1 ? CustomColors.green : CustomColors.accentColor,
|
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
padding: EdgeInsets.only(left: 8,right: 8,top: 4,bottom: 4),
|
|
|
|
|
decoration: containerRadius(CustomColors.devider, 100),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
SvgPicture.asset(
|
|
|
|
|
"assets/images/new-design/ic_schedule.svg",
|
|
|
|
|
width: 16,
|
|
|
|
|
height: 16,
|
|
|
|
|
color: Colors.black,
|
|
|
|
|
),
|
|
|
|
|
mWidth(4),
|
|
|
|
|
Text(
|
|
|
|
|
"Schedule",
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 11,
|
|
|
|
|
letterSpacing: -0.44,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getClinicTimings(PatientERGetClinicsList patientERGetClinicsList) {
|
|
|
|
|
LiveCareService service = new LiveCareService();
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
service.getLivecareClinicTiming(patientERGetClinicsList.serviceID, context).then((res) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (res['MessageStatus'] == 1) {
|
|
|
|
|
setState(() {
|
|
|
|
|
clinicsServiceTimingsResponse = ClinicsServiceTimingsResponse.fromJson(res);
|
|
|
|
|
print(clinicsServiceTimingsResponse.patientERGetClinicsServiceTimingsList.length);
|
|
|
|
|
|
|
|
|
|
showGeneralDialog(
|
|
|
|
|
barrierColor: Colors.black.withOpacity(0.5),
|
|
|
|
|
transitionBuilder: (context, a1, a2, widget) {
|
|
|
|
|
final curvedValue = Curves.easeInOutBack.transform(a1.value) - 1.0;
|
|
|
|
|
return Transform(
|
|
|
|
|
transform: Matrix4.translationValues(0.0, curvedValue * 200, 0.0),
|
|
|
|
|
child: Opacity(
|
|
|
|
|
opacity: a1.value,
|
|
|
|
|
child: ClinicTimingsDialog(
|
|
|
|
|
clinicName: patientERGetClinicsList.serviceName,
|
|
|
|
|
patientERGetClinicsServiceTimingsList: clinicsServiceTimingsResponse.patientERGetClinicsServiceTimingsList,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
transitionDuration: Duration(milliseconds: 500),
|
|
|
|
|
barrierDismissible: true,
|
|
|
|
|
barrierLabel: '',
|
|
|
|
|
context: context,
|
|
|
|
|
pageBuilder: (context, animation1, animation2) {});
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
AppToast.showErrorToast(message: res['ErrorEndUserMessage']);
|
|
|
|
|
}
|
|
|
|
|
}).catchError((err) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
print(err);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|