@ -1,20 +1,16 @@
import ' package:diplomaticquarterapp/core/enum/viewstate.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/uitl/translations_delegate_base.dart ' ;
import ' package:diplomaticquarterapp/widgets/avatar/large_avatar.dart ' ;
import ' package:diplomaticquarterapp/widgets/buttons/secondary_button.dart ' ;
import ' package:diplomaticquarterapp/widgets/data_display/text.dart ' ;
import ' package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart ' ;
import ' package:diplomaticquarterapp/widgets/input/text_field.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:eva_icons_flutter/eva_icons_flutter.dart ' ;
import ' package:flutter/cupertino.dart ' ;
import ' package:flutter/material.dart ' ;
import ' package:hexcolor/hexcolor.dart ' ;
class RateAppointmentDoctor extends StatefulWidget {
@ override
@ -30,214 +26,172 @@ class _RateAppointmentDoctorState extends State<RateAppointmentDoctor> {
Widget build ( BuildContext context ) {
return BaseView < AppointmentRateViewModel > (
builder: ( _ , model , w ) = > AppScaffold (
isShowAppBar: true ,
showNewAppBar: true ,
showNewAppBarTitle: true ,
baseViewModel: model ,
body: Scaffold (
backgroundColor: Colors . grey [ 200 ] ,
appBar: AppBar (
elevation: 0 ,
textTheme: TextTheme (
headline6:
TextStyle ( color: Colors . white , fontWeight: FontWeight . bold ) ,
) ,
title: Text ( TranslationBase . of ( context ) . rate ) ,
leading: Builder (
builder: ( BuildContext context ) {
return IconButton (
icon: Icon ( Icons . menu ) ,
color: Colors . white ,
onPressed: ( ) = > Scaffold . of ( context ) . openDrawer ( ) ,
) ;
} ,
) ,
centerTitle: true ,
) ,
drawer: SafeArea ( child: AppDrawer ( ) ) ,
body: FractionallySizedBox (
widthFactor: 1 ,
child: SingleChildScrollView (
child: Container (
padding: EdgeInsets . all ( 12 ) ,
child: Column (
children: < Widget > [
SizedBox (
height: 25 , / / 5598
) ,
Texts (
TranslationBase . of ( context ) . lastVisit ,
bold: true ,
color: Colors . black ,
) ,
SizedBox (
height: 25 ,
) ,
Container (
width: double . infinity ,
decoration: BoxDecoration (
borderRadius: BorderRadius . circular ( 15 ) ,
color: Colors . white ,
shape: BoxShape . rectangle ,
border: Border . all ( color: Colors . white , width: 0.5 ) ,
) ,
appBarTitle: TranslationBase . of ( context ) . rateDoctor ,
body: SingleChildScrollView (
child: Container (
padding: EdgeInsets . all ( 12 ) ,
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: < Widget > [
SizedBox (
height: 25 , / / 5598
) ,
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: Card (
elevation: 0 ,
shape: cardRadius ( 10 ) ,
child: Padding (
padding: const EdgeInsets . all ( 12.0 ) ,
child: Column (
children: < Widget > [
SizedBox (
height: 8 ,
) ,
LargeAvatar (
name: model . appointmentDetails . doctorName ,
url: model . appointmentDetails . doctorImageURL ,
width: 110 ,
height: 110 ,
) ,
SizedBox (
height: 22 ,
) ,
Texts (
TranslationBase . of ( context ) . dr + " " + model . appointmentDetails . doctorName ,
bold: true ,
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: 4 ,
height: 12 ,
) ,
Texts (
model . appointmentDetails . clinicName ! = null ? model . appointmentDetails . clinicName : " " ,
bold: true ,
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 ] ,
/ / Theme . of ( context ) . hintColor ,
icon: Icon ( rating > = ( index + 1 ) ? Icons . star : Icons . star ) ) ,
) ,
) ,
)
] ,
) ,
SizedBox (
height: 8 ,
)
] ,
) ,
) ,
SizedBox (
height: 12 ,
) ,
Center (
child: Texts (
TranslationBase . of ( context ) . tapTitle ,
textAlign: TextAlign . center ,
) ) ,
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 ] ,
/ / Theme . of ( context ) . hintColor ,
icon: Icon ( rating > = ( index + 1 )
? EvaIcons . star
: EvaIcons . star ) ) ,
) ,
) ,
)
] ,
) ,
SizedBox (
height: 12 ,
) ,
Form (
key: formKey ,
child: TextFields (
hintText: TranslationBase . of ( context ) . notes ,
minLines: 4 ,
maxLines: 4 ,
/ / validator: ( value ) {
/ / if ( value . isEmpty )
/ / return ' Please enter your note ' ;
/ / else if ( rating = = 0 ) return ' Rating cannot be \" 0 \" ' ;
/ / return null ;
/ / } ,
onChanged: ( value ) {
setState ( ( ) {
note = value ;
} ) ;
} ,
) ,
) ,
SizedBox (
height: 12 ,
) ,
Card (
elevation: 0 ,
shape: 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 ( ) ,
) ,
) ,
SizedBox (
height: 12 ,
) ,
Container (
width: double . infinity ,
child: Column (
children: < Widget > [
Container (
width: MediaQuery . of ( context ) . size . width * 0.9 ,
child: SecondaryButton (
onTap: ( ) async {
final form = formKey . currentState ;
if ( form . validate ( ) & & rating > 0 ) {
form . save ( ) ;
Navigator . push (
context ,
FadePage (
page: RateAppointmentClinic (
appointmentDetails:
model . appointmentDetails ,
doctorNote: note ,
doctorRate: rating ,
) ,
) ,
) ;
}
} ,
label: TranslationBase . of ( context ) . next ,
disabled: ( model . state = = ViewState . BusyLocal | | rating = = 0 ) ,
loading: model . state = = ViewState . BusyLocal ,
textColor: Theme . of ( context ) . backgroundColor ) ,
) ,
SizedBox (
height: 12 ,
) ;
} ,
color: Color ( 0xffEAEAEA ) ,
textColor: Color ( 0xff2B353E ) ,
) ,
) ,
SizedBox ( width: 10 ) ,
Expanded (
child: DefaultButton (
TranslationBase . of ( context ) . next ,
( ) {
final form = formKey . currentState ;
if ( form . validate ( ) & & rating > 0 ) {
form . save ( ) ;
Navigator . push (
context ,
FadePage (
page: RateAppointmentClinic (
appointmentDetails: model . appointmentDetails ,
doctorNote: note ,
doctorRate: rating ,
) ,
InkWell (
onTap: ( ) {
Navigator . pushReplacement (
context ,
FadePage (
page: LandingPage ( ) ,
) ,
) ;
} ,
child: Texts (
TranslationBase . of ( context ) . later ,
decoration: TextDecoration . underline ,
color: HexColor ( ' #151DFE ' ) ,
fontSize: 18 ,
) ,
)
] ,
) ,
)
] ,
) ,
) ;
}
} ,
/ / iconData: Icons . notifications_active ,
color: Color ( 0xff359846 ) ,
) ,
) ,
) ,
] ,
) ,
) ,
) ,
) ;
}
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 ;
}
}