|
|
|
|
@ -2,6 +2,7 @@ import 'dart:io';
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:test_sa/controllers/api_routes/urls.dart';
|
|
|
|
|
import 'package:test_sa/controllers/providers/api/asset_transfer_provider.dart';
|
|
|
|
|
import 'package:test_sa/controllers/providers/api/user_provider.dart';
|
|
|
|
|
import 'package:test_sa/extensions/context_extension.dart';
|
|
|
|
|
@ -10,7 +11,7 @@ import 'package:test_sa/extensions/string_extensions.dart';
|
|
|
|
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
|
|
|
|
import 'package:test_sa/models/device/device_transfer.dart';
|
|
|
|
|
import 'package:test_sa/views/pages/device_transfer/update_device_transfer.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/images/multi_image_picker.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/images/files_list.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/loaders/app_loading.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
|
|
|
|
|
|
|
|
|
|
@ -57,7 +58,7 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
return const ALoading();
|
|
|
|
|
} else {
|
|
|
|
|
_model = snapshot.data as DeviceTransfer?;
|
|
|
|
|
_attachments = _model?.assetTransferAttachments?.map((e) => File(e.attachmentName ?? '')).toList() ?? [];
|
|
|
|
|
// _attachments = _model?.assetTransferAttachments?.map((e) => URLs.getFileUrl(e.attachmentName ?? '') ?? '').toList() ?? [];
|
|
|
|
|
return Form(
|
|
|
|
|
key: _formKey,
|
|
|
|
|
child: LoadingManager(
|
|
|
|
|
@ -96,7 +97,10 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
_buildTextWidget(_model!.comment!),
|
|
|
|
|
],
|
|
|
|
|
if (_attachments.isNotEmpty) ...[
|
|
|
|
|
attachmentWidget(),
|
|
|
|
|
8.height,
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
FilesList(images: _model?.assetTransferAttachments?.map((e) => URLs.getFileUrl(e.attachmentName ?? '') ?? '').toList() ?? []),
|
|
|
|
|
//attachmentWidget(),
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -159,25 +163,29 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget attachmentWidget() {
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
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,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
// Widget attachmentWidget() {
|
|
|
|
|
// _attachments.forEach((abc) {
|
|
|
|
|
// print(abc);
|
|
|
|
|
// });
|
|
|
|
|
//
|
|
|
|
|
// return Column(
|
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
// children: [
|
|
|
|
|
// 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,
|
|
|
|
|
// ),
|
|
|
|
|
// ],
|
|
|
|
|
// ],
|
|
|
|
|
// );
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
_buildTextWidget(String text) {
|
|
|
|
|
return text.bodyText(context);
|
|
|
|
|
|