|
|
|
@ -39,10 +39,8 @@ class _GasRefillCommentsBottomSheetState extends State<GasRefillCommentsBottomSh
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final commentsProvider = Provider.of<GasRefillCommentsProvider>(context);
|
|
|
|
final commentsProvider = Provider.of<GasRefillCommentsProvider>(context);
|
|
|
|
final userProvider = Provider.of<UserProvider>(context, listen: false);
|
|
|
|
final userProvider = Provider.of<UserProvider>(context, listen: false);
|
|
|
|
return SingleChildScrollView(
|
|
|
|
return Container(
|
|
|
|
child: Wrap(
|
|
|
|
height: MediaQuery.of(context).size.height * 0.6,
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Container(
|
|
|
|
|
|
|
|
clipBehavior: Clip.antiAlias,
|
|
|
|
clipBehavior: Clip.antiAlias,
|
|
|
|
margin: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
|
|
|
|
margin: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
@ -53,17 +51,6 @@ class _GasRefillCommentsBottomSheetState extends State<GasRefillCommentsBottomSh
|
|
|
|
child: Form(
|
|
|
|
child: Form(
|
|
|
|
key: _formKey,
|
|
|
|
key: _formKey,
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
|
|
|
|
LoadingManager(
|
|
|
|
|
|
|
|
isLoading: commentsProvider.isLoading,
|
|
|
|
|
|
|
|
isFailedLoading: commentsProvider.comments == null,
|
|
|
|
|
|
|
|
stateCode: commentsProvider.stateCode,
|
|
|
|
|
|
|
|
onRefresh: () async {
|
|
|
|
|
|
|
|
commentsProvider.reset();
|
|
|
|
|
|
|
|
await commentsProvider.getComments(callId: widget.requestId);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
width: 40.toScreenWidth,
|
|
|
|
width: 40.toScreenWidth,
|
|
|
|
@ -75,7 +62,15 @@ class _GasRefillCommentsBottomSheetState extends State<GasRefillCommentsBottomSh
|
|
|
|
alignment: AlignmentDirectional.centerStart,
|
|
|
|
alignment: AlignmentDirectional.centerStart,
|
|
|
|
child: context.translation.comments.heading3(context).custom(fontWeight: FontWeight.w600),
|
|
|
|
child: context.translation.comments.heading3(context).custom(fontWeight: FontWeight.w600),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
commentsProvider.comments.isEmpty
|
|
|
|
LoadingManager(
|
|
|
|
|
|
|
|
isLoading: commentsProvider.isLoading,
|
|
|
|
|
|
|
|
isFailedLoading: commentsProvider.comments == null,
|
|
|
|
|
|
|
|
stateCode: commentsProvider.stateCode,
|
|
|
|
|
|
|
|
onRefresh: () async {
|
|
|
|
|
|
|
|
commentsProvider.reset();
|
|
|
|
|
|
|
|
await commentsProvider.getComments(callId: widget.requestId);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
child: commentsProvider.comments.isEmpty
|
|
|
|
? SizedBox(
|
|
|
|
? SizedBox(
|
|
|
|
height: MediaQuery.of(context).size.height * 0.25,
|
|
|
|
height: MediaQuery.of(context).size.height * 0.25,
|
|
|
|
child: NoItemFound(message: context.translation.noDataFound),
|
|
|
|
child: NoItemFound(message: context.translation.noDataFound),
|
|
|
|
@ -86,8 +81,8 @@ class _GasRefillCommentsBottomSheetState extends State<GasRefillCommentsBottomSh
|
|
|
|
child: ListView.separated(
|
|
|
|
child: ListView.separated(
|
|
|
|
itemCount: commentsProvider.comments.length,
|
|
|
|
itemCount: commentsProvider.comments.length,
|
|
|
|
padding: const EdgeInsets.only(top: 16, bottom: 8),
|
|
|
|
padding: const EdgeInsets.only(top: 16, bottom: 8),
|
|
|
|
shrinkWrap: true,
|
|
|
|
// shrinkWrap: true,
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
// physics: const NeverScrollableScrollPhysics(),
|
|
|
|
separatorBuilder: (cxt, index) => 8.height,
|
|
|
|
separatorBuilder: (cxt, index) => 8.height,
|
|
|
|
itemBuilder: (context, itemIndex) {
|
|
|
|
itemBuilder: (context, itemIndex) {
|
|
|
|
final model = commentsProvider.comments[itemIndex];
|
|
|
|
final model = commentsProvider.comments[itemIndex];
|
|
|
|
@ -95,9 +90,9 @@ class _GasRefillCommentsBottomSheetState extends State<GasRefillCommentsBottomSh
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
(model?.createdBy?.userName ?? "Nurse").heading6(context),
|
|
|
|
(model?.createdBy?.userName ?? "Nurse").heading6(context),
|
|
|
|
8.height,
|
|
|
|
// 8.height,
|
|
|
|
(model?.comment ?? "").bodyText(context),
|
|
|
|
(model?.comment ?? "").bodyText(context),
|
|
|
|
8.height,
|
|
|
|
//8.height,
|
|
|
|
Align(
|
|
|
|
Align(
|
|
|
|
alignment: AlignmentDirectional.bottomEnd,
|
|
|
|
alignment: AlignmentDirectional.bottomEnd,
|
|
|
|
child: Text(DateTime.tryParse(model.createdOn).toIso8601String().toServiceRequestDetailsFormat,
|
|
|
|
child: Text(DateTime.tryParse(model.createdOn).toIso8601String().toServiceRequestDetailsFormat,
|
|
|
|
@ -108,9 +103,7 @@ class _GasRefillCommentsBottomSheetState extends State<GasRefillCommentsBottomSh
|
|
|
|
},
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
).expanded,
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
if (userProvider.user.type == UsersTypes.normal_user) 8.height,
|
|
|
|
if (userProvider.user.type == UsersTypes.normal_user) 8.height,
|
|
|
|
if (userProvider.user.type == UsersTypes.normal_user)
|
|
|
|
if (userProvider.user.type == UsersTypes.normal_user)
|
|
|
|
AppTextFormField(
|
|
|
|
AppTextFormField(
|
|
|
|
@ -123,8 +116,8 @@ class _GasRefillCommentsBottomSheetState extends State<GasRefillCommentsBottomSh
|
|
|
|
suffixIcon: "comment_send".toSvgAsset().paddingOnly(end: 16).onPress(() {
|
|
|
|
suffixIcon: "comment_send".toSvgAsset().paddingOnly(end: 16).onPress(() {
|
|
|
|
if (_formKey.currentState.validate()) {
|
|
|
|
if (_formKey.currentState.validate()) {
|
|
|
|
_formKey.currentState.save();
|
|
|
|
_formKey.currentState.save();
|
|
|
|
final comment = GasRefillComment(id: 0, gasRefillId: num.tryParse(widget.requestId ?? ""), comment: text);
|
|
|
|
// final comment = GasRefillComment(id: 0, gasRefillId: num.tryParse(widget.requestId ?? ""), comment: text);
|
|
|
|
commentsProvider.addComment(context, comment: comment);
|
|
|
|
commentsProvider.addComment(context, comment: text, id: num.tryParse(widget.requestId ?? ""));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
onSaved: (value) {
|
|
|
|
onSaved: (value) {
|
|
|
|
@ -135,9 +128,6 @@ class _GasRefillCommentsBottomSheetState extends State<GasRefillCommentsBottomSh
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|