|
|
|
|
@ -1,3 +1,5 @@
|
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:test_sa/controllers/providers/api/gas_refill_comments.dart';
|
|
|
|
|
@ -10,6 +12,7 @@ import 'package:test_sa/extensions/widget_extensions.dart';
|
|
|
|
|
import 'package:test_sa/new_views/common_widgets/app_filled_button.dart';
|
|
|
|
|
import 'package:test_sa/views/pages/user/gas_refill/gas_refill_form.dart';
|
|
|
|
|
import 'package:test_sa/views/pages/user/gas_refill/request_gas_refill.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/images/multi_image_picker.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/loaders/app_loading.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/loaders/no_data_found.dart';
|
|
|
|
|
|
|
|
|
|
@ -39,6 +42,7 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
|
|
|
|
|
|
|
|
|
|
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
|
|
|
|
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
|
|
|
|
List<File> _attachments = [];
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
@ -63,6 +67,8 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
|
|
|
|
|
return const ALoading();
|
|
|
|
|
} else if (snap.hasData) {
|
|
|
|
|
_model = snap.data as GasRefillModel;
|
|
|
|
|
_attachments = _model.gasRefillAttachments?.map((e) => File(e.attachmentName ?? '')).toList() ?? [];
|
|
|
|
|
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
@ -139,7 +145,19 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
gasRefillModel.comment!.bodyText(context),
|
|
|
|
|
8.height,
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
if (_attachments.isNotEmpty) ...[
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
context.translation.attachments.bodyText(context),
|
|
|
|
|
8.height,
|
|
|
|
|
MultiFilesPicker(
|
|
|
|
|
label: context.translation.attachments,
|
|
|
|
|
files: _attachments,
|
|
|
|
|
enabled: false,
|
|
|
|
|
onlyImages: false,
|
|
|
|
|
),
|
|
|
|
|
12.height,
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
).expanded,
|
|
|
|
|
if (_userProvider.user!.type == UsersTypes.engineer && (gasRefillModel.status?.value ?? 0) != 2) 8.height,
|
|
|
|
|
@ -149,69 +167,70 @@ class _GasRefillDetailsPageState extends State<GasRefillDetailsPage> {
|
|
|
|
|
style: AppTextStyles.tinyFont.copyWith(color: context.isDark ? AppColor.neutral10 : AppColor.neutral50),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
|
|
|
|
|
).paddingOnly(top: 16, start: 16, end: 16),
|
|
|
|
|
|
|
|
|
|
/// TBD
|
|
|
|
|
(_userProvider.user!.type == UsersTypes.normal_user
|
|
|
|
|
? Container(
|
|
|
|
|
height: 50,
|
|
|
|
|
padding: const EdgeInsets.only(left: 16, right: 16),
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
decoration: ShapeDecoration(
|
|
|
|
|
color: context.isDark ? AppColor.neutral50 : AppColor.neutral30,
|
|
|
|
|
shape: const RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
|
bottomLeft: Radius.circular(14),
|
|
|
|
|
bottomRight: Radius.circular(14),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
'${context.translation.commentHere}...',
|
|
|
|
|
style: AppTextStyles.heading6.copyWith(
|
|
|
|
|
color: (context.isDark ? AppColor.neutral30 : AppColor.neutral50).withOpacity(.6),
|
|
|
|
|
),
|
|
|
|
|
).expanded,
|
|
|
|
|
"comment_send".toSvgAsset(width: 24, color: context.isDark ? AppColor.primary50 : AppColor.primary70),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: Column(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
8.height,
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
context.translation.viewComments,
|
|
|
|
|
style: AppTextStyles.bodyText.copyWith(color: AppColor.blueStatus(context)),
|
|
|
|
|
),
|
|
|
|
|
4.width,
|
|
|
|
|
Icon(
|
|
|
|
|
Icons.arrow_forward,
|
|
|
|
|
color: AppColor.blueStatus(context),
|
|
|
|
|
size: 14,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(bottom: 16, start: 16, end: 16))
|
|
|
|
|
.onPress(() {
|
|
|
|
|
showModalBottomSheet(
|
|
|
|
|
context: context,
|
|
|
|
|
useSafeArea: true,
|
|
|
|
|
isScrollControlled: true,
|
|
|
|
|
useRootNavigator: true,
|
|
|
|
|
backgroundColor: Colors.transparent,
|
|
|
|
|
builder: (context) => GasRefillCommentsBottomSheet(requestId: gasRefillModel.id.toString()),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
// (_userProvider.user!.type == UsersTypes.normal_user
|
|
|
|
|
// ? Container(
|
|
|
|
|
// height: 50,
|
|
|
|
|
// padding: const EdgeInsets.only(left: 16, right: 16),
|
|
|
|
|
// alignment: Alignment.center,
|
|
|
|
|
// width: double.infinity,
|
|
|
|
|
// decoration: ShapeDecoration(
|
|
|
|
|
// color: context.isDark ? AppColor.neutral50 : AppColor.neutral30,
|
|
|
|
|
// shape: const RoundedRectangleBorder(
|
|
|
|
|
// borderRadius: BorderRadius.only(
|
|
|
|
|
// bottomLeft: Radius.circular(14),
|
|
|
|
|
// bottomRight: Radius.circular(14),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// ),
|
|
|
|
|
// child: Row(
|
|
|
|
|
// children: [
|
|
|
|
|
// Text(
|
|
|
|
|
// '${context.translation.commentHere}...',
|
|
|
|
|
// style: AppTextStyles.heading6.copyWith(
|
|
|
|
|
// color: (context.isDark ? AppColor.neutral30 : AppColor.neutral50).withOpacity(.6),
|
|
|
|
|
// ),
|
|
|
|
|
// ).expanded,
|
|
|
|
|
// "comment_send".toSvgAsset(width: 24, color: context.isDark ? AppColor.primary50 : AppColor.primary70),
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// )
|
|
|
|
|
// : Column(
|
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
// children: [
|
|
|
|
|
// const Divider().defaultStyle(context),
|
|
|
|
|
// 8.height,
|
|
|
|
|
// Row(
|
|
|
|
|
// mainAxisSize: MainAxisSize.min,
|
|
|
|
|
// children: [
|
|
|
|
|
// Text(
|
|
|
|
|
// context.translation.viewComments,
|
|
|
|
|
// style: AppTextStyles.bodyText.copyWith(color: AppColor.blueStatus(context)),
|
|
|
|
|
// ),
|
|
|
|
|
// 4.width,
|
|
|
|
|
// Icon(
|
|
|
|
|
// Icons.arrow_forward,
|
|
|
|
|
// color: AppColor.blueStatus(context),
|
|
|
|
|
// size: 14,
|
|
|
|
|
// )
|
|
|
|
|
// ],
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ).paddingOnly(bottom: 16, start: 16, end: 16))
|
|
|
|
|
// .onPress(() {
|
|
|
|
|
// showModalBottomSheet(
|
|
|
|
|
// context: context,
|
|
|
|
|
// useSafeArea: true,
|
|
|
|
|
// isScrollControlled: true,
|
|
|
|
|
// useRootNavigator: true,
|
|
|
|
|
// backgroundColor: Colors.transparent,
|
|
|
|
|
// builder: (context) => GasRefillCommentsBottomSheet(requestId: gasRefillModel.id.toString()),
|
|
|
|
|
// );
|
|
|
|
|
// }),
|
|
|
|
|
],
|
|
|
|
|
).toShadowContainer(context, padding: 0);
|
|
|
|
|
}
|
|
|
|
|
|