Removed a few warnings

This commit is contained in:
Benoy Bose 2024-10-31 21:25:50 +05:30
parent 66c3b2fb9c
commit 01e27a1c11
14 changed files with 83 additions and 352 deletions

View File

@ -52,7 +52,7 @@ class Profile {
String? lastName;
List<String> qualifications;
var profileDescription;
String? profileDescription;
Profile({
this.title,

View File

@ -3,7 +3,7 @@ import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:telemednet/data/models/doctor.dart';
import '../../controllers/doctor _controller.dart';
import '../../controllers/doctor_controller.dart';
class DoctorProfileService {
static final String doctorProfileCollectionName =

View File

@ -1,7 +1,7 @@
import 'package:firebase_ui_auth/firebase_ui_auth.dart';
import 'package:flutter/material.dart';
import 'package:telemednet/screens/authentication/launch_screen.dart';
import 'package:telemednet/screens/doctor_screens/Doctor_profile_screen.dart';
import 'package:telemednet/screens/doctor_screens/doctor_profile_screen.dart';
import 'package:telemednet/controller/patient_controller.dart';
import 'package:telemednet/screens/doctor_screens/achivements.dart';
import 'package:telemednet/screens/doctor_screens/address_screen.dart';
@ -16,7 +16,7 @@ import 'package:telemednet/screens/patientScreens/registrationScreens/patient_ad
import 'package:telemednet/screens/patientScreens/registrationScreens/patient_family_members_screen.dart';
import 'package:telemednet/screens/patientScreens/registrationScreens/patient_registration_screen.dart';
import 'controllers/doctor _controller.dart';
import 'controllers/doctor_controller.dart';
import 'screens/patientScreens/patient_landing_screen.dart';
import 'screens/patientScreens/registrationScreens/family_members_edit_screen.dart';
@ -30,7 +30,7 @@ final Map<String, Widget Function(BuildContext)> routes = {
// var user = ModalRoute.of(context)!.settings.arguments as TelemedUser?;
// return UserProfileScreen(user: user);
// },
RouteNames.profileUpload: (context) => ProfileUploadPage(),
RouteNames.profileUpload: (context) => const ProfileUploadPage(),
RouteNames.patientLandingScreen: (context) => const PatientLandingScreen(),
RouteNames.patientDashboardScreen: (context) =>
const PatientDashboardScreen(),

View File

@ -3,14 +3,16 @@ import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:telemednet/route_names.dart';
import 'package:telemednet/screens/doctor_screens/address_screen.dart';
import '../../controllers/doctor _controller.dart';
import '../../controllers/doctor_controller.dart';
class ProfileUploadPage extends StatefulWidget {
const ProfileUploadPage({super.key});
@override
_ProfileUploadPageState createState() => _ProfileUploadPageState();
ProfileUploadPageState createState() => ProfileUploadPageState();
}
class _ProfileUploadPageState extends State<ProfileUploadPage> {
class ProfileUploadPageState extends State<ProfileUploadPage> {
final DoctorController _controller = DoctorController();
final _titleController = TextEditingController();
final _surnameController = TextEditingController();
@ -56,7 +58,7 @@ class _ProfileUploadPageState extends State<ProfileUploadPage> {
});
}
bool _validateAndProceed() {
bool validateAndProceed() {
_controller.profileController.updateTitle(_titleController.text);
_controller.profileController.updateSurName(_surnameController.text);
_controller.profileController.updateLastName(_firstnameController.text);
@ -69,10 +71,10 @@ class _ProfileUploadPageState extends State<ProfileUploadPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Doctor Profile'),
title: const Text('Doctor Profile'),
),
body: SingleChildScrollView(
padding: EdgeInsets.all(16.0),
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -83,11 +85,11 @@ class _ProfileUploadPageState extends State<ProfileUploadPage> {
radius: 60,
backgroundImage: _image != null ? FileImage(_image!) : null,
child:
_image == null ? Icon(Icons.camera_alt, size: 50) : null,
_image == null ? const Icon(Icons.camera_alt, size: 50) : null,
),
),
),
SizedBox(height: 24),
const SizedBox(height: 24),
_buildTextField(
'Title',
'Mr, Ms..',
@ -112,42 +114,42 @@ class _ProfileUploadPageState extends State<ProfileUploadPage> {
_middlenameController,
(value) => _controller.profileController.updateMiddleName(value),
),
SizedBox(height: 16),
Text(
const SizedBox(height: 16),
const Text(
'Qualifications',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
SizedBox(height: 8),
const SizedBox(height: 8),
Row(
children: [
Expanded(
child: TextField(
controller: _qualificationController,
decoration: InputDecoration(
decoration: const InputDecoration(
hintText: 'Add Qualification',
border: OutlineInputBorder(),
),
),
),
SizedBox(width: 8),
const SizedBox(width: 8),
ElevatedButton(
onPressed: _addQualification,
child: Icon(Icons.add),
style: ElevatedButton.styleFrom(
shape: CircleBorder(),
padding: EdgeInsets.all(12),
shape: const CircleBorder(),
padding: const EdgeInsets.all(12),
),
child: const Icon(Icons.add),
),
],
),
SizedBox(height: 16),
const SizedBox(height: 16),
Wrap(
spacing: 8,
runSpacing: 8,
children: _controller.profileController.model.qualifications
.map((qual) => Chip(
label: Text(qual),
deleteIcon: Icon(Icons.close),
deleteIcon: const Icon(Icons.close),
onDeleted: () => _removeQualification(qual),
))
.toList(),
@ -191,7 +193,7 @@ class _ProfileUploadPageState extends State<ProfileUploadPage> {
decoration: InputDecoration(
labelText: label,
hintText: hint,
border: OutlineInputBorder(),
border: const OutlineInputBorder(),
),
onChanged: onChanged,
),

View File

@ -1,14 +1,14 @@
import 'package:flutter/material.dart';
import '../../controllers/doctor _controller.dart';
import '../../controllers/doctor_controller.dart';
import '../../route_names.dart';
class AchievementsScreen extends StatefulWidget {
final DoctorController controller;
const AchievementsScreen({
Key? key,
super.key,
required this.controller,
}) : super(key: key);
});
@override
State<AchievementsScreen> createState() => _AchievementsScreenState();
@ -146,11 +146,11 @@ class _AchievementsScreenState extends State<AchievementsScreen> {
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(16.0),
const Padding(
padding: EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
children: [
Text(
'Add Your Achievements',
style: TextStyle(

View File

@ -1,14 +1,13 @@
import 'package:flutter/material.dart';
import 'package:telemednet/screens/doctor_screens/profile_description_screen.dart';
import '../../common/custom_style.dart';
import '../../controllers/doctor _controller.dart';
import '../../controllers/doctor_controller.dart';
import '../../route_names.dart';
class DoctorAddressScreen extends StatefulWidget {
final DoctorController controller;
const DoctorAddressScreen({Key? key, required this.controller})
: super(key: key);
const DoctorAddressScreen({super.key, required this.controller});
@override
State<DoctorAddressScreen> createState() => _DoctorAddressScreenState();
@ -51,7 +50,7 @@ class _DoctorAddressScreenState extends State<DoctorAddressScreen> {
super.dispose();
}
bool _validateAndProceed() {
bool validateAndProceed() {
// Update the address model
addressController.updateFloorBuilding(_floorBuildingController.text);
addressController.updateStreet(_streetController.text);

View File

@ -1,278 +1,7 @@
// // import 'package:flutter/material.dart';
// // import 'dart:io';
// // import 'package:image_picker/image_picker.dart';
// // import '../../controllers/doctor _controller.dart';
// // class DigitalSignatureScreen extends StatefulWidget {
// // final DoctorController controller;
// // const DigitalSignatureScreen({
// // Key? key,
// // required this.controller,
// // }) : super(key: key);
// // @override
// // State<DigitalSignatureScreen> createState() => _DigitalSignatureScreenState();
// // }
// // class _DigitalSignatureScreenState extends State<DigitalSignatureScreen> {
// // File? _signatureFile;
// // final ImagePicker _picker = ImagePicker();
// // Future<void> _pickImage() async {
// // try {
// // final XFile? image = await _picker.pickImage(source: ImageSource.gallery);
// // if (image != null) {
// // setState(() {
// // _signatureFile = File(image.path);
// // });
// // widget.controller.updateDigitalSignature(image.path);
// // }
// // } catch (e) {
// // debugPrint('Error picking image: $e');
// // }
// // }
// // @override
// // Widget build(BuildContext context) {
// // return Scaffold(
// // appBar: AppBar(
// // title: const Text(
// // 'Digital Signature',
// // style: TextStyle(
// // fontSize: 24,
// // fontWeight: FontWeight.bold,
// // ),
// // ),
// // actions: [
// // TextButton(
// // onPressed: () {
// // Navigator.pop(context);
// // },
// // child: const Text(
// // 'Skip',
// // style: TextStyle(
// // color: Color(0xFF5BC0DE),
// // fontSize: 16,
// // ),
// // ),
// // ),
// // ],
// // ),
// // body: Column(
// // crossAxisAlignment: CrossAxisAlignment.center,
// // children: [
// // const SizedBox(height: 20),
// // Center(
// // child: SizedBox(
// // width: 605,
// // height: 205,
// // child: Container(
// // decoration: BoxDecoration(
// // border: Border.all(color: Colors.grey.shade300),
// // borderRadius: BorderRadius.circular(12),
// // ),
// // child: Stack(
// // children: [
// // if (_signatureFile != null)
// // ClipRRect(
// // borderRadius: BorderRadius.circular(12),
// // child: Image.file(
// // _signatureFile!,
// // width: 605,
// // height: 205,
// // fit: BoxFit.contain,
// // ),
// // ),
// // Positioned(
// // right: 16,
// // bottom: 16,
// // child: ElevatedButton.icon(
// // onPressed: _pickImage,
// // icon: const Icon(Icons.upload),
// // label: const Text('Upload'),
// // style: ElevatedButton.styleFrom(
// // backgroundColor: Colors.white,
// // foregroundColor: Colors.black,
// // shape: RoundedRectangleBorder(
// // borderRadius: BorderRadius.circular(20),
// // ),
// // ),
// // ),
// // ),
// // ],
// // ),
// // ),
// // ),
// // ),
// // const Spacer(),
// // Padding(
// // padding: const EdgeInsets.all(16),
// // child: ElevatedButton(
// // onPressed: () {
// // if (widget.controller.validateProfile()) {
// // Navigator.pop(context);
// // }
// // },
// // style: ElevatedButton.styleFrom(
// // backgroundColor: const Color(0xFF5BC0DE),
// // shape: const CircleBorder(),
// // padding: const EdgeInsets.all(24),
// // ),
// // child: const Icon(
// // Icons.arrow_forward_ios,
// // color: Colors.white,
// // ),
// // ),
// // ),
// // ],
// // ),
// // );
// // }
// // }
// import 'package:flutter/material.dart';
// import 'dart:io';
// import 'package:image_picker/image_picker.dart';
// import '../../controllers/doctor _controller.dart';
// class DigitalSignatureScreen extends StatefulWidget {
// final DoctorController controller;
// const DigitalSignatureScreen({
// Key? key,
// required this.controller,
// }) : super(key: key);
// @override
// State<DigitalSignatureScreen> createState() => _DigitalSignatureScreenState();
// }
// class _DigitalSignatureScreenState extends State<DigitalSignatureScreen> {
// File? _signatureFile;
// final ImagePicker _picker = ImagePicker();
// Future<void> _pickImage() async {
// try {
// final XFile? image = await _picker.pickImage(source: ImageSource.gallery);
// if (image != null) {
// setState(() {
// _signatureFile = File(image.path);
// });
// widget.controller.updateDigitalSignature(image.path);
// }
// } catch (e) {
// debugPrint('Error picking image: $e');
// }
// }
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// appBar: AppBar(
// title: const Text(
// 'Digital Signature',
// style: TextStyle(
// fontSize: 24,
// fontWeight: FontWeight.bold,
// ),
// ),
// actions: [
// TextButton(
// onPressed: () {
// Navigator.pop(context);
// },
// child: const Text(
// 'Save and Skip',
// style: TextStyle(
// color: Color(0xFF5BC0DE),
// fontSize: 16,
// ),
// ),
// ),
// ],
// ),
// body: Column(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// const SizedBox(height: 20),
// Center(
// child: SizedBox(
// width: 605,
// height: 205,
// child: Container(
// decoration: BoxDecoration(
// border: Border.all(color: Colors.grey.shade300),
// borderRadius: BorderRadius.circular(12),
// ),
// child: Stack(
// children: [
// if (_signatureFile != null)
// ClipRRect(
// borderRadius: BorderRadius.circular(12),
// child: Image.file(
// _signatureFile!,
// width: 605,
// height: 205,
// fit: BoxFit.contain,
// ),
// ),
// if (_signatureFile == null)
// Center(
// child: Text(
// 'No signature uploaded',
// style: TextStyle(
// color: Colors.grey.shade400,
// fontSize: 16,
// ),
// ),
// ),
// ],
// ),
// ),
// ),
// ),
// const SizedBox(height: 20),
// ElevatedButton.icon(
// onPressed: _pickImage,
// icon: const Icon(Icons.upload),
// label: const Text('Upload Signature'),
// style: ElevatedButton.styleFrom(
// backgroundColor: const Color(0xFF5BC0DE),
// foregroundColor: Colors.white,
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(8),
// ),
// ),
// ),
// const Spacer(),
// Padding(
// padding: const EdgeInsets.all(16),
// child: ElevatedButton(
// onPressed: () {
// if (widget.controller.validateProfile()) {
// Navigator.pop(context);
// }
// },
// style: ElevatedButton.styleFrom(
// backgroundColor: const Color(0xFF5BC0DE),
// shape: const CircleBorder(),
// padding: const EdgeInsets.all(24),
// ),
// child: const Icon(
// Icons.arrow_forward_ios,
// color: Colors.white,
// ),
// ),
// ),
// ],
// ),
// );
// }
// }
import 'package:flutter/material.dart';
import 'dart:io';
import 'package:image_picker/image_picker.dart';
import '../../controllers/doctor _controller.dart';
import '../../controllers/doctor_controller.dart';
import '../../data/services/doctor_profile_service.dart';
import '../../route_names.dart';
@ -280,9 +9,9 @@ class DigitalSignatureScreen extends StatefulWidget {
final DoctorController controller;
const DigitalSignatureScreen({
Key? key,
super.key,
required this.controller,
}) : super(key: key);
});
@override
State<DigitalSignatureScreen> createState() => _DigitalSignatureScreenState();
@ -307,20 +36,22 @@ class _DigitalSignatureScreenState extends State<DigitalSignatureScreen> {
}
Future<void> _saveProfile() async {
// Directly save the doctor profile without validation
bool success =
await DoctorProfileService.saveDoctorProfile(widget.controller);
if (success) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Doctor profile saved successfully!')),
);
Navigator.of(context).pushNamed(RouteNames.doctorAddressScreen);
} else {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Failed to save profile. Please try again.')),
);
if (mounted) {
setState(() {
if (success) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Doctor profile saved successfully!')),
);
Navigator.of(context).pushNamed(RouteNames.doctorAddressScreen);
} else {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Failed to save profile. Please try again.')),
);
}
});
}
}

View File

@ -1,18 +1,17 @@
import 'package:flutter/material.dart';
import '../../controllers/doctor _controller.dart';
import '../../controllers/doctor_controller.dart';
import '../../route_names.dart';
class ExperienceScreen extends StatefulWidget {
final DoctorController controller;
const ExperienceScreen({Key? key, required this.controller})
: super(key: key);
const ExperienceScreen({super.key, required this.controller});
@override
_ExperienceScreenState createState() => _ExperienceScreenState();
ExperienceScreenState createState() => ExperienceScreenState();
}
class _ExperienceScreenState extends State<ExperienceScreen> {
class ExperienceScreenState extends State<ExperienceScreen> {
String? _selectedExperience;
final _licenseController = TextEditingController();
late final DoctorController _controller;

View File

@ -1,21 +1,21 @@
import 'package:flutter/material.dart';
import '../../controllers/doctor _controller.dart';
import '../../controllers/doctor_controller.dart';
import '../../route_names.dart';
class ProfileDescriptionScreen extends StatefulWidget {
final DoctorController controller;
const ProfileDescriptionScreen({
Key? key,
super.key,
required this.controller,
}) : super(key: key);
});
@override
_ProfileDescriptionScreenState createState() =>
_ProfileDescriptionScreenState();
ProfileDescriptionScreenState createState() =>
ProfileDescriptionScreenState();
}
class _ProfileDescriptionScreenState extends State<ProfileDescriptionScreen> {
class ProfileDescriptionScreenState extends State<ProfileDescriptionScreen> {
final _descriptionController = TextEditingController();
late final DoctorController _controller;
bool _isEditing = false;
@ -78,7 +78,7 @@ class _ProfileDescriptionScreenState extends State<ProfileDescriptionScreen> {
);
}
bool _validateAndProceed() {
bool validateAndProceed() {
if (!_validateDescription()) {
return false;
}

View File

@ -1,14 +1,14 @@
import 'package:flutter/material.dart';
import '../../controllers/doctor _controller.dart';
import '../../controllers/doctor_controller.dart';
import '../../route_names.dart';
class SpecialitiesScreen extends StatefulWidget {
final DoctorController controller;
const SpecialitiesScreen({
Key? key,
super.key,
required this.controller,
}) : super(key: key);
});
@override
State<SpecialitiesScreen> createState() => _SpecialitiesScreenState();
@ -164,11 +164,11 @@ class _SpecialitiesScreenState extends State<SpecialitiesScreen> {
),
body: Column(
children: [
Padding(
padding: const EdgeInsets.all(16.0),
const Padding(
padding: EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
children: [
Text(
'Select Your Specialization',
style: TextStyle(

View File

@ -79,11 +79,11 @@ class _PatientDashboardScreenState extends State<PatientDashboardScreen> {
const SizedBox(height: 16),
ElevatedButton(
onPressed: () {},
child: const Text('Consultation >'),
style: ElevatedButton.styleFrom(
backgroundColor: Colors.white,
foregroundColor: Colors.black,
),
child: const Text('Consultation >'),
),
],
),

View File

@ -38,13 +38,13 @@ class _PatientFamilyMembersScreenState
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Family members'),
title: const Text('Family members'),
actions: [
TextButton(
onPressed: () {
// Handle 'Done' action
},
child: Text('Done', style: TextStyle(color: Colors.blue)),
child: const Text('Done', style: TextStyle(color: Colors.blue)),
),
],
),
@ -60,8 +60,8 @@ class _PatientFamilyMembersScreenState
),
floatingActionButton: FloatingActionButton(
onPressed: _addFamilyMember,
child: Icon(Icons.add),
backgroundColor: Colors.blue,
child: const Icon(Icons.add),
),
);
}
@ -117,30 +117,30 @@ class FamilyMemberCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Card(
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Padding(
padding: EdgeInsets.all(16),
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Name: ${familyMember.name}',
style: TextStyle(fontWeight: FontWeight.bold)),
SizedBox(height: 4),
style: const TextStyle(fontWeight: FontWeight.bold)),
const SizedBox(height: 4),
Text('Gender: ${familyMember.gender}'),
SizedBox(height: 4),
const SizedBox(height: 4),
Text('Date of Birth: ${familyMember.dateOfBirth}'),
SizedBox(height: 4),
const SizedBox(height: 4),
Text('Relation: ${familyMember.relation}'),
SizedBox(height: 8),
const SizedBox(height: 8),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
IconButton(
icon: Icon(Icons.edit, color: Colors.blue),
icon: const Icon(Icons.edit, color: Colors.blue),
onPressed: onEdit,
),
IconButton(
icon: Icon(Icons.delete, color: Colors.red),
icon: const Icon(Icons.delete, color: Colors.red),
onPressed: onDelete,
),
],

View File

@ -22,7 +22,7 @@ class _PatientAddressScreenState extends State<PatientAddressScreen> {
String? state;
String? city;
String? addressType;
Map<String, String> _errors = {};
final Map<String, String> _errors = {};
bool _hasErrors = false;
@override