removed all add functionalities

This commit is contained in:
Ashutosh 2024-08-01 16:00:22 +05:30
parent 50306ed759
commit 5889717efe
9 changed files with 148 additions and 198 deletions

View File

@ -75,18 +75,18 @@ class _CarePlanMenuScreenState extends State<CarePlanMenuScreen> {
// const LineWidget( // const LineWidget(
// text: "Key Contacts", // text: "Key Contacts",
// ), // ),
5.verticalSpace, // 5.verticalSpace,
LineWidget( // LineWidget(
text: "Care Notes", // text: "Care Notes",
onItemTap: () { // onItemTap: () {
Navigator.pushNamed( // Navigator.pushNamed(
controller.screenKey.currentContext!, // controller.screenKey.currentContext!,
CustomRouteNames.kCareNotesScreenRoute, // CustomRouteNames.kCareNotesScreenRoute,
arguments: CareNotesScreenArgs( // arguments: CareNotesScreenArgs(
serviceUserId: controller.serviceUser()!.id!), // serviceUserId: controller.serviceUser()!.id!),
); // );
}, // },
), // ),
5.verticalSpace, 5.verticalSpace,
LineWidget( LineWidget(
text: "Risk Assesments", text: "Risk Assesments",

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart'; 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:ftc_mobile_app/view/custom_widgets/custom_app_bar_with_action.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
@ -33,11 +32,9 @@ class _ConsentAndCapacityQuestionnaireScreenState
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return CustomScaffold( return CustomScaffold(
// onBackButton: () => controller.backButtonPressed(context),
backgroundColor: CustomAppColors.kPrimaryColor, backgroundColor: CustomAppColors.kPrimaryColor,
screenKey: controller.screenKey, screenKey: controller.screenKey,
onScreenTap: controller.removeFocus, onScreenTap: controller.removeFocus,
// sideDrawer: const CustomDrawer(),
showAppBar: true, showAppBar: true,
appBar: _appBar(context), appBar: _appBar(context),
body: SafeArea( body: SafeArea(
@ -104,20 +101,9 @@ class _ConsentAndCapacityQuestionnaireScreenState
} }
AppBar _appBar(BuildContext context) { AppBar _appBar(BuildContext context) {
return CustomAppBarWithAction( return CustomAppBarTitleOnly(
context, context,
titleText: "Consent And Capacity", 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);
}
},
); );
} }

View File

@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/models/clients/HealthIssuesDetailsModel.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/models/profileData/user_data.dart';
import 'package:ftc_mobile_app/utilities/enums/body_parts.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/human_body_mapper_widget.dart';
import 'package:ftc_mobile_app/view/custom_widgets/my_circle_image.dart'; import 'package:ftc_mobile_app/view/custom_widgets/my_circle_image.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -111,16 +110,8 @@ class _CurrentHealthIssuesScreenState extends State<CurrentHealthIssuesScreen> {
child: IssueDetailPopupWidget( child: IssueDetailPopupWidget(
userData: widget.userData, userData: widget.userData,
data: controller.issueBodyParts[b]!.data, data: controller.issueBodyParts[b]!.data,
onActionChange: (status, data) { canChangeStatus: false,
if (data.status != status) { canUpdate: false,
controller.updateHealthIssueStatus(
bodyPoint: b, data: data, status: status);
}
},
onUpdateButtonTap: (data) async {
Get.back();
onAddOrUpdateButtonTap(context, data);
},
), ),
), ),
]); ]);
@ -135,11 +126,9 @@ class _CurrentHealthIssuesScreenState extends State<CurrentHealthIssuesScreen> {
} }
AppBar _appBar(BuildContext context) { AppBar _appBar(BuildContext context) {
return CustomAppBarWithAction( return CustomAppBarTitleOnly(
context, context,
titleText: "Current Health Issues", titleText: "Current Health Issues",
actionText: '+ Add New',
onActionTap: () => onAddOrUpdateButtonTap(context),
); );
} }

View File

@ -11,14 +11,18 @@ class IssueDetailPopupWidget extends StatefulWidget {
super.key, super.key,
required this.userData, required this.userData,
required this.data, required this.data,
required this.onActionChange, this.canChangeStatus = true,
required this.onUpdateButtonTap, this.canUpdate = true,
this.onActionChange,
this.onUpdateButtonTap,
}); });
final UserData userData; final UserData userData;
final HealthIssueDetailsModel data; final HealthIssueDetailsModel data;
final Function(bool status, HealthIssueDetailsModel data) onActionChange; final bool canChangeStatus;
final Function(HealthIssueDetailsModel data) onUpdateButtonTap; final bool canUpdate;
final Function(bool status, HealthIssueDetailsModel data)? onActionChange;
final Function(HealthIssueDetailsModel data)? onUpdateButtonTap;
static const actionActive = "Active"; static const actionActive = "Active";
static const actionResolved = "Resolved"; static const actionResolved = "Resolved";
@ -91,98 +95,90 @@ class _IssueDetailPopupWidgetState extends State<IssueDetailPopupWidget> {
? Colors.red.withOpacity(0.3) ? Colors.red.withOpacity(0.3)
: Colors.green.withOpacity(0.3), : Colors.green.withOpacity(0.3),
), ),
child: DropdownButtonHideUnderline( child: IgnorePointer(
child: DropdownButtonFormField( ignoring: widget.canChangeStatus.not,
onTap: () { child: DropdownButtonHideUnderline(
FocusScopeNode().unfocus(); child: DropdownButtonFormField(
}, onTap: () {
value: selectedValue, FocusScopeNode().unfocus();
dropdownColor: Colors.white, },
borderRadius: 4.toRadius(), value: selectedValue,
decoration: InputDecoration( dropdownColor: Colors.white,
isDense: true, borderRadius: 4.toRadius(),
border: InputBorder.none, decoration: InputDecoration(
suffixIcon: Icon(Icons.arrow_drop_down_sharp, isDense: true,
size: 18, border: InputBorder.none,
color: (selectedValue == suffixIcon: Icon(Icons.arrow_drop_down_sharp,
IssueDetailPopupWidget.actionActive) size: 18,
? Colors.red color: (selectedValue ==
: Colors.green) IssueDetailPopupWidget
.paddingOnly(right: 12.r), .actionActive)
suffixIconConstraints: BoxConstraints.tightFor( ? Colors.red
width: 24.r, height: 32.r), : Colors.green)
// contentPadding: REdgeInsets.only(left: 0), .paddingOnly(right: 12.r),
), suffixIconConstraints: BoxConstraints.tightFor(
elevation: 4, width: 24.r, height: 32.r),
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,
), ),
), elevation: 4,
selectedItemBuilder: (_) { icon: FrequentFunctions.noWidget,
return actionsMap.keys.map( style: TextStyle(
(e) { fontWeight: FontWeight.w400,
return DropdownMenuItem<String>( fontSize: 10.sp,
value: e, color: Colors.black),
child: Container( hint: Text(
// color: (selectedValue == e) "Select...",
// ? (selectedValue == style: TextStyle(
// IssueDetailPopupWidget fontWeight: FontWeight.w400,
// .actionActive) fontSize: 12.sp,
// ? Colors.red.withOpacity(0.3) color: CustomAppColors.kLightTextColor,
// : Colors.green.withOpacity(0.3) ),
// : Colors.white, ),
alignment: Alignment.center, selectedItemBuilder: (_) {
child: Text( return actionsMap.keys.map(
e, (e) {
style: TextStyle( return DropdownMenuItem<String>(
color: (selectedValue == e) value: e,
? (selectedValue == child: Container(
IssueDetailPopupWidget alignment: Alignment.center,
.actionActive) child: Text(
? Colors.red e,
: Colors.green style: TextStyle(
: Colors.black), color: (selectedValue == e)
? (selectedValue ==
IssueDetailPopupWidget
.actionActive)
? Colors.red
: Colors.green
: Colors.black),
),
), ),
);
},
).toList();
},
items: actionsMap.keys
.map(
(e) => DropdownMenuItem<String>(
value: e,
child: Text(e),
), ),
); )
}, .toList(),
).toList(); // padding: EdgeInsets.zero,
}, isExpanded: true,
items: actionsMap.keys onChanged: (v) {
.map( if (v != null) {
(e) => DropdownMenuItem<String>( setState(() {
value: e, selectedValue = v;
child: Text(e),
), if (widget.onActionChange != null) {
) widget.onActionChange!
.toList(), .call(actionsMap[v]!, widget.data);
// 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);
});
}
},
), ),
), ),
) )
@ -241,16 +237,21 @@ class _IssueDetailPopupWidgetState extends State<IssueDetailPopupWidget> {
), ),
), ),
16.verticalSpace, 16.verticalSpace,
Center( (widget.canUpdate)
child: SizedBox( ? Center(
width: 120.r, child: SizedBox(
height: 32.r, width: 120.r,
child: CustomAppButton( height: 32.r,
onTap: () => widget.onUpdateButtonTap(widget.data), child: CustomAppButton(
buttonText: "Update", onTap: (widget.onUpdateButtonTap == null)
), ? () {}
), : () =>
), widget.onUpdateButtonTap!.call(widget.data),
buttonText: "Update",
),
),
)
: FrequentFunctions.noWidget,
], ],
), ),
), ),

View File

@ -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/clients/documents_list_model.dart';
import 'package:ftc_mobile_app/models/profileData/user_data.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/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:ftc_mobile_app/view/screens/clientsListing/widgets/search_bar_widget.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
@ -53,19 +52,19 @@ class _DocumentsListScreenState extends State<DocumentsListScreen> {
} }
AppBar _appBar(BuildContext context) { AppBar _appBar(BuildContext context) {
return CustomAppBarWithAction( return CustomAppBarTitleOnly(
context, context,
titleText: "Documents", titleText: "Documents",
actionText: '+ Add New', // actionText: '+ Add New',
onActionTap: () async { // onActionTap: () async {
dynamic response = await Navigator.pushNamed( // dynamic response = await Navigator.pushNamed(
context, CustomRouteNames.kAddNewDocumentScreenRoute, // context, CustomRouteNames.kAddNewDocumentScreenRoute,
arguments: controller.serviceUser.value); // arguments: controller.serviceUser.value);
if (response is DocumentModel) { // if (response is DocumentModel) {
controller.documentsList.insert(0, response); // controller.documentsList.insert(0, response);
controller.documentsList.refresh(); // controller.documentsList.refresh();
} // }
}, // },
); );
} }

View File

@ -29,16 +29,13 @@ class _PBSPlanScreenState extends State<PBSPlanScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return CustomScaffold( return CustomScaffold(
// onBackButton: () => controller.onBackPress(context),
backgroundColor: CustomAppColors.kPrimaryColor, backgroundColor: CustomAppColors.kPrimaryColor,
screenKey: controller.screenKey, screenKey: controller.screenKey,
onScreenTap: controller.removeFocus, onScreenTap: controller.removeFocus,
// sideDrawer: const CustomDrawer(),
showAppBar: true, showAppBar: true,
appBar: _appBar(context), appBar: _appBar(context),
body: Column( body: Column(
children: [ children: [
// SearchBarWidget(onSearchTextChange: (_) {}),
Expanded(child: Obx(() { Expanded(child: Obx(() {
if (controller.pbsList.isEmpty) { if (controller.pbsList.isEmpty) {
return FrequentFunctions.centerText(text: "No data found"); return FrequentFunctions.centerText(text: "No data found");
@ -52,11 +49,11 @@ class _PBSPlanScreenState extends State<PBSPlanScreen> {
} }
AppBar _appBar(BuildContext context) { AppBar _appBar(BuildContext context) {
return CustomAppBarWithAction( return CustomAppBarTitleOnly(
context, context,
titleText: "PBS Plan", titleText: "PBS Plan",
actionText: '+ Add Form', // actionText: '+ Add Form',
onActionTap: _onAddNewTap, // onActionTap: _onAddNewTap,
); );
} }

View File

@ -49,17 +49,9 @@ class _PhotoGalleryScreenState extends State<PhotoGalleryScreen> {
} }
AppBar _appBar(BuildContext context) { AppBar _appBar(BuildContext context) {
return CustomAppBarWithAction( return CustomAppBarTitleOnly(
context, context,
titleText: 'Photo Gallery', titleText: 'Photo Gallery',
actionText: '+ Add New',
onActionTap: () async {
final result = await _gotoAddEditMemoryBoxScreen();
if (result == true) {
controller.getMemoryList();
}
},
); );
} }

View File

@ -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/clients/recent_incidents_model.dart';
import 'package:ftc_mobile_app/models/profileData/user_data.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/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:ftc_mobile_app/view/screens/clientsListing/widgets/search_bar_widget.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import '../../../ftc_mobile_app.dart'; import '../../../ftc_mobile_app.dart';
@ -31,11 +30,9 @@ class _RecentIncidentsScreenState extends State<RecentIncidentsScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return CustomScaffold( return CustomScaffold(
// onBackButton: () => controller.onBackPress(context),
backgroundColor: CustomAppColors.kPrimaryColor, backgroundColor: CustomAppColors.kPrimaryColor,
screenKey: controller.screenKey, screenKey: controller.screenKey,
onScreenTap: controller.removeFocus, onScreenTap: controller.removeFocus,
// sideDrawer: const CustomDrawer(),
showAppBar: true, showAppBar: true,
appBar: _appBar(context), appBar: _appBar(context),
body: SafeArea( body: SafeArea(
@ -88,20 +85,20 @@ class _RecentIncidentsScreenState extends State<RecentIncidentsScreen> {
} }
AppBar _appBar(BuildContext context) { AppBar _appBar(BuildContext context) {
return CustomAppBarWithAction( return CustomAppBarTitleOnly(
context, context,
titleText: "Recent Incidents", titleText: "Recent Incidents",
actionText: '+ Add New', // actionText: '+ Add New',
onActionTap: () async { // onActionTap: () async {
dynamic result = await Navigator.pushNamed( // dynamic result = await Navigator.pushNamed(
context, CustomRouteNames.kAddNewRecentIncidentsScreenRoute, // context, CustomRouteNames.kAddNewRecentIncidentsScreenRoute,
arguments: AddNewRecentIncidentsScreenArgs( // arguments: AddNewRecentIncidentsScreenArgs(
userId: controller.serviceUser()!.id!)); // userId: controller.serviceUser()!.id!));
if (result is RecentIncidentsModel) { // if (result is RecentIncidentsModel) {
controller.recentIncidentsList.insert(0, result); // controller.recentIncidentsList.insert(0, result);
controller.recentIncidentsList = controller.recentIncidentsList; // controller.recentIncidentsList = controller.recentIncidentsList;
} // }
}, // },
); );
} }

View File

@ -52,20 +52,9 @@ class _RiskAssessmentsTemplateScreenState
} }
AppBar _appBar(BuildContext context) { AppBar _appBar(BuildContext context) {
return CustomAppBarWithAction( return CustomAppBarTitleOnly(
context, context,
titleText: 'Risk Assessments Template', 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();
}
},
); );
} }