@ -7,18 +7,20 @@ import 'package:diplomaticquarterapp/models/FamilyFiles/GetAllSharedRecordByStat
import ' package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/dialogs/select_country_ingo_Dialog.dart ' ;
import ' package:diplomaticquarterapp/pages/AlHabibMedicalService/E-Referral/dialogs/select_country_ingo_Dialog.dart ' ;
import ' package:diplomaticquarterapp/pages/base/base_view.dart ' ;
import ' package:diplomaticquarterapp/pages/base/base_view.dart ' ;
import ' package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart ' ;
import ' package:diplomaticquarterapp/pages/medical/balance/new_text_Field.dart ' ;
import ' package:diplomaticquarterapp/theme/colors.dart ' ;
import ' package:diplomaticquarterapp/uitl/app_shared_preferences.dart ' ;
import ' package:diplomaticquarterapp/uitl/app_shared_preferences.dart ' ;
import ' package:diplomaticquarterapp/uitl/translations_delegate_base.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/buttons/defaultButton.dart ' ;
import ' package:diplomaticquarterapp/widgets/buttons/secondary_button.dart ' ;
import ' package:diplomaticquarterapp/widgets/buttons/secondary_button.dart ' ;
import ' package:diplomaticquarterapp/widgets/data_display/text.dart ' ;
import ' package:diplomaticquarterapp/widgets/data_display/text.dart ' ;
import ' package:diplomaticquarterapp/widgets/mobile-no/mobile_no.dart ' ;
import ' package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart ' ;
import ' package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart ' ;
import ' package:flutter/cupertino.dart ' ;
import ' package:flutter/cupertino.dart ' ;
import ' package:flutter/material.dart ' ;
import ' package:flutter/material.dart ' ;
import ' ../dialogs/select_city_dialog.dart ' ;
import ' ../dialogs/select_city_dialog.dart ' ;
class NewEReferralStepTowPage extends StatefulWidget {
class NewEReferralStepTowPage extends StatefulWidget {
final CreateEReferralRequestModel createEReferralRequestModel ;
final CreateEReferralRequestModel createEReferralRequestModel ;
final Function changePageViewIndex ;
final Function changePageViewIndex ;
@ -32,20 +34,14 @@ class NewEReferralStepTowPage extends StatefulWidget {
class _NewEReferralStepTowPageState extends State < NewEReferralStepTowPage > {
class _NewEReferralStepTowPageState extends State < NewEReferralStepTowPage > {
TextEditingController _patientNameTextController = TextEditingController ( ) ;
TextEditingController _patientNameTextController = TextEditingController ( ) ;
TextEditingController _patientIdentificationTextController = TextEditingController ( ) ;
TextEditingController _patientIdentificationTextController = TextEditingController ( ) ;
TextEditingController _mobileTextController = TextEditingController ( ) ;
String mobileNo = " " ;
GetAllCitiesResponseModel _selectedCity ;
GetAllCitiesResponseModel _selectedCity ;
GetAllSharedRecordsByStatusList selectedPatientFamily ;
GetAllSharedRecordsByStatusList selectedPatientFamily ;
/ / todo create a model for Country
/ / todo create a model for Country
/ / todo use country from the json
/ / todo use country from the json
dynamic _selectedCountry = {
dynamic _selectedCountry = { " name " : " Saudi Arabia " , " name_ar " : " المملكة العربية السعودية " , " code " : " +966 " , " countryCode " : " SA " , " pattern " : " 5xxxxxxxx " , " maxLength " : 9 } ;
" name " : " Saudi Arabia " ,
" name_ar " : " المملكة العربية السعودية " ,
" code " : " +966 " ,
" countryCode " : " SA " ,
" pattern " : " 5xxxxxxxx " ,
" maxLength " : 9
} ;
AppSharedPreferences sharedPref = AppSharedPreferences ( ) ;
AppSharedPreferences sharedPref = AppSharedPreferences ( ) ;
AuthenticatedUser authUser ;
AuthenticatedUser authUser ;
@ -60,106 +56,108 @@ class _NewEReferralStepTowPageState extends State<NewEReferralStepTowPage> {
onModelReady: ( model ) = > model . getAllCities ( ) ,
onModelReady: ( model ) = > model . getAllCities ( ) ,
builder: ( _ , model , widget ) = > AppScaffold (
builder: ( _ , model , widget ) = > AppScaffold (
isShowAppBar: false ,
isShowAppBar: false ,
body: SingleChildScrollView (
backgroundColor: CustomColors . appBackgroudGrey2Color ,
body: Column (
children: [
Expanded (
child: SingleChildScrollView (
physics: ScrollPhysics ( ) ,
physics: ScrollPhysics ( ) ,
child: Container (
child: Container (
margin: EdgeInsets . all ( 12 ) ,
margin: EdgeInsets . all ( 12 ) ,
child: Center (
child: FractionallySizedBox (
widthFactor: 0.94 ,
child: Column (
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
children: [
SizedBox (
SizedBox (
height: 3 0,
height: 2 0,
) ,
) ,
Center (
Text (
child: Texts (
TranslationBase . of ( context ) . patientInfo ,
TranslationBase . of ( context ) . patientInfo ,
/ / " Patient information " ,
style: TextStyle (
textAlign: TextAlign . center ,
fontSize: 16 ,
) ,
fontWeight: FontWeight . w600 ,
letterSpacing: - 0.64 ,
) ,
) ,
SizedBox (
height: 12 ,
) ,
NewTextFields (
hintText: TranslationBase . of ( context ) . enterIdentificationNumber ,
controller: _patientIdentificationTextController ,
keyboardType: TextInputType . number ,
) ,
) ,
SizedBox (
SizedBox (
height: 12 ,
height: 12 ,
) ,
) ,
NewTextFields (
inputWidget ( TranslationBase . of ( context ) . enterIdentificationNumber , " " , _patientIdentificationTextController , isInputTypeNum: true ) ,
hintText: TranslationBase . of ( context ) . patientName ,
controller: _patientNameTextController ,
) ,
SizedBox (
SizedBox (
height: 12 ,
height: 12 ,
) ,
) ,
InkWell (
inputWidget ( TranslationBase . of ( context ) . patientName , " " , _patientNameTextController , isInputTypeNum: true ) ,
onTap: ( ) = > confirmSelectCountryTypeDialog ( ) ,
child: Container (
padding: EdgeInsets . all ( 12 ) ,
width: double . infinity ,
height: 65 ,
decoration: BoxDecoration (
borderRadius: BorderRadius . circular ( 12 ) ,
color: Colors . white ) ,
child: Row (
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
children: [
Texts ( getCountryName ( ) ) ,
Icon ( Icons . arrow_drop_down )
] ,
) ,
) ,
) ,
SizedBox (
SizedBox (
height: 12 ,
height: 12 ,
) ,
) ,
MobileNumberTextFiled (
PhoneNumberSelectorWidget ( onNumberChange: ( value ) {
controller: _mobileTextController ,
setState ( ( ) {
code: _selectedCountry = = null
mobileNo = value ;
? " 11 "
} ) ;
: _selectedCountry [ " code " ] ,
} , onCountryChange: ( value ) {
) ,
setState ( ( ) {
_selectedCountry = value ;
} ) ;
} ) ,
SizedBox (
SizedBox (
height: 12 ,
height: 12 ,
) ,
) ,
Center (
Text (
child: Texts (
TranslationBase . of ( context ) . patientLocated ,
TranslationBase . of ( context ) . patientLocated ,
textAlign: TextAlign . center ,
style: TextStyle (
fontSize: 16 ,
fontWeight: FontWeight . w600 ,
letterSpacing: - 0.64 ,
) ,
) ,
) ,
) ,
SizedBox (
SizedBox (
height: 12 ,
height: 12 ,
) ,
) ,
InkWell (
Container (
onTap: ( ) = > confirmSelectCityDialog (
padding: EdgeInsets . only ( left: 16 , right: 16 , bottom: 15 , top: 15 ) ,
model . allCities ) ,
alignment: Alignment . center ,
child: Container (
padding: EdgeInsets . all ( 12 ) ,
width: double . infinity ,
height: 65 ,
decoration: BoxDecoration (
decoration: BoxDecoration (
borderRadius: BorderRadius . circular ( 12 ) ,
borderRadius: BorderRadius . circular ( 15 ) ,
color: Colors . white ) ,
color: Colors . white ,
border: Border . all (
color: Color ( 0xffefefef ) ,
width: 1 ,
) ,
) ,
child: InkWell (
onTap: ( ) = > confirmSelectCityDialog ( model . allCities ) ,
child: Row (
child: Row (
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
children: [
children: [
Texts ( getRelationName ( ) ) ,
Expanded (
Icon ( Icons . arrow_drop_down )
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
Text (
TranslationBase . of ( context ) . selectCity ,
style: TextStyle (
fontSize: 11 ,
fontWeight: FontWeight . w600 ,
color: Color ( 0xff2B353E ) ,
letterSpacing: - 0.44 ,
) ,
) ,
Text (
getRelationName ( ) ,
style: TextStyle (
fontSize: 14 ,
height: 21 / 14 ,
fontWeight: FontWeight . w400 ,
color: Color ( 0xff2B353E ) ,
letterSpacing: - 0.44 ,
) ,
) ,
] ,
] ,
) ,
) ,
) ,
) ,
Icon ( Icons . arrow_drop_down ) ,
] ,
) ,
) ,
) ,
SizedBox (
height: 12 ,
) ,
) ,
SizedBox (
SizedBox (
height: 12 ,
height: 12 ,
) ,
) ,
@ -168,32 +166,109 @@ class _NewEReferralStepTowPageState extends State<NewEReferralStepTowPage> {
) ,
) ,
) ,
) ,
) ,
) ,
) ,
Card (
bottomSheet: Container (
margin: EdgeInsets . zero ,
color: Theme . of ( context ) . scaffoldBackgroundColor ,
shape: cardRadius ( 0 ) ,
elevation: 20 ,
child: Container (
width: double . infinity ,
width: double . infinity ,
padding: EdgeInsets . all ( 9 ) ,
padding: EdgeInsets . all ( 12 ) ,
child: DefaultButton (
child: DefaultButton (
TranslationBase . of ( context ) . next ,
TranslationBase . of ( context ) . next ,
( _patientNameTextController . text . isEmpty | | _patientIdentificationTextController . text . isEmpty | |
( _patientNameTextController . text . isEmpty | | _patientIdentificationTextController . text . isEmpty | | _selectedCity = = null | | mobileNo . isEmpty )
_selectedCity = = null | |
? null
_mobileTextController . text . isEmpty ) ? null : ( ) {
: ( ) {
this . widget . changePageViewIndex ( 2 ) ;
this . widget . changePageViewIndex ( 2 ) ;
this . widget . createEReferralRequestModel . identificationNo = int . parse ( _patientIdentificationTextController . text ) ;
this . widget . createEReferralRequestModel . identificationNo = int . parse ( _patientIdentificationTextController . text ) ;
this . widget . createEReferralRequestModel . fullName = _patientNameTextController . text ;
this . widget . createEReferralRequestModel . fullName = _patientNameTextController . text ;
this . widget . createEReferralRequestModel . patientMobileNumber = _selectedCountry [ ' code ' ] . toString ( ) . substring ( 1 ) + _mobileTextController . text ;
this . widget . createEReferralRequestModel . patientMobileNumber = _selectedCountry [ ' code ' ] . toString ( ) . substring ( 1 ) + mobileNo ;
this . widget . createEReferralRequestModel . cityCode = _selectedCity . iD . toString ( ) ;
this . widget . createEReferralRequestModel . cityCode = _selectedCity . iD . toString ( ) ;
this . widget . createEReferralRequestModel . cityName = _selectedCity . description ;
this . widget . createEReferralRequestModel . cityName = _selectedCity . description ;
} ,
} ,
disabledColor: Colors . grey ,
disabledColor: Colors . grey ,
) ,
) ,
) ) ) ;
) ,
)
] ,
) ,
) ,
) ;
}
Widget inputWidget ( String _labelText , String _hintText , TextEditingController _controller ,
{ VoidCallback suffixTap , bool isEnable = true , bool hasSelection = false , int lines , bool isInputTypeNum = false } ) {
return Container (
padding: EdgeInsets . only ( left: 16 , right: 16 , bottom: 15 , top: 15 ) ,
alignment: Alignment . center ,
decoration: BoxDecoration (
borderRadius: BorderRadius . circular ( 15 ) ,
color: Colors . white ,
border: Border . all (
color: Color ( 0xffefefef ) ,
width: 1 ,
) ,
) ,
child: InkWell (
onTap: hasSelection ? ( ) { } : null ,
child: Row (
children: [
Expanded (
child: Column (
mainAxisSize: MainAxisSize . min ,
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
Text (
_labelText ,
style: TextStyle (
fontSize: 11 ,
fontWeight: FontWeight . w600 ,
color: Color ( 0xff2B353E ) ,
letterSpacing: - 0.44 ,
) ,
) ,
TextField (
enabled: isEnable ,
scrollPadding: EdgeInsets . zero ,
keyboardType: isInputTypeNum ? TextInputType . number : TextInputType . text ,
controller: _controller ,
maxLines: lines ,
onChanged: ( value ) = > { setState ( ( ) { } ) } ,
style: TextStyle (
fontSize: 14 ,
height: 21 / 14 ,
fontWeight: FontWeight . w400 ,
color: Color ( 0xff2B353E ) ,
letterSpacing: - 0.44 ,
) ,
decoration: InputDecoration (
isDense: true ,
hintText: _hintText ,
hintStyle: TextStyle (
fontSize: 14 ,
height: 21 / 14 ,
fontWeight: FontWeight . w400 ,
color: Color ( 0xff575757 ) ,
letterSpacing: - 0.56 ,
) ,
suffixIconConstraints: BoxConstraints ( minWidth: 50 ) ,
suffixIcon: suffixTap = = null ? null : IconButton ( icon: Icon ( Icons . mic , color: Color ( 0xff2E303A ) ) , onPressed: suffixTap ) ,
contentPadding: EdgeInsets . zero ,
border: InputBorder . none ,
focusedBorder: InputBorder . none ,
enabledBorder: InputBorder . none ,
) ,
) ,
] ,
) ,
) ,
if ( hasSelection ) Icon ( Icons . keyboard_arrow_down_outlined ) ,
] ,
) ,
) ,
) ;
}
}
void confirmSelectCityDialog (
void confirmSelectCityDialog ( List < GetAllCitiesResponseModel > cities ) {
List < GetAllCitiesResponseModel > cities ) {
showDialog (
showDialog (
context: context ,
context: context ,
child: SelectCityDialog (
child: SelectCityDialog (
@ -238,12 +313,7 @@ class _NewEReferralStepTowPageState extends State<NewEReferralStepTowPage> {
}
}
class MobileNumberTextFiled extends StatelessWidget {
class MobileNumberTextFiled extends StatelessWidget {
const MobileNumberTextFiled ( {
const MobileNumberTextFiled ( { Key key , this . controller , this . code } ) : super ( key: key ) ;
Key key ,
this . controller ,
this . code
} ) : super ( key: key ) ;
final TextEditingController controller ;
final TextEditingController controller ;
final String code ;
final String code ;
@ -252,8 +322,7 @@ class MobileNumberTextFiled extends StatelessWidget {
Widget build ( BuildContext context ) {
Widget build ( BuildContext context ) {
return Container (
return Container (
padding: EdgeInsets . all ( 5 ) ,
padding: EdgeInsets . all ( 5 ) ,
decoration: BoxDecoration (
decoration: BoxDecoration ( borderRadius: BorderRadius . circular ( 15 ) , color: Colors . white ) ,
borderRadius: BorderRadius . circular ( 15 ) , color: Colors . white ) ,
child: Row ( children: < Widget > [
child: Row ( children: < Widget > [
Expanded (
Expanded (
flex: 1 ,
flex: 1 ,
@ -274,8 +343,7 @@ class MobileNumberTextFiled extends StatelessWidget {
child: TextField (
child: TextField (
controller: controller ,
controller: controller ,
keyboardType: TextInputType . phone ,
keyboardType: TextInputType . phone ,
decoration: InputDecoration (
decoration: InputDecoration ( border: InputBorder . none , hintText: TranslationBase . of ( context ) . mobileNumber ) ,
border: InputBorder . none , hintText: TranslationBase . of ( context ) . mobileNumber ) ,
) ,
) ,
) ,
) ,
)
)