Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54f05e377d | ||
|
|
8e3d05de97 | ||
|
|
1f12d4cb5d | ||
|
|
810548880a |
2
.env
2
.env
@ -1,4 +1,4 @@
|
||||
CUSTOM_SCHEME=com.cosqnet.medoraprovider
|
||||
CUSTOM_SCHEME=com.cosqnet.telemednet
|
||||
PROFILE_COLLECTION_NAME=telemednetusers
|
||||
PATIENT_PROFILE_COLLECTION_NAME=patientprofiles
|
||||
DOCTOR_PROFILE_COLLECTION_NAME=doctorprofiles
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
CUSTOM_SCHEME=com.cosqnet.medoraprovider
|
||||
CUSTOM_SCHEME=com.cosqnet.telemednet
|
||||
PROFILE_COLLECTION_NAME=telemednetusers
|
||||
|
||||
@ -14,7 +14,7 @@ keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.cosqnet.medoraprovider"
|
||||
namespace = "com.cosqnet.telemednet"
|
||||
compileSdk = flutter.compileSdkVersion
|
||||
ndkVersion = "25.1.8937393"
|
||||
|
||||
@ -28,7 +28,7 @@ android {
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "com.cosqnet.medoraprovider"
|
||||
applicationId = "com.cosqnet.telemednet"
|
||||
minSdk = 23
|
||||
targetSdk = flutter.targetSdkVersion
|
||||
versionCode = flutter.versionCode
|
||||
|
||||
@ -2,33 +2,14 @@
|
||||
"project_info": {
|
||||
"project_number": "885942326335",
|
||||
"project_id": "cosq-telemednet-dev",
|
||||
"storage_bucket": "cosq-telemednet-dev.firebasestorage.app"
|
||||
"storage_bucket": "cosq-telemednet-dev.appspot.com"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:885942326335:android:c9dbdbb37592f8a1fb948a",
|
||||
"android_client_info": {
|
||||
"package_name": "com.cosqnet.medoraprovider"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyDKT8Tv5LN11065TkiMGE-CDFdlzxW0LrI"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:885942326335:android:9d43fae1fe50a9d3fb948a",
|
||||
"android_client_info": {
|
||||
"package_name": "com.cosqnet.medoraprovider"
|
||||
"package_name": "com.cosqnet.telemednet"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.cosqnet.medoraprovider;
|
||||
package com.cosqnet.telemednet;
|
||||
|
||||
import io.flutter.embedding.android.FlutterActivity;
|
||||
|
||||
@ -1 +1,36 @@
|
||||
{"flutter":{"platforms":{"android":{"default":{"projectId":"cosq-telemednet-dev","appId":"1:885942326335:android:c9dbdbb37592f8a1fb948a","fileOutput":"android/app/google-services.json"}},"dart":{"lib/firebase_options.dart":{"projectId":"cosq-telemednet-dev","configurations":{"android":"1:885942326335:android:c9dbdbb37592f8a1fb948a","ios":"1:885942326335:ios:dee3d7727c8cb9c6fb948a","macos":"1:885942326335:ios:bafdd38b5ec03c82fb948a","web":"1:885942326335:web:a29a77fb5e4430d3fb948a","windows":"1:885942326335:web:86fb07fffed3d889fb948a"}}}}}}
|
||||
{
|
||||
"flutter": {
|
||||
"platforms": {
|
||||
"android": {
|
||||
"default": {
|
||||
"projectId": "cosq-telemednet-dev",
|
||||
"appId": "1:885942326335:android:9d43fae1fe50a9d3fb948a",
|
||||
"fileOutput": "android/app/google-services.json"
|
||||
}
|
||||
},
|
||||
"dart": {
|
||||
"lib/firebase_options.dart": {
|
||||
"projectId": "cosq-telemednet-dev",
|
||||
"configurations": {
|
||||
"android": "1:885942326335:android:9d43fae1fe50a9d3fb948a",
|
||||
"ios": "1:885942326335:ios:bafdd38b5ec03c82fb948a",
|
||||
"macos": "1:885942326335:ios:bafdd38b5ec03c82fb948a",
|
||||
"web": "1:885942326335:web:ce5eeb369e458643fb948a",
|
||||
"windows": "1:885942326335:web:a29a77fb5e4430d3fb948a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"hosting": {
|
||||
"source": ".",
|
||||
"ignore": [
|
||||
"firebase.json",
|
||||
"**/.*",
|
||||
"**/node_modules/**"
|
||||
],
|
||||
"frameworksBackend": {
|
||||
"region": "asia-east1"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -368,7 +368,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cosqnet.medoraprovider;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cosqnet.telemednet;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
@ -384,7 +384,7 @@
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cosqnet.medoraprovider.RunnerTests;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cosqnet.telemednet.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
@ -401,7 +401,7 @@
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cosqnet.medoraprovider.RunnerTests;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cosqnet.telemednet.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
|
||||
@ -416,7 +416,7 @@
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cosqnet.medoraprovider.RunnerTests;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cosqnet.telemednet.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
|
||||
@ -547,7 +547,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cosqnet.medoraprovider;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cosqnet.telemednet;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
@ -569,7 +569,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cosqnet.medoraprovider;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cosqnet.telemednet;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
SWIFT_VERSION = 5.0;
|
||||
|
||||
@ -57,6 +57,14 @@ class PatientController {
|
||||
model.address.city = city;
|
||||
}
|
||||
|
||||
void updateAddressType(String addressType) {
|
||||
model.address.addressType = addressType;
|
||||
}
|
||||
|
||||
void updateOtherLabel(String otherLabel) {
|
||||
model.address.otherLabel = otherLabel;
|
||||
}
|
||||
|
||||
void addFamilyMember(FamilyMember member) {
|
||||
model.familyMembers.add(member);
|
||||
}
|
||||
|
||||
@ -92,15 +92,20 @@ class PatientAddress {
|
||||
String? country;
|
||||
String? state;
|
||||
String? city;
|
||||
String? addressType;
|
||||
String? otherLabel;
|
||||
|
||||
PatientAddress(
|
||||
{this.houseNo,
|
||||
PatientAddress({
|
||||
this.houseNo,
|
||||
this.line,
|
||||
this.town,
|
||||
this.pincode,
|
||||
this.country,
|
||||
this.state,
|
||||
this.city});
|
||||
this.city,
|
||||
this.addressType,
|
||||
this.otherLabel,
|
||||
});
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
@ -111,6 +116,8 @@ class PatientAddress {
|
||||
'country': country,
|
||||
'state': state,
|
||||
'city': city,
|
||||
'addressType': addressType,
|
||||
'otherLabel': otherLabel,
|
||||
};
|
||||
}
|
||||
|
||||
@ -122,5 +129,7 @@ class PatientAddress {
|
||||
country = json['country'];
|
||||
state = json['state'];
|
||||
city = json['city'];
|
||||
addressType = json['addressType'];
|
||||
otherLabel = json['otherLabel'];
|
||||
}
|
||||
}
|
||||
|
||||
39
lib/data_service.dart
Normal file
39
lib/data_service.dart
Normal file
@ -0,0 +1,39 @@
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:telemednet/telemed_user.dart';
|
||||
|
||||
class DataService {
|
||||
static final String profileCollectionName =
|
||||
dotenv.env['PROFILE_COLLECTION_NAME']!;
|
||||
static final db = FirebaseFirestore.instance;
|
||||
|
||||
static User? getCurrentUser() {
|
||||
return FirebaseAuth.instance.currentUser;
|
||||
}
|
||||
|
||||
static Future<TelemedUser?> getProfile() async {
|
||||
try {
|
||||
final user = getCurrentUser();
|
||||
if (user == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final uid = user.uid;
|
||||
final profiles = db.collection(profileCollectionName);
|
||||
final profile = await profiles.doc(uid).get();
|
||||
if (!profile.exists) {
|
||||
return null;
|
||||
}
|
||||
final profileData = profile.data();
|
||||
if (profileData == null) {
|
||||
return null;
|
||||
}
|
||||
var telemedUser = TelemedUser.fromJson(profileData, uid);
|
||||
return telemedUser;
|
||||
} catch (e) {
|
||||
print(e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
31
lib/error_view.dart
Normal file
31
lib/error_view.dart
Normal file
@ -0,0 +1,31 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ErrorView extends StatefulWidget {
|
||||
final String message;
|
||||
final String okMessage;
|
||||
final Function() onPressed;
|
||||
|
||||
const ErrorView(
|
||||
{super.key,
|
||||
required this.message,
|
||||
required this.okMessage,
|
||||
required this.onPressed});
|
||||
|
||||
@override
|
||||
State<ErrorView> createState() => _ErrorViewState();
|
||||
}
|
||||
|
||||
class _ErrorViewState extends State<ErrorView> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Column(
|
||||
children: [
|
||||
Text(widget.message),
|
||||
ElevatedButton(
|
||||
onPressed: widget.onPressed, child: Text(widget.okMessage))
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -42,29 +42,29 @@ class DefaultFirebaseOptions {
|
||||
|
||||
static const FirebaseOptions web = FirebaseOptions(
|
||||
apiKey: 'AIzaSyBjjfki3kFcyIMgEtK2hJMr4bW0QuDu3R4',
|
||||
appId: '1:885942326335:web:a29a77fb5e4430d3fb948a',
|
||||
appId: '1:885942326335:web:ce5eeb369e458643fb948a',
|
||||
messagingSenderId: '885942326335',
|
||||
projectId: 'cosq-telemednet-dev',
|
||||
authDomain: 'cosq-telemednet-dev.firebaseapp.com',
|
||||
storageBucket: 'cosq-telemednet-dev.firebasestorage.app',
|
||||
measurementId: 'G-BBV9TFGNN5',
|
||||
storageBucket: 'cosq-telemednet-dev.appspot.com',
|
||||
measurementId: 'G-JM2FQB2LKG',
|
||||
);
|
||||
|
||||
static const FirebaseOptions android = FirebaseOptions(
|
||||
apiKey: 'AIzaSyDKT8Tv5LN11065TkiMGE-CDFdlzxW0LrI',
|
||||
appId: '1:885942326335:android:c9dbdbb37592f8a1fb948a',
|
||||
appId: '1:885942326335:android:9d43fae1fe50a9d3fb948a',
|
||||
messagingSenderId: '885942326335',
|
||||
projectId: 'cosq-telemednet-dev',
|
||||
storageBucket: 'cosq-telemednet-dev.firebasestorage.app',
|
||||
storageBucket: 'cosq-telemednet-dev.appspot.com',
|
||||
);
|
||||
|
||||
static const FirebaseOptions ios = FirebaseOptions(
|
||||
apiKey: 'AIzaSyBFhr46aK82ZIL-dzV-P5IiL44ZIGv0p24',
|
||||
appId: '1:885942326335:ios:dee3d7727c8cb9c6fb948a',
|
||||
appId: '1:885942326335:ios:bafdd38b5ec03c82fb948a',
|
||||
messagingSenderId: '885942326335',
|
||||
projectId: 'cosq-telemednet-dev',
|
||||
storageBucket: 'cosq-telemednet-dev.firebasestorage.app',
|
||||
iosBundleId: 'com.cosqnet.medoraprovider',
|
||||
storageBucket: 'cosq-telemednet-dev.appspot.com',
|
||||
iosBundleId: 'com.cosqnet.telemednet',
|
||||
);
|
||||
|
||||
static const FirebaseOptions macos = FirebaseOptions(
|
||||
@ -72,18 +72,18 @@ class DefaultFirebaseOptions {
|
||||
appId: '1:885942326335:ios:bafdd38b5ec03c82fb948a',
|
||||
messagingSenderId: '885942326335',
|
||||
projectId: 'cosq-telemednet-dev',
|
||||
storageBucket: 'cosq-telemednet-dev.firebasestorage.app',
|
||||
iosBundleId: 'com.cosqnet.medoraprovider',
|
||||
storageBucket: 'cosq-telemednet-dev.appspot.com',
|
||||
iosBundleId: 'com.cosqnet.telemednet',
|
||||
);
|
||||
|
||||
static const FirebaseOptions windows = FirebaseOptions(
|
||||
apiKey: 'AIzaSyBjjfki3kFcyIMgEtK2hJMr4bW0QuDu3R4',
|
||||
appId: '1:885942326335:web:86fb07fffed3d889fb948a',
|
||||
appId: '1:885942326335:web:a29a77fb5e4430d3fb948a',
|
||||
messagingSenderId: '885942326335',
|
||||
projectId: 'cosq-telemednet-dev',
|
||||
authDomain: 'cosq-telemednet-dev.firebaseapp.com',
|
||||
storageBucket: 'cosq-telemednet-dev.firebasestorage.app',
|
||||
measurementId: 'G-FH3TSY3CCC',
|
||||
storageBucket: 'cosq-telemednet-dev.appspot.com',
|
||||
measurementId: 'G-BBV9TFGNN5',
|
||||
);
|
||||
|
||||
}
|
||||
18
lib/primary_button.dart
Normal file
18
lib/primary_button.dart
Normal file
@ -0,0 +1,18 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class PrimaryButton extends StatelessWidget {
|
||||
final String text;
|
||||
final void Function()? onPressed;
|
||||
|
||||
const PrimaryButton({super.key, required this.text, required this.onPressed});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Theme.of(context).colorScheme.primary),
|
||||
onPressed: onPressed,
|
||||
child: Text(text,
|
||||
style: TextStyle(color: Theme.of(context).colorScheme.onPrimary)));
|
||||
}
|
||||
}
|
||||
@ -17,6 +17,7 @@ class _PatientAddressScreenState extends State<PatientAddressScreen> {
|
||||
late TextEditingController _lineController;
|
||||
late TextEditingController _townController;
|
||||
late TextEditingController _pincodeController;
|
||||
late TextEditingController _otherLabelController;
|
||||
final String country = 'India';
|
||||
String? state;
|
||||
String? city;
|
||||
@ -37,9 +38,11 @@ class _PatientAddressScreenState extends State<PatientAddressScreen> {
|
||||
_lineController = TextEditingController(text: address.line ?? '');
|
||||
_townController = TextEditingController(text: address.town ?? '');
|
||||
_pincodeController = TextEditingController(text: address.pincode ?? '');
|
||||
|
||||
_otherLabelController =
|
||||
TextEditingController(text: address.otherLabel ?? '');
|
||||
state = address.state;
|
||||
city = address.city;
|
||||
addressType = address.addressType;
|
||||
}
|
||||
|
||||
@override
|
||||
@ -137,6 +140,21 @@ class _PatientAddressScreenState extends State<PatientAddressScreen> {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
_buildSectionContainer(
|
||||
'Address Type',
|
||||
Column(
|
||||
children: [
|
||||
_buildAddressTypeChips(),
|
||||
if (addressType == 'Other')
|
||||
_buildTextField(
|
||||
'Other Label',
|
||||
_otherLabelController,
|
||||
(value) => widget.controller!.updateOtherLabel(value),
|
||||
icon: Icons.label_outline,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -162,7 +180,7 @@ class _PatientAddressScreenState extends State<PatientAddressScreen> {
|
||||
if (pincode.isEmpty) {
|
||||
_errors['pincode'] = 'Pincode is required';
|
||||
_hasErrors = true;
|
||||
} else if (!RegExp(r'^[1-9][0-9]{5}$').hasMatch(pincode)) {
|
||||
} else if (!RegExp(r'^\d{6}$').hasMatch(pincode)) {
|
||||
_errors['pincode'] = 'Enter a valid 6-digit pincode';
|
||||
_hasErrors = true;
|
||||
}
|
||||
@ -176,6 +194,16 @@ class _PatientAddressScreenState extends State<PatientAddressScreen> {
|
||||
_errors['city'] = 'City is required';
|
||||
_hasErrors = true;
|
||||
}
|
||||
|
||||
if (addressType == null || addressType!.isEmpty) {
|
||||
_errors['addressType'] = 'Please select an address type';
|
||||
_hasErrors = true;
|
||||
}
|
||||
|
||||
if (addressType == 'Other' && _otherLabelController.text.trim().isEmpty) {
|
||||
_errors['otherLabel'] = 'Please specify other label';
|
||||
_hasErrors = true;
|
||||
}
|
||||
});
|
||||
|
||||
return !_hasErrors;
|
||||
@ -273,6 +301,24 @@ class _PatientAddressScreenState extends State<PatientAddressScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildAddressTypeChips() {
|
||||
return Wrap(
|
||||
spacing: 8.0,
|
||||
children: ['Home', 'Office', 'Other'].map((String type) {
|
||||
return ChoiceChip(
|
||||
label: Text(type),
|
||||
selected: addressType == type,
|
||||
onSelected: (bool selected) {
|
||||
setState(() {
|
||||
addressType = selected ? type : addressType;
|
||||
});
|
||||
widget.controller!.updateAddressType(addressType!);
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
);
|
||||
}
|
||||
|
||||
void _saveAndExit() {
|
||||
if (_validateFields()) {
|
||||
widget.controller!.updateHouseNo(_houseNoController.text);
|
||||
@ -282,7 +328,8 @@ class _PatientAddressScreenState extends State<PatientAddressScreen> {
|
||||
widget.controller!.updateCountry(country);
|
||||
widget.controller!.updateState(state ?? '');
|
||||
widget.controller!.updateCity(city ?? '');
|
||||
|
||||
widget.controller!.updateAddressType(addressType ?? '');
|
||||
widget.controller!.updateOtherLabel(_otherLabelController.text);
|
||||
widget.controller!.updatePatientData();
|
||||
Navigator.pop(context, true);
|
||||
} else {
|
||||
@ -328,6 +375,7 @@ class _PatientAddressScreenState extends State<PatientAddressScreen> {
|
||||
_lineController.dispose();
|
||||
_townController.dispose();
|
||||
_pincodeController.dispose();
|
||||
_otherLabelController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,8 +137,6 @@ class _PatientRegistrationScreenState extends State<PatientRegistrationScreen> {
|
||||
}
|
||||
|
||||
void _showResultDialog(bool isSuccess) {
|
||||
if (!mounted) return;
|
||||
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
@ -180,7 +178,14 @@ class _PatientRegistrationScreenState extends State<PatientRegistrationScreen> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: IconButton(
|
||||
onPressed: _handleProfileSave,
|
||||
onPressed: () {
|
||||
if (_validateAllFields()) {
|
||||
_controller.savePatientData();
|
||||
_showResultDialog(true);
|
||||
} else {
|
||||
_showValidationErrors();
|
||||
}
|
||||
},
|
||||
icon: const Icon(Icons.check, color: Colors.blue, weight: 50),
|
||||
),
|
||||
),
|
||||
@ -551,6 +556,12 @@ class _PatientRegistrationScreenState extends State<PatientRegistrationScreen> {
|
||||
_errors['address'] = 'Please complete all required address fields';
|
||||
_hasErrors = true;
|
||||
}
|
||||
|
||||
if (address.addressType == 'Other' &&
|
||||
(address.otherLabel?.isEmpty ?? true)) {
|
||||
_errors['address'] = 'Please specify other address label';
|
||||
_hasErrors = true;
|
||||
}
|
||||
});
|
||||
|
||||
return !_hasErrors;
|
||||
@ -592,27 +603,6 @@ class _PatientRegistrationScreenState extends State<PatientRegistrationScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _handleProfileSave() async {
|
||||
if (_validateAllFields()) {
|
||||
try {
|
||||
final bool isSuccess = await _controller.savePatientData();
|
||||
if (mounted) {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
|
||||
_showResultDialog(isSuccess);
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
|
||||
_showResultDialog(false);
|
||||
}
|
||||
} else {
|
||||
_showValidationErrors();
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildNavigationField(
|
||||
String label, IconData icon, VoidCallback onTap) {
|
||||
bool isAddressField = label == 'Address';
|
||||
@ -682,7 +672,8 @@ class _PatientRegistrationScreenState extends State<PatientRegistrationScreen> {
|
||||
|
||||
return Text(
|
||||
'${address.houseNo}, ${address.line}\n'
|
||||
'${address.city}, ${address.state} ${address.pincode}\n',
|
||||
'${address.city}, ${address.state} ${address.pincode}\n'
|
||||
'${address.addressType}${address.addressType == "Other" ? ": ${address.otherLabel}" : ""}',
|
||||
style: const TextStyle(color: Colors.black87),
|
||||
);
|
||||
}
|
||||
|
||||
41
lib/telemed_user.dart
Normal file
41
lib/telemed_user.dart
Normal file
@ -0,0 +1,41 @@
|
||||
enum UserRole { doctor, patient }
|
||||
|
||||
class TelemedUser {
|
||||
String uid;
|
||||
late String? name;
|
||||
late String? email;
|
||||
late String? photoURL;
|
||||
late String? phoneNumber;
|
||||
late String? alterPhoneNumber;
|
||||
late UserRole? role;
|
||||
TelemedUser(
|
||||
{required this.uid,
|
||||
this.name,
|
||||
this.email,
|
||||
this.photoURL,
|
||||
this.phoneNumber,
|
||||
this.alterPhoneNumber,
|
||||
this.role});
|
||||
|
||||
TelemedUser.fromJson(Map<String, dynamic> json, this.uid) {
|
||||
uid = json['uid'];
|
||||
name = json['name'];
|
||||
email = json['email'];
|
||||
photoURL = json['photoURL'];
|
||||
phoneNumber = json['phoneNumber'];
|
||||
alterPhoneNumber = json['alterPhoneNumber'];
|
||||
role = json['role'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = <String, dynamic>{};
|
||||
data['uid'] = uid;
|
||||
data['name'] = name;
|
||||
data['email'] = email;
|
||||
data['photoURL'] = photoURL;
|
||||
data['phoneNumber'] = phoneNumber;
|
||||
data['alterPhoneNumber'] = alterPhoneNumber;
|
||||
data['role'] = role;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
17
lib/user_profile_screen.dart
Normal file
17
lib/user_profile_screen.dart
Normal file
@ -0,0 +1,17 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class UserProfileScreen extends StatelessWidget {
|
||||
const UserProfileScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('User Profile Screen'),
|
||||
),
|
||||
body: const Center(
|
||||
child: Text('User Profile Screen'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
17
lib/user_screen.dart
Normal file
17
lib/user_screen.dart
Normal file
@ -0,0 +1,17 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class UserScreen extends StatelessWidget {
|
||||
const UserScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('User Screen'),
|
||||
),
|
||||
body: const Center(
|
||||
child: Text('User Screen'),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -7,7 +7,7 @@ project(runner LANGUAGES CXX)
|
||||
set(BINARY_NAME "telemednet")
|
||||
# The unique GTK application identifier for this application. See:
|
||||
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
|
||||
set(APPLICATION_ID "com.cosqnet.medoraprovider")
|
||||
set(APPLICATION_ID "com.cosqnet.telemednet")
|
||||
|
||||
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
|
||||
# versions of CMake.
|
||||
|
||||
@ -385,7 +385,7 @@
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cosqnet.medoraprovider.RunnerTests;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cosqnet.telemednet.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/telemednet.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/telemednet";
|
||||
@ -399,7 +399,7 @@
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cosqnet.medoraprovider.RunnerTests;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cosqnet.telemednet.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/telemednet.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/telemednet";
|
||||
@ -413,7 +413,7 @@
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cosqnet.medoraprovider.RunnerTests;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cosqnet.telemednet.RunnerTests;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/telemednet.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/telemednet";
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
PRODUCT_NAME = telemednet
|
||||
|
||||
// The application's bundle identifier
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cosqnet.medoraprovider
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.cosqnet.telemednet
|
||||
|
||||
// The copyright displayed in application information
|
||||
PRODUCT_COPYRIGHT = Copyright © 2024 com.cosqnet. All rights reserved.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user