removed all add functionalities
This commit is contained in:
@@ -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<CurrentHealthIssuesScreen> {
|
||||
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<CurrentHealthIssuesScreen> {
|
||||
}
|
||||
|
||||
AppBar _appBar(BuildContext context) {
|
||||
return CustomAppBarWithAction(
|
||||
return CustomAppBarTitleOnly(
|
||||
context,
|
||||
titleText: "Current Health Issues",
|
||||
actionText: '+ Add New',
|
||||
onActionTap: () => onAddOrUpdateButtonTap(context),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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<IssueDetailPopupWidget> {
|
||||
? 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<String>(
|
||||
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<String>(
|
||||
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<String>(
|
||||
value: e,
|
||||
child: Text(e),
|
||||
),
|
||||
);
|
||||
},
|
||||
).toList();
|
||||
},
|
||||
items: actionsMap.keys
|
||||
.map(
|
||||
(e) => DropdownMenuItem<String>(
|
||||
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<IssueDetailPopupWidget> {
|
||||
),
|
||||
),
|
||||
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,
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user