bug fixes
parent
5b656b0b51
commit
11ffed2ae3
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,146 @@
|
||||
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:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
|
||||
import 'package:hexcolor/hexcolor.dart';
|
||||
import 'package:diplomaticquarterapp/widgets/data_display/text.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;
|
||||
List<DoctorScheduleResponse> doctorScheduleResponse = [];
|
||||
final List<Widget> introWidgetsList = <Widget>[
|
||||
Text('Hello'),
|
||||
Text('Hi'),
|
||||
Text('hey')
|
||||
];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
getSchedule(widget.doctorList);
|
||||
// _pageController.addListener(() {
|
||||
// setState(() {
|
||||
// currentPage = _pageController.page;
|
||||
// });
|
||||
// });
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppScaffold(
|
||||
appBarTitle: TranslationBase.of(context).schedule,
|
||||
isShowAppBar: true,
|
||||
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: doctorScheduleResponse.length,
|
||||
itemBuilder: (context, index) => ClipRRect(
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(20.0)),
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: 10,
|
||||
right: 10,
|
||||
top: 25,
|
||||
bottom: 25),
|
||||
height: 100,
|
||||
margin: EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.green,
|
||||
spreadRadius: 3),
|
||||
],
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(10.0)),
|
||||
color: Colors.white),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(children: [
|
||||
Column(
|
||||
children: [
|
||||
Texts(
|
||||
doctorScheduleResponse[index]
|
||||
.dayName,
|
||||
color: HexColor('#0bb690'),
|
||||
),
|
||||
Texts(
|
||||
DateUtil
|
||||
.getDayMonthYearDateFormatted(
|
||||
DateUtil
|
||||
.convertStringToDate(
|
||||
doctorScheduleResponse[
|
||||
index]
|
||||
.date,
|
||||
),
|
||||
),
|
||||
color: HexColor('#0bb690'),
|
||||
)
|
||||
],
|
||||
)
|
||||
]),
|
||||
),
|
||||
Expanded(
|
||||
child: Texts(
|
||||
doctorScheduleResponse[index]
|
||||
.workingHours,
|
||||
color: HexColor('#0bb690'),
|
||||
),
|
||||
)
|
||||
],
|
||||
)))));
|
||||
},
|
||||
)),
|
||||
PageViewIndicator(
|
||||
isActive: true,
|
||||
currentPage: this.currentPage,
|
||||
length: introWidgetsList.length,
|
||||
)
|
||||
],
|
||||
)));
|
||||
}
|
||||
|
||||
getSchedule(DoctorList doctor) {
|
||||
// GifLoaderDialogUtils.showMyDialog(AppGlobal.context);
|
||||
service = new DoctorsListService();
|
||||
service.getSchedule(doctor).then((value) {
|
||||
doctorScheduleResponse.clear();
|
||||
setState(() {
|
||||
value['List_DoctorWorkingHoursTable'].forEach((item) => {
|
||||
doctorScheduleResponse.add(DoctorScheduleResponse.fromJson(item))
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
@ -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))),
|
||||
);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue