From 5889717efe4736bfb5fd64aeb3443c3b12e39bbc Mon Sep 17 00:00:00 2001 From: Ashutosh Date: Thu, 1 Aug 2024 16:00:22 +0530 Subject: [PATCH] removed all add functionalities --- .../clients/care_plan_menu_screen.dart | 24 +- ...ent_and_capacity_questionnaire_screen.dart | 16 +- .../current_health_issues_screen.dart | 17 +- .../widget/IssueDetailPopupWidget.dart | 207 +++++++++--------- .../documentsList/documents_list_screen.dart | 23 +- lib/view/screens/clients/pbs_plan_screen.dart | 9 +- .../screens/clients/photo_gallery_screen.dart | 10 +- .../clients/recent_incidents_screen.dart | 27 +-- .../risk_assessments_template_screen.dart | 13 +- 9 files changed, 148 insertions(+), 198 deletions(-) diff --git a/lib/view/screens/clients/care_plan_menu_screen.dart b/lib/view/screens/clients/care_plan_menu_screen.dart index 908eb58..5298944 100644 --- a/lib/view/screens/clients/care_plan_menu_screen.dart +++ b/lib/view/screens/clients/care_plan_menu_screen.dart @@ -75,18 +75,18 @@ class _CarePlanMenuScreenState extends State { // const LineWidget( // text: "Key Contacts", // ), - 5.verticalSpace, - LineWidget( - text: "Care Notes", - onItemTap: () { - Navigator.pushNamed( - controller.screenKey.currentContext!, - CustomRouteNames.kCareNotesScreenRoute, - arguments: CareNotesScreenArgs( - serviceUserId: controller.serviceUser()!.id!), - ); - }, - ), + // 5.verticalSpace, + // LineWidget( + // text: "Care Notes", + // onItemTap: () { + // Navigator.pushNamed( + // controller.screenKey.currentContext!, + // CustomRouteNames.kCareNotesScreenRoute, + // arguments: CareNotesScreenArgs( + // serviceUserId: controller.serviceUser()!.id!), + // ); + // }, + // ), 5.verticalSpace, LineWidget( text: "Risk Assesments", diff --git a/lib/view/screens/clients/consent_and_capacity_questionnaire_screen.dart b/lib/view/screens/clients/consent_and_capacity_questionnaire_screen.dart index 0f34c9f..4692bf3 100644 --- a/lib/view/screens/clients/consent_and_capacity_questionnaire_screen.dart +++ b/lib/view/screens/clients/consent_and_capacity_questionnaire_screen.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:ftc_mobile_app/utilities/extensions/custom_extensions.dart'; import 'package:ftc_mobile_app/view/custom_widgets/custom_app_bar_with_action.dart'; import 'package:get/get.dart'; import 'package:intl/intl.dart'; @@ -33,11 +32,9 @@ class _ConsentAndCapacityQuestionnaireScreenState @override Widget build(BuildContext context) { return CustomScaffold( - // onBackButton: () => controller.backButtonPressed(context), backgroundColor: CustomAppColors.kPrimaryColor, screenKey: controller.screenKey, onScreenTap: controller.removeFocus, - // sideDrawer: const CustomDrawer(), showAppBar: true, appBar: _appBar(context), body: SafeArea( @@ -104,20 +101,9 @@ class _ConsentAndCapacityQuestionnaireScreenState } AppBar _appBar(BuildContext context) { - return CustomAppBarWithAction( + return CustomAppBarTitleOnly( context, titleText: "Consent And Capacity", - actionText: '+ Add New', - onActionTap: () async { - final result = await Navigator.pushNamed( - context, CustomRouteNames.kConsentAndCapacityAddNewFormScreenRoute, - arguments: ConsentAndCapacityAddNewFormScreenArgs( - userData: widget.userData, - )); - if (result is ConsentDetailsModel) { - controller.consentDetailsList.insert(0, result); - } - }, ); } diff --git a/lib/view/screens/clients/currentHealthIssues/current_health_issues_screen.dart b/lib/view/screens/clients/currentHealthIssues/current_health_issues_screen.dart index 58ebb82..6d07921 100644 --- a/lib/view/screens/clients/currentHealthIssues/current_health_issues_screen.dart +++ b/lib/view/screens/clients/currentHealthIssues/current_health_issues_screen.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:ftc_mobile_app/models/clients/HealthIssuesDetailsModel.dart'; import 'package:ftc_mobile_app/models/profileData/user_data.dart'; import 'package:ftc_mobile_app/utilities/enums/body_parts.dart'; -import 'package:ftc_mobile_app/view/custom_widgets/custom_app_bar_with_action.dart'; import 'package:ftc_mobile_app/view/custom_widgets/human_body_mapper_widget.dart'; import 'package:ftc_mobile_app/view/custom_widgets/my_circle_image.dart'; import 'package:get/get.dart'; @@ -111,16 +110,8 @@ class _CurrentHealthIssuesScreenState extends State { child: IssueDetailPopupWidget( userData: widget.userData, data: controller.issueBodyParts[b]!.data, - onActionChange: (status, data) { - if (data.status != status) { - controller.updateHealthIssueStatus( - bodyPoint: b, data: data, status: status); - } - }, - onUpdateButtonTap: (data) async { - Get.back(); - onAddOrUpdateButtonTap(context, data); - }, + canChangeStatus: false, + canUpdate: false, ), ), ]); @@ -135,11 +126,9 @@ class _CurrentHealthIssuesScreenState extends State { } AppBar _appBar(BuildContext context) { - return CustomAppBarWithAction( + return CustomAppBarTitleOnly( context, titleText: "Current Health Issues", - actionText: '+ Add New', - onActionTap: () => onAddOrUpdateButtonTap(context), ); } diff --git a/lib/view/screens/clients/currentHealthIssues/widget/IssueDetailPopupWidget.dart b/lib/view/screens/clients/currentHealthIssues/widget/IssueDetailPopupWidget.dart index de3dce6..7e17168 100644 --- a/lib/view/screens/clients/currentHealthIssues/widget/IssueDetailPopupWidget.dart +++ b/lib/view/screens/clients/currentHealthIssues/widget/IssueDetailPopupWidget.dart @@ -11,14 +11,18 @@ class IssueDetailPopupWidget extends StatefulWidget { super.key, required this.userData, required this.data, - required this.onActionChange, - required this.onUpdateButtonTap, + this.canChangeStatus = true, + this.canUpdate = true, + this.onActionChange, + this.onUpdateButtonTap, }); final UserData userData; final HealthIssueDetailsModel data; - final Function(bool status, HealthIssueDetailsModel data) onActionChange; - final Function(HealthIssueDetailsModel data) onUpdateButtonTap; + final bool canChangeStatus; + final bool canUpdate; + final Function(bool status, HealthIssueDetailsModel data)? onActionChange; + final Function(HealthIssueDetailsModel data)? onUpdateButtonTap; static const actionActive = "Active"; static const actionResolved = "Resolved"; @@ -91,98 +95,90 @@ class _IssueDetailPopupWidgetState extends State { ? Colors.red.withOpacity(0.3) : Colors.green.withOpacity(0.3), ), - child: DropdownButtonHideUnderline( - child: DropdownButtonFormField( - onTap: () { - FocusScopeNode().unfocus(); - }, - value: selectedValue, - dropdownColor: Colors.white, - borderRadius: 4.toRadius(), - decoration: InputDecoration( - isDense: true, - border: InputBorder.none, - suffixIcon: Icon(Icons.arrow_drop_down_sharp, - size: 18, - color: (selectedValue == - IssueDetailPopupWidget.actionActive) - ? Colors.red - : Colors.green) - .paddingOnly(right: 12.r), - suffixIconConstraints: BoxConstraints.tightFor( - width: 24.r, height: 32.r), - // contentPadding: REdgeInsets.only(left: 0), - ), - elevation: 4, - icon: FrequentFunctions.noWidget, - style: TextStyle( - fontWeight: FontWeight.w400, - fontSize: 10.sp, - color: Colors.black), - hint: Text( - "Select...", - style: TextStyle( - fontWeight: FontWeight.w400, - fontSize: 12.sp, - color: CustomAppColors.kLightTextColor, + child: IgnorePointer( + ignoring: widget.canChangeStatus.not, + child: DropdownButtonHideUnderline( + child: DropdownButtonFormField( + onTap: () { + FocusScopeNode().unfocus(); + }, + value: selectedValue, + dropdownColor: Colors.white, + borderRadius: 4.toRadius(), + decoration: InputDecoration( + isDense: true, + border: InputBorder.none, + suffixIcon: Icon(Icons.arrow_drop_down_sharp, + size: 18, + color: (selectedValue == + IssueDetailPopupWidget + .actionActive) + ? Colors.red + : Colors.green) + .paddingOnly(right: 12.r), + suffixIconConstraints: BoxConstraints.tightFor( + width: 24.r, height: 32.r), ), - ), - selectedItemBuilder: (_) { - return actionsMap.keys.map( - (e) { - return DropdownMenuItem( - value: e, - child: Container( - // color: (selectedValue == e) - // ? (selectedValue == - // IssueDetailPopupWidget - // .actionActive) - // ? Colors.red.withOpacity(0.3) - // : Colors.green.withOpacity(0.3) - // : Colors.white, - alignment: Alignment.center, - child: Text( - e, - style: TextStyle( - color: (selectedValue == e) - ? (selectedValue == - IssueDetailPopupWidget - .actionActive) - ? Colors.red - : Colors.green - : Colors.black), + elevation: 4, + icon: FrequentFunctions.noWidget, + style: TextStyle( + fontWeight: FontWeight.w400, + fontSize: 10.sp, + color: Colors.black), + hint: Text( + "Select...", + style: TextStyle( + fontWeight: FontWeight.w400, + fontSize: 12.sp, + color: CustomAppColors.kLightTextColor, + ), + ), + selectedItemBuilder: (_) { + return actionsMap.keys.map( + (e) { + return DropdownMenuItem( + value: e, + child: Container( + alignment: Alignment.center, + child: Text( + e, + style: TextStyle( + color: (selectedValue == e) + ? (selectedValue == + IssueDetailPopupWidget + .actionActive) + ? Colors.red + : Colors.green + : Colors.black), + ), ), + ); + }, + ).toList(); + }, + items: actionsMap.keys + .map( + (e) => DropdownMenuItem( + value: e, + child: Text(e), ), - ); - }, - ).toList(); - }, - items: actionsMap.keys - .map( - (e) => DropdownMenuItem( - value: e, - child: Text(e), - ), - ) - .toList(), - // padding: EdgeInsets.zero, - isExpanded: true, - // iconSize: 20.h, - // icon: Padding( - // padding: REdgeInsets.only(right: 0.0), - // child: Icon(Icons.arrow_drop_down_sharp, - // size: 18, - // color: Colors.black), - // ), - onChanged: (v) { - if (v != null) { - setState(() { - selectedValue = v; - widget.onActionChange( - actionsMap[v]!, widget.data); - }); - } - }, + ) + .toList(), + // padding: EdgeInsets.zero, + isExpanded: true, + onChanged: (v) { + if (v != null) { + setState(() { + selectedValue = v; + + if (widget.onActionChange != null) { + widget.onActionChange! + .call(actionsMap[v]!, widget.data); + } + }); + } + }, + ), ), ), ) @@ -241,16 +237,21 @@ class _IssueDetailPopupWidgetState extends State { ), ), 16.verticalSpace, - Center( - child: SizedBox( - width: 120.r, - height: 32.r, - child: CustomAppButton( - onTap: () => widget.onUpdateButtonTap(widget.data), - buttonText: "Update", - ), - ), - ), + (widget.canUpdate) + ? Center( + child: SizedBox( + width: 120.r, + height: 32.r, + child: CustomAppButton( + onTap: (widget.onUpdateButtonTap == null) + ? () {} + : () => + widget.onUpdateButtonTap!.call(widget.data), + buttonText: "Update", + ), + ), + ) + : FrequentFunctions.noWidget, ], ), ), diff --git a/lib/view/screens/clients/documentsList/documents_list_screen.dart b/lib/view/screens/clients/documentsList/documents_list_screen.dart index 3a2baa6..ab82871 100644 --- a/lib/view/screens/clients/documentsList/documents_list_screen.dart +++ b/lib/view/screens/clients/documentsList/documents_list_screen.dart @@ -3,7 +3,6 @@ import 'package:ftc_mobile_app/ftc_mobile_app.dart'; import 'package:ftc_mobile_app/models/clients/documents_list_model.dart'; import 'package:ftc_mobile_app/models/profileData/user_data.dart'; import 'package:ftc_mobile_app/view/custom_widgets/custom_app_bar_with_action.dart'; -import 'package:ftc_mobile_app/view/custom_widgets/edit_icon.dart'; import 'package:ftc_mobile_app/view/screens/clientsListing/widgets/search_bar_widget.dart'; import 'package:get/get.dart'; import 'package:intl/intl.dart'; @@ -53,19 +52,19 @@ class _DocumentsListScreenState extends State { } AppBar _appBar(BuildContext context) { - return CustomAppBarWithAction( + return CustomAppBarTitleOnly( context, titleText: "Documents", - actionText: '+ Add New', - onActionTap: () async { - dynamic response = await Navigator.pushNamed( - context, CustomRouteNames.kAddNewDocumentScreenRoute, - arguments: controller.serviceUser.value); - if (response is DocumentModel) { - controller.documentsList.insert(0, response); - controller.documentsList.refresh(); - } - }, + // actionText: '+ Add New', + // onActionTap: () async { + // dynamic response = await Navigator.pushNamed( + // context, CustomRouteNames.kAddNewDocumentScreenRoute, + // arguments: controller.serviceUser.value); + // if (response is DocumentModel) { + // controller.documentsList.insert(0, response); + // controller.documentsList.refresh(); + // } + // }, ); } diff --git a/lib/view/screens/clients/pbs_plan_screen.dart b/lib/view/screens/clients/pbs_plan_screen.dart index b1771d8..1632e72 100644 --- a/lib/view/screens/clients/pbs_plan_screen.dart +++ b/lib/view/screens/clients/pbs_plan_screen.dart @@ -29,16 +29,13 @@ class _PBSPlanScreenState extends State { @override Widget build(BuildContext context) { return CustomScaffold( - // onBackButton: () => controller.onBackPress(context), backgroundColor: CustomAppColors.kPrimaryColor, screenKey: controller.screenKey, onScreenTap: controller.removeFocus, - // sideDrawer: const CustomDrawer(), showAppBar: true, appBar: _appBar(context), body: Column( children: [ - // SearchBarWidget(onSearchTextChange: (_) {}), Expanded(child: Obx(() { if (controller.pbsList.isEmpty) { return FrequentFunctions.centerText(text: "No data found"); @@ -52,11 +49,11 @@ class _PBSPlanScreenState extends State { } AppBar _appBar(BuildContext context) { - return CustomAppBarWithAction( + return CustomAppBarTitleOnly( context, titleText: "PBS Plan", - actionText: '+ Add Form', - onActionTap: _onAddNewTap, + // actionText: '+ Add Form', + // onActionTap: _onAddNewTap, ); } diff --git a/lib/view/screens/clients/photo_gallery_screen.dart b/lib/view/screens/clients/photo_gallery_screen.dart index 14e15e3..0efe04d 100644 --- a/lib/view/screens/clients/photo_gallery_screen.dart +++ b/lib/view/screens/clients/photo_gallery_screen.dart @@ -49,17 +49,9 @@ class _PhotoGalleryScreenState extends State { } AppBar _appBar(BuildContext context) { - return CustomAppBarWithAction( + return CustomAppBarTitleOnly( context, titleText: 'Photo Gallery', - actionText: '+ Add New', - onActionTap: () async { - final result = await _gotoAddEditMemoryBoxScreen(); - - if (result == true) { - controller.getMemoryList(); - } - }, ); } diff --git a/lib/view/screens/clients/recent_incidents_screen.dart b/lib/view/screens/clients/recent_incidents_screen.dart index a862061..d2f1595 100644 --- a/lib/view/screens/clients/recent_incidents_screen.dart +++ b/lib/view/screens/clients/recent_incidents_screen.dart @@ -3,7 +3,6 @@ import 'package:ftc_mobile_app/dialogs/app_dialogs.dart'; import 'package:ftc_mobile_app/models/clients/recent_incidents_model.dart'; import 'package:ftc_mobile_app/models/profileData/user_data.dart'; import 'package:ftc_mobile_app/view/custom_widgets/custom_app_bar_with_action.dart'; -import 'package:ftc_mobile_app/view/custom_widgets/edit_icon.dart'; import 'package:ftc_mobile_app/view/screens/clientsListing/widgets/search_bar_widget.dart'; import 'package:get/get.dart'; import '../../../ftc_mobile_app.dart'; @@ -31,11 +30,9 @@ class _RecentIncidentsScreenState extends State { @override Widget build(BuildContext context) { return CustomScaffold( - // onBackButton: () => controller.onBackPress(context), backgroundColor: CustomAppColors.kPrimaryColor, screenKey: controller.screenKey, onScreenTap: controller.removeFocus, - // sideDrawer: const CustomDrawer(), showAppBar: true, appBar: _appBar(context), body: SafeArea( @@ -88,20 +85,20 @@ class _RecentIncidentsScreenState extends State { } AppBar _appBar(BuildContext context) { - return CustomAppBarWithAction( + return CustomAppBarTitleOnly( context, titleText: "Recent Incidents", - actionText: '+ Add New', - onActionTap: () async { - dynamic result = await Navigator.pushNamed( - context, CustomRouteNames.kAddNewRecentIncidentsScreenRoute, - arguments: AddNewRecentIncidentsScreenArgs( - userId: controller.serviceUser()!.id!)); - if (result is RecentIncidentsModel) { - controller.recentIncidentsList.insert(0, result); - controller.recentIncidentsList = controller.recentIncidentsList; - } - }, + // actionText: '+ Add New', + // onActionTap: () async { + // dynamic result = await Navigator.pushNamed( + // context, CustomRouteNames.kAddNewRecentIncidentsScreenRoute, + // arguments: AddNewRecentIncidentsScreenArgs( + // userId: controller.serviceUser()!.id!)); + // if (result is RecentIncidentsModel) { + // controller.recentIncidentsList.insert(0, result); + // controller.recentIncidentsList = controller.recentIncidentsList; + // } + // }, ); } diff --git a/lib/view/screens/clients/risk_assessments_template_screen.dart b/lib/view/screens/clients/risk_assessments_template_screen.dart index e38efa7..693abfa 100644 --- a/lib/view/screens/clients/risk_assessments_template_screen.dart +++ b/lib/view/screens/clients/risk_assessments_template_screen.dart @@ -52,20 +52,9 @@ class _RiskAssessmentsTemplateScreenState } AppBar _appBar(BuildContext context) { - return CustomAppBarWithAction( + return CustomAppBarTitleOnly( context, titleText: 'Risk Assessments Template', - actionText: '+ Add New', - onActionTap: () async { - final result = await Navigator.pushNamed( - context, CustomRouteNames.kAddEditRiskAssessmentScreen, - arguments: AddEditRiskAssessmentScreenArgs( - userData: widget.userData, - )); - if (result == true) { - controller.getRiskAssessments(); - } - }, ); }