Merge branch 'development' into development_new_design_2.0
# Conflicts: # lib/config/localized_values.dart # lib/pages/AlHabibMedicalService/ancillary-orders/ancillaryOrdersDetails.dart # lib/pages/MyAppointments/AppointmentDetails.dart # lib/pages/landing/landing_page.dart # lib/pages/medical/medical_profile_page.dart # lib/uitl/translations_delegate_base.dartmerge-update-with-lab-changes
commit
bb18645d85
Binary file not shown.
|
After Width: | Height: | Size: 2.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
@ -0,0 +1,163 @@
|
|||||||
|
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
|
||||||
|
|
||||||
|
import 'package:diplomaticquarterapp/pages/MyAppointments/models/DoctorScheduleResponse.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/indicator.dart';
|
||||||
|
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:hexcolor/hexcolor.dart';
|
||||||
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
||||||
|
import 'package:diplomaticquarterapp/core/viewModels/medical/medical_view_model.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
||||||
|
|
||||||
|
class SchedulePage extends StatefulWidget {
|
||||||
|
final DoctorList doctorList;
|
||||||
|
|
||||||
|
SchedulePage(this.doctorList);
|
||||||
|
@override
|
||||||
|
_SchedulePageState createState() => _SchedulePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SchedulePageState extends State<SchedulePage> {
|
||||||
|
DoctorsListService service;
|
||||||
|
PageController _pageController = PageController();
|
||||||
|
double currentPage = 0;
|
||||||
|
int selectedindex = 0;
|
||||||
|
bool isLoading = true;
|
||||||
|
List<DoctorScheduleResponse> doctorScheduleResponse = [];
|
||||||
|
final List<Widget> introWidgetsList = <Widget>[
|
||||||
|
Text('Hello'),
|
||||||
|
Text('Hi'),
|
||||||
|
Text('hey')
|
||||||
|
];
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
//getSchedule(widget.doctorList, context);
|
||||||
|
// _pageController.addListener(() {
|
||||||
|
// setState(() {
|
||||||
|
// currentPage = _pageController.page;
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return BaseView<MedicalViewModel>(
|
||||||
|
onModelReady: (model) => model.getDoctorSchedule(widget.doctorList),
|
||||||
|
builder: (_, model, widget) => AppScaffold(
|
||||||
|
appBarTitle: TranslationBase.of(context).schedule,
|
||||||
|
isShowAppBar: true,
|
||||||
|
baseViewModel: model,
|
||||||
|
body: SizedBox(
|
||||||
|
height: MediaQuery.of(context).size.height,
|
||||||
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
child: PageView.builder(
|
||||||
|
controller: _pageController,
|
||||||
|
itemCount: 3,
|
||||||
|
onPageChanged: (index) {
|
||||||
|
setState(() {
|
||||||
|
this.currentPage = index.toDouble();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return Container(
|
||||||
|
child: ListView.builder(
|
||||||
|
itemCount: model.getDoctorScheduleList.length,
|
||||||
|
itemBuilder: (context, index) => ClipRRect(
|
||||||
|
borderRadius: const BorderRadius.all(
|
||||||
|
Radius.circular(20.0)),
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
left: 10,
|
||||||
|
right: 10,
|
||||||
|
top: 20,
|
||||||
|
bottom: 20),
|
||||||
|
margin: EdgeInsets.only(
|
||||||
|
left: 20,
|
||||||
|
right: 20,
|
||||||
|
top: 7,
|
||||||
|
bottom: 7),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
boxShadow: [
|
||||||
|
BoxShadow(
|
||||||
|
color: Colors.green,
|
||||||
|
offset: Offset(-10, 0)),
|
||||||
|
],
|
||||||
|
borderRadius:
|
||||||
|
const BorderRadius.all(
|
||||||
|
Radius.circular(10.0)),
|
||||||
|
color: Colors.white),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Row(children: [
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
Texts(
|
||||||
|
model
|
||||||
|
.getDoctorScheduleList[
|
||||||
|
index]
|
||||||
|
.dayName,
|
||||||
|
color:
|
||||||
|
HexColor('#0bb690'),
|
||||||
|
),
|
||||||
|
Texts(
|
||||||
|
DateUtil
|
||||||
|
.getDayMonthYearDateFormatted(
|
||||||
|
DateUtil
|
||||||
|
.convertStringToDate(
|
||||||
|
model
|
||||||
|
.getDoctorScheduleList[
|
||||||
|
index]
|
||||||
|
.date,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
color:
|
||||||
|
HexColor('#0bb690'),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Texts(
|
||||||
|
model
|
||||||
|
.getDoctorScheduleList[
|
||||||
|
index]
|
||||||
|
.workingHours,
|
||||||
|
color: HexColor('#0bb690'),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)))));
|
||||||
|
},
|
||||||
|
)),
|
||||||
|
PageViewIndicator(
|
||||||
|
isActive: true,
|
||||||
|
currentPage: this.currentPage,
|
||||||
|
length: introWidgetsList.length,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
))));
|
||||||
|
}
|
||||||
|
|
||||||
|
//getSchedule(DoctorList doctor, BuildContext context) {
|
||||||
|
//GifLoaderDialogUtils.showMyDialog(context);
|
||||||
|
//service = new DoctorsListService();
|
||||||
|
// service.getSchedule(doctor).then((value) {
|
||||||
|
// doctorScheduleResponse.clear();
|
||||||
|
// setState(() {
|
||||||
|
// value['List_DoctorWorkingHoursTable'].forEach((item) => {
|
||||||
|
// doctorScheduleResponse.add(DoctorScheduleResponse.fromJson(item))
|
||||||
|
// });
|
||||||
|
// GifLoaderDialogUtils.hideDialog(context);
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
}
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
class DoctorScheduleResponse {
|
||||||
|
String clinicName;
|
||||||
|
String date;
|
||||||
|
String dayName;
|
||||||
|
String projectName;
|
||||||
|
String workingHours;
|
||||||
|
|
||||||
|
DoctorScheduleResponse(
|
||||||
|
{this.clinicName,
|
||||||
|
this.date,
|
||||||
|
this.dayName,
|
||||||
|
this.projectName,
|
||||||
|
this.workingHours});
|
||||||
|
|
||||||
|
DoctorScheduleResponse.fromJson(Map<String, dynamic> json) {
|
||||||
|
clinicName = json['ClinicName'];
|
||||||
|
date = json['Date'];
|
||||||
|
dayName = json['DayName'];
|
||||||
|
projectName = json['ProjectName'];
|
||||||
|
workingHours = json['WorkingHours'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||||
|
data['ClinicName'] = this.clinicName;
|
||||||
|
data['Date'] = this.date;
|
||||||
|
data['DayName'] = this.dayName;
|
||||||
|
data['ProjectName'] = this.projectName;
|
||||||
|
data['WorkingHours'] = this.workingHours;
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class PageViewIndicator extends StatelessWidget {
|
||||||
|
final bool isActive;
|
||||||
|
final int length;
|
||||||
|
final double currentPage;
|
||||||
|
PageViewIndicator({
|
||||||
|
@required this.isActive,
|
||||||
|
@required this.length,
|
||||||
|
@required this.currentPage,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return _indicator(this.isActive);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _indicator(bool isActive) {
|
||||||
|
return Positioned(
|
||||||
|
bottom: 10,
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
child: Container(
|
||||||
|
margin: EdgeInsets.only(bottom: 35),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
for (int i = 0; i < length; i++)
|
||||||
|
if (i == currentPage) ...[circleBar(true)] else circleBar(false),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget circleBar(bool isActive) {
|
||||||
|
return AnimatedContainer(
|
||||||
|
duration: Duration(milliseconds: 150),
|
||||||
|
margin: EdgeInsets.symmetric(horizontal: 8),
|
||||||
|
height: isActive ? 12 : 8,
|
||||||
|
width: isActive ? 12 : 8,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: isActive ? Colors.red : Colors.grey,
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(12))),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,127 @@
|
|||||||
|
import 'package:diplomaticquarterapp/models/Appointments/AppoimentAllHistoryResultList.dart';
|
||||||
|
import 'package:diplomaticquarterapp/pages/MyAppointments/widgets/custom_radio.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/CalendarUtils.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
||||||
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:manage_calendar_events/manage_calendar_events.dart';
|
||||||
|
|
||||||
|
class PrescriptionReminderDialog extends StatefulWidget {
|
||||||
|
static var selectedDuration;
|
||||||
|
|
||||||
|
final String eventId;
|
||||||
|
final String title;
|
||||||
|
final String description;
|
||||||
|
final DateTime startDate;
|
||||||
|
final DateTime endDate;
|
||||||
|
final String location;
|
||||||
|
final int days;
|
||||||
|
|
||||||
|
List<DateTime> _scheduleList = List();
|
||||||
|
|
||||||
|
PrescriptionReminderDialog({
|
||||||
|
@required this.eventId,
|
||||||
|
@required this.title,
|
||||||
|
@required this.description,
|
||||||
|
@required this.startDate,
|
||||||
|
@required this.endDate,
|
||||||
|
@required this.location,
|
||||||
|
@required this.days,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
_ReminderDialogState createState() => _ReminderDialogState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ReminderDialogState extends State<PrescriptionReminderDialog> {
|
||||||
|
final CalendarPlugin _myPlugin = CalendarPlugin();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
child: Dialog(
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12.0)),
|
||||||
|
child: Container(
|
||||||
|
// height: MediaQuery.of(context).size.height * 0.57,
|
||||||
|
width: 450.0,
|
||||||
|
child:
|
||||||
|
Column(crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: <Widget>[
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.all(20.0),
|
||||||
|
child: Text(TranslationBase.of(context).setReminder,
|
||||||
|
style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold)),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
transform: Matrix4.translationValues(0.0, -30.0, 0.0),
|
||||||
|
child: CustomRadio(),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
height: 40.0,
|
||||||
|
margin: EdgeInsets.only(left: 30.0, top: 0.0, right: 30.0),
|
||||||
|
child: RaisedButton(
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10.0), side: BorderSide(color: Colors.blue)),
|
||||||
|
color: Colors.blue,
|
||||||
|
onPressed: () {
|
||||||
|
createOrUpdateEvents();
|
||||||
|
},
|
||||||
|
child: Text(TranslationBase.of(context).confirm,
|
||||||
|
style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
width: MediaQuery.of(context).size.width,
|
||||||
|
margin: EdgeInsets.only(left: 100.0, top: 20.0, right: 100.0, bottom: 20.0),
|
||||||
|
child: OutlineButton(
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10.0)),
|
||||||
|
color: Colors.red,
|
||||||
|
borderSide: BorderSide(color: Colors.red),
|
||||||
|
highlightColor: Colors.red,
|
||||||
|
highlightedBorderColor: Colors.red,
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
child: Text(TranslationBase.of(context).cancel_nocaps,
|
||||||
|
style: TextStyle(color: Colors.red, fontWeight: FontWeight.bold)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
createOrUpdateEvents() async {
|
||||||
|
Navigator.pop(context);
|
||||||
|
|
||||||
|
for (int count = 0; count < widget.days; count++) {
|
||||||
|
widget._scheduleList.add(DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<DateTime> scheduleDateTime = calculateDaysInterval(
|
||||||
|
widget.startDate.subtract(new Duration(microseconds: PrescriptionReminderDialog.selectedDuration)),
|
||||||
|
widget.endDate);
|
||||||
|
|
||||||
|
CalendarUtils calendarUtils = await CalendarUtils.getInstance();
|
||||||
|
|
||||||
|
calendarUtils.createOrUpdateEvents(
|
||||||
|
scheduleList: widget._scheduleList,
|
||||||
|
description: widget.description,
|
||||||
|
title: widget.title,
|
||||||
|
scheduleDateTime: scheduleDateTime);
|
||||||
|
|
||||||
|
AppToast.showSuccessToast(message: TranslationBase.of(context).reminderSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<DateTime> calculateDaysInterval(DateTime startDate, DateTime endDate) {
|
||||||
|
List<DateTime> days = [];
|
||||||
|
for (int i = 0; i <= endDate.difference(startDate).inDays; i++) {
|
||||||
|
widget._scheduleList.forEach((element) {
|
||||||
|
days.add(startDate.add(Duration(days: i, hours: element.hour, minutes: element.minute)));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return days;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue