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.
214 lines
8.5 KiB
Dart
214 lines
8.5 KiB
Dart
import 'package:diplomaticquarterapp/core/viewModels/appointment_rate_view_model.dart';
|
|
import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart';
|
|
import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/DoctorView.dart';
|
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
|
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
|
|
import 'package:diplomaticquarterapp/pages/rateAppointment/rate_appointment_clinic.dart';
|
|
import 'package:diplomaticquarterapp/theme/colors.dart';
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
|
|
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class RateAppointmentDoctor extends StatefulWidget {
|
|
@override
|
|
_RateAppointmentDoctorState createState() => _RateAppointmentDoctorState();
|
|
}
|
|
|
|
class _RateAppointmentDoctorState extends State<RateAppointmentDoctor> {
|
|
final formKey = GlobalKey<FormState>();
|
|
String note = "";
|
|
int rating = 0;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BaseView<AppointmentRateViewModel>(
|
|
builder: (_, model, w) => AppScaffold(
|
|
isShowAppBar: true,
|
|
showNewAppBar: true,
|
|
showNewAppBarTitle: true,
|
|
baseViewModel: model,
|
|
appBarTitle: TranslationBase.of(context).rateDoctor,
|
|
body: SingleChildScrollView(
|
|
child: Container(
|
|
padding: EdgeInsets.all(12),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
Text(
|
|
TranslationBase.of(context).lastVisit,
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w600,
|
|
color: Color(0xff2B353E),
|
|
letterSpacing: -0.64,
|
|
height: 23 / 16),
|
|
),
|
|
SizedBox(
|
|
height: 25,
|
|
),
|
|
Container(
|
|
child: DoctorView(
|
|
doctor: getDoctorObject(model),
|
|
isLiveCareAppointment: false,
|
|
isShowFlag: false,
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 12,
|
|
),
|
|
Container(
|
|
width: double.infinity,
|
|
child: Container(
|
|
decoration: cardRadius(10),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(12.0),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
TranslationBase.of(context).tapTitle,
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w600,
|
|
color: Color(0xff2B353E),
|
|
letterSpacing: -0.64,
|
|
height: 23 / 16),
|
|
),
|
|
SizedBox(
|
|
height: 12,
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: <Widget>[
|
|
...List.generate(
|
|
5,
|
|
(index) => AnimatedSwitcher(
|
|
duration: Duration(milliseconds: 1000),
|
|
switchInCurve: Curves.elasticOut,
|
|
switchOutCurve: Curves.elasticIn,
|
|
transitionBuilder: (Widget child,
|
|
Animation<double> animation) {
|
|
return ScaleTransition(
|
|
child: child, scale: animation);
|
|
},
|
|
child: Container(
|
|
key: ValueKey<int>(rating),
|
|
child: IconButton(
|
|
iconSize: 45.0,
|
|
onPressed: () {
|
|
setState(() {
|
|
rating = index + 1;
|
|
});
|
|
},
|
|
color: rating >= (index + 1)
|
|
? Color.fromRGBO(255, 186, 0, 1.0)
|
|
: Colors.grey[400],
|
|
icon: Icon(rating >= (index + 1)
|
|
? Icons.star
|
|
: Icons.star)),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 12,
|
|
),
|
|
Container(
|
|
decoration: cardRadius(10),
|
|
child: Padding(
|
|
padding: EdgeInsets.all(8.0),
|
|
child: TextField(
|
|
maxLines: 5,
|
|
decoration: InputDecoration.collapsed(
|
|
hintText: TranslationBase.of(context).notes,
|
|
hintStyle: TextStyle(
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w600,
|
|
color: Color(0xff2B353E),
|
|
letterSpacing: -0.64,
|
|
height: 23 / 16)),
|
|
onChanged: (value) {
|
|
setState(() {
|
|
note = value;
|
|
});
|
|
},
|
|
))),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
bottomSheet: Container(
|
|
color: Colors.white,
|
|
padding: EdgeInsets.only(top: 16, bottom: 16, right: 21, left: 21),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Expanded(
|
|
child: DefaultButton(
|
|
TranslationBase.of(context).later,
|
|
() {
|
|
Navigator.pushReplacement(
|
|
context,
|
|
FadePage(
|
|
page: LandingPage(),
|
|
),
|
|
);
|
|
},
|
|
color: CustomColors.accentColor,
|
|
textColor: Colors.white,
|
|
),
|
|
),
|
|
SizedBox(width: 10),
|
|
Expanded(
|
|
child: DefaultButton(
|
|
TranslationBase.of(context).next,
|
|
rating <= 0
|
|
? null
|
|
: () {
|
|
Navigator.push(
|
|
context,
|
|
FadePage(
|
|
page: RateAppointmentClinic(
|
|
appointmentDetails: model.appointmentDetails,
|
|
doctorNote: note,
|
|
doctorRate: rating,
|
|
),
|
|
),
|
|
);
|
|
},
|
|
// iconData: Icons.notifications_active,
|
|
color: Color(0xff359846),
|
|
disabledColor: Colors.grey,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
DoctorList getDoctorObject(AppointmentRateViewModel model) {
|
|
DoctorList doctor = new DoctorList();
|
|
|
|
doctor.name = model.appointmentDetails.doctorName;
|
|
doctor.doctorImageURL = model.appointmentDetails.doctorImageURL;
|
|
doctor.clinicName = model.appointmentDetails.clinicName;
|
|
doctor.projectName = model.appointmentDetails.projectName;
|
|
doctor.actualDoctorRate = 5;
|
|
|
|
return doctor;
|
|
}
|
|
}
|