|
|
|
|
@ -1,3 +1,5 @@
|
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:test_sa/controllers/providers/api/asset_transfer_provider.dart';
|
|
|
|
|
@ -8,6 +10,7 @@ import 'package:test_sa/extensions/string_extensions.dart';
|
|
|
|
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
|
|
|
|
import 'package:test_sa/models/device/asset_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/loaders/app_loading.dart';
|
|
|
|
|
import 'package:test_sa/views/widgets/loaders/loading_manager.dart';
|
|
|
|
|
|
|
|
|
|
@ -31,6 +34,7 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
AssetTransfer? _model;
|
|
|
|
|
final bool _isLoading = false;
|
|
|
|
|
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
|
|
|
|
|
List<File> _attachments = [];
|
|
|
|
|
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
@ -41,6 +45,7 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
_userProvider ??= Provider.of<UserProvider>(context);
|
|
|
|
|
|
|
|
|
|
return Scaffold(
|
|
|
|
|
appBar: DefaultAppBar(title: context.translation.deviceTransferDetails),
|
|
|
|
|
key: _scaffoldKey,
|
|
|
|
|
@ -52,6 +57,7 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
return const ALoading();
|
|
|
|
|
} else {
|
|
|
|
|
_model = snapshot.data as AssetTransfer?;
|
|
|
|
|
_attachments = _model?.attachments?.map((e) => File(e.attachmentName ?? '')).toList() ?? [];
|
|
|
|
|
|
|
|
|
|
return Form(
|
|
|
|
|
key: _formKey,
|
|
|
|
|
@ -89,6 +95,8 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
8.height,
|
|
|
|
|
_buildTextWidget(_model!.comment!),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
@ -177,6 +185,27 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
return widget.toShadowContainer(context).paddingOnly(top: 14, start: 14, end: 14);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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,
|
|
|
|
|
),
|
|
|
|
|
12.height,
|
|
|
|
|
],
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_buildTextWidget(String text) {
|
|
|
|
|
return text.bodyText(context);
|
|
|
|
|
}
|
|
|
|
|
@ -224,6 +253,8 @@ class _DeviceTransferDetailsState extends State<DeviceTransferDetails> {
|
|
|
|
|
const Divider().defaultStyle(context),
|
|
|
|
|
8.height,
|
|
|
|
|
_buildTextWidget(comment),
|
|
|
|
|
attachmentWidget(),
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
).toShadowContainer(context);
|
|
|
|
|
|