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.
117 lines
4.3 KiB
Dart
117 lines
4.3 KiB
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:flutter/material.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) {
|
|
return Container(
|
|
width: double.infinity,
|
|
margin: EdgeInsets.fromLTRB(15.0, 0.0, 15.0, 8.0),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.all(
|
|
Radius.circular(10.0),
|
|
),
|
|
border: Border.all(width: 2, color: widget.isSelected ? CustomColors.green : Color(0xffEFEFEF)),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Color(0xff000000).withOpacity(.05),
|
|
blurRadius: 27,
|
|
offset: Offset(0, -3),
|
|
),
|
|
],
|
|
color: Colors.white),
|
|
child: Container(
|
|
padding: EdgeInsets.fromLTRB(12.0, 25.0, 12.0, 25.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: <Widget>[
|
|
Container(
|
|
child: Text(widget.languageID == 'ar' ? widget.patientERGetClinicsList.serviceNameN : widget.patientERGetClinicsList.serviceName,
|
|
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.48, height: 20 / 16)),
|
|
),
|
|
Row(
|
|
children: [
|
|
Container(
|
|
child: Text(".", style: TextStyle(fontSize: 30.0)),
|
|
),
|
|
Container(
|
|
child: Text("Online"),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
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);
|
|
});
|
|
}
|
|
}
|