|
|
|
import 'dart:convert';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'package:healthcare_user/common/settings.dart';
|
|
|
|
import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart';
|
|
|
|
|
|
|
|
class AddDoctor extends StatefulWidget {
|
|
|
|
const AddDoctor({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<AddDoctor> createState() => _AddDoctorState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _AddDoctorState extends State<AddDoctor> {
|
|
|
|
bool isPwdObscureText=true;
|
|
|
|
TextEditingController doctorIdController = TextEditingController();
|
|
|
|
bool isFirstAddButtonShow=false;
|
|
|
|
bool isSecondAddButtonShow=false;
|
|
|
|
bool is2ndPlaceOfPracticeControllerVisible=false;
|
|
|
|
bool is3rdPlaceOfPracticeControllerVisible=false;
|
|
|
|
bool isConfirmPwdObscureText=true;
|
|
|
|
TextEditingController nameController = TextEditingController();
|
|
|
|
TextEditingController mobileNumberController = TextEditingController();
|
|
|
|
TextEditingController emailController = TextEditingController();
|
|
|
|
/*TextEditingController ageController = TextEditingController();*/
|
|
|
|
TextEditingController specializationController = TextEditingController();
|
|
|
|
TextEditingController qualificationController = TextEditingController();
|
|
|
|
TextEditingController hospitalNameController1 = TextEditingController();
|
|
|
|
TextEditingController hospitalNameController2 = TextEditingController();
|
|
|
|
TextEditingController hospitalNameController3 = TextEditingController();
|
|
|
|
TextEditingController practiceAddressController1 = TextEditingController();
|
|
|
|
TextEditingController practiceAddressController2 = TextEditingController();
|
|
|
|
TextEditingController practiceAddressController3 = TextEditingController();
|
|
|
|
String? gender;
|
|
|
|
List placeOfPractices=[];
|
|
|
|
final GlobalKey qrKey = GlobalKey(debugLabel: 'QR');
|
|
|
|
bool isQrScannerVisible=false;
|
|
|
|
String doctorId='';
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
|
|
|
|
super.initState();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> scanQR() async {
|
|
|
|
String barcodeScanRes;
|
|
|
|
// Platform messages may fail, so we use a try/catch PlatformException.
|
|
|
|
try {
|
|
|
|
barcodeScanRes = await FlutterBarcodeScanner.scanBarcode(
|
|
|
|
'#ff6666', 'Cancel', true, ScanMode.QR);
|
|
|
|
print(barcodeScanRes);
|
|
|
|
setState(() {
|
|
|
|
doctorId=jsonDecode(barcodeScanRes)['doctorId'];
|
|
|
|
doctorIdController.text=doctorId;
|
|
|
|
});
|
|
|
|
} on PlatformException {
|
|
|
|
barcodeScanRes = 'Failed to get platform version.';
|
|
|
|
}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
|
|
|
return Scaffold(
|
|
|
|
appBar:AppSettings.appBar('Add Doctor'),
|
|
|
|
body: Stack(children: <Widget>[
|
|
|
|
|
|
|
|
GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
FocusScope.of(context).requestFocus(new FocusNode());
|
|
|
|
},
|
|
|
|
child: SafeArea(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
child: Column(
|
|
|
|
children: <Widget>[
|
|
|
|
SizedBox(
|
|
|
|
height:MediaQuery.of(context).size.height * .02,
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
IconButton(
|
|
|
|
onPressed: (){
|
|
|
|
scanQR();
|
|
|
|
},
|
|
|
|
icon: Icon(
|
|
|
|
Icons.qr_code_scanner,
|
|
|
|
color: primaryColor,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Text('Scan Qr Code',style: TextStyle(fontSize: 12,color: secondaryColor),)
|
|
|
|
],
|
|
|
|
)
|
|
|
|
),
|
|
|
|
|
|
|
|
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
|
|
|
Container(
|
|
|
|
child: TextFormField(
|
|
|
|
cursorColor: greyColor,
|
|
|
|
controller: doctorIdController,
|
|
|
|
textCapitalization: TextCapitalization.characters,
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
prefixIcon: Icon(
|
|
|
|
Icons.person,
|
|
|
|
color: greyColor,
|
|
|
|
),
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor)),
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
),
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
),
|
|
|
|
labelText: 'Doctor Id',
|
|
|
|
labelStyle: TextStyle(
|
|
|
|
color: greyColor, //<-- SEE HERE
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
|
|
|
Container(
|
|
|
|
child: TextFormField(
|
|
|
|
cursorColor: greyColor,
|
|
|
|
controller: nameController,
|
|
|
|
textCapitalization: TextCapitalization.words,
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
prefixIcon: Icon(
|
|
|
|
Icons.person,
|
|
|
|
color: greyColor,
|
|
|
|
),
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor)),
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
),
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
),
|
|
|
|
labelText: 'DoctorName',
|
|
|
|
labelStyle: TextStyle(
|
|
|
|
color: greyColor, //<-- SEE HERE
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),//name
|
|
|
|
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
|
|
|
Container(
|
|
|
|
child: TextFormField(
|
|
|
|
cursorColor: greyColor,
|
|
|
|
controller: mobileNumberController,
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
prefixIcon: Icon(
|
|
|
|
Icons.phone_android,
|
|
|
|
color: greyColor,
|
|
|
|
),
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor)),
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
),
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
),
|
|
|
|
labelText: 'Enter Mobile Number',
|
|
|
|
labelStyle: TextStyle(
|
|
|
|
color: greyColor, //<-- SEE HERE
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
), //mobile
|
|
|
|
/*SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
|
|
|
Container(
|
|
|
|
child: TextFormField(
|
|
|
|
cursorColor: greyColor,
|
|
|
|
controller: ageController,
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
prefixIcon: Icon(
|
|
|
|
Icons.person,
|
|
|
|
color: greyColor,
|
|
|
|
),
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor)),
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
),
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
),
|
|
|
|
labelText: 'Enter age',
|
|
|
|
labelStyle: TextStyle(
|
|
|
|
color: greyColor, //<-- SEE HERE
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),*/
|
|
|
|
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
|
|
|
Text('Select Gender',style: TextStyle(color: primaryColor,fontSize: 14,fontWeight: FontWeight.bold),),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Expanded(child: RadioListTile(
|
|
|
|
title: Text("Male",style: TextStyle(color: primaryColor,fontSize: 11)),
|
|
|
|
value: "male",
|
|
|
|
groupValue: gender,
|
|
|
|
activeColor: primaryColor,
|
|
|
|
onChanged: (value){
|
|
|
|
setState(() {
|
|
|
|
gender = value.toString();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
),),
|
|
|
|
Expanded(child: RadioListTile(
|
|
|
|
title: Text("Female",style:TextStyle(color: primaryColor,fontSize: 11)),
|
|
|
|
value: "female",
|
|
|
|
groupValue: gender,
|
|
|
|
activeColor: primaryColor,
|
|
|
|
onChanged: (value){
|
|
|
|
setState(() {
|
|
|
|
gender = value.toString();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
),),
|
|
|
|
Expanded(child: RadioListTile(
|
|
|
|
title: Text("Others",style: TextStyle(color: primaryColor,fontSize: 11)),
|
|
|
|
value: "other",
|
|
|
|
groupValue: gender,
|
|
|
|
activeColor: primaryColor,
|
|
|
|
|
|
|
|
onChanged: (value){
|
|
|
|
setState(() {
|
|
|
|
gender = value.toString();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
),),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
|
|
|
Container(
|
|
|
|
child: TextFormField(
|
|
|
|
cursorColor: greyColor,
|
|
|
|
controller: qualificationController,
|
|
|
|
textCapitalization: TextCapitalization.words,
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
prefixIcon: Icon(
|
|
|
|
Icons.quickreply,
|
|
|
|
color: greyColor,
|
|
|
|
),
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor)),
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
),
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
),
|
|
|
|
labelText: 'Enter qualifications',
|
|
|
|
labelStyle: TextStyle(
|
|
|
|
color: greyColor, //<-- SEE HERE
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
|
|
|
Container(
|
|
|
|
child: TextFormField(
|
|
|
|
cursorColor: greyColor,
|
|
|
|
controller: specializationController,
|
|
|
|
textCapitalization: TextCapitalization.words,
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
prefixIcon: Icon(
|
|
|
|
Icons.folder_special,
|
|
|
|
color: greyColor,
|
|
|
|
),
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor)),
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
),
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
),
|
|
|
|
labelText: 'Enter specializations',
|
|
|
|
labelStyle: TextStyle(
|
|
|
|
color: greyColor, //<-- SEE HERE
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
|
|
|
Text('Place of practice',style: TextStyle(color: primaryColor,fontSize: 14,fontWeight: FontWeight.bold),),
|
|
|
|
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: secondaryColor,
|
|
|
|
border: Border.all(
|
|
|
|
//width: 10,
|
|
|
|
color: Colors.white,
|
|
|
|
),
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
20,
|
|
|
|
)),
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
children: [
|
|
|
|
TextFormField(
|
|
|
|
cursorColor: greyColor,
|
|
|
|
controller: hospitalNameController1,
|
|
|
|
textCapitalization: TextCapitalization.words,
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
prefixIcon: Icon(
|
|
|
|
Icons.location_city,
|
|
|
|
color: greyColor,
|
|
|
|
),
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor)),
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
),
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
),
|
|
|
|
labelText: 'Enter hospital name',
|
|
|
|
labelStyle: TextStyle(
|
|
|
|
color: greyColor, //<-- SEE HERE
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
|
|
|
TextFormField(
|
|
|
|
cursorColor: greyColor,
|
|
|
|
controller: practiceAddressController1,
|
|
|
|
textCapitalization: TextCapitalization.words,
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
prefixIcon: Icon(
|
|
|
|
Icons.location_on,
|
|
|
|
color: greyColor,
|
|
|
|
),
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor)),
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
),
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
),
|
|
|
|
labelText: 'Enter practice address',
|
|
|
|
labelStyle: TextStyle(
|
|
|
|
color: greyColor, //<-- SEE HERE
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Visibility(
|
|
|
|
visible: hospitalNameController1.text!='',
|
|
|
|
child: IconButton(
|
|
|
|
onPressed: (){
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
is2ndPlaceOfPracticeControllerVisible=true;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
icon: Icon(Icons.add_box, color: primaryColor,)))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
|
|
|
Visibility(
|
|
|
|
visible:hospitalNameController2.text!=''&&hospitalNameController2.text!='null'||is2ndPlaceOfPracticeControllerVisible,
|
|
|
|
child: Container(
|
|
|
|
width: double.infinity,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: secondaryColor,
|
|
|
|
border: Border.all(
|
|
|
|
//width: 10,
|
|
|
|
color: Colors.white,
|
|
|
|
),
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
20,
|
|
|
|
)),
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
children: [
|
|
|
|
TextFormField(
|
|
|
|
cursorColor: greyColor,
|
|
|
|
controller: hospitalNameController2,
|
|
|
|
textCapitalization: TextCapitalization.words,
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
prefixIcon: Icon(
|
|
|
|
Icons.location_city,
|
|
|
|
color: greyColor,
|
|
|
|
),
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor)),
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
),
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
),
|
|
|
|
labelText: 'Enter hospital name',
|
|
|
|
labelStyle: TextStyle(
|
|
|
|
color: greyColor, //<-- SEE HERE
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
|
|
|
TextFormField(
|
|
|
|
cursorColor: greyColor,
|
|
|
|
controller: practiceAddressController2,
|
|
|
|
textCapitalization: TextCapitalization.words,
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
prefixIcon: Icon(
|
|
|
|
Icons.location_on,
|
|
|
|
color: greyColor,
|
|
|
|
),
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor)),
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
),
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
),
|
|
|
|
labelText: 'Enter practice place',
|
|
|
|
labelStyle: TextStyle(
|
|
|
|
color: greyColor, //<-- SEE HERE
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Visibility(
|
|
|
|
visible: hospitalNameController2.text!='',
|
|
|
|
child: IconButton(
|
|
|
|
onPressed: (){
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
is3rdPlaceOfPracticeControllerVisible=true;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
icon: Icon(Icons.add_box, color: primaryColor,)))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),),
|
|
|
|
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
|
|
|
Visibility(
|
|
|
|
visible: hospitalNameController3.text!=''&&hospitalNameController3.text!='null'||is3rdPlaceOfPracticeControllerVisible,
|
|
|
|
child: Container(
|
|
|
|
width: double.infinity,
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: secondaryColor,
|
|
|
|
border: Border.all(
|
|
|
|
//width: 10,
|
|
|
|
color: Colors.white,
|
|
|
|
),
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
20,
|
|
|
|
)),
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.all(10),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
children: [
|
|
|
|
TextFormField(
|
|
|
|
cursorColor: greyColor,
|
|
|
|
controller: hospitalNameController3,
|
|
|
|
textCapitalization: TextCapitalization.words,
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
prefixIcon: Icon(
|
|
|
|
Icons.location_city,
|
|
|
|
color: greyColor,
|
|
|
|
),
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor)),
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
),
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
),
|
|
|
|
labelText: 'Enter hospital name',
|
|
|
|
labelStyle: TextStyle(
|
|
|
|
color: greyColor, //<-- SEE HERE
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
|
|
|
TextFormField(
|
|
|
|
cursorColor: greyColor,
|
|
|
|
controller: practiceAddressController3,
|
|
|
|
textCapitalization: TextCapitalization.words,
|
|
|
|
onChanged:(val) {
|
|
|
|
|
|
|
|
},
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
prefixIcon: Icon(
|
|
|
|
Icons.location_on,
|
|
|
|
color: greyColor,
|
|
|
|
),
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor)),
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
),
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide(color: greyColor),
|
|
|
|
),
|
|
|
|
labelText: 'Enter practice place',
|
|
|
|
labelStyle: TextStyle(
|
|
|
|
color: greyColor, //<-- SEE HERE
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),),
|
|
|
|
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
|
|
|
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
|
|
|
Container(
|
|
|
|
width:double.infinity,
|
|
|
|
height: MediaQuery.of(context).size.height * .06,
|
|
|
|
child: ElevatedButton(
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
primary: primaryColor, // background
|
|
|
|
onPrimary: Colors.white, // foreground
|
|
|
|
),
|
|
|
|
onPressed: () async{
|
|
|
|
if(doctorIdController.text!=''&&nameController.text!=''&&gender!=null){
|
|
|
|
if(hospitalNameController1!=''){
|
|
|
|
placeOfPractices.add({
|
|
|
|
'hospitalName': hospitalNameController1.text,
|
|
|
|
'address': practiceAddressController1.text
|
|
|
|
});
|
|
|
|
}
|
|
|
|
if(hospitalNameController2!=''){
|
|
|
|
placeOfPractices.add({
|
|
|
|
'hospitalName': hospitalNameController2.text,
|
|
|
|
'address': practiceAddressController2.text
|
|
|
|
});
|
|
|
|
}
|
|
|
|
if(hospitalNameController3!=''){
|
|
|
|
placeOfPractices.add({
|
|
|
|
'hospitalName': hospitalNameController3.text,
|
|
|
|
'address': practiceAddressController3.text
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
int age=0;
|
|
|
|
/*if(ageController.text.toString()!=''||ageController.text.toString()!='null'){
|
|
|
|
age=int.parse(ageController.text.toString());
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
age=0;
|
|
|
|
}*/
|
|
|
|
|
|
|
|
|
|
|
|
AppSettings.preLoaderDialog(context);
|
|
|
|
var payload = new Map<String, dynamic>();
|
|
|
|
|
|
|
|
payload["doctorId"] =doctorIdController.text.toString();
|
|
|
|
payload["doctorName"] = nameController.text.toString();
|
|
|
|
payload["phone"] = mobileNumberController.text.toString();
|
|
|
|
payload["age"] = age;
|
|
|
|
payload["gender"] = gender;
|
|
|
|
payload["specialization"] = specializationController.text;
|
|
|
|
payload["qualification"] =qualificationController.text ;
|
|
|
|
payload["placeOfPractice"] =placeOfPractices ;
|
|
|
|
|
|
|
|
bool status = await AppSettings.addDoctor(payload);
|
|
|
|
if(status){
|
|
|
|
Navigator.of(context,rootNavigator: true).pop();
|
|
|
|
AppSettings.longSuccessToast('Doctor added successfully');
|
|
|
|
Navigator.pop(context);
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
Navigator.of(context,rootNavigator: true).pop();
|
|
|
|
AppSettings.longFailedToast('There is a problem for adding doctor');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
AppSettings.longFailedToast('Please enter valid details');
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
child: Text('Add Doctor'),
|
|
|
|
)
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
)),
|
|
|
|
),
|
|
|
|
]));
|
|
|
|
}
|
|
|
|
}
|