gas refill attachment issue fixed

design_3.0_task_module_new
WaseemAbbasi22 7 months ago
parent be276f327d
commit b592e114bc

@ -67,10 +67,12 @@ class _NewGasRefillRequestPageState extends State<NewGasRefillRequestPage> {
@override
void dispose() {
super.dispose();
_gasRefillProvider!.gasRefillAttachments.clear();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: DefaultAppBar(title: context.translation.newGasRefillRequest),
body: Column(

@ -636,11 +636,17 @@ class _AssistantEmployeeCardState extends State<AssistantEmployeeCard> {
} else {
employeeList = widget.formModel!.assetTransferAssistantEmployeesReceiver ?? [];
}
widget.formModel?.modelAssistantEmployees = employeeList.isNotEmpty ? employeeList[0] : AssetTransferAssistantEmployees();
AssignedEmployee? assignedUser = AssignedEmployee(
id: employeeList[0].employeeId,
name: employeeList[0].employeeName,
);
widget.formModel?.modelAssistantEmployees = employeeList.isEmpty ? AssetTransferAssistantEmployees():employeeList[0];
AssignedEmployee? assignedUser = AssignedEmployee();
if(employeeList.isNotEmpty){
assignedUser= AssignedEmployee(
id: employeeList[0].employeeId,
name: employeeList[0].employeeName,
);
}
selectedEmployee = AssistantEmployees(userId: assignedUser.id, user: assignedUser);
}

@ -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);
}

@ -176,7 +176,6 @@ class _RequestGasRefillState extends State<RequestGasRefill> {
@override
Widget build(BuildContext context) {
_userProvider = Provider.of<UserProvider>(context);
_settingProvider = Provider.of<SettingProvider>(context);
_gasRefillProvider ??= Provider.of<GasRefillProvider>(context, listen: false);

@ -51,17 +51,19 @@ class _MultiFilesPickerState extends State<MultiFilesPicker> {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppDashedButton(
title: widget.label,
height: widget.buttonHeight,
buttonColor: widget.buttonColor,
icon: widget.buttonIcon,
onPressed: (widget.enabled == false)
? () {}
: widget.showAsGrid
? showFileSourceSheet
: onFilePicker),
16.height,
if(widget.enabled)...[
AppDashedButton(
title: widget.label,
height: widget.buttonHeight,
buttonColor: widget.buttonColor,
icon: widget.buttonIcon,
onPressed: (widget.enabled == false)
? () {}
: widget.showAsGrid
? showFileSourceSheet
: onFilePicker),
16.height,
],
if (widget.files.isNotEmpty)
Wrap(
spacing: 8.toScreenWidth,

Loading…
Cancel
Save