e-referral done.
parent
5f047e1b6f
commit
fb69723a65
@ -0,0 +1,60 @@
|
||||
class SearchEReferralRequestModel {
|
||||
String? patientMobileNumber;
|
||||
double? versionID;
|
||||
int? channel;
|
||||
int? languageID;
|
||||
String? iPAdress;
|
||||
String? generalid;
|
||||
int? patientOutSA;
|
||||
dynamic sessionID;
|
||||
bool? isDentalAllowedBackend;
|
||||
int? deviceTypeID;
|
||||
int? referralNumber;
|
||||
String? identificationNo;
|
||||
|
||||
SearchEReferralRequestModel(
|
||||
{this.patientMobileNumber,
|
||||
this.versionID,
|
||||
this.channel,
|
||||
this.languageID,
|
||||
this.iPAdress,
|
||||
this.generalid,
|
||||
this.patientOutSA,
|
||||
this.sessionID,
|
||||
this.isDentalAllowedBackend,
|
||||
this.deviceTypeID,
|
||||
this.referralNumber,
|
||||
this.identificationNo});
|
||||
|
||||
SearchEReferralRequestModel.fromJson(Map<String, dynamic> json) {
|
||||
patientMobileNumber = json['PatientMobileNumber'];
|
||||
versionID = json['VersionID'];
|
||||
channel = json['Channel'];
|
||||
languageID = json['LanguageID'];
|
||||
iPAdress = json['IPAdress'];
|
||||
generalid = json['generalid'];
|
||||
patientOutSA = json['PatientOutSA'];
|
||||
sessionID = json['SessionID'];
|
||||
isDentalAllowedBackend = json['isDentalAllowedBackend'];
|
||||
deviceTypeID = json['DeviceTypeID'];
|
||||
referralNumber = json['ReferralNumber'];
|
||||
identificationNo = json['IdentificationNo'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['PatientMobileNumber'] = this.patientMobileNumber;
|
||||
data['VersionID'] = this.versionID;
|
||||
data['Channel'] = this.channel;
|
||||
data['LanguageID'] = this.languageID;
|
||||
data['IPAdress'] = this.iPAdress;
|
||||
data['generalid'] = this.generalid;
|
||||
data['PatientOutSA'] = this.patientOutSA;
|
||||
data['SessionID'] = this.sessionID;
|
||||
data['isDentalAllowedBackend'] = this.isDentalAllowedBackend;
|
||||
data['DeviceTypeID'] = this.deviceTypeID;
|
||||
data['ReferralNumber'] = this.referralNumber;
|
||||
data['IdentificationNo'] = this.identificationNo;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,161 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class SearchEReferralResponseModel {
|
||||
dynamic acceptedBrachCode;
|
||||
dynamic acceptedBranchName;
|
||||
dynamic acceptedBranchNameAr;
|
||||
dynamic channel;
|
||||
dynamic identityCardAttachment;
|
||||
String? identityNumber;
|
||||
dynamic insuranceCardAttachment;
|
||||
bool? isInsuredPatient;
|
||||
List<MedicalReportAttachment>? medicalReportAttachment;
|
||||
String? otherRelationship;
|
||||
String? patientContactNo;
|
||||
int? patientId;
|
||||
String? patientName;
|
||||
dynamic preferredBranchCode;
|
||||
dynamic preferredBranchName;
|
||||
String? referralDate;
|
||||
int? referralNumber;
|
||||
RelationshipType? relationshipType;
|
||||
String? requesterContactNo;
|
||||
String? requesterName;
|
||||
String? status;
|
||||
String? statusAr;
|
||||
|
||||
SearchEReferralResponseModel({
|
||||
this.acceptedBrachCode,
|
||||
this.acceptedBranchName,
|
||||
this.acceptedBranchNameAr,
|
||||
this.channel,
|
||||
this.identityCardAttachment,
|
||||
this.identityNumber,
|
||||
this.insuranceCardAttachment,
|
||||
this.isInsuredPatient,
|
||||
this.medicalReportAttachment,
|
||||
this.otherRelationship,
|
||||
this.patientContactNo,
|
||||
this.patientId,
|
||||
this.patientName,
|
||||
this.preferredBranchCode,
|
||||
this.preferredBranchName,
|
||||
this.referralDate,
|
||||
this.referralNumber,
|
||||
this.relationshipType,
|
||||
this.requesterContactNo,
|
||||
this.requesterName,
|
||||
this.status,
|
||||
this.statusAr,
|
||||
});
|
||||
|
||||
factory SearchEReferralResponseModel.fromRawJson(String str) => SearchEReferralResponseModel.fromJson(json.decode(str));
|
||||
|
||||
String toRawJson() => json.encode(toJson());
|
||||
|
||||
factory SearchEReferralResponseModel.fromJson(Map<String, dynamic> json) => SearchEReferralResponseModel(
|
||||
acceptedBrachCode: json["AcceptedBrachCode"],
|
||||
acceptedBranchName: json["AcceptedBranchName"],
|
||||
acceptedBranchNameAr: json["AcceptedBranchNameAr"],
|
||||
channel: json["Channel"],
|
||||
identityCardAttachment: json["IdentityCardAttachment"],
|
||||
identityNumber: json["IdentityNumber"],
|
||||
insuranceCardAttachment: json["InsuranceCardAttachment"],
|
||||
isInsuredPatient: json["IsInsuredPatient"],
|
||||
medicalReportAttachment: json["MedicalReportAttachment"] == null ? [] : List<MedicalReportAttachment>.from(json["MedicalReportAttachment"]!.map((x) => MedicalReportAttachment.fromJson(x))),
|
||||
otherRelationship: json["OtherRelationship"],
|
||||
patientContactNo: json["PatientContactNo"],
|
||||
patientId: json["PatientId"],
|
||||
patientName: json["PatientName"],
|
||||
preferredBranchCode: json["PreferredBranchCode"],
|
||||
preferredBranchName: json["PreferredBranchName"],
|
||||
referralDate: json["ReferralDate"],
|
||||
referralNumber: json["ReferralNumber"],
|
||||
relationshipType: json["RelationshipType"] == null ? null : RelationshipType.fromJson(json["RelationshipType"]),
|
||||
requesterContactNo: json["RequesterContactNo"],
|
||||
requesterName: json["RequesterName"],
|
||||
status: json["Status"],
|
||||
statusAr: json["StatusAr"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"AcceptedBrachCode": acceptedBrachCode,
|
||||
"AcceptedBranchName": acceptedBranchName,
|
||||
"AcceptedBranchNameAr": acceptedBranchNameAr,
|
||||
"Channel": channel,
|
||||
"IdentityCardAttachment": identityCardAttachment,
|
||||
"IdentityNumber": identityNumber,
|
||||
"InsuranceCardAttachment": insuranceCardAttachment,
|
||||
"IsInsuredPatient": isInsuredPatient,
|
||||
"MedicalReportAttachment": medicalReportAttachment == null ? [] : List<dynamic>.from(medicalReportAttachment!.map((x) => x.toJson())),
|
||||
"OtherRelationship": otherRelationship,
|
||||
"PatientContactNo": patientContactNo,
|
||||
"PatientId": patientId,
|
||||
"PatientName": patientName,
|
||||
"PreferredBranchCode": preferredBranchCode,
|
||||
"PreferredBranchName": preferredBranchName,
|
||||
"ReferralDate": referralDate,
|
||||
"ReferralNumber": referralNumber,
|
||||
"RelationshipType": relationshipType?.toJson(),
|
||||
"RequesterContactNo": requesterContactNo,
|
||||
"RequesterName": requesterName,
|
||||
"Status": status,
|
||||
"StatusAr": statusAr,
|
||||
};
|
||||
}
|
||||
|
||||
class MedicalReportAttachment {
|
||||
String? base64String;
|
||||
String? fileName;
|
||||
|
||||
MedicalReportAttachment({
|
||||
this.base64String,
|
||||
this.fileName,
|
||||
});
|
||||
|
||||
factory MedicalReportAttachment.fromRawJson(String str) => MedicalReportAttachment.fromJson(json.decode(str));
|
||||
|
||||
String toRawJson() => json.encode(toJson());
|
||||
|
||||
factory MedicalReportAttachment.fromJson(Map<String, dynamic> json) => MedicalReportAttachment(
|
||||
base64String: json["Base64String"],
|
||||
fileName: json["FileName"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"Base64String": base64String,
|
||||
"FileName": fileName,
|
||||
};
|
||||
}
|
||||
|
||||
class RelationshipType {
|
||||
int? id;
|
||||
String? text;
|
||||
String? textAr;
|
||||
String? textEn;
|
||||
|
||||
RelationshipType({
|
||||
this.id,
|
||||
this.text,
|
||||
this.textAr,
|
||||
this.textEn,
|
||||
});
|
||||
|
||||
factory RelationshipType.fromRawJson(String str) => RelationshipType.fromJson(json.decode(str));
|
||||
|
||||
String toRawJson() => json.encode(toJson());
|
||||
|
||||
factory RelationshipType.fromJson(Map<String, dynamic> json) => RelationshipType(
|
||||
id: json["ID"],
|
||||
text: json["Text"],
|
||||
textAr: json["Text_Ar"],
|
||||
textEn: json["Text_En"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"ID": id,
|
||||
"Text": text,
|
||||
"Text_Ar": textAr,
|
||||
"Text_En": textEn,
|
||||
};
|
||||
}
|
||||
@ -1,103 +0,0 @@
|
||||
import 'dart:ui';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_export.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/features/contact_us/contact_us_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
||||
import 'package:hmg_patient_app_new/presentation/e_referral/new_e_referral.dart';
|
||||
import 'package:hmg_patient_app_new/presentation/e_referral/search_e_referral.dart';
|
||||
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/custom_tab_bar.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class EReferralPage extends StatefulWidget {
|
||||
const EReferralPage({super.key});
|
||||
|
||||
@override
|
||||
_EReferralPageState createState() => _EReferralPageState();
|
||||
}
|
||||
|
||||
class _EReferralPageState extends State<EReferralPage> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
bool isNewReferral = true;
|
||||
VoidCallback? onNextStep;
|
||||
int _currentPageIndex = 0;
|
||||
int activeTabIndex = 0;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.bgScaffoldColor,
|
||||
body: CollapsingListView(
|
||||
title: "E Referral".needTranslation,
|
||||
child: Consumer<ContactUsViewModel>(builder: (context, contactUsVM, child) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 16.h),
|
||||
CustomTabBar(
|
||||
activeTextColor: AppColors.primaryRedColor,
|
||||
activeBackgroundColor: AppColors.primaryRedColor.withValues(alpha: .1),
|
||||
tabs: [
|
||||
CustomTabBarModel(null, "New Referral".needTranslation),
|
||||
CustomTabBarModel(null, "Search Referral".needTranslation),
|
||||
],
|
||||
onTabChange: (index) {
|
||||
activeTabIndex =index;
|
||||
setState(() {
|
||||
|
||||
});
|
||||
},
|
||||
).paddingSymmetrical(24.h, 0.h),
|
||||
SizedBox(height: 24.h),
|
||||
activeTabIndex ==0 ? NewReferralPage(
|
||||
onNextStep: (nextStep) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
setState(() {
|
||||
onNextStep = nextStep;
|
||||
});
|
||||
});
|
||||
},
|
||||
onStepChanged: (int value) {
|
||||
setState(() {
|
||||
_currentPageIndex = value;
|
||||
});
|
||||
},
|
||||
) :
|
||||
SearchEReferralPage(
|
||||
onNextStep: (onNextStep) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
setState(() {
|
||||
onNextStep = onNextStep;
|
||||
});
|
||||
});
|
||||
},
|
||||
)
|
||||
],
|
||||
);
|
||||
}),
|
||||
),
|
||||
bottomNavigationBar: Padding(
|
||||
padding: EdgeInsets.all(20.h),
|
||||
child: CustomButton(
|
||||
text:activeTabIndex == 0 ? _currentPageIndex >= 2 ? LocaleKeys.submit.tr() : LocaleKeys.next.tr() : LocaleKeys.search.tr(),
|
||||
onPressed: onNextStep ?? () {},
|
||||
backgroundColor: AppColors.primaryRedColor,
|
||||
borderColor: AppColors.primaryRedColor,
|
||||
textColor: AppColors.whiteColor,
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,310 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_export.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/date_util.dart';
|
||||
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
||||
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
|
||||
import 'package:hmg_patient_app_new/features/hmg_services/hmg_services_view_model.dart';
|
||||
import 'package:hmg_patient_app_new/features/hmg_services/models/resq_models/search_e_referral_resp_model.dart';
|
||||
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:smooth_corner/smooth_corner.dart';
|
||||
|
||||
class SearchResultPage extends StatefulWidget {
|
||||
const SearchResultPage({super.key});
|
||||
|
||||
@override
|
||||
_SearchResultPageState createState() => _SearchResultPageState();
|
||||
}
|
||||
|
||||
class _SearchResultPageState extends State<SearchResultPage> {
|
||||
HmgServicesViewModel? hmgServicesVM;
|
||||
|
||||
String _selectedFilter = 'All';
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
hmgServicesVM = context.read<HmgServicesViewModel>();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CollapsingListView(
|
||||
title: "Search Result".needTranslation,
|
||||
child: Column(
|
||||
children: [
|
||||
// List of referrals
|
||||
ListView.builder(
|
||||
padding: EdgeInsets.zero,
|
||||
shrinkWrap: true,
|
||||
itemCount: hmgServicesVM?.searchReferralList.length,
|
||||
itemBuilder: (context, index) {
|
||||
return _buildReferralCard(hmgServicesVM!.searchReferralList[index]);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildReferralCard(SearchEReferralResponseModel referral) {
|
||||
return SmoothCard(
|
||||
borderRadius: BorderRadius.circular(16.h),
|
||||
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
color: AppColors.whiteColor,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(16.h),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
|
||||
'Referral No ${referral.referralNumber}'.needTranslation.toText18(isBold: true, color: AppColors.textColor),
|
||||
|
||||
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||
decoration: BoxDecoration(
|
||||
color: _getStatusColor(referral.status!),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child:
|
||||
referral.status!.toText12(color: AppColors.whiteColor,
|
||||
// style: TextStyle(
|
||||
// color: Colors.white,
|
||||
// fontSize: 12,
|
||||
// fontWeight: FontWeight.w500,
|
||||
// ),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
SizedBox(height: 16),
|
||||
|
||||
// Patient information
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 50,
|
||||
height: 50,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.lightGrayBGColor,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(
|
||||
Icons.person,
|
||||
color: AppColors.lightGrayBGColor,
|
||||
size: 30,
|
||||
),
|
||||
),
|
||||
SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
//Text(
|
||||
referral.patientName!.toText16(isBold: true, color: AppColors.textColor),
|
||||
// style: TextStyle(
|
||||
// fontSize: 16,
|
||||
// fontWeight: FontWeight.bold,
|
||||
// ),
|
||||
// ),
|
||||
SizedBox(height: 4),
|
||||
// Text(
|
||||
'ID: ${referral.identityNumber}'.toText14(color: AppColors.greyTextColor),
|
||||
// style: TextStyle(
|
||||
// color: Colors.grey[600],
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
SizedBox(height: 16),
|
||||
|
||||
// Details row
|
||||
Row(
|
||||
children: [
|
||||
_buildDetailItem(
|
||||
Icons.phone,
|
||||
referral.patientContactNo!,
|
||||
),
|
||||
SizedBox(width: 16),
|
||||
_buildDetailItem(Icons.calendar_today, Utils.getDayMonthYearDateFormatted(DateUtil.convertStringToDateNoTimeZone(referral.referralDate!))),
|
||||
],
|
||||
),
|
||||
|
||||
SizedBox(height: 16),
|
||||
|
||||
// Requester information
|
||||
Container(
|
||||
padding: EdgeInsets.all(5.h),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.lightGrayBGColor,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.person_outline,
|
||||
color: Colors.grey[600],
|
||||
size: 20,
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
//Text(
|
||||
'Requester: ${referral.requesterName}'.toText14(),
|
||||
// style: TextStyle(
|
||||
// color: Colors.grey[700],
|
||||
// ),
|
||||
// ),
|
||||
SizedBox(width: 16),
|
||||
Icon(
|
||||
Icons.phone,
|
||||
color: Colors.grey[600],
|
||||
size: 16,
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
// Text(
|
||||
referral.requesterContactNo!.toText14(),
|
||||
// style: TextStyle(
|
||||
// color: Colors.grey[700],
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
SizedBox(height: 12),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.group,
|
||||
color: Colors.grey[600],
|
||||
size: 16,
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
//Text(
|
||||
'Relationship: ${referral.relationshipType?.text}'.toText14(color:AppColors.greyTextColor),
|
||||
// style: TextStyle(
|
||||
// color: Colors.grey[700],
|
||||
// fontSize: 14,
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.attach_file,
|
||||
color: Colors.grey[600],
|
||||
size: 16,
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
// Text(
|
||||
'${referral.medicalReportAttachment?.length} file(s)'.toText14(color:AppColors.greyTextColor),
|
||||
// style: TextStyle(
|
||||
// color: Colors.grey[700],
|
||||
// fontSize: 14,
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
SizedBox(height: 16),
|
||||
|
||||
// Action buttons
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDetailItem(IconData icon, String text) {
|
||||
return Row(
|
||||
children: [
|
||||
Icon(
|
||||
icon,
|
||||
color: Colors.grey[600],
|
||||
size: 16,
|
||||
),
|
||||
SizedBox(width: 4),
|
||||
// Text(
|
||||
text.toText14(color: AppColors.greyTextColor),
|
||||
// style: TextStyle(
|
||||
// color: Colors.grey[700],
|
||||
// ),
|
||||
// ),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Color _getStatusColor(String status) {
|
||||
switch (status) {
|
||||
case 'Pending':
|
||||
return AppColors.alertColor;
|
||||
case 'Completed':
|
||||
return AppColors.bgGreenColor;
|
||||
case 'Rejected':
|
||||
return AppColors.primaryRedColor;
|
||||
default:
|
||||
return AppColors.lightGrayColor;
|
||||
}
|
||||
}
|
||||
|
||||
void _showFilterOptions() {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
'Filter Results',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
_buildFilterOption('All'),
|
||||
_buildFilterOption('Pending'),
|
||||
_buildFilterOption('Completed'),
|
||||
_buildFilterOption('Rejected'),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildFilterOption(String filter) {
|
||||
return ListTile(
|
||||
leading: Icon(
|
||||
_selectedFilter == filter ? Icons.radio_button_checked : Icons.radio_button_off,
|
||||
color: _selectedFilter == filter ? Colors.blue[700] : Colors.grey,
|
||||
),
|
||||
title: Text(filter),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_selectedFilter = filter;
|
||||
});
|
||||
Navigator.pop(context);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,72 +0,0 @@
|
||||
// widgets/progress_stepper_widget.dart
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||
|
||||
class ProgressStepperWidget extends StatelessWidget {
|
||||
final int currentStep;
|
||||
final List<String> steps;
|
||||
|
||||
const ProgressStepperWidget({
|
||||
super.key,
|
||||
required this.currentStep,
|
||||
required this.steps,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
for (int i = 0; i < steps.length; i++)
|
||||
_buildStep(
|
||||
title: steps[i],
|
||||
active: i == currentStep,
|
||||
showDivider: i < steps.length - 1,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStep({required String title, required bool active, bool showDivider = true}) {
|
||||
final Color activeColor = active ? AppColors.primaryRedColor : Colors.grey.shade400;
|
||||
|
||||
return Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
CircleAvatar(
|
||||
radius: 13,
|
||||
backgroundColor: active ? activeColor : Colors.grey.shade300,
|
||||
child: Icon(Icons.check, size: 14, color: Colors.white),
|
||||
),
|
||||
if (showDivider)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: Divider(thickness: 1),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Text(title, style: const TextStyle(fontSize: 11, fontWeight: FontWeight.w600)),
|
||||
const SizedBox(height: 6),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: active ? activeColor.withOpacity(0.15) : Colors.grey.shade100,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Text(
|
||||
active ? 'Active' : 'Inactive',
|
||||
style: TextStyle(fontSize: 9, color: active ? activeColor : Colors.grey)
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hmg_patient_app_new/core/app_export.dart';
|
||||
import 'package:hmg_patient_app_new/theme/colors.dart';
|
||||
|
||||
class StepperWidget extends StatelessWidget {
|
||||
|
||||
double width = 80.w;
|
||||
Color activeColor = AppColors.primaryRedColor;
|
||||
bool hasThumb = true;
|
||||
double? height = 4.h;
|
||||
StepperWidget( this.width, this.activeColor, this.hasThumb, this.height, {super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return oneProgressBar(width, activeColor, hasThumb);
|
||||
}
|
||||
|
||||
Widget oneProgressBar(double width, Color color, bool hasThumb) {
|
||||
return Row(
|
||||
children: [
|
||||
AnimatedSize(
|
||||
duration: const Duration(seconds: 1),
|
||||
child: SizedBox(
|
||||
height: 28.h,
|
||||
width: width,
|
||||
child: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: height,
|
||||
child: Container(
|
||||
width: width,
|
||||
height: height,
|
||||
decoration: BoxDecoration(
|
||||
color: color,
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.circular(30.h)
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Visibility(
|
||||
visible: hasThumb,
|
||||
child: Positioned(
|
||||
top: -6.h, // move thumb above bar center
|
||||
left: width - 22.h, // move to right end
|
||||
child: thumb(color),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 8.h)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget thumb(Color color) {
|
||||
return Container(
|
||||
width: 18.h,
|
||||
height: 18.h,
|
||||
padding: EdgeInsets.zero,
|
||||
decoration: BoxDecoration(
|
||||
color: color,
|
||||
shape: BoxShape.circle,
|
||||
border: Border.all(color: Colors.white, width: 2.h)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue