@ -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 ;
@ -57,143 +53,222 @@ class _NewEReferralStepTowPageState extends State<NewEReferralStepTowPage> {
@ override
@ override
Widget build ( BuildContext context ) {
Widget build ( BuildContext context ) {
return BaseView < EReferralViewModel > (
return BaseView < EReferralViewModel > (
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 ,
physics: ScrollPhysics ( ) ,
body: Column (
child: Container (
children: [
margin: EdgeInsets . all ( 12 ) ,
Expanded (
child: Center (
child: SingleChildScrollView (
child: FractionallySizedBox (
physics: ScrollPhysics ( ) ,
widthFactor: 0.94 ,
child: Container (
child: Column (
margin: EdgeInsets . all ( 12 ) ,
crossAxisAlignment: CrossAxisAlignment . start ,
child: Column (
children: [
crossAxisAlignment: CrossAxisAlignment . start ,
SizedBox (
children: [
height: 30 ,
SizedBox (
) ,
height: 20 ,
Center (
) ,
child: Texts (
Text (
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 (
height: 12 ,
) ,
NewTextFields (
hintText: TranslationBase . of ( context ) . patientName ,
controller: _patientNameTextController ,
) ,
SizedBox (
height: 12 ,
) ,
) ,
InkWell (
) ,
onTap: ( ) = > confirmSelectCountryTypeDialog ( ) ,
SizedBox (
child: Container (
height: 12 ,
padding: EdgeInsets . all ( 12 ) ,
) ,
width: double . infinity ,
inputWidget ( TranslationBase . of ( context ) . enterIdentificationNumber , " " , _patientIdentificationTextController , isInputTypeNum: true ) ,
height: 65 ,
SizedBox (
decoration: BoxDecoration (
height: 12 ,
borderRadius: BorderRadius . circular ( 12 ) ,
) ,
color: Colors . white ) ,
inputWidget ( TranslationBase . of ( context ) . patientName , " " , _patientNameTextController , isInputTypeNum: true ) ,
child: Row (
SizedBox (
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
height: 12 ,
children: [
) ,
Texts ( getCountryName ( ) ) ,
PhoneNumberSelectorWidget ( onNumberChange: ( value ) {
Icon ( Icons . arrow_drop_down )
setState ( ( ) {
] ,
mobileNo = value ;
) ,
} ) ;
) ,
} , onCountryChange: ( value ) {
) ,
setState ( ( ) {
SizedBox (
_selectedCountry = value ;
height: 12 ,
} ) ;
) ,
} ) ,
MobileNumberTextFiled (
SizedBox (
controller: _mobileTextController ,
height: 12 ,
code: _selectedCountry = = null
) ,
? " 11 "
Text (
: _selectedCountry [ " code " ] ,
TranslationBase . of ( context ) . patientLocated ,
style: TextStyle (
fontSize: 16 ,
fontWeight: FontWeight . w600 ,
letterSpacing: - 0.64 ,
) ,
) ,
SizedBox (
) ,
height: 12 ,
SizedBox (
) ,
height: 12 ,
Center (
) ,
child: Texts (
Container (
TranslationBase . of ( context ) . patientLocated ,
padding: EdgeInsets . only ( left: 16 , right: 16 , bottom: 15 , top: 15 ) ,
textAlign: TextAlign . center ,
alignment: Alignment . center ,
decoration: BoxDecoration (
borderRadius: BorderRadius . circular ( 15 ) ,
color: Colors . white ,
border: Border . all (
color: Color ( 0xffefefef ) ,
width: 1 ,
) ,
) ,
) ,
) ,
SizedBox (
child: InkWell (
height: 12 ,
onTap: ( ) = > confirmSelectCityDialog ( model . allCities ) ,
) ,
child: Row (
InkWell (
children: [
onTap: ( ) = > confirmSelectCityDialog (
Expanded (
model . allCities ) ,
child: Column (
child: Container (
crossAxisAlignment: CrossAxisAlignment . start ,
padding: EdgeInsets . all ( 12 ) ,
children: [
width: double . infinity ,
Text (
height: 65 ,
TranslationBase . of ( context ) . selectCity ,
decoration: BoxDecoration (
style: TextStyle (
borderRadius: BorderRadius . circular ( 12 ) ,
fontSize: 11 ,
color: Colors . white ) ,
fontWeight: FontWeight . w600 ,
child: Row (
color: Color ( 0xff2B353E ) ,
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
letterSpacing: - 0.44 ,
children: [
) ,
Texts ( getRelationName ( ) ) ,
) ,
Icon ( Icons . arrow_drop_down )
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 (
) ,
height: 12 ,
) ,
SizedBox (
] ,
height: 12 ,
) ,
] ,
) ,
) ,
) ,
) ,
) ,
) ,
) ,
) ,
) ,
bottomSheet: Container (
Card (
color: Theme . of ( context ) . scaffoldBackgroundColor ,
margin: EdgeInsets . zero ,
width: double . infinity ,
shape: cardRadius ( 0 ) ,
padding: EdgeInsets . all ( 9 ) ,
elevation: 20 ,
child: DefaultButton (
child: Container (
TranslationBase . of ( context ) . next ,
width: double . infinity ,
( _patientNameTextController . text . isEmpty | | _patientIdentificationTextController . text . isEmpty | |
padding: EdgeInsets . all ( 12 ) ,
_selectedCity = = null | |
child: DefaultButton (
_mobileTextController . text . isEmpty ) ? null : ( ) {
TranslationBase . of ( context ) . next ,
this . widget . changePageViewIndex ( 2 ) ;
( _patientNameTextController . text . isEmpty | | _patientIdentificationTextController . text . isEmpty | | _selectedCity = = null | | mobileNo . isEmpty )
this . widget . createEReferralRequestModel . identificationNo = int . parse ( _patientIdentificationTextController . text ) ;
? null
this . widget . createEReferralRequestModel . fullName = _patientNameTextController . text ;
: ( ) {
this . widget . createEReferralRequestModel . patientMobileNumber = _selectedCountry [ ' code ' ] . toString ( ) . substring ( 1 ) + _mobileTextController . text ;
this . widget . changePageViewIndex ( 2 ) ;
this . widget . createEReferralRequestModel . cityCode = _selectedCity . iD . toString ( ) ;
this . widget . createEReferralRequestModel . identificationNo = int . parse ( _patientIdentificationTextController . text ) ;
this . widget . createEReferralRequestModel . cityName = _selectedCity . description ;
this . widget . createEReferralRequestModel . fullName = _patientNameTextController . text ;
} ,
this . widget . createEReferralRequestModel . patientMobileNumber = _selectedCountry [ ' code ' ] . toString ( ) . substring ( 1 ) + mobileNo ;
disabledColor: Colors . grey ,
this . widget . createEReferralRequestModel . cityCode = _selectedCity . iD . toString ( ) ;
this . widget . createEReferralRequestModel . cityName = _selectedCity . description ;
} ,
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 ) ,
) ,
) ,
) ,
) ,
)
)