From e3b75b18c8aa05aa875d4177d919803bc01e1491 Mon Sep 17 00:00:00 2001 From: "taha.alam" Date: Wed, 16 Apr 2025 16:27:54 +0300 Subject: [PATCH] WD: stepper back button added and text directionality added. --- .../search_result/ResultByClinic.dart | 9 ++- .../search_result/ResultByHospital.dart | 25 +++++--- .../search_result/SearchResultWithTab.dart | 57 +++++++++++++++++- .../SearchResultWithTabForHospital.dart | 60 ++++++++++++++++++- 4 files changed, 136 insertions(+), 15 deletions(-) diff --git a/lib/pages/BookAppointment/search_result/ResultByClinic.dart b/lib/pages/BookAppointment/search_result/ResultByClinic.dart index 9c532140..6d7b5592 100644 --- a/lib/pages/BookAppointment/search_result/ResultByClinic.dart +++ b/lib/pages/BookAppointment/search_result/ResultByClinic.dart @@ -12,6 +12,7 @@ import 'package:diplomaticquarterapp/services/appointment_services/doctor_respon import 'package:diplomaticquarterapp/services/clinic_services/get_clinic_service.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; @@ -48,8 +49,9 @@ class _ResultByClinicState extends State { return Column( children: [ Expanded( - child: ListView.builder( - itemBuilder: (_, index) => InkWell( + child: clinicIds?.isNotEmpty == true + ? ListView.builder( + itemBuilder: (_, index) => InkWell( onTap: () { getDoctorsList( context, @@ -94,7 +96,8 @@ class _ResultByClinicState extends State { ), ), itemCount: clinicIds?.length ?? 0, - )) + ) + : getNoDataWidget(context)), ], ); } diff --git a/lib/pages/BookAppointment/search_result/ResultByHospital.dart b/lib/pages/BookAppointment/search_result/ResultByHospital.dart index 5f7547f6..aecb78f8 100644 --- a/lib/pages/BookAppointment/search_result/ResultByHospital.dart +++ b/lib/pages/BookAppointment/search_result/ResultByHospital.dart @@ -1,9 +1,11 @@ +import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/models/Appointments/DoctorListResponse.dart'; import 'package:diplomaticquarterapp/models/Appointments/OBGyneProcedureListResponse.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:provider/provider.dart'; typedef OnHospitalSelected = Function(String, int); @@ -100,14 +102,21 @@ class HospitalBodyWidget extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - patientDoctorAppointmentListHospital![index] - .filterName ?? - '', - style: TextStyle( - fontSize: 22, - color: Colors.black, - fontWeight: FontWeight.w700), + Directionality( + textDirection: + (context.read().isArabic == + true) + ? TextDirection.rtl + : TextDirection.ltr, + child: Text( + patientDoctorAppointmentListHospital![index] + .filterName ?? + '', + style: TextStyle( + fontSize: 22, + color: Colors.black, + fontWeight: FontWeight.w700), + ), ), SizedBox( height: 8, diff --git a/lib/pages/BookAppointment/search_result/SearchResultWithTab.dart b/lib/pages/BookAppointment/search_result/SearchResultWithTab.dart index 573f78e5..25d527b9 100644 --- a/lib/pages/BookAppointment/search_result/SearchResultWithTab.dart +++ b/lib/pages/BookAppointment/search_result/SearchResultWithTab.dart @@ -57,14 +57,14 @@ class _SearchResultWithTabState extends State { changePageViewIndex(pageIndex) { _controller.jumpToPage(pageIndex); - scrollController.jumpTo(pageIndex); + // scrollController.jumpTo(pageIndex); } @override Widget build(BuildContext context) { return AppScaffold( - appBarTitle: getTitle(), + appBarTitle: TranslationBase.of(context).bookAppo, isShowDecPage: false, isShowAppBar: true, showNewAppBarTitle: true, @@ -207,7 +207,37 @@ class _SearchResultWithTabState extends State { ), ), ), - mHeight(24), + Padding( + padding: + const EdgeInsetsDirectional.fromSTEB(10.0, 18, 0, 24), + child: Row( + children: [ + (_currentIndex != 0) + ? InkWell( + onTap: () { + handleBackClick(); + }, + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 0, 0, 04, 0), + child: Icon( + Icons.arrow_back, + color: Theme.of(context).primaryColor, + ), + ), + ) + : mWidth(24), + Text( + getTitle(), + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.w600, + color: Colors.black), + ) + ], + ), + ), + // mHeight(24), Expanded( child: PageView( physics: NeverScrollableScrollPhysics(), @@ -320,6 +350,27 @@ class _SearchResultWithTabState extends State { return ""; } + void handleBackClick() { + switch (_currentIndex) { + case 1: + selectedHospitalIndex = -1; + selectedRegion = ""; + _currentIndex = 0; + changePageViewIndex(0); + break; + case 2: + selectedHospitalIndex = -1; + _currentIndex = 1; + changePageViewIndex(1); + break; + case 3: + selectedHospitalIndex = -1; + _currentIndex = 2; + changePageViewIndex(2); + break; + } + } + Widget showProgress( {String? title, String? status, diff --git a/lib/pages/BookAppointment/search_result/SearchResultWithTabForHospital.dart b/lib/pages/BookAppointment/search_result/SearchResultWithTabForHospital.dart index d1d81f26..db54904e 100644 --- a/lib/pages/BookAppointment/search_result/SearchResultWithTabForHospital.dart +++ b/lib/pages/BookAppointment/search_result/SearchResultWithTabForHospital.dart @@ -69,6 +69,34 @@ class _SearchResultWithTabForHospitalState // duration: const Duration(milliseconds: 300),);} } + void handleBackClick() { + switch (_currentIndex) { + case 1: + selectedHospitalIndex = -1; + selectedRegion = ""; + doctorList = null; + _currentIndex = 0; + changePageViewIndex(0); + break; + case 2: + selectedHospitalIndex = -1; + doctorList = null; + _currentIndex = 1; + changePageViewIndex(1); + break; + case 3: + selectedHospitalIndex = -1; + doctorList = null; + _currentIndex = 2; + changePageViewIndex(2); + break; + case 4: + _currentIndex = 3; + doctorList = null; + changePageViewIndex(3); + } + } + @override Widget build(BuildContext context) { return SizedBox( @@ -211,7 +239,37 @@ class _SearchResultWithTabForHospitalState ), ), ), - mHeight(24), + Padding( + padding: + const EdgeInsetsDirectional.fromSTEB(10.0, 18, 0, 24), + child: Row( + children: [ + (_currentIndex != 0) + ? InkWell( + onTap: () { + handleBackClick(); + }, + child: Padding( + padding: const EdgeInsetsDirectional.fromSTEB( + 0, 0, 04, 0), + child: Icon( + Icons.arrow_back, + color: Theme.of(context).primaryColor, + ), + ), + ) + : mWidth(24), + Text( + getTitle(), + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.w600, + color: Colors.black), + ) + ], + ), + ), + // mHeight(24), Expanded( child: PageView( physics: NeverScrollableScrollPhysics(),